From 9c59c340f1698455db25b5825398496f6638ef90 Mon Sep 17 00:00:00 2001 From: Nayden Naydenov Date: Fri, 13 Oct 2023 15:29:34 +0300 Subject: [PATCH] chore: migrate samples prepare to storybook --- .../samples-prepare.js | 170 --- .../samples-prepare.ts | 220 ++++ packages/tools/lib/cem/schema.json | 16 + packages/tools/lib/cem/types.d.ts | 1118 +++++++++++++++++ packages/tools/package.json | 1 + yarn.lock | 228 +++- 6 files changed, 1575 insertions(+), 178 deletions(-) delete mode 100644 packages/playground/build-scripts-storybook/samples-prepare.js create mode 100644 packages/playground/build-scripts-storybook/samples-prepare.ts create mode 100644 packages/tools/lib/cem/types.d.ts diff --git a/packages/playground/build-scripts-storybook/samples-prepare.js b/packages/playground/build-scripts-storybook/samples-prepare.js deleted file mode 100644 index abf19dc5edf5..000000000000 --- a/packages/playground/build-scripts-storybook/samples-prepare.js +++ /dev/null @@ -1,170 +0,0 @@ -const fs = require('fs/promises'); -const path = require('path'); - -const STORIES_ROOT_FOLDER_NAME = '../_stories'; - -// run the script to generate the argTypes for the stories available in the _stories folder -const main = async () => { - const api = JSON.parse((await fs.readFile(`./.storybook/custom-elements.json`)).toString()); - - // read all directories inside _stories folder and create a list of components - const packages = await fs.readdir(path.join(__dirname, STORIES_ROOT_FOLDER_NAME)); - for (const package of packages) { - // packages [main, fiori] - - const packagePath = path.join(__dirname, STORIES_ROOT_FOLDER_NAME, package); - const packageStats = await fs.stat(packagePath); - if (packageStats.isDirectory()) { - const componentsInPackage = await fs.readdir(packagePath); - for (const component of componentsInPackage) { - // components [Button, Card, ...] - const componentPath = path.join(packagePath, component); - const componentStats = await fs.stat(componentPath); - if (componentStats.isDirectory()) { - generateStoryDoc(componentPath, component, api, package); - } - } - } - } - - async function generateStoryDoc(componentPath, component, api, package) { - console.log(`Generating argTypes for story ${component}`); - const apiData = getAPIData(api, component, package); - const { storyArgsTypes, slotNames, info } = apiData; - - await fs.writeFile(componentPath + '/argTypes.ts', `export default ${storyArgsTypes}; -export const componentInfo = ${JSON.stringify(info, null, 4)}; -export type StoryArgsSlots = { - ${slotNames.map(slotName => `${slotName}: string;`).join('\n ')} -}`); - }; - - function getAPIData(api, module, package) { - const moduleAPI = api.modules?.find(currModule => currModule.declarations?.find(s => s?._ui5reference?.name === module && s?._ui5reference?.package === `@ui5/webcomponents${package !== 'main' ? `-${package}` : ''}`)); - const data = getArgsTypes(api, moduleAPI.declarations?.find(declaration => declaration._ui5reference?.name === module && declaration._ui5reference?.package === `@ui5/webcomponents${package !== 'main' ? `-${package}` : ''}`), package); - - - const test = api.modules - ?.find(currModule => currModule.declarations - ?.find(s => s?._ui5reference?.name === module && s?._ui5reference?.package === `@ui5/webcomponents${package !== 'main' ? `-${package}` : ''}`)) - ?.declarations - ?.find(s => s?._ui5reference?.name === module && s?._ui5reference?.package === `@ui5/webcomponents${package !== 'main' ? `-${package}` : ''}`); - - return { - info: { - package: `@ui5/webcomponents${package !== 'main' ? `-${package}` : ''}`, - since: test?._ui5since - }, - slotNames: data.slotNames, - storyArgsTypes: JSON.stringify(data.args, null, "\t") - }; - } - - function getArgsTypes(api, moduleAPI, package) { - let args = {}; - let slotNames = []; - - moduleAPI?.members?.filter(member => member.kind === "field") - .forEach(prop => { - let typeEnum; - - if (prop.type?.references?.length) { - for (let currModule of api.modules) { - for (let s of currModule.declarations) { - - if (s?._ui5reference?.name === prop.type?.references[0].name && s?._ui5reference?.package === prop.type?.references[0].package && s.kind === "enum") { - typeEnum = s; - break; - } - } - } - } - - - if (prop.readonly) { - args[prop.name] = { - control: { - type: false - }, - }; - } else if (Array.isArray(typeEnum?.members)) { - args[prop.name] = { - control: "select", - options: typeEnum.members.map(a => a.name), - }; - } - }); - - moduleAPI?.slots?.forEach(prop => { - args[prop.name] = { - control: { - type: "text" - } - }; - slotNames.push(prop.name); - }); - - // methods parsing because Storybook does not include them in the args by default from the custom-elements.json - // only changing the category to Methods so they are not displayed in the Properties tab - moduleAPI?.members - ?.filter(prop => prop.kind === "method") - .forEach((prop) => { - prop.kind = "field"; - - args[prop.name] = { - description: prop.description, - table: { - category: "methods", - }, - }; - - // methods can have custom descriptions with parameters and return value - if (prop.parameters || prop.return) { - args[prop.name].UI5CustomData = { - parameters: prop.parameters, - returnValue: prop.return, - } - } - }); - - // events also have custom descriptions with parameters of their detail object - moduleAPI?.events?.forEach((prop) => { - if (prop.privacy === "public" && prop.params?.length) { - args[prop.name] = { - description: prop.description, - table: { - category: "events", - }, - UI5CustomData: { - parameters: prop.params, - }, - }; - } - }); - - const packages = ["@ui5/webcomponents", "@ui5/webcomponents-fiori"] - - // recursively merging the args from the parent/parents - const moduleAPIBeingExtended = moduleAPI.superclass && api.modules - ?.find(currModule => currModule.declarations - ?.find(s => s?._ui5reference?.name === moduleAPI.superclass?.name && s?._ui5reference?.package === moduleAPI.superclass?.package)) - ?.declarations - ?.find(s => s?._ui5reference?.name === moduleAPI.superclass?.name && s?._ui5reference?.package === moduleAPI.superclass?.package); - - if (moduleAPIBeingExtended && packages.includes(moduleAPIBeingExtended._ui5reference?.package)) { - console.log("=====") - console.log("Current module", moduleAPI.name) - console.log("Extended module", moduleAPIBeingExtended.name) - const { args: nextArgs, slotNames: nextSlotNames } = getArgsTypes(api, moduleAPIBeingExtended, moduleAPIBeingExtended._ui5reference?.package === "@ui5/webcomponents" ? "main" : "fiori"); - args = { ...args, ...nextArgs }; - slotNames = [...slotNames, ...nextSlotNames].filter((v, i, a) => a.indexOf(v) === i); - } - - return { - args, - slotNames - }; - } -}; - -main(); diff --git a/packages/playground/build-scripts-storybook/samples-prepare.ts b/packages/playground/build-scripts-storybook/samples-prepare.ts new file mode 100644 index 000000000000..f7f484e2251d --- /dev/null +++ b/packages/playground/build-scripts-storybook/samples-prepare.ts @@ -0,0 +1,220 @@ +import fs from "fs/promises"; +import path from "path"; +import type CEM from "@ui5/webcomponents-tools/lib/cem/types.d.ts"; + +const STORIES_ROOT_FOLDER_NAME = '../_stories'; + +const isCustomElementDeclaration = (object: any): object is CEM.CustomElementDeclaration => { + return "customElement" in object && object.customElement; +}; + +type ControlType = "text" | "select" | "multi-select" | boolean; + +type ArgsTypes = { + [key: string]: { + control?: ControlType | { type: ControlType; /* See below for more */ }; + description?: string; + mapping?: { [key: string]: { [option: string]: any } }; + name?: string; + options?: string[]; + table?: { + category?: string; + defaultValue?: { summary: string; detail?: string }; + subcategory?: string; + type?: { summary?: string; detail?: string }; + }, + UI5CustomData?: { + parameters?: Array, + returnValue?: { + description?: string + summary?: string + type?: CEM.Type + } + } + } +} + +type APIData = { + info: { + package: string; + since: string | undefined; + }; + slotNames: Array; + storyArgsTypes: string; +} + +// run the script to generate the argTypes for the stories available in the _stories folder +const main = async () => { + const api: CEM.MySchema = JSON.parse((await fs.readFile(`./.storybook/custom-elements.json`)).toString()); + + // read all directories inside _stories folder and create a list of components + const packages = await fs.readdir(path.join(__dirname, STORIES_ROOT_FOLDER_NAME)); + for (const currPackage of packages) { + // packages [main, fiori] + + const packagePath = path.join(__dirname, STORIES_ROOT_FOLDER_NAME, currPackage); + const packageStats = await fs.stat(packagePath); + if (packageStats.isDirectory()) { + const componentsInPackage = await fs.readdir(packagePath); + for (const component of componentsInPackage) { + // components [Button, Card, ...] + const componentPath = path.join(packagePath, component); + const componentStats = await fs.stat(componentPath); + if (componentStats.isDirectory()) { + generateStoryDoc(componentPath, component, api, currPackage); + } + } + } + } + + async function generateStoryDoc(componentPath: string, component: string, api: CEM.MySchema, componentPackage: string) { + console.log(`Generating argTypes for story ${component}`); + const apiData = getAPIData(api, component, componentPackage); + + if (!apiData) { + return; + } + + const { storyArgsTypes, slotNames, info } = apiData; + + await fs.writeFile(componentPath + '/argTypes.ts', `export default ${storyArgsTypes}; +export const componentInfo = ${JSON.stringify(info, null, 4)}; +export type StoryArgsSlots = { + ${slotNames.map(slotName => `${slotName}: string;`).join('\n ')} +}`); + }; + + function getAPIData(api: CEM.MySchema, module: string, componentPackage: string): APIData | undefined { + const moduleAPI = api.modules?.find(currModule => currModule.declarations?.find(s => s._ui5reference?.name === module && s._ui5reference?.package === `@ui5/webcomponents${componentPackage !== 'main' ? `-${componentPackage}` : ''}`)); + const declaration = moduleAPI?.declarations?.find(s => s._ui5reference?.name === module && s._ui5reference?.package === `@ui5/webcomponents${componentPackage !== 'main' ? `-${componentPackage}` : ''}`); + + if (!declaration) { + return; + } + + const data = getArgsTypes(api, declaration as CEM.CustomElementDeclaration, componentPackage); + + return { + info: { + package: `@ui5/webcomponents${componentPackage !== 'main' ? `-${componentPackage}` : ''}`, + since: declaration?._ui5since + }, + slotNames: data.slotNames, + storyArgsTypes: JSON.stringify(data.args, null, "\t") + }; + } + + function getArgsTypes(api: CEM.MySchema, moduleAPI: CEM.CustomElementDeclaration | CEM.ClassDeclaration, componentPackage: string): { args: any, slotNames: Array } { + let args: ArgsTypes = {}; + let slotNames: Array = []; + + moduleAPI.members + ?.filter((member): member is CEM.ClassField => "kind" in member && member.kind === "field") + .forEach(prop => { + let typeEnum: CEM.EnumDeclaration | undefined; + + if (prop.type?.references?.length) { + for (let currModule of api.modules) { + if (!currModule.declarations) { + continue; + } + + for (let s of currModule.declarations) { + if (s?._ui5reference?.name === prop.type?.references[0].name && s?._ui5reference?.package === prop.type?.references[0].package && s.kind === "enum") { + typeEnum = s; + break; + } + } + } + } + + if (prop.readonly) { + args[prop.name] = { + control: { + type: false + }, + }; + } else if (typeEnum && Array.isArray(typeEnum.members)) { + args[prop.name] = { + control: "select", + options: typeEnum.members.map(a => a.name), + }; + } + }); + + if (isCustomElementDeclaration(moduleAPI)) { + moduleAPI.slots?.forEach(prop => { + args[prop.name] = { + control: { + type: "text" + } + }; + slotNames.push(prop.name); + }); + } + + // methods parsing because Storybook does not include them in the args by default from the custom-elements.json + // only changing the category to Methods so they are not displayed in the Properties tab + moduleAPI.members + ?.filter((member): member is CEM.ClassMethod => "kind" in member && member.kind === "method") + .forEach((prop) => { + args[prop.name] = { + description: prop.description, + table: { + category: "methods", + }, + }; + + // methods can have custom descriptions with parameters and return value + if (prop.parameters || prop.return) { + args[prop.name].UI5CustomData = { + parameters: prop.parameters, + returnValue: prop.return, + } + } + + (prop as unknown as CEM.ClassField).kind = "field"; + }); + + // events also have custom descriptions with parameters of their detail objec + if (isCustomElementDeclaration(moduleAPI)) { + moduleAPI.events?.forEach((prop) => { + if (prop.privacy === "public" && prop.params?.length) { + args[prop.name] = { + description: prop.description, + table: { + category: "events", + }, + UI5CustomData: { + parameters: prop.params, + }, + }; + } + }); + } + + const packages = ["@ui5/webcomponents", "@ui5/webcomponents-fiori"] + + // recursively merging the args from the parent/parents + const moduleAPIBeingExtended = moduleAPI.superclass && api.modules + ?.find(currModule => currModule.declarations + ?.find(s => s?._ui5reference?.name === moduleAPI.superclass?.name && s?._ui5reference?.package === moduleAPI.superclass?.package)) + ?.declarations + ?.find(s => s?._ui5reference?.name === moduleAPI.superclass?.name && s?._ui5reference?.package === moduleAPI.superclass?.package) as CEM.ClassDeclaration; + + const referencePackage = moduleAPIBeingExtended?._ui5reference?.package + + if (moduleAPIBeingExtended && referencePackage && packages.includes(referencePackage)) { + const { args: nextArgs, slotNames: nextSlotNames } = getArgsTypes(api, moduleAPIBeingExtended, referencePackage === "@ui5/webcomponents" ? "main" : "fiori"); + args = { ...args, ...nextArgs }; + slotNames = [...slotNames, ...nextSlotNames].filter((v, i, a) => a.indexOf(v) === i); + } + + return { + args, + slotNames + }; + } +}; + +main(); diff --git a/packages/tools/lib/cem/schema.json b/packages/tools/lib/cem/schema.json index e080356b9cd2..f5330743f3fa 100644 --- a/packages/tools/lib/cem/schema.json +++ b/packages/tools/lib/cem/schema.json @@ -622,6 +622,9 @@ "additionalProperties": false, "description": "A class mixin that also adds custom element related properties.", "properties": { + "_ui5reference": { + "$ref": "#/definitions/Reference" + }, "_ui5since": { "description": "Marks when the field was introduced", "type": "string" @@ -751,6 +754,7 @@ } }, "required": [ + "_ui5reference", "customElement", "kind", "name" @@ -837,6 +841,9 @@ "FunctionDeclaration": { "additionalProperties": false, "properties": { + "_ui5reference": { + "$ref": "#/definitions/Reference" + }, "_ui5since": { "description": "Marks when the field was introduced", "type": "string" @@ -892,6 +899,7 @@ } }, "required": [ + "_ui5reference", "kind", "name" ], @@ -1022,6 +1030,9 @@ "additionalProperties": false, "description": "A description of a class mixin.\n\nMixins are functions which generate a new subclass of a given superclass.\nThis interfaces describes the class and custom element features that\nare added by the mixin. As such, it extends the CustomElement interface and\nClassLike interface.\n\nSince mixins are functions, it also extends the FunctionLike interface. This\nmeans a mixin is callable, and has parameters and a return type.\n\nThe return type is often hard or impossible to accurately describe in type\nsystems like TypeScript. It requires generics and an `extends` operator\nthat TypeScript lacks. Therefore it's recommended that the return type is\nleft empty. The most common form of a mixin function takes a single\nargument, so consumers of this interface should assume that the return type\nis the single argument subclassed by this declaration.\n\nA mixin should not have a superclass. If a mixins composes other mixins,\nthey should be listed in the `mixins` field.\n\nSee [this article]{@link https://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/}\nfor more information on the classmixin pattern in JavaScript.", "properties": { + "_ui5reference": { + "$ref": "#/definitions/Reference" + }, "_ui5since": { "description": "Marks when the field was introduced", "type": "string" @@ -1101,6 +1112,7 @@ } }, "required": [ + "_ui5reference", "kind", "name" ], @@ -1308,6 +1320,9 @@ "VariableDeclaration": { "additionalProperties": false, "properties": { + "_ui5reference": { + "$ref": "#/definitions/Reference" + }, "_ui5since": { "description": "Marks when the field was introduced", "type": "string" @@ -1351,6 +1366,7 @@ } }, "required": [ + "_ui5reference", "kind", "name" ], diff --git a/packages/tools/lib/cem/types.d.ts b/packages/tools/lib/cem/types.d.ts new file mode 100644 index 000000000000..7ba211132884 --- /dev/null +++ b/packages/tools/lib/cem/types.d.ts @@ -0,0 +1,1118 @@ +export type Privacy = "private" | "protected" | "public" + +/** + * The top-level interface of a custom elements manifest file. + * + * Because custom elements are JavaScript classes, describing a custom element + * may require describing arbitrary JavaScript concepts like modules, classes, + * functions, etc. So custom elements manifests are capable of documenting + * the elements in a package, as well as those JavaScript concepts. + * + * The modules described in a package should be the public entrypoints that + * other packages may import from. Multiple modules may export the same object + * via re-exports, but in most cases a package should document the single + * canonical export that should be used. + */ +export interface MySchema { + /** + * Whether the package is deprecated. + * If the value is a string, it's the reason for the deprecation. + */ + deprecated?: string | boolean + /** + * An array of the modules this package contains. + */ + modules: JavaScriptModule[] + /** + * The Markdown to use for the main readme of this package. + * + * This can be used to override the readme used by Github or npm if that + * file contains information irrelevant to custom element catalogs and + * documentation viewers. + */ + readme?: string + /** + * The version of the schema used in this file. + */ + schemaVersion: string +} +export interface JavaScriptModule { + /** + * Marks when the field was introduced + */ + _ui5since?: string + /** + * The declarations of a module. + * + * For documentation purposes, all declarations that are reachable from + * exports should be described here. Ie, functions and objects that may be + * properties of exported objects, or passed as arguments to functions. + */ + declarations?: ( + | ClassDeclaration + | EnumDeclaration + | InterfaceDeclaration + | FunctionDeclaration + | MixinDeclaration + | VariableDeclaration + | CustomElementDeclaration + | CustomElementMixinDeclaration + )[] + /** + * Whether the module is deprecated. + * If the value is a string, it's the reason for the deprecation. + */ + deprecated?: string | boolean + /** + * A markdown description of the module. + */ + description?: string + /** + * The exports of a module. This includes JavaScript exports and + * custom element definitions. + */ + exports?: (JavaScriptExport | CustomElementExport)[] + kind: "javascript-module" + /** + * Path to the javascript file needed to be imported. + * (not the path for example to a typescript file.) + */ + path: string + /** + * A markdown summary suitable for display in a listing. + */ + summary?: string +} +export interface ClassDeclaration { + privacy: Privacy + _ui5reference: Reference + /** + * Whether the class or mixin is deprecated. + * If the value is a string, it's the reason for the deprecation. + */ + deprecated?: string | boolean + /** + * A markdown description of the class. + */ + description?: string + /** + * Marks when the field was + */ + _ui5since?: string + kind: "class" + members?: (ClassField | ClassMethod)[] + /** + * Any class mixins applied in the extends clause of this class. + * + * If mixins are applied in the class definition, then the true superclass + * of this class is the result of applying mixins in order to the superclass. + * + * Mixins must be listed in order of their application to the superclass or + * previous mixin application. This means that the innermost mixin is listed + * first. This may read backwards from the common order in JavaScript, but + * matches the order of language used to describe mixin application, like + * "S with A, B". + */ + mixins?: Reference[] + name: string + source?: SourceReference + /** + * A markdown summary suitable for display in a listing. + */ + summary?: string + /** + * A reference to an export of a module. + * + * All references are required to be publically accessible, so the canonical + * representation of a reference is the export it's available from. + * + * `package` should generally refer to an npm package name. If `package` is + * undefined then the reference is local to this package. If `module` is + * undefined the reference is local to the containing module. + * + * References to global symbols like `Array`, `HTMLElement`, or `Event` should + * use a `package` name of `"global:"`. + */ + superclass?: { + /** + * Marks when the field was introduced + */ + _ui5since?: string + module?: string + name: string + package?: string + } +} +/** + * A reference to an export of a module. + * + * All references are required to be publically accessible, so the canonical + * representation of a reference is the export it's available from. + * + * `package` should generally refer to an npm package name. If `package` is + * undefined then the reference is local to this package. If `module` is + * undefined the reference is local to the containing module. + * + * References to global symbols like `Array`, `HTMLElement`, or `Event` should + * use a `package` name of `"global:"`. + */ +export interface Reference { + /** + * Marks when the field was introduced + */ + _ui5since?: string + module?: string + name: string + package?: string +} +export interface ClassField { + /** + * Marks when the field was introduced + */ + _ui5since?: string + default: string + /** + * Whether the property is deprecated. + * If the value is a string, it's the reason for the deprecation. + */ + deprecated?: string | boolean + /** + * A markdown description of the field. + */ + description?: string + inheritedFrom?: Reference + kind: "field" + name: string + privacy: Privacy + /** + * Whether the property is read-only. + */ + readonly?: boolean + source?: SourceReference + static?: boolean + /** + * A markdown summary suitable for display in a listing. + */ + summary?: string + type: Type +} +/** + * A reference to the source of a declaration or member. + */ +export interface SourceReference { + /** + * Marks when the field was introduced + */ + _ui5since?: string + /** + * An absolute URL to the source (ie. a GitHub URL). + */ + href: string +} +export interface Type { + /** + * Marks when the field was introduced + */ + _ui5since?: string + /** + * An array of references to the types in the type string. + * + * These references have optional indices into the type string so that tools + * can understand the references in the type string independently of the type + * system and syntax. For example, a documentation viewer could display the + * type `Array` with cross-references to `FooElement` + * and `BarElement` without understanding arrays, generics, or union types. + */ + references?: TypeReference[] + source?: SourceReference + /** + * The full string representation of the type, in whatever type syntax is + * used, such as JSDoc, Closure, or TypeScript. + */ + text: string +} +/** + * A reference that is associated with a type string and optionally a range + * within the string. + * + * Start and end must both be present or not present. If they're present, they + * are indices into the associated type string. If they are missing, the entire + * type string is the symbol referenced and the name should match the type + * string. + */ +export interface TypeReference { + /** + * Marks when the field was introduced + */ + _ui5since?: string + end?: number + module?: string + name: string + package?: string + start?: number +} +export interface ClassMethod { + /** + * Marks when the field was introduced + */ + _ui5since?: string + /** + * Whether the function is deprecated. + * If the value is a string, it's the reason for the deprecation. + */ + deprecated?: string | boolean + /** + * A markdown description. + */ + description?: string + inheritedFrom?: Reference + kind: "method" + name: string + parameters?: Parameter[] + privacy: Privacy + return: { + /** + * A markdown description. + */ + description?: string + /** + * A markdown summary suitable for display in a listing. + */ + summary?: string + type?: Type + [k: string]: unknown + } + source?: SourceReference + static?: boolean + /** + * A markdown summary suitable for display in a listing. + */ + summary?: string +} +export interface Parameter { + privacy: Privacy + /** + * Marks when the field was introduced + */ + _ui5since?: string + default?: string + /** + * Whether the property is deprecated. + * If the value is a string, it's the reason for the deprecation. + */ + deprecated?: string | boolean + /** + * A markdown description of the field. + */ + description?: string + name: string + /** + * Whether the parameter is optional. Undefined implies non-optional. + */ + optional?: boolean + /** + * Whether the property is read-only. + */ + readonly?: boolean + /** + * Whether the parameter is a rest parameter. Only the last parameter may be a rest parameter. + * Undefined implies single parameter. + */ + rest?: boolean + /** + * A markdown summary suitable for display in a listing. + */ + summary?: string + type: Type +} +export interface EnumDeclaration { + privacy: Privacy + _ui5reference: Reference + /** + * Marks when the field was introduced + */ + _ui5since?: string + /** + * Whether the class or mixin is deprecated. + * If the value is a string, it's the reason for the deprecation. + */ + deprecated?: string | boolean + /** + * A markdown description of the class. + */ + description?: string + kind: "enum" + members?: ClassField[] + /** + * Any class mixins applied in the extends clause of this class. + * + * If mixins are applied in the class definition, then the true superclass + * of this class is the result of applying mixins in order to the superclass. + * + * Mixins must be listed in order of their application to the superclass or + * previous mixin application. This means that the innermost mixin is listed + * first. This may read backwards from the common order in JavaScript, but + * matches the order of language used to describe mixin application, like + * "S with A, B". + */ + mixins?: Reference[] + name: string + source?: SourceReference + /** + * A markdown summary suitable for display in a listing. + */ + summary?: string + /** + * A reference to an export of a module. + * + * All references are required to be publically accessible, so the canonical + * representation of a reference is the export it's available from. + * + * `package` should generally refer to an npm package name. If `package` is + * undefined then the reference is local to this package. If `module` is + * undefined the reference is local to the containing module. + * + * References to global symbols like `Array`, `HTMLElement`, or `Event` should + * use a `package` name of `"global:"`. + */ + superclass?: { + /** + * Marks when the field was introduced + */ + _ui5since?: string + module?: string + name: string + package?: string + } +} +export interface InterfaceDeclaration { + privacy: Privacy + _ui5reference: Reference + /** + * Marks when the field was introduced + */ + _ui5since?: string + /** + * Whether the class or mixin is deprecated. + * If the value is a string, it's the reason for the deprecation. + */ + deprecated?: string | boolean + /** + * A markdown description of the class. + */ + description?: string + kind: "interface" + /** + * Any class mixins applied in the extends clause of this class. + * + * If mixins are applied in the class definition, then the true superclass + * of this class is the result of applying mixins in order to the superclass. + * + * Mixins must be listed in order of their application to the superclass or + * previous mixin application. This means that the innermost mixin is listed + * first. This may read backwards from the common order in JavaScript, but + * matches the order of language used to describe mixin application, like + * "S with A, B". + */ + mixins?: Reference[] + name: string + source?: SourceReference + /** + * A markdown summary suitable for display in a listing. + */ + summary?: string + /** + * A reference to an export of a module. + * + * All references are required to be publically accessible, so the canonical + * representation of a reference is the export it's available from. + * + * `package` should generally refer to an npm package name. If `package` is + * undefined then the reference is local to this package. If `module` is + * undefined the reference is local to the containing module. + * + * References to global symbols like `Array`, `HTMLElement`, or `Event` should + * use a `package` name of `"global:"`. + */ + superclass?: { + /** + * Marks when the field was introduced + */ + _ui5since?: string + module?: string + name: string + package?: string + } +} +export interface FunctionDeclaration { + _ui5reference: Reference + /** + * Marks when the field was introduced + */ + _ui5since?: string + /** + * Whether the function is deprecated. + * If the value is a string, it's the reason for the deprecation. + */ + deprecated?: string | boolean + /** + * A markdown description. + */ + description?: string + kind: "function" + name: string + parameters?: Parameter[] + return?: { + /** + * A markdown description. + */ + description?: string + /** + * A markdown summary suitable for display in a listing. + */ + summary?: string + type?: Type + [k: string]: unknown + } + source?: SourceReference + /** + * A markdown summary suitable for display in a listing. + */ + summary?: string +} +/** + * A description of a class mixin. + * + * Mixins are functions which generate a new subclass of a given superclass. + * This interfaces describes the class and custom element features that + * are added by the mixin. As such, it extends the CustomElement interface and + * ClassLike interface. + * + * Since mixins are functions, it also extends the FunctionLike interface. This + * means a mixin is callable, and has parameters and a return type. + * + * The return type is often hard or impossible to accurately describe in type + * systems like TypeScript. It requires generics and an `extends` operator + * that TypeScript lacks. Therefore it's recommended that the return type is + * left empty. The most common form of a mixin function takes a single + * argument, so consumers of this interface should assume that the return type + * is the single argument subclassed by this declaration. + * + * A mixin should not have a superclass. If a mixins composes other mixins, + * they should be listed in the `mixins` field. + * + * See [this article]{@link https://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/} + * for more information on the classmixin pattern in JavaScript. + */ +export interface MixinDeclaration { + _ui5reference: Reference + /** + * Marks when the field was introduced + */ + _ui5since?: string + /** + * Whether the class or mixin is deprecated. + * If the value is a string, it's the reason for the deprecation. + */ + deprecated?: string | boolean + /** + * A markdown description of the class. + */ + description?: string + kind: "mixin" + members?: (ClassField | ClassMethod)[] + /** + * Any class mixins applied in the extends clause of this class. + * + * If mixins are applied in the class definition, then the true superclass + * of this class is the result of applying mixins in order to the superclass. + * + * Mixins must be listed in order of their application to the superclass or + * previous mixin application. This means that the innermost mixin is listed + * first. This may read backwards from the common order in JavaScript, but + * matches the order of language used to describe mixin application, like + * "S with A, B". + */ + mixins?: Reference[] + name: string + parameters?: Parameter[] + return?: { + /** + * A markdown description. + */ + description?: string + /** + * A markdown summary suitable for display in a listing. + */ + summary?: string + type?: Type + [k: string]: unknown + } + source?: SourceReference + /** + * A markdown summary suitable for display in a listing. + */ + summary?: string + /** + * A reference to an export of a module. + * + * All references are required to be publically accessible, so the canonical + * representation of a reference is the export it's available from. + * + * `package` should generally refer to an npm package name. If `package` is + * undefined then the reference is local to this package. If `module` is + * undefined the reference is local to the containing module. + * + * References to global symbols like `Array`, `HTMLElement`, or `Event` should + * use a `package` name of `"global:"`. + */ + superclass?: { + /** + * Marks when the field was introduced + */ + _ui5since?: string + module?: string + name: string + package?: string + } +} +export interface VariableDeclaration { + _ui5reference: Reference + /** + * Marks when the field was introduced + */ + _ui5since?: string + default?: string + /** + * Whether the property is deprecated. + * If the value is a string, it's the reason for the deprecation. + */ + deprecated?: string | boolean + /** + * A markdown description of the field. + */ + description?: string + kind: "variable" + name: string + /** + * Whether the property is read-only. + */ + readonly?: boolean + source?: SourceReference + /** + * A markdown summary suitable for display in a listing. + */ + summary?: string + type?: Type +} +/** + * A description of a custom element class. + * + * Custom elements are JavaScript classes, so this extends from + * `ClassDeclaration` and adds custom-element-specific features like + * attributes, events, and slots. + * + * Note that `tagName` in this interface is optional. Tag names are not + * neccessarily part of a custom element class, but belong to the definition + * (often called the "registration") or the `customElements.define()` call. + * + * Because classes and tag names can only be registered once, there's a + * one-to-one relationship between classes and tag names. For ease of use, + * we allow the tag name here. + * + * Some packages define and register custom elements in separate modules. In + * these cases one `Module` should contain the `CustomElement` without a + * tagName, and another `Module` should contain the + * `CustomElementExport`. + */ +export interface CustomElementDeclaration { + _ui5abstract?: boolean + privacy: Privacy + _ui5reference: Reference + /** + * Marks when the field was introduced + */ + _ui5since?: string + /** + * The attributes that this element is known to understand. + */ + attributes?: Attribute[] + cssParts?: CssPart[] + cssProperties?: CssCustomProperty[] + /** + * Distinguishes a regular JavaScript class from a + * custom element class + */ + customElement: true + demos?: Demo[] + /** + * Whether the class or mixin is deprecated. + * If the value is a string, it's the reason for the deprecation. + */ + deprecated?: string | boolean + /** + * A markdown description of the class. + */ + description?: string + /** + * The events that this element fires. + */ + events?: Event[] + kind: "class" + members?: (ClassField | ClassMethod)[] + /** + * Any class mixins applied in the extends clause of this class. + * + * If mixins are applied in the class definition, then the true superclass + * of this class is the result of applying mixins in order to the superclass. + * + * Mixins must be listed in order of their application to the superclass or + * previous mixin application. This means that the innermost mixin is listed + * first. This may read backwards from the common order in JavaScript, but + * matches the order of language used to describe mixin application, like + * "S with A, B". + */ + mixins?: Reference[] + name: string + /** + * The shadow dom content slots that this element accepts. + */ + slots?: Slot[] + source?: SourceReference + /** + * A markdown summary suitable for display in a listing. + */ + summary?: string + /** + * A reference to an export of a module. + * + * All references are required to be publically accessible, so the canonical + * representation of a reference is the export it's available from. + * + * `package` should generally refer to an npm package name. If `package` is + * undefined then the reference is local to this package. If `module` is + * undefined the reference is local to the containing module. + * + * References to global symbols like `Array`, `HTMLElement`, or `Event` should + * use a `package` name of `"global:"`. + */ + superclass?: { + /** + * Marks when the field was introduced + */ + _ui5since?: string + module?: string + name: string + package?: string + } + /** + * An optional tag name that should be specified if this is a + * self-registering element. + * + * Self-registering elements must also include a CustomElementExport + * in the module's exports. + */ + tagName?: string +} +export interface Attribute { + /** + * The default value of the attribute, if any. + * + * As attributes are always strings, this is the actual value, not a human + * readable description. + */ + default?: string + /** + * Whether the attribute is deprecated. + * If the value is a string, it's the reason for the deprecation. + */ + deprecated?: string | boolean + /** + * A markdown description. + */ + description?: string + /** + * The name of the field this attribute is associated with, if any. + */ + fieldName?: string + inheritedFrom?: Reference + name: string + /** + * A markdown summary suitable for display in a listing. + */ + summary?: string + /** + * The type that the attribute will be serialized/deserialized as. + */ + type?: { + /** + * Marks when the field was introduced + */ + _ui5since?: string + /** + * An array of references to the types in the type string. + * + * These references have optional indices into the type string so that tools + * can understand the references in the type string independently of the type + * system and syntax. For example, a documentation viewer could display the + * type `Array` with cross-references to `FooElement` + * and `BarElement` without understanding arrays, generics, or union types. + */ + references?: TypeReference[] + source?: SourceReference + /** + * The full string representation of the type, in whatever type syntax is + * used, such as JSDoc, Closure, or TypeScript. + */ + text: string + } +} +/** + * The description of a CSS Part + */ +export interface CssPart { + /** + * Marks when the field was introduced + */ + _ui5since?: string + /** + * Whether the CSS shadow part is deprecated. + * If the value is a string, it's the reason for the deprecation. + */ + deprecated?: string | boolean + /** + * A markdown description. + */ + description?: string + name: string + /** + * A markdown summary suitable for display in a listing. + */ + summary?: string +} +export interface CssCustomProperty { + /** + * Marks when the field was introduced + */ + _ui5since?: string + default?: string + /** + * Whether the CSS custom property is deprecated. + * If the value is a string, it's the reason for the deprecation. + */ + deprecated?: string | boolean + /** + * A markdown description. + */ + description?: string + /** + * The name of the property, including leading `--`. + */ + name: string + /** + * A markdown summary suitable for display in a listing. + */ + summary?: string + /** + * The expected syntax of the defined property. Defaults to "*". + * + * The syntax must be a valid CSS [syntax string](https://developer.mozilla.org/en-US/docs/Web/CSS/@property/syntax) + * as defined in the CSS Properties and Values API. + * + * Examples: + * + * "": accepts a color + * " | ": accepts lengths or percentages but not calc expressions with a combination of the two + * "small | medium | large": accepts one of these values set as custom idents. + * "*": any valid token + */ + syntax?: string +} +export interface Demo { + /** + * Marks when the field was introduced + */ + _ui5since?: string + /** + * A markdown description of the demo. + */ + description?: string + source?: SourceReference + /** + * Relative URL of the demo if it's published with the package. Absolute URL + * if it's hosted. + */ + url: string +} +export interface Event { + params?: Parameter[] + privacy: Privacy + /** + * Whether the parameter is optional. Undefined implies non-optional. + */ + _ui5allowPreventDefault?: boolean + /** + * Marks when the field was introduced + */ + _ui5since?: string + /** + * Whether the event is deprecated. + * If the value is a string, it's the reason for the deprecation. + */ + deprecated?: string | boolean + /** + * A markdown description. + */ + description?: string + inheritedFrom?: Reference + name: string + /** + * A markdown summary suitable for display in a listing. + */ + summary?: string + /** + * The type of the event object that's fired. + */ + type: { + /** + * Marks when the field was introduced + */ + _ui5since?: string + /** + * An array of references to the types in the type string. + * + * These references have optional indices into the type string so that tools + * can understand the references in the type string independently of the type + * system and syntax. For example, a documentation viewer could display the + * type `Array` with cross-references to `FooElement` + * and `BarElement` without understanding arrays, generics, or union types. + */ + references?: TypeReference[] + source?: SourceReference + /** + * The full string representation of the type, in whatever type syntax is + * used, such as JSDoc, Closure, or TypeScript. + */ + text: string + } +} +export interface Slot { + type: Type + privacy: Privacy + /** + * Marks when the field was introduced + */ + _ui5since?: string + /** + * Whether the slot is deprecated. + * If the value is a string, it's the reason for the deprecation. + */ + deprecated?: string | boolean + /** + * A markdown description. + */ + description?: string + /** + * The slot name, or the empty string for an unnamed slot. + */ + name: string + /** + * A markdown summary suitable for display in a listing. + */ + summary?: string +} +/** + * A class mixin that also adds custom element related properties. + */ +export interface CustomElementMixinDeclaration { + _ui5reference: Reference + /** + * Marks when the field was introduced + */ + _ui5since?: string + /** + * The attributes that this element is known to understand. + */ + attributes?: Attribute[] + cssParts?: CssPart[] + cssProperties?: CssCustomProperty[] + /** + * Distinguishes a regular JavaScript class from a + * custom element class + */ + customElement: true + demos?: Demo[] + /** + * Whether the class or mixin is deprecated. + * If the value is a string, it's the reason for the deprecation. + */ + deprecated?: string | boolean + /** + * A markdown description of the class. + */ + description?: string + /** + * The events that this element fires. + */ + events?: Event[] + kind: "mixin" + members?: (ClassField | ClassMethod)[] + /** + * Any class mixins applied in the extends clause of this class. + * + * If mixins are applied in the class definition, then the true superclass + * of this class is the result of applying mixins in order to the superclass. + * + * Mixins must be listed in order of their application to the superclass or + * previous mixin application. This means that the innermost mixin is listed + * first. This may read backwards from the common order in JavaScript, but + * matches the order of language used to describe mixin application, like + * "S with A, B". + */ + mixins?: Reference[] + name: string + parameters?: Parameter[] + return?: { + /** + * A markdown description. + */ + description?: string + /** + * A markdown summary suitable for display in a listing. + */ + summary?: string + type?: Type + [k: string]: unknown + } + /** + * The shadow dom content slots that this element accepts. + */ + slots?: Slot[] + source?: SourceReference + /** + * A markdown summary suitable for display in a listing. + */ + summary?: string + /** + * A reference to an export of a module. + * + * All references are required to be publically accessible, so the canonical + * representation of a reference is the export it's available from. + * + * `package` should generally refer to an npm package name. If `package` is + * undefined then the reference is local to this package. If `module` is + * undefined the reference is local to the containing module. + * + * References to global symbols like `Array`, `HTMLElement`, or `Event` should + * use a `package` name of `"global:"`. + */ + superclass?: { + /** + * Marks when the field was introduced + */ + _ui5since?: string + module?: string + name: string + package?: string + } + /** + * An optional tag name that should be specified if this is a + * self-registering element. + * + * Self-registering elements must also include a CustomElementExport + * in the module's exports. + */ + tagName?: string +} +export interface JavaScriptExport { + /** + * Marks when the field was introduced + */ + _ui5since?: string + /** + * A reference to an export of a module. + * + * All references are required to be publically accessible, so the canonical + * representation of a reference is the export it's available from. + * + * `package` should generally refer to an npm package name. If `package` is + * undefined then the reference is local to this package. If `module` is + * undefined the reference is local to the containing module. + * + * References to global symbols like `Array`, `HTMLElement`, or `Event` should + * use a `package` name of `"global:"`. + */ + declaration: { + /** + * Marks when the field was introduced + */ + _ui5since?: string + module?: string + name: string + package?: string + } + /** + * Whether the export is deprecated. For example, the name of the export was changed. + * If the value is a string, it's the reason for the deprecation. + */ + deprecated?: string | boolean + kind: "js" + /** + * The name of the exported symbol. + * + * JavaScript has a number of ways to export objects which determine the + * correct name to use. + * + * - Default exports must use the name "default". + * - Named exports use the name that is exported. If the export is renamed + * with the "as" clause, use the exported name. + * - Aggregating exports (`* from`) should use the name `*` + */ + name: string +} +/** + * A global custom element defintion, ie the result of a + * `customElements.define()` call. + * + * This is represented as an export because a definition makes the element + * available outside of the module it's defined it. + */ +export interface CustomElementExport { + /** + * Marks when the field was introduced + */ + _ui5since?: string + /** + * A reference to an export of a module. + * + * All references are required to be publically accessible, so the canonical + * representation of a reference is the export it's available from. + * + * `package` should generally refer to an npm package name. If `package` is + * undefined then the reference is local to this package. If `module` is + * undefined the reference is local to the containing module. + * + * References to global symbols like `Array`, `HTMLElement`, or `Event` should + * use a `package` name of `"global:"`. + */ + declaration: { + /** + * Marks when the field was introduced + */ + _ui5since?: string + module?: string + name: string + package?: string + } + /** + * Whether the custom-element export is deprecated. + * For example, a future version will not register the custom element in this file. + * If the value is a string, it's the reason for the deprecation. + */ + deprecated?: string | boolean + kind: "custom-element-definition" + /** + * The tag name of the custom element. + */ + name: string +} diff --git a/packages/tools/package.json b/packages/tools/package.json index 043bce2570e0..055a7d224067 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -53,6 +53,7 @@ "is-port-reachable": "^3.1.0", "jsdoc": "^3.6.6", "json-beautify": "^1.1.1", + "json-schema-to-typescript": "^13.1.1", "mkdirp": "^1.0.4", "nps": "^5.10.0", "postcss": "^8.4.5", diff --git a/yarn.lock b/yarn.lock index d9262042ff37..7c5b8d41de4c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1048,6 +1048,16 @@ "@babel/helper-validator-identifier" "^7.22.20" to-fast-properties "^2.0.0" +"@bcherny/json-schema-ref-parser@10.0.5-fork": + version "10.0.5-fork" + resolved "https://registry.yarnpkg.com/@bcherny/json-schema-ref-parser/-/json-schema-ref-parser-10.0.5-fork.tgz#9b5e1e7e07964ea61840174098e634edbe8197bc" + integrity sha512-E/jKbPoca1tfUPj3iSbitDZTGnq6FUFjkH6L8U2oDwSuwK1WhnnVtCG7oFOTg/DDnyoXbQYUiUiGOibHqaGVnw== + dependencies: + "@jsdevtools/ono" "^7.1.3" + "@types/json-schema" "^7.0.6" + call-me-maybe "^1.0.1" + js-yaml "^4.1.0" + "@buxlabs/amd-to-es6@0.16.1": version "0.16.1" resolved "https://registry.yarnpkg.com/@buxlabs/amd-to-es6/-/amd-to-es6-0.16.1.tgz#4baf5bc01af7d2306a8fe3ecb3fe3589688e7aa7" @@ -1602,6 +1612,11 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" +"@jsdevtools/ono@^7.1.3": + version "7.1.3" + resolved "https://registry.yarnpkg.com/@jsdevtools/ono/-/ono-7.1.3.tgz#9df03bbd7c696a5c58885c34aa06da41c8543796" + integrity sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg== + "@juggle/resize-observer@^3.3.1": version "3.4.0" resolved "https://registry.yarnpkg.com/@juggle/resize-observer/-/resize-observer-3.4.0.tgz#08d6c5e20cf7e4cc02fd181c4b0c225cd31dbb60" @@ -3337,6 +3352,14 @@ "@types/jsonfile" "*" "@types/node" "*" +"@types/glob@^7.1.3": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.2.0.tgz#bc1b5bf3aa92f25bd5dd39f35c57361bdce5b2eb" + integrity sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA== + dependencies: + "@types/minimatch" "*" + "@types/node" "*" + "@types/glob@^8.1.0": version "8.1.0" resolved "https://registry.yarnpkg.com/@types/glob/-/glob-8.1.0.tgz#b63e70155391b0584dce44e7ea25190bbc38f2fc" @@ -3411,7 +3434,7 @@ dependencies: "@types/sizzle" "*" -"@types/json-schema@^7.0.9": +"@types/json-schema@^7.0.11", "@types/json-schema@^7.0.6", "@types/json-schema@^7.0.9": version "7.0.13" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.13.tgz#02c24f4363176d2d18fc8b70b9f3c54aba178a85" integrity sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ== @@ -3461,7 +3484,7 @@ dependencies: "@types/lodash" "*" -"@types/lodash@*", "@types/lodash@^4.14.167": +"@types/lodash@*", "@types/lodash@^4.14.167", "@types/lodash@^4.14.182": version "4.14.199" resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.199.tgz#c3edb5650149d847a277a8961a7ad360c474e9bf" integrity sha512-Vrjz5N5Ia4SEzWWgIVwnHNEnb1UE1XMkvY5DGXrAeOGE9imk0hgTHh5GyDjLDJi9OTCn9oo9dXH1uToK1VRfrg== @@ -3506,16 +3529,16 @@ resolved "https://registry.yarnpkg.com/@types/mime/-/mime-1.3.3.tgz#bbe64987e0eb05de150c305005055c7ad784a9ce" integrity sha512-Ys+/St+2VF4+xuY6+kDIXGxbNRO0mesVg0bbxEfB97Od1Vjpjx9KD1qxs64Gcb3CWPirk9Xe+PT4YiiHQ9T+eg== +"@types/minimatch@*", "@types/minimatch@^5.1.2": + version "5.1.2" + resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca" + integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA== + "@types/minimatch@^3.0.3": version "3.0.5" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.5.tgz#1001cc5e6a3704b83c236027e77f2f58ea010f40" integrity sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ== -"@types/minimatch@^5.1.2": - version "5.1.2" - resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca" - integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA== - "@types/minimist@^1.2.0", "@types/minimist@^1.2.2": version "1.2.3" resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.3.tgz#dd249cef80c6fff2ba6a0d4e5beca913e04e25f8" @@ -3586,6 +3609,11 @@ resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0" integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA== +"@types/prettier@^2.6.1": + version "2.7.3" + resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.7.3.tgz#3e51a17e291d01d17d3fc61422015a933af7a08f" + integrity sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA== + "@types/pretty-hrtime@^1.0.0": version "1.0.1" resolved "https://registry.yarnpkg.com/@types/pretty-hrtime/-/pretty-hrtime-1.0.1.tgz#72a26101dc567b0d68fd956cf42314556e42d601" @@ -4324,6 +4352,11 @@ ansi-styles@^6.1.0: resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== +any-promise@^1.0.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" + integrity sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A== + anymatch@^3.0.3, anymatch@~3.1.2: version "3.1.3" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" @@ -5005,6 +5038,11 @@ call-bind@^1.0.0, call-bind@^1.0.2: function-bind "^1.1.1" get-intrinsic "^1.0.2" +call-me-maybe@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/call-me-maybe/-/call-me-maybe-1.0.2.tgz#03f964f19522ba643b1b0693acb9152fe2074baa" + integrity sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ== + callsites@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" @@ -5296,6 +5334,17 @@ cli-boxes@^2.2.0: resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-2.2.1.tgz#ddd5035d25094fce220e9cab40a45840a440318f" integrity sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw== +cli-color@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/cli-color/-/cli-color-2.0.3.tgz#73769ba969080629670f3f2ef69a4bf4e7cc1879" + integrity sha512-OkoZnxyC4ERN3zLzZaY9Emb7f/MhBOIpePv0Ycok0fJYT+Ouo00UBEIwsVsr0yoow++n5YWlSUgST9GKhNHiRQ== + dependencies: + d "^1.0.1" + es5-ext "^0.10.61" + es6-iterator "^2.0.3" + memoizee "^0.4.15" + timers-ext "^0.1.7" + cli-cursor@3.1.0, cli-cursor@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307" @@ -6027,6 +6076,14 @@ custom-elements-manifest@1.0.0: resolved "https://registry.yarnpkg.com/custom-elements-manifest/-/custom-elements-manifest-1.0.0.tgz#b35c2129076a1dc9f95d720c6f7b5b71a857274b" integrity sha512-j59k0ExGCKA8T6Mzaq+7axc+KVHwpEphEERU7VZ99260npu/p/9kd+Db+I3cGKxHkM5y6q5gnlXn00mzRQkX2A== +d@1, d@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/d/-/d-1.0.1.tgz#8698095372d58dbee346ffd0c7093f99f8f9eb5a" + integrity sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA== + dependencies: + es5-ext "^0.10.50" + type "^1.0.1" + dargs@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/dargs/-/dargs-7.0.0.tgz#04015c41de0bcb69ec84050f3d9be0caf8d6d5cc" @@ -6636,6 +6693,42 @@ es-to-primitive@^1.2.1: is-date-object "^1.0.1" is-symbol "^1.0.2" +es5-ext@^0.10.35, es5-ext@^0.10.46, es5-ext@^0.10.50, es5-ext@^0.10.53, es5-ext@^0.10.61, es5-ext@~0.10.14, es5-ext@~0.10.2, es5-ext@~0.10.46: + version "0.10.62" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.62.tgz#5e6adc19a6da524bf3d1e02bbc8960e5eb49a9a5" + integrity sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA== + dependencies: + es6-iterator "^2.0.3" + es6-symbol "^3.1.3" + next-tick "^1.1.0" + +es6-iterator@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" + integrity sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g== + dependencies: + d "1" + es5-ext "^0.10.35" + es6-symbol "^3.1.1" + +es6-symbol@^3.1.1, es6-symbol@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18" + integrity sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA== + dependencies: + d "^1.0.1" + ext "^1.1.2" + +es6-weak-map@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.3.tgz#b6da1f16cc2cc0d9be43e6bdbfc5e7dfcdf31d53" + integrity sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA== + dependencies: + d "1" + es5-ext "^0.10.46" + es6-iterator "^2.0.3" + es6-symbol "^3.1.1" + esbuild-plugin-alias@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/esbuild-plugin-alias/-/esbuild-plugin-alias-0.2.1.tgz#45a86cb941e20e7c2bc68a2bea53562172494fcb" @@ -6894,6 +6987,14 @@ etag@~1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== +event-emitter@^0.3.5: + version "0.3.5" + resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39" + integrity sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA== + dependencies: + d "1" + es5-ext "~0.10.14" + event-stream@=3.3.4: version "3.3.4" resolved "https://registry.yarnpkg.com/event-stream/-/event-stream-3.3.4.tgz#4ab4c9a0f5a54db9338b4c34d86bfce8f4b35571" @@ -7041,6 +7142,13 @@ express@^4.14.0, express@^4.17.3: utils-merge "1.0.1" vary "~1.1.2" +ext@^1.1.2: + version "1.7.0" + resolved "https://registry.yarnpkg.com/ext/-/ext-1.7.0.tgz#0ea4383c0103d60e70be99e9a7f11027a33c4f5f" + integrity sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw== + dependencies: + type "^2.7.2" + extend@^3.0.0: version "3.0.2" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" @@ -7550,6 +7658,11 @@ get-stdin@^4.0.1: resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" integrity sha512-F5aQMywwJ2n85s4hJPTT9RPxGmubonuB10MNYo17/xph174n2MIR33HRguhzVag10O/npM7SPk73LMZNP+FaWw== +get-stdin@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-8.0.0.tgz#cbad6a73feb75f6eeb22ba9e01f89aa28aa97a53" + integrity sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg== + get-stdin@^9.0.0: version "9.0.0" resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-9.0.0.tgz#3983ff82e03d56f1b2ea0d3e60325f39d703a575" @@ -7673,6 +7786,13 @@ glob-parent@6.0.2, glob-parent@^6.0.2: dependencies: is-glob "^4.0.3" +glob-promise@^4.2.2: + version "4.2.2" + resolved "https://registry.yarnpkg.com/glob-promise/-/glob-promise-4.2.2.tgz#15f44bcba0e14219cd93af36da6bb905ff007877" + integrity sha512-xcUzJ8NWN5bktoTIX7eOclO1Npxd/dyVqUJxlLIDasT4C7KZyqlPIwkdJ0Ypiy3p2ZKahTjK4M9uC3sNSfNMzw== + dependencies: + "@types/glob" "^7.1.3" + glob-to-regexp@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" @@ -8628,6 +8748,11 @@ is-port-reachable@^3.1.0: resolved "https://registry.yarnpkg.com/is-port-reachable/-/is-port-reachable-3.1.0.tgz#f6668d3bca9c36b07f737c48a8f875ab0653cd2b" integrity sha512-vjc0SSRNZ32s9SbZBzGaiP6YVB+xglLShhgZD/FHMZUXBvQWaV9CtzgeVhjccFJrI6RAMV+LX7NYxueW/A8W5A== +is-promise@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.2.2.tgz#39ab959ccbf9a774cf079f7b40c7a26f763135f1" + integrity sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ== + is-regex@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958" @@ -9055,6 +9180,26 @@ json-schema-migrate@^2.0.0: dependencies: ajv "^8.0.0" +json-schema-to-typescript@^13.1.1: + version "13.1.1" + resolved "https://registry.yarnpkg.com/json-schema-to-typescript/-/json-schema-to-typescript-13.1.1.tgz#8d1b28f93530d3b57730ee7272eec8e4400238e9" + integrity sha512-F3CYhtA7F3yPbb8vF7sFchk/2dnr1/yTKf8RcvoNpjnh67ZS/ZMH1ElLt5KHAtf2/bymiejLQQszszPWEeTdSw== + dependencies: + "@bcherny/json-schema-ref-parser" "10.0.5-fork" + "@types/json-schema" "^7.0.11" + "@types/lodash" "^4.14.182" + "@types/prettier" "^2.6.1" + cli-color "^2.0.2" + get-stdin "^8.0.0" + glob "^7.1.6" + glob-promise "^4.2.2" + is-glob "^4.0.3" + lodash "^4.17.21" + minimist "^1.2.6" + mkdirp "^1.0.4" + mz "^2.7.0" + prettier "^2.6.2" + json-schema-traverse@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" @@ -9671,6 +9816,13 @@ lru-cache@^7.4.4, lru-cache@^7.5.1, lru-cache@^7.7.1: resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.0.1.tgz#0a3be479df549cca0e5d693ac402ff19537a6b7a" integrity sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g== +lru-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/lru-queue/-/lru-queue-0.1.0.tgz#2738bd9f0d3cf4f84490c5736c48699ac632cda3" + integrity sha512-BpdYkt9EvGl8OfWHDQPISVpcl5xZthb+XPsbELj5AQXxIC8IriDZIQYjBJPEm5rS420sjZ0TLEzRcq5KdBhYrQ== + dependencies: + es5-ext "~0.10.2" + magic-string@^0.30.0: version "0.30.4" resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.4.tgz#c2c683265fc18dda49b56fc7318d33ca0332c98c" @@ -9972,6 +10124,20 @@ media-typer@0.3.0: resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" integrity sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ== +memoizee@^0.4.15: + version "0.4.15" + resolved "https://registry.yarnpkg.com/memoizee/-/memoizee-0.4.15.tgz#e6f3d2da863f318d02225391829a6c5956555b72" + integrity sha512-UBWmJpLZd5STPm7PMUlOw/TSy972M+z8gcyQ5veOnSDRREz/0bmpyTfKt3/51DhEBqCZQn1udM/5flcSPYhkdQ== + dependencies: + d "^1.0.1" + es5-ext "^0.10.53" + es6-weak-map "^2.0.3" + event-emitter "^0.3.5" + is-promise "^2.2.2" + lru-queue "^0.1.0" + next-tick "^1.1.0" + timers-ext "^0.1.7" + memoizerific@^1.11.3: version "1.11.3" resolved "https://registry.yarnpkg.com/memoizerific/-/memoizerific-1.11.3.tgz#7c87a4646444c32d75438570905f2dbd1b1a805a" @@ -10648,6 +10814,15 @@ mute-stream@0.0.8, mute-stream@~0.0.4: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== +mz@^2.7.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" + integrity sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q== + dependencies: + any-promise "^1.0.0" + object-assign "^4.0.1" + thenify-all "^1.0.0" + nanoid@3.3.3: version "3.3.3" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.3.tgz#fd8e8b7aa761fe807dba2d1b98fb7241bb724a25" @@ -10678,6 +10853,11 @@ neo-async@^2.5.0, neo-async@^2.6.2: resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== +next-tick@1, next-tick@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb" + integrity sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ== + nice-try@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" @@ -11981,7 +12161,7 @@ prepend-http@^2.0.0: resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897" integrity sha512-ravE6m9Atw9Z/jjttRUZ+clIXogdghyZAuWJ3qEzjT+jI/dL1ifAqhZeC5VHzQp1MSt1+jxKkFNemj/iO7tVUA== -prettier@^2.8.0, prettier@^2.8.1: +prettier@^2.6.2, prettier@^2.8.0, prettier@^2.8.1: version "2.8.8" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== @@ -13761,6 +13941,20 @@ thenby@^1.3.4: resolved "https://registry.yarnpkg.com/thenby/-/thenby-1.3.4.tgz#81581f6e1bb324c6dedeae9bfc28e59b1a2201cc" integrity sha512-89Gi5raiWA3QZ4b2ePcEwswC3me9JIg+ToSgtE0JWeCynLnLxNr/f9G+xfo9K+Oj4AFdom8YNJjibIARTJmapQ== +thenify-all@^1.0.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" + integrity sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA== + dependencies: + thenify ">= 3.1.0 < 4" + +"thenify@>= 3.1.0 < 4": + version "3.3.1" + resolved "https://registry.yarnpkg.com/thenify/-/thenify-3.3.1.tgz#8932e686a4066038a016dd9e2ca46add9838a95f" + integrity sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw== + dependencies: + any-promise "^1.0.0" + third-party-web@^0.12.4: version "0.12.7" resolved "https://registry.yarnpkg.com/third-party-web/-/third-party-web-0.12.7.tgz#64445702379abf1a29066d636a965173e4e423c6" @@ -13796,6 +13990,14 @@ timed-out@4.0.1: resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-4.0.1.tgz#f32eacac5a175bea25d7fab565ab3ed8741ef56f" integrity sha512-G7r3AhovYtr5YKOWQkta8RKAPb+J9IsO4uVmzjl8AZwfhs8UcUwTiD6gcJYSgOtzyjvQKrKYn41syHbUWMkafA== +timers-ext@^0.1.7: + version "0.1.7" + resolved "https://registry.yarnpkg.com/timers-ext/-/timers-ext-0.1.7.tgz#6f57ad8578e07a3fb9f91d9387d65647555e25c6" + integrity sha512-b85NUNzTSdodShTIbky6ZF02e8STtVVfD+fu4aXXShEELpozH+bCpJLYMPZbsABN2wDH7fJpqIoXxJpzbf0NqQ== + dependencies: + es5-ext "~0.10.46" + next-tick "1" + tiny-invariant@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/tiny-invariant/-/tiny-invariant-1.3.1.tgz#8560808c916ef02ecfd55e66090df23a4b7aa642" @@ -14011,6 +14213,16 @@ type-is@~1.6.18: media-typer "0.3.0" mime-types "~2.1.24" +type@^1.0.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/type/-/type-1.2.0.tgz#848dd7698dafa3e54a6c479e759c4bc3f18847a0" + integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg== + +type@^2.7.2: + version "2.7.2" + resolved "https://registry.yarnpkg.com/type/-/type-2.7.2.tgz#2376a15a3a28b1efa0f5350dcf72d24df6ef98d0" + integrity sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw== + typed-array-buffer@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/typed-array-buffer/-/typed-array-buffer-1.0.0.tgz#18de3e7ed7974b0a729d3feecb94338d1472cd60"