@dpuse/dpuse-development 1.0.139 → 1.0.141
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/dist/{apiReference-sI13y2nG.js → apiReference-CdMhhAl1.js} +1 -1
- package/dist/{apiReference-sI13y2nG.js.map → apiReference-CdMhhAl1.js.map} +1 -1
- package/dist/dpuse-development.es.js +37 -33
- package/dist/dpuse-development.es.js.map +1 -1
- package/dist/{utilities-DzQ2yZXo.js → utilities-D98znirs.js} +10 -0
- package/dist/{utilities-DzQ2yZXo.js.map → utilities-D98znirs.js.map} +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -78,12 +78,12 @@ _Note: Sonda's Vite reports currently exclude CSS files, since Vite does not gen
|
|
|
78
78
|
|
|
79
79
|
| Chunk/Module/File | Composition |
|
|
80
80
|
| :------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------- |
|
|
81
|
-
| **dist/dpuse-development.es.js** | 65.5 kB · gzip 20.8 kB · 63.
|
|
81
|
+
| **dist/dpuse-development.es.js** | 65.5 kB · gzip 20.8 kB · 63.6% of the build |
|
|
82
82
|
| src → documentDependencies.ts + 22 more | `█████████████████░░░` 86.8% · 56.9 kB |
|
|
83
83
|
| ↳ documentDependencies.ts | `▒▒▒░░░░░░░░░░░░░░░░░` 17.4% · 11.4 kB |
|
|
84
84
|
| ↳ documentQualitySecurity.ts | `▒▒▒░░░░░░░░░░░░░░░░░` 15.2% · 9.9 kB |
|
|
85
85
|
| ↳ documentBundleSizes.ts | `▒▒▒░░░░░░░░░░░░░░░░░` 13.8% · 9.0 kB |
|
|
86
|
-
| ↳ checkConfigFiles.ts | `▒░░░░░░░░░░░░░░░░░░░` 5.
|
|
86
|
+
| ↳ checkConfigFiles.ts | `▒░░░░░░░░░░░░░░░░░░░` 5.7% · 3.8 kB |
|
|
87
87
|
| ↳ rustCrates.ts | `▒░░░░░░░░░░░░░░░░░░░` 5.3% · 3.4 kB |
|
|
88
88
|
| ↳ documentUsage.ts | `▒░░░░░░░░░░░░░░░░░░░` 4.1% · 2.7 kB |
|
|
89
89
|
| ↳ cloudflare.ts | `▒░░░░░░░░░░░░░░░░░░░` 3.4% · 2.2 kB |
|
|
@@ -98,12 +98,12 @@ _Note: Sonda's Vite reports currently exclude CSS files, since Vite does not gen
|
|
|
98
98
|
| ↳ 8 smaller files | `▒░░░░░░░░░░░░░░░░░░░` 4.3% · 2.8 kB |
|
|
99
99
|
| (inlined worker) | `░░░░░░░░░░░░░░░░░░░░` 0.0% · 17 B |
|
|
100
100
|
| (bundler output, whitespace & JSON) | `███░░░░░░░░░░░░░░░░░` 13.1% · 8.6 kB |
|
|
101
|
-
| **dist/utilities-
|
|
102
|
-
| @dpuse/dpuse-shared → dist/dpuse-shared.es.js | `███████████░░░░░░░░░`
|
|
103
|
-
| src → index.ts | `███████░░░░░░░░░░░░░` 33.
|
|
101
|
+
| **dist/utilities-D98znirs.js** | 26.6 kB · gzip 7.4 kB · 25.8% of the build |
|
|
102
|
+
| @dpuse/dpuse-shared → dist/dpuse-shared.es.js | `███████████░░░░░░░░░` 54.0% · 14.3 kB |
|
|
103
|
+
| src → index.ts | `███████░░░░░░░░░░░░░` 33.4% · 8.9 kB |
|
|
104
104
|
| valibot → dist/index.mjs | `░░░░░░░░░░░░░░░░░░░░` 1.5% · 413 B |
|
|
105
|
-
| (bundler output, whitespace & JSON) | `██░░░░░░░░░░░░░░░░░░` 11.
|
|
106
|
-
| **dist/apiReference-
|
|
105
|
+
| (bundler output, whitespace & JSON) | `██░░░░░░░░░░░░░░░░░░` 11.0% · 2.9 kB |
|
|
106
|
+
| **dist/apiReference-CdMhhAl1.js** | 8.5 kB · gzip 3.1 kB · 8.2% of the build |
|
|
107
107
|
| src → apiReference.ts | `███████████████████░` 95.1% · 8.0 kB |
|
|
108
108
|
| (bundler output, whitespace & JSON) | `█░░░░░░░░░░░░░░░░░░░` 4.9% · 427 B |
|
|
109
109
|
| **dist/vite.es.js** | 2.5 kB · gzip 1.1 kB · 2.4% of the build |
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiReference-sI13y2nG.js","names":["writeTextFile","readJSONFile","logStepHeader","path","ts","TOPIC_GROUPING_MINIMUM","GENERAL_TOPIC","EXPORT_KINDS","API_REFERENCE_INTRO","writeAPIReference","stepIcon","apiReferencePath","entryPoints","resolveEntryPoints","program","sourcePath","readCompilerOptions","checker","fieldGroupOwners","mapFieldGroupOwners","sections","sourceFile","importPath","buildSection","listExports","packageName","packageJSON","exportsField","exportEntries","subpath","target","typesPath","\"types\"","configPath","fileName","config","moduleSymbol","symbol","resolveAlias","exportedSymbol","entry","describeExport","formatExportName","readDescription","readTopic","a","b","resolvePath","unresolvedPath","folder","segment","letter","signature","isSchema","name","formatParameter","parameter","formatOrigin","formatConstantType","description","declaration","variableDeclaration","initializer","isWrittenAs","typeNode","formatTypeNode","clauses","clause","formatCode","type","typeAlias","schemaName","findSchemaName","fields","findSchemaFields","parents","findSchemaParents","parent","group","property","resolveObjectLiteral","owner","typeName","candidates","typeAliases","statement","listFieldGroups","owners","groupCandidates","fewestAdded","addedFieldCount","tied","ownGroup","spreadGroups","argument","isTypeReferenceNamed","returnTypeArgument","fieldsQuery","schema","resolveInitializer","node","declarationName","parameterDeclaration","isOptional","typeText","formatParameterName","names","element","topics","entries","compareTopics","buildKindLists","topicSections","topic","items","kind","formatEntry","headingLevel","detailCode","detail","firstLine","origin","text"],"sources":["../src/utilities/apiReference.ts"],"sourcesContent":["// ── External Dependencies & Registrations\nimport type { PackageJson } from 'type-fest';\nimport path from 'node:path';\nimport ts from 'typescript';\n\n// ── Local Framework\nimport { logStepHeader, readJSONFile, writeTextFile } from '@/utilities';\n\n// ── Types ────────────────────────────────────────────────────────────────────────────────────────────────────────────\n\ninterface ExportEntry {\n description: string | undefined;\n detail: string; // What follows the name in code, such as a function's parameters or a constant's type.\n kind: ExportKind;\n name: string;\n origin: string;\n topic: string; // The folder the export is declared in, such as 'Component › Module › Connector'.\n}\n\ntype ExportKind = 'Classes' | 'Constants' | 'Functions' | 'Schemas' | 'Types';\n\n// ── Constants ────────────────────────────────────────────────────────────────────────────────────────────────────────\n\n// An import path whose exports come from at least this many folders is listed by folder, so a package with one entry\n// point for everything still reads as topics rather than one long list.\nconst TOPIC_GROUPING_MINIMUM = 3;\n\n// Declared directly in the source folder, rather than in a topic folder within it.\nconst GENERAL_TOPIC = 'General';\n\n// In the order each import path's section lists them.\nconst EXPORT_KINDS: ExportKind[] = ['Functions', 'Classes', 'Constants', 'Schemas', 'Types'];\n\nconst API_REFERENCE_INTRO = 'Every export, grouped by import path. This file is updated each time `npm run document` is run, and with each release.';\n\n// ── Actions ──────────────────────────────────────────────────────────────────────────────────────────────────────────\n\n// Lists the exports of each import path in package.json 'exports', read from the TypeScript source the path's types are\n// built from. Paths without types, such as a shared config file, are left out. This module is loaded only when the API\n// reference is written, as TypeScript is an optional peer.\nexport async function writeAPIReference(stepIcon: string, apiReferencePath: string): Promise<void> {\n logStepHeader(`${stepIcon} Write '${apiReferencePath}'`);\n\n const packageJSON = await readJSONFile<PackageJson>('package.json');\n const entryPoints = resolveEntryPoints(packageJSON);\n if (entryPoints.length === 0) throw new Error(\"package.json 'exports' must name at least one import path with types to document the API reference.\");\n\n // Absolute paths, as TypeScript keeps the working directory it first saw, so relative ones could resolve against a\n // folder the process has since left.\n const program = ts.createProgram(\n entryPoints.map(({ sourcePath }) => path.resolve(sourcePath)),\n readCompilerOptions()\n );\n const checker = program.getTypeChecker();\n const fieldGroupOwners = mapFieldGroupOwners(program, checker);\n\n const sections = entryPoints.map(({ importPath, sourcePath }) => {\n const sourceFile = program.getSourceFile(path.resolve(sourcePath));\n if (sourceFile === undefined) throw new Error(`Unable to read '${sourcePath}', the source of '${importPath}'.`);\n return buildSection(importPath, listExports(checker, sourceFile, fieldGroupOwners));\n });\n\n await writeTextFile(apiReferencePath, `# API Reference\\n\\n${API_REFERENCE_INTRO}\\n\\n${sections.join('\\n\\n')}\\n`);\n}\n\n// ── Helpers ──────────────────────────────────────────────────────────────────────────────────────────────────────────\n\n// The types path of each export, such as './dist/types/src/errors/index.d.ts', mirrors its source file\n// ('src/errors/index.ts'), so the source is found by stripping the output folder and swapping the extension.\nfunction resolveEntryPoints(packageJSON: PackageJson): { importPath: string; sourcePath: string }[] {\n const packageName = packageJSON.name ?? '';\n const exportsField = packageJSON.exports;\n const exportEntries = exportsField != null && typeof exportsField === 'object' && !Array.isArray(exportsField) ? Object.entries(exportsField) : [];\n\n const entryPoints: { importPath: string; sourcePath: string }[] = [];\n for (const [subpath, target] of exportEntries) {\n const typesPath = target != null && typeof target === 'object' && !Array.isArray(target) ? target['types'] : undefined;\n if (typeof typesPath !== 'string') continue;\n const importPath = subpath === '.' ? packageName : `${packageName}${subpath.slice(1)}`;\n const sourcePath = typesPath.replace(/^\\.\\/dist\\/types\\//, '').replace(/\\.d\\.ts$/, '.ts');\n entryPoints.push({ importPath, sourcePath });\n }\n return entryPoints;\n}\n\n// Uses the project's own tsconfig, so '@/' and other path aliases resolve as they do in the build.\nfunction readCompilerOptions(): ts.CompilerOptions {\n const configPath = ts.findConfigFile(process.cwd(), (fileName) => ts.sys.fileExists(fileName));\n if (configPath === undefined) return { module: ts.ModuleKind.ESNext, moduleResolution: ts.ModuleResolutionKind.Bundler, target: ts.ScriptTarget.ESNext };\n\n const { config } = ts.readConfigFile(configPath, (fileName) => ts.sys.readFile(fileName)) as { config: unknown };\n return ts.parseJsonConfigFileContent(config, ts.sys, process.cwd()).options;\n}\n\nfunction listExports(checker: ts.TypeChecker, sourceFile: ts.SourceFile, fieldGroupOwners: Map<ts.ObjectLiteralExpression, string>): ExportEntry[] {\n const moduleSymbol = checker.getSymbolAtLocation(sourceFile);\n const exportedSymbols = moduleSymbol === undefined ? [] : checker.getExportsOfModule(moduleSymbol);\n\n const entries = exportedSymbols.flatMap((exportedSymbol) => {\n const symbol = resolveAlias(checker, exportedSymbol);\n const entry = describeExport(checker, formatExportName(exportedSymbol, symbol), symbol, fieldGroupOwners);\n return entry === undefined ? [] : { ...entry, description: readDescription(checker, symbol), topic: readTopic(symbol) };\n });\n return entries.toSorted((a, b) => a.name.localeCompare(b.name));\n}\n\n// Named from the folders between 'src' and the file declaring the export: 'component/module/connector' reads as\n// 'Component › Module › Connector', with camel-case names split into words.\nfunction readTopic(symbol: ts.Symbol): string {\n const fileName = symbol.declarations?.[0]?.getSourceFile().fileName;\n if (fileName === undefined) return GENERAL_TOPIC;\n\n // TypeScript reports files with symbolic links resolved (on macOS, '/var' is really '/private/var'), so the source\n // folder is resolved the same way before the two are compared.\n const resolvePath = (unresolvedPath: string): string => ts.sys.realpath?.(unresolvedPath) ?? unresolvedPath;\n const folder = path.relative(resolvePath(path.join(process.cwd(), 'src')), resolvePath(path.dirname(fileName)));\n return folder === '' || folder.startsWith('..')\n ? GENERAL_TOPIC\n : folder\n .split(path.sep)\n .map((segment) => segment.replaceAll(/([a-z])([A-Z])/g, '$1 $2').replace(/^./, (letter) => letter.toUpperCase()))\n .join(' › ');\n}\n\n// Functions include constants holding a function, as with arrow functions. Schemas are the constants named '…Schema'.\nfunction describeExport(\n checker: ts.TypeChecker,\n name: string,\n symbol: ts.Symbol,\n fieldGroupOwners: Map<ts.ObjectLiteralExpression, string>\n): Omit<ExportEntry, 'description' | 'topic'> | undefined {\n const isValue = (symbol.flags & (ts.SymbolFlags.Function | ts.SymbolFlags.Variable)) !== 0;\n const [signature] = isValue ? checker.getSignaturesOfType(checker.getTypeOfSymbol(symbol), ts.SignatureKind.Call) : [];\n const isSchema = name.endsWith('Schema');\n\n if (signature !== undefined && !isSchema) {\n const parameters = signature.parameters.map((parameter) => formatParameter(checker, parameter));\n return { detail: `(${parameters.join(', ')})`, kind: 'Functions', name, origin: '' };\n }\n if ((symbol.flags & ts.SymbolFlags.Class) !== 0) return { detail: '', kind: 'Classes', name, origin: formatOrigin(checker, symbol, fieldGroupOwners) };\n if (isSchema && (symbol.flags & ts.SymbolFlags.Variable) !== 0) return { detail: '', kind: 'Schemas', name, origin: '' };\n if ((symbol.flags & ts.SymbolFlags.Variable) !== 0) return { detail: `: ${formatConstantType(checker, symbol)}`, kind: 'Constants', name, origin: '' };\n const isType = (symbol.flags & (ts.SymbolFlags.Enum | ts.SymbolFlags.Interface | ts.SymbolFlags.TypeAlias)) !== 0;\n return isType ? { detail: '', kind: 'Types', name, origin: formatOrigin(checker, symbol, fieldGroupOwners) } : undefined;\n}\n\n// The summary of the '/** … */' comment above the item, on one line. Tags such as '@param' are left out, and '//'\n// comments, which are notes for maintainers, are never read.\nfunction readDescription(checker: ts.TypeChecker, symbol: ts.Symbol): string | undefined {\n const description = ts.displayPartsToString(symbol.getDocumentationComment(checker)).replaceAll(/\\s+/g, ' ').trim();\n return description === '' ? undefined : description;\n}\n\n// The type as written, on the declaration or in an 'as' on its value, which keeps the names it was written with. Where\n// none is written, the inferred type is widened, so 'MAX_COUNT = 3' reads as 'number' rather than '3'.\nfunction formatConstantType(checker: ts.TypeChecker, symbol: ts.Symbol): string {\n const declaration = symbol.valueDeclaration;\n const variableDeclaration = declaration !== undefined && ts.isVariableDeclaration(declaration) ? declaration : undefined;\n const initializer = variableDeclaration?.initializer;\n const isWrittenAs = initializer !== undefined && ts.isAsExpression(initializer) && !ts.isConstTypeReference(initializer.type); // 'as const' names no type.\n const typeNode = variableDeclaration?.type ?? (isWrittenAs ? initializer.type : undefined);\n return typeNode === undefined ? checker.typeToString(checker.getBaseTypeOfLiteralType(checker.getTypeOfSymbol(symbol)), declaration) : formatTypeNode(typeNode);\n}\n\n// What a type or class comes from: the schema it is inferred from, and what it extends or implements, such as\n// ' (extends DPUseError)'. A type inferred from a schema has no 'extends' clause, so its parent is found from the schema\n// instead. The parent is named even when it is not exported, as it is still what the type inherits from.\nfunction formatOrigin(checker: ts.TypeChecker, symbol: ts.Symbol, fieldGroupOwners: Map<ts.ObjectLiteralExpression, string>): string {\n const heritageClauses = (symbol.declarations ?? []).flatMap((declaration) =>\n ts.isClassDeclaration(declaration) || ts.isInterfaceDeclaration(declaration) ? [...(declaration.heritageClauses ?? [])] : []\n );\n const clauses = heritageClauses.map((clause) => {\n const keyword = clause.token === ts.SyntaxKind.ExtendsKeyword ? 'extends' : 'implements';\n return `${keyword} ${clause.types.map((type) => formatCode(formatTypeNode(type))).join(', ')}`;\n });\n\n const typeAlias = symbol.declarations?.find((declaration) => ts.isTypeAliasDeclaration(declaration));\n const schemaName = typeAlias === undefined ? undefined : findSchemaName(typeAlias);\n if (typeAlias !== undefined && schemaName !== undefined) {\n clauses.push(`inferred from ${formatCode(schemaName.getText())}`);\n const fields = findSchemaFields(checker, typeAlias);\n const parents = fields === undefined ? [] : findSchemaParents(checker, fields, typeAlias.name.text, fieldGroupOwners);\n if (parents.length > 0) clauses.push(`extends ${parents.map((parent) => formatCode(parent)).join(', ')}`);\n }\n return clauses.length === 0 ? '' : ` (${clauses.join(', ')})`;\n}\n\n// A schema inherits by spreading in a group of fields, as in 'strictObject({ ...moduleConfigCoreFields, … })'. Where\n// the type owns the group it spreads, as 'ModuleConfig' owns 'moduleConfigCoreFields', its parent is found in that\n// group's own spreads.\nfunction findSchemaParents(checker: ts.TypeChecker, fields: ts.ObjectLiteralExpression, typeName: string, fieldGroupOwners: Map<ts.ObjectLiteralExpression, string>): string[] {\n return fields.properties.flatMap((property) => {\n const group = ts.isSpreadAssignment(property) ? resolveObjectLiteral(checker, property.expression) : undefined;\n if (group === undefined) return [];\n const owner = fieldGroupOwners.get(group);\n if (owner === typeName) return findSchemaParents(checker, group, typeName, fieldGroupOwners);\n return owner === undefined ? [] : [owner];\n });\n}\n\n// A field group is not a type, so it is named by the type whose schema adds the fewest fields to it. Where two types\n// tie, the group is left unnamed rather than guessed at.\nfunction mapFieldGroupOwners(program: ts.Program, checker: ts.TypeChecker): Map<ts.ObjectLiteralExpression, string> {\n const candidates = new Map<ts.ObjectLiteralExpression, { addedFieldCount: number; typeName: string }[]>();\n const typeAliases = program\n .getSourceFiles()\n .filter((sourceFile) => !sourceFile.isDeclarationFile && !program.isSourceFileFromExternalLibrary(sourceFile))\n .flatMap((sourceFile) => sourceFile.statements.filter((statement) => ts.isTypeAliasDeclaration(statement)));\n\n for (const typeAlias of typeAliases) {\n for (const { addedFieldCount, group } of listFieldGroups(checker, typeAlias)) {\n candidates.set(group, [...(candidates.get(group) ?? []), { addedFieldCount, typeName: typeAlias.name.text }]);\n }\n }\n\n const owners = new Map<ts.ObjectLiteralExpression, string>();\n for (const [group, groupCandidates] of candidates) {\n const fewestAdded = Math.min(...groupCandidates.map(({ addedFieldCount }) => addedFieldCount));\n const [owner, ...tied] = groupCandidates.filter(({ addedFieldCount }) => addedFieldCount === fewestAdded);\n if (owner !== undefined && tied.length === 0) owners.set(group, owner.typeName);\n }\n return owners;\n}\n\n// Each field group a type's schema is built from, with the number of fields the schema adds to it.\nfunction listFieldGroups(checker: ts.TypeChecker, typeAlias: ts.TypeAliasDeclaration): { addedFieldCount: number; group: ts.ObjectLiteralExpression }[] {\n const fields = findSchemaFields(checker, typeAlias);\n if (fields === undefined) return [];\n\n // Fields declared under a name of their own, rather than written inside the schema, are a group themselves.\n const ownGroup = ts.isVariableDeclaration(fields.parent) ? [{ addedFieldCount: 0, group: fields }] : [];\n const spreadGroups = fields.properties.flatMap((property) => {\n const group = ts.isSpreadAssignment(property) ? resolveObjectLiteral(checker, property.expression) : undefined;\n return group === undefined ? [] : [{ addedFieldCount: fields.properties.length - 1, group }];\n });\n return [...ownGroup, ...spreadGroups];\n}\n\n// The schema a type is inferred from, written either as 'InferOutput<typeof schema>' or, where the schema is built in\n// place from a group of fields, as 'InferOutput<ReturnType<typeof strictObject<typeof fields>>>'.\nfunction findSchemaName(typeAlias: ts.TypeAliasDeclaration): ts.EntityName | undefined {\n const [argument] = isTypeReferenceNamed(typeAlias.type, 'InferOutput') ? (typeAlias.type.typeArguments ?? []) : [];\n if (argument === undefined) return undefined;\n if (ts.isTypeQueryNode(argument)) return argument.exprName;\n\n const [returnTypeArgument] = isTypeReferenceNamed(argument, 'ReturnType') ? (argument.typeArguments ?? []) : [];\n const [fieldsQuery] = returnTypeArgument !== undefined && ts.isTypeQueryNode(returnTypeArgument) ? (returnTypeArgument.typeArguments ?? []) : [];\n return fieldsQuery !== undefined && ts.isTypeQueryNode(fieldsQuery) ? fieldsQuery.exprName : undefined;\n}\n\n// The fields of the schema a type is inferred from: those passed to 'strictObject({ … })', or the group of fields itself.\nfunction findSchemaFields(checker: ts.TypeChecker, typeAlias: ts.TypeAliasDeclaration): ts.ObjectLiteralExpression | undefined {\n const schemaName = findSchemaName(typeAlias);\n const schema = schemaName === undefined ? undefined : resolveInitializer(checker, schemaName);\n if (schema === undefined) return undefined;\n if (ts.isObjectLiteralExpression(schema)) return schema;\n\n const [fields] = ts.isCallExpression(schema) ? schema.arguments : [];\n return fields === undefined ? undefined : resolveObjectLiteral(checker, fields);\n}\n\nfunction isTypeReferenceNamed(node: ts.TypeNode, name: string): node is ts.TypeReferenceNode {\n if (!ts.isTypeReferenceNode(node)) return false;\n const typeName = ts.isQualifiedName(node.typeName) ? node.typeName.right : node.typeName;\n return typeName.text === name;\n}\n\nfunction resolveObjectLiteral(checker: ts.TypeChecker, node: ts.Node): ts.ObjectLiteralExpression | undefined {\n if (ts.isObjectLiteralExpression(node)) return node;\n const initializer = resolveInitializer(checker, node);\n return initializer !== undefined && ts.isObjectLiteralExpression(initializer) ? initializer : undefined;\n}\n\n// The value a name was declared with, following imports back to the declaration.\nfunction resolveInitializer(checker: ts.TypeChecker, name: ts.Node): ts.Expression | undefined {\n const symbol = checker.getSymbolAtLocation(name);\n const declaration = symbol === undefined ? undefined : resolveAlias(checker, symbol).valueDeclaration;\n return declaration !== undefined && ts.isVariableDeclaration(declaration) ? declaration.initializer : undefined;\n}\n\nfunction resolveAlias(checker: ts.TypeChecker, symbol: ts.Symbol): ts.Symbol {\n return (symbol.flags & ts.SymbolFlags.Alias) === 0 ? symbol : checker.getAliasedSymbol(symbol);\n}\n\n// A default export is imported under any name, so the name it has where it is declared is shown alongside.\nfunction formatExportName(exportedSymbol: ts.Symbol, symbol: ts.Symbol): string {\n if (exportedSymbol.name !== 'default') return exportedSymbol.name;\n const declarationName = symbol.declarations?.map((declaration) => ts.getNameOfDeclaration(declaration)?.getText()).find((name) => name !== undefined);\n return declarationName === undefined || declarationName === 'default' ? 'default' : `default (${declarationName})`;\n}\n\n// A parameter that can be left out, being optional or having a default, is marked with '?'. Its type is as written, or\n// inferred where none is, as with a default value.\nfunction formatParameter(checker: ts.TypeChecker, parameter: ts.Symbol): string {\n const declaration = parameter.valueDeclaration;\n const parameterDeclaration = declaration !== undefined && ts.isParameter(declaration) ? declaration : undefined;\n const isOptional = parameterDeclaration?.questionToken !== undefined || parameterDeclaration?.initializer !== undefined;\n const typeText = parameterDeclaration?.type === undefined ? checker.typeToString(checker.getTypeOfSymbol(parameter), declaration) : formatTypeNode(parameterDeclaration.type);\n const name = parameterDeclaration === undefined ? parameter.name : formatParameterName(parameterDeclaration.name);\n return `${name}${isOptional ? '?' : ''}: ${typeText}`;\n}\n\n// A destructured parameter has no name of its own, so TypeScript calls it '__0'. It is shown by the names it unpacks\n// instead, as '{ allowedLicenses, moduleLevel }', leaving out their defaults.\nfunction formatParameterName(name: ts.BindingName): string {\n if (ts.isIdentifier(name)) return name.text;\n const names = name.elements.flatMap((element) =>\n ts.isBindingElement(element) ? [(element.dotDotDotToken === undefined ? '' : '...') + formatParameterName(element.name)] : []\n );\n return ts.isObjectBindingPattern(name) ? `{ ${names.join(', ')} }` : `[${names.join(', ')}]`;\n}\n\n// A type written across several lines is shown on one.\nfunction formatTypeNode(typeNode: ts.TypeNode): string {\n return typeNode.getText().replaceAll(/\\s+/g, ' ');\n}\n\nfunction buildSection(importPath: string, entries: ExportEntry[]): string {\n const topics = [...new Set(entries.map((entry) => entry.topic))].toSorted(compareTopics);\n if (topics.length < TOPIC_GROUPING_MINIMUM) return [`## ${importPath}`, ...buildKindLists(entries, '###')].join('\\n\\n');\n\n const topicSections = topics.map((topic) =>\n [\n `### ${topic}`,\n ...buildKindLists(\n entries.filter((entry) => entry.topic === topic),\n '####'\n )\n ].join('\\n\\n')\n );\n return [`## ${importPath}`, ...topicSections].join('\\n\\n');\n}\n\n// General comes first, as it holds what the whole package shares; the rest are alphabetical.\nfunction compareTopics(a: string, b: string): number {\n const isEitherGeneral = a === GENERAL_TOPIC || b === GENERAL_TOPIC;\n return isEitherGeneral ? Number(b === GENERAL_TOPIC) - Number(a === GENERAL_TOPIC) : a.localeCompare(b);\n}\n\nfunction buildKindLists(entries: ExportEntry[], headingLevel: string): string[] {\n return EXPORT_KINDS.flatMap((kind) => {\n const items = entries.filter((entry) => entry.kind === kind).map((entry) => formatEntry(entry));\n return items.length === 0 ? [] : `${headingLevel} ${kind}\\n\\n${items.join('\\n')}`;\n });\n}\n\n// The name and what follows it are code, shown on a shaded background, with only the name bold so it stands out from\n// its parameters or type. The description is a quote nested in the item, which indents every line of it and shows it\n// in lighter text, so the names can be read straight down the left.\nfunction formatEntry({ description, detail, name, origin }: ExportEntry): string {\n const detailCode = detail === '' ? '' : formatCode(detail);\n const firstLine = `- **${formatCode(name)}**${detailCode}${origin}`;\n return description === undefined ? firstLine : `${firstLine}\\n > ${description}`;\n}\n\nfunction formatCode(text: string): string {\n return `\\`${text}\\``;\n}\n"],"mappings":";;;;AAyBA,IAAMK,IAAyB,GAGzBC,IAAgB,WAGhBC,IAA6B;CAAC;CAAa;CAAW;CAAa;CAAW;AAAO,GAErFC,IAAsB;AAO5B,eAAsBC,EAAkB,GAAkB,GAAyC;CAC/F,EAAc,GAAGC,EAAS,UAAUC,EAAiB,EAAE;CAGvD,IAAMC,IAAcC,EAAmB,MADbZ,EAA0B,cAAc,CAChB;CAClD,IAAIW,EAAY,WAAW,GAAG,MAAU,MAAM,qGAAqG;CAInJ,IAAME,IAAUV,EAAG,cACfQ,EAAY,KAAK,EAAE,oBAAiBT,EAAK,QAAQY,CAAU,CAAC,GAC5DC,E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":"apiReference-CdMhhAl1.js","names":["writeTextFile","readJSONFile","logStepHeader","path","ts","TOPIC_GROUPING_MINIMUM","GENERAL_TOPIC","EXPORT_KINDS","API_REFERENCE_INTRO","writeAPIReference","stepIcon","apiReferencePath","entryPoints","resolveEntryPoints","program","sourcePath","readCompilerOptions","checker","fieldGroupOwners","mapFieldGroupOwners","sections","sourceFile","importPath","buildSection","listExports","packageName","packageJSON","exportsField","exportEntries","subpath","target","typesPath","\"types\"","configPath","fileName","config","moduleSymbol","symbol","resolveAlias","exportedSymbol","entry","describeExport","formatExportName","readDescription","readTopic","a","b","resolvePath","unresolvedPath","folder","segment","letter","signature","isSchema","name","formatParameter","parameter","formatOrigin","formatConstantType","description","declaration","variableDeclaration","initializer","isWrittenAs","typeNode","formatTypeNode","clauses","clause","formatCode","type","typeAlias","schemaName","findSchemaName","fields","findSchemaFields","parents","findSchemaParents","parent","group","property","resolveObjectLiteral","owner","typeName","candidates","typeAliases","statement","listFieldGroups","owners","groupCandidates","fewestAdded","addedFieldCount","tied","ownGroup","spreadGroups","argument","isTypeReferenceNamed","returnTypeArgument","fieldsQuery","schema","resolveInitializer","node","declarationName","parameterDeclaration","isOptional","typeText","formatParameterName","names","element","topics","entries","compareTopics","buildKindLists","topicSections","topic","items","kind","formatEntry","headingLevel","detailCode","detail","firstLine","origin","text"],"sources":["../src/utilities/apiReference.ts"],"sourcesContent":["// ── External Dependencies & Registrations\nimport type { PackageJson } from 'type-fest';\nimport path from 'node:path';\nimport ts from 'typescript';\n\n// ── Local Framework\nimport { logStepHeader, readJSONFile, writeTextFile } from '@/utilities';\n\n// ── Types ────────────────────────────────────────────────────────────────────────────────────────────────────────────\n\ninterface ExportEntry {\n description: string | undefined;\n detail: string; // What follows the name in code, such as a function's parameters or a constant's type.\n kind: ExportKind;\n name: string;\n origin: string;\n topic: string; // The folder the export is declared in, such as 'Component › Module › Connector'.\n}\n\ntype ExportKind = 'Classes' | 'Constants' | 'Functions' | 'Schemas' | 'Types';\n\n// ── Constants ────────────────────────────────────────────────────────────────────────────────────────────────────────\n\n// An import path whose exports come from at least this many folders is listed by folder, so a package with one entry\n// point for everything still reads as topics rather than one long list.\nconst TOPIC_GROUPING_MINIMUM = 3;\n\n// Declared directly in the source folder, rather than in a topic folder within it.\nconst GENERAL_TOPIC = 'General';\n\n// In the order each import path's section lists them.\nconst EXPORT_KINDS: ExportKind[] = ['Functions', 'Classes', 'Constants', 'Schemas', 'Types'];\n\nconst API_REFERENCE_INTRO = 'Every export, grouped by import path. This file is updated each time `npm run document` is run, and with each release.';\n\n// ── Actions ──────────────────────────────────────────────────────────────────────────────────────────────────────────\n\n// Lists the exports of each import path in package.json 'exports', read from the TypeScript source the path's types are\n// built from. Paths without types, such as a shared config file, are left out. This module is loaded only when the API\n// reference is written, as TypeScript is an optional peer.\nexport async function writeAPIReference(stepIcon: string, apiReferencePath: string): Promise<void> {\n logStepHeader(`${stepIcon} Write '${apiReferencePath}'`);\n\n const packageJSON = await readJSONFile<PackageJson>('package.json');\n const entryPoints = resolveEntryPoints(packageJSON);\n if (entryPoints.length === 0) throw new Error(\"package.json 'exports' must name at least one import path with types to document the API reference.\");\n\n // Absolute paths, as TypeScript keeps the working directory it first saw, so relative ones could resolve against a\n // folder the process has since left.\n const program = ts.createProgram(\n entryPoints.map(({ sourcePath }) => path.resolve(sourcePath)),\n readCompilerOptions()\n );\n const checker = program.getTypeChecker();\n const fieldGroupOwners = mapFieldGroupOwners(program, checker);\n\n const sections = entryPoints.map(({ importPath, sourcePath }) => {\n const sourceFile = program.getSourceFile(path.resolve(sourcePath));\n if (sourceFile === undefined) throw new Error(`Unable to read '${sourcePath}', the source of '${importPath}'.`);\n return buildSection(importPath, listExports(checker, sourceFile, fieldGroupOwners));\n });\n\n await writeTextFile(apiReferencePath, `# API Reference\\n\\n${API_REFERENCE_INTRO}\\n\\n${sections.join('\\n\\n')}\\n`);\n}\n\n// ── Helpers ──────────────────────────────────────────────────────────────────────────────────────────────────────────\n\n// The types path of each export, such as './dist/types/src/errors/index.d.ts', mirrors its source file\n// ('src/errors/index.ts'), so the source is found by stripping the output folder and swapping the extension.\nfunction resolveEntryPoints(packageJSON: PackageJson): { importPath: string; sourcePath: string }[] {\n const packageName = packageJSON.name ?? '';\n const exportsField = packageJSON.exports;\n const exportEntries = exportsField != null && typeof exportsField === 'object' && !Array.isArray(exportsField) ? Object.entries(exportsField) : [];\n\n const entryPoints: { importPath: string; sourcePath: string }[] = [];\n for (const [subpath, target] of exportEntries) {\n const typesPath = target != null && typeof target === 'object' && !Array.isArray(target) ? target['types'] : undefined;\n if (typeof typesPath !== 'string') continue;\n const importPath = subpath === '.' ? packageName : `${packageName}${subpath.slice(1)}`;\n const sourcePath = typesPath.replace(/^\\.\\/dist\\/types\\//, '').replace(/\\.d\\.ts$/, '.ts');\n entryPoints.push({ importPath, sourcePath });\n }\n return entryPoints;\n}\n\n// Uses the project's own tsconfig, so '@/' and other path aliases resolve as they do in the build.\nfunction readCompilerOptions(): ts.CompilerOptions {\n const configPath = ts.findConfigFile(process.cwd(), (fileName) => ts.sys.fileExists(fileName));\n if (configPath === undefined) return { module: ts.ModuleKind.ESNext, moduleResolution: ts.ModuleResolutionKind.Bundler, target: ts.ScriptTarget.ESNext };\n\n const { config } = ts.readConfigFile(configPath, (fileName) => ts.sys.readFile(fileName)) as { config: unknown };\n return ts.parseJsonConfigFileContent(config, ts.sys, process.cwd()).options;\n}\n\nfunction listExports(checker: ts.TypeChecker, sourceFile: ts.SourceFile, fieldGroupOwners: Map<ts.ObjectLiteralExpression, string>): ExportEntry[] {\n const moduleSymbol = checker.getSymbolAtLocation(sourceFile);\n const exportedSymbols = moduleSymbol === undefined ? [] : checker.getExportsOfModule(moduleSymbol);\n\n const entries = exportedSymbols.flatMap((exportedSymbol) => {\n const symbol = resolveAlias(checker, exportedSymbol);\n const entry = describeExport(checker, formatExportName(exportedSymbol, symbol), symbol, fieldGroupOwners);\n return entry === undefined ? [] : { ...entry, description: readDescription(checker, symbol), topic: readTopic(symbol) };\n });\n return entries.toSorted((a, b) => a.name.localeCompare(b.name));\n}\n\n// Named from the folders between 'src' and the file declaring the export: 'component/module/connector' reads as\n// 'Component › Module › Connector', with camel-case names split into words.\nfunction readTopic(symbol: ts.Symbol): string {\n const fileName = symbol.declarations?.[0]?.getSourceFile().fileName;\n if (fileName === undefined) return GENERAL_TOPIC;\n\n // TypeScript reports files with symbolic links resolved (on macOS, '/var' is really '/private/var'), so the source\n // folder is resolved the same way before the two are compared.\n const resolvePath = (unresolvedPath: string): string => ts.sys.realpath?.(unresolvedPath) ?? unresolvedPath;\n const folder = path.relative(resolvePath(path.join(process.cwd(), 'src')), resolvePath(path.dirname(fileName)));\n return folder === '' || folder.startsWith('..')\n ? GENERAL_TOPIC\n : folder\n .split(path.sep)\n .map((segment) => segment.replaceAll(/([a-z])([A-Z])/g, '$1 $2').replace(/^./, (letter) => letter.toUpperCase()))\n .join(' › ');\n}\n\n// Functions include constants holding a function, as with arrow functions. Schemas are the constants named '…Schema'.\nfunction describeExport(\n checker: ts.TypeChecker,\n name: string,\n symbol: ts.Symbol,\n fieldGroupOwners: Map<ts.ObjectLiteralExpression, string>\n): Omit<ExportEntry, 'description' | 'topic'> | undefined {\n const isValue = (symbol.flags & (ts.SymbolFlags.Function | ts.SymbolFlags.Variable)) !== 0;\n const [signature] = isValue ? checker.getSignaturesOfType(checker.getTypeOfSymbol(symbol), ts.SignatureKind.Call) : [];\n const isSchema = name.endsWith('Schema');\n\n if (signature !== undefined && !isSchema) {\n const parameters = signature.parameters.map((parameter) => formatParameter(checker, parameter));\n return { detail: `(${parameters.join(', ')})`, kind: 'Functions', name, origin: '' };\n }\n if ((symbol.flags & ts.SymbolFlags.Class) !== 0) return { detail: '', kind: 'Classes', name, origin: formatOrigin(checker, symbol, fieldGroupOwners) };\n if (isSchema && (symbol.flags & ts.SymbolFlags.Variable) !== 0) return { detail: '', kind: 'Schemas', name, origin: '' };\n if ((symbol.flags & ts.SymbolFlags.Variable) !== 0) return { detail: `: ${formatConstantType(checker, symbol)}`, kind: 'Constants', name, origin: '' };\n const isType = (symbol.flags & (ts.SymbolFlags.Enum | ts.SymbolFlags.Interface | ts.SymbolFlags.TypeAlias)) !== 0;\n return isType ? { detail: '', kind: 'Types', name, origin: formatOrigin(checker, symbol, fieldGroupOwners) } : undefined;\n}\n\n// The summary of the '/** … */' comment above the item, on one line. Tags such as '@param' are left out, and '//'\n// comments, which are notes for maintainers, are never read.\nfunction readDescription(checker: ts.TypeChecker, symbol: ts.Symbol): string | undefined {\n const description = ts.displayPartsToString(symbol.getDocumentationComment(checker)).replaceAll(/\\s+/g, ' ').trim();\n return description === '' ? undefined : description;\n}\n\n// The type as written, on the declaration or in an 'as' on its value, which keeps the names it was written with. Where\n// none is written, the inferred type is widened, so 'MAX_COUNT = 3' reads as 'number' rather than '3'.\nfunction formatConstantType(checker: ts.TypeChecker, symbol: ts.Symbol): string {\n const declaration = symbol.valueDeclaration;\n const variableDeclaration = declaration !== undefined && ts.isVariableDeclaration(declaration) ? declaration : undefined;\n const initializer = variableDeclaration?.initializer;\n const isWrittenAs = initializer !== undefined && ts.isAsExpression(initializer) && !ts.isConstTypeReference(initializer.type); // 'as const' names no type.\n const typeNode = variableDeclaration?.type ?? (isWrittenAs ? initializer.type : undefined);\n return typeNode === undefined ? checker.typeToString(checker.getBaseTypeOfLiteralType(checker.getTypeOfSymbol(symbol)), declaration) : formatTypeNode(typeNode);\n}\n\n// What a type or class comes from: the schema it is inferred from, and what it extends or implements, such as\n// ' (extends DPUseError)'. A type inferred from a schema has no 'extends' clause, so its parent is found from the schema\n// instead. The parent is named even when it is not exported, as it is still what the type inherits from.\nfunction formatOrigin(checker: ts.TypeChecker, symbol: ts.Symbol, fieldGroupOwners: Map<ts.ObjectLiteralExpression, string>): string {\n const heritageClauses = (symbol.declarations ?? []).flatMap((declaration) =>\n ts.isClassDeclaration(declaration) || ts.isInterfaceDeclaration(declaration) ? [...(declaration.heritageClauses ?? [])] : []\n );\n const clauses = heritageClauses.map((clause) => {\n const keyword = clause.token === ts.SyntaxKind.ExtendsKeyword ? 'extends' : 'implements';\n return `${keyword} ${clause.types.map((type) => formatCode(formatTypeNode(type))).join(', ')}`;\n });\n\n const typeAlias = symbol.declarations?.find((declaration) => ts.isTypeAliasDeclaration(declaration));\n const schemaName = typeAlias === undefined ? undefined : findSchemaName(typeAlias);\n if (typeAlias !== undefined && schemaName !== undefined) {\n clauses.push(`inferred from ${formatCode(schemaName.getText())}`);\n const fields = findSchemaFields(checker, typeAlias);\n const parents = fields === undefined ? [] : findSchemaParents(checker, fields, typeAlias.name.text, fieldGroupOwners);\n if (parents.length > 0) clauses.push(`extends ${parents.map((parent) => formatCode(parent)).join(', ')}`);\n }\n return clauses.length === 0 ? '' : ` (${clauses.join(', ')})`;\n}\n\n// A schema inherits by spreading in a group of fields, as in 'strictObject({ ...moduleConfigCoreFields, … })'. Where\n// the type owns the group it spreads, as 'ModuleConfig' owns 'moduleConfigCoreFields', its parent is found in that\n// group's own spreads.\nfunction findSchemaParents(checker: ts.TypeChecker, fields: ts.ObjectLiteralExpression, typeName: string, fieldGroupOwners: Map<ts.ObjectLiteralExpression, string>): string[] {\n return fields.properties.flatMap((property) => {\n const group = ts.isSpreadAssignment(property) ? resolveObjectLiteral(checker, property.expression) : undefined;\n if (group === undefined) return [];\n const owner = fieldGroupOwners.get(group);\n if (owner === typeName) return findSchemaParents(checker, group, typeName, fieldGroupOwners);\n return owner === undefined ? [] : [owner];\n });\n}\n\n// A field group is not a type, so it is named by the type whose schema adds the fewest fields to it. Where two types\n// tie, the group is left unnamed rather than guessed at.\nfunction mapFieldGroupOwners(program: ts.Program, checker: ts.TypeChecker): Map<ts.ObjectLiteralExpression, string> {\n const candidates = new Map<ts.ObjectLiteralExpression, { addedFieldCount: number; typeName: string }[]>();\n const typeAliases = program\n .getSourceFiles()\n .filter((sourceFile) => !sourceFile.isDeclarationFile && !program.isSourceFileFromExternalLibrary(sourceFile))\n .flatMap((sourceFile) => sourceFile.statements.filter((statement) => ts.isTypeAliasDeclaration(statement)));\n\n for (const typeAlias of typeAliases) {\n for (const { addedFieldCount, group } of listFieldGroups(checker, typeAlias)) {\n candidates.set(group, [...(candidates.get(group) ?? []), { addedFieldCount, typeName: typeAlias.name.text }]);\n }\n }\n\n const owners = new Map<ts.ObjectLiteralExpression, string>();\n for (const [group, groupCandidates] of candidates) {\n const fewestAdded = Math.min(...groupCandidates.map(({ addedFieldCount }) => addedFieldCount));\n const [owner, ...tied] = groupCandidates.filter(({ addedFieldCount }) => addedFieldCount === fewestAdded);\n if (owner !== undefined && tied.length === 0) owners.set(group, owner.typeName);\n }\n return owners;\n}\n\n// Each field group a type's schema is built from, with the number of fields the schema adds to it.\nfunction listFieldGroups(checker: ts.TypeChecker, typeAlias: ts.TypeAliasDeclaration): { addedFieldCount: number; group: ts.ObjectLiteralExpression }[] {\n const fields = findSchemaFields(checker, typeAlias);\n if (fields === undefined) return [];\n\n // Fields declared under a name of their own, rather than written inside the schema, are a group themselves.\n const ownGroup = ts.isVariableDeclaration(fields.parent) ? [{ addedFieldCount: 0, group: fields }] : [];\n const spreadGroups = fields.properties.flatMap((property) => {\n const group = ts.isSpreadAssignment(property) ? resolveObjectLiteral(checker, property.expression) : undefined;\n return group === undefined ? [] : [{ addedFieldCount: fields.properties.length - 1, group }];\n });\n return [...ownGroup, ...spreadGroups];\n}\n\n// The schema a type is inferred from, written either as 'InferOutput<typeof schema>' or, where the schema is built in\n// place from a group of fields, as 'InferOutput<ReturnType<typeof strictObject<typeof fields>>>'.\nfunction findSchemaName(typeAlias: ts.TypeAliasDeclaration): ts.EntityName | undefined {\n const [argument] = isTypeReferenceNamed(typeAlias.type, 'InferOutput') ? (typeAlias.type.typeArguments ?? []) : [];\n if (argument === undefined) return undefined;\n if (ts.isTypeQueryNode(argument)) return argument.exprName;\n\n const [returnTypeArgument] = isTypeReferenceNamed(argument, 'ReturnType') ? (argument.typeArguments ?? []) : [];\n const [fieldsQuery] = returnTypeArgument !== undefined && ts.isTypeQueryNode(returnTypeArgument) ? (returnTypeArgument.typeArguments ?? []) : [];\n return fieldsQuery !== undefined && ts.isTypeQueryNode(fieldsQuery) ? fieldsQuery.exprName : undefined;\n}\n\n// The fields of the schema a type is inferred from: those passed to 'strictObject({ … })', or the group of fields itself.\nfunction findSchemaFields(checker: ts.TypeChecker, typeAlias: ts.TypeAliasDeclaration): ts.ObjectLiteralExpression | undefined {\n const schemaName = findSchemaName(typeAlias);\n const schema = schemaName === undefined ? undefined : resolveInitializer(checker, schemaName);\n if (schema === undefined) return undefined;\n if (ts.isObjectLiteralExpression(schema)) return schema;\n\n const [fields] = ts.isCallExpression(schema) ? schema.arguments : [];\n return fields === undefined ? undefined : resolveObjectLiteral(checker, fields);\n}\n\nfunction isTypeReferenceNamed(node: ts.TypeNode, name: string): node is ts.TypeReferenceNode {\n if (!ts.isTypeReferenceNode(node)) return false;\n const typeName = ts.isQualifiedName(node.typeName) ? node.typeName.right : node.typeName;\n return typeName.text === name;\n}\n\nfunction resolveObjectLiteral(checker: ts.TypeChecker, node: ts.Node): ts.ObjectLiteralExpression | undefined {\n if (ts.isObjectLiteralExpression(node)) return node;\n const initializer = resolveInitializer(checker, node);\n return initializer !== undefined && ts.isObjectLiteralExpression(initializer) ? initializer : undefined;\n}\n\n// The value a name was declared with, following imports back to the declaration.\nfunction resolveInitializer(checker: ts.TypeChecker, name: ts.Node): ts.Expression | undefined {\n const symbol = checker.getSymbolAtLocation(name);\n const declaration = symbol === undefined ? undefined : resolveAlias(checker, symbol).valueDeclaration;\n return declaration !== undefined && ts.isVariableDeclaration(declaration) ? declaration.initializer : undefined;\n}\n\nfunction resolveAlias(checker: ts.TypeChecker, symbol: ts.Symbol): ts.Symbol {\n return (symbol.flags & ts.SymbolFlags.Alias) === 0 ? symbol : checker.getAliasedSymbol(symbol);\n}\n\n// A default export is imported under any name, so the name it has where it is declared is shown alongside.\nfunction formatExportName(exportedSymbol: ts.Symbol, symbol: ts.Symbol): string {\n if (exportedSymbol.name !== 'default') return exportedSymbol.name;\n const declarationName = symbol.declarations?.map((declaration) => ts.getNameOfDeclaration(declaration)?.getText()).find((name) => name !== undefined);\n return declarationName === undefined || declarationName === 'default' ? 'default' : `default (${declarationName})`;\n}\n\n// A parameter that can be left out, being optional or having a default, is marked with '?'. Its type is as written, or\n// inferred where none is, as with a default value.\nfunction formatParameter(checker: ts.TypeChecker, parameter: ts.Symbol): string {\n const declaration = parameter.valueDeclaration;\n const parameterDeclaration = declaration !== undefined && ts.isParameter(declaration) ? declaration : undefined;\n const isOptional = parameterDeclaration?.questionToken !== undefined || parameterDeclaration?.initializer !== undefined;\n const typeText = parameterDeclaration?.type === undefined ? checker.typeToString(checker.getTypeOfSymbol(parameter), declaration) : formatTypeNode(parameterDeclaration.type);\n const name = parameterDeclaration === undefined ? parameter.name : formatParameterName(parameterDeclaration.name);\n return `${name}${isOptional ? '?' : ''}: ${typeText}`;\n}\n\n// A destructured parameter has no name of its own, so TypeScript calls it '__0'. It is shown by the names it unpacks\n// instead, as '{ allowedLicenses, moduleLevel }', leaving out their defaults.\nfunction formatParameterName(name: ts.BindingName): string {\n if (ts.isIdentifier(name)) return name.text;\n const names = name.elements.flatMap((element) =>\n ts.isBindingElement(element) ? [(element.dotDotDotToken === undefined ? '' : '...') + formatParameterName(element.name)] : []\n );\n return ts.isObjectBindingPattern(name) ? `{ ${names.join(', ')} }` : `[${names.join(', ')}]`;\n}\n\n// A type written across several lines is shown on one.\nfunction formatTypeNode(typeNode: ts.TypeNode): string {\n return typeNode.getText().replaceAll(/\\s+/g, ' ');\n}\n\nfunction buildSection(importPath: string, entries: ExportEntry[]): string {\n const topics = [...new Set(entries.map((entry) => entry.topic))].toSorted(compareTopics);\n if (topics.length < TOPIC_GROUPING_MINIMUM) return [`## ${importPath}`, ...buildKindLists(entries, '###')].join('\\n\\n');\n\n const topicSections = topics.map((topic) =>\n [\n `### ${topic}`,\n ...buildKindLists(\n entries.filter((entry) => entry.topic === topic),\n '####'\n )\n ].join('\\n\\n')\n );\n return [`## ${importPath}`, ...topicSections].join('\\n\\n');\n}\n\n// General comes first, as it holds what the whole package shares; the rest are alphabetical.\nfunction compareTopics(a: string, b: string): number {\n const isEitherGeneral = a === GENERAL_TOPIC || b === GENERAL_TOPIC;\n return isEitherGeneral ? Number(b === GENERAL_TOPIC) - Number(a === GENERAL_TOPIC) : a.localeCompare(b);\n}\n\nfunction buildKindLists(entries: ExportEntry[], headingLevel: string): string[] {\n return EXPORT_KINDS.flatMap((kind) => {\n const items = entries.filter((entry) => entry.kind === kind).map((entry) => formatEntry(entry));\n return items.length === 0 ? [] : `${headingLevel} ${kind}\\n\\n${items.join('\\n')}`;\n });\n}\n\n// The name and what follows it are code, shown on a shaded background, with only the name bold so it stands out from\n// its parameters or type. The description is a quote nested in the item, which indents every line of it and shows it\n// in lighter text, so the names can be read straight down the left.\nfunction formatEntry({ description, detail, name, origin }: ExportEntry): string {\n const detailCode = detail === '' ? '' : formatCode(detail);\n const firstLine = `- **${formatCode(name)}**${detailCode}${origin}`;\n return description === undefined ? firstLine : `${firstLine}\\n > ${description}`;\n}\n\nfunction formatCode(text: string): string {\n return `\\`${text}\\``;\n}\n"],"mappings":";;;;AAyBA,IAAMK,IAAyB,GAGzBC,IAAgB,WAGhBC,IAA6B;CAAC;CAAa;CAAW;CAAa;CAAW;AAAO,GAErFC,IAAsB;AAO5B,eAAsBC,EAAkB,GAAkB,GAAyC;CAC/F,EAAc,GAAGC,EAAS,UAAUC,EAAiB,EAAE;CAGvD,IAAMC,IAAcC,EAAmB,MADbZ,EAA0B,cAAc,CAChB;CAClD,IAAIW,EAAY,WAAW,GAAG,MAAU,MAAM,qGAAqG;CAInJ,IAAME,IAAUV,EAAG,cACfQ,EAAY,KAAK,EAAE,oBAAiBT,EAAK,QAAQY,CAAU,CAAC,GAC5DC,EAAoB,CACxB,GACMC,IAAUH,EAAQ,eAAe,GACjCI,IAAmBC,EAAoBL,GAASG,CAAO,GAEvDG,IAAWR,E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, g as h, h as g, i as _, k as v, l as y, m as ee, n as te, o as ne, p as b, r as re, s as ie, t as ae, u as oe, v as x, w as S, x as C, y as w } from "./utilities-
|
|
1
|
+
import { A as e, C as t, D as n, E as r, M as i, N as a, O as o, S as s, T as c, _ as l, a as u, b as d, c as f, d as p, f as m, g as h, h as g, i as _, k as v, l as y, m as ee, n as te, o as ne, p as b, r as re, s as ie, t as ae, u as oe, v as x, w as S, x as C, y as w } from "./utilities-D98znirs.js";
|
|
2
2
|
import { SHIPPED_PACKAGES_FILE_NAME as se } from "./vite.es.js";
|
|
3
3
|
import { existsSync as ce, promises as T } from "node:fs";
|
|
4
4
|
import E from "node:path";
|
|
@@ -1080,7 +1080,7 @@ var H = "API_REFERENCE.md";
|
|
|
1080
1080
|
async function An() {
|
|
1081
1081
|
try {
|
|
1082
1082
|
l("Document API Reference");
|
|
1083
|
-
let { writeAPIReference: e } = await import("./apiReference-
|
|
1083
|
+
let { writeAPIReference: e } = await import("./apiReference-CdMhhAl1.js");
|
|
1084
1084
|
await e("1️⃣ ", H), x("API reference documented");
|
|
1085
1085
|
} catch (e) {
|
|
1086
1086
|
console.error("❌ Error documenting API reference", e), process.exit(1);
|
|
@@ -1383,8 +1383,12 @@ async function xr() {
|
|
|
1383
1383
|
}
|
|
1384
1384
|
//#endregion
|
|
1385
1385
|
//#region src/utilities/cloudflare.ts
|
|
1386
|
-
var Sr =
|
|
1387
|
-
|
|
1386
|
+
var Sr = {
|
|
1387
|
+
".css": "text/css",
|
|
1388
|
+
".js": "application/javascript",
|
|
1389
|
+
".wasm": "application/wasm"
|
|
1390
|
+
}, Cr = "dpuse-sample-data-eu";
|
|
1391
|
+
async function wr() {
|
|
1388
1392
|
let e = await C("config.json"), t = {
|
|
1389
1393
|
body: JSON.stringify(e),
|
|
1390
1394
|
headers: { "Content-Type": "application/json" },
|
|
@@ -1392,12 +1396,12 @@ async function Cr() {
|
|
|
1392
1396
|
}, n = await fetch(`https://api.dpuse.app/configs/${e.id}`, t);
|
|
1393
1397
|
if (!n.ok) throw Error(await n.text());
|
|
1394
1398
|
}
|
|
1395
|
-
async function
|
|
1396
|
-
let n = await
|
|
1397
|
-
for (let [e, t] of r) await
|
|
1399
|
+
async function Tr(e, t) {
|
|
1400
|
+
let n = await Ar(`${e}/${t}`, t), r = Map.groupBy(n, ({ key: e }) => c(e));
|
|
1401
|
+
for (let [e, t] of r) await kr(t, ["--content-type", e]);
|
|
1398
1402
|
}
|
|
1399
|
-
async function
|
|
1400
|
-
await
|
|
1403
|
+
async function Er(e) {
|
|
1404
|
+
await Tr(e, "application"), await Tr(e, "fileStore"), await kr(["applicationIndex.json", "fileStoreIndex.json"].map((t) => ({
|
|
1401
1405
|
file: `${e}/${t}`,
|
|
1402
1406
|
key: t
|
|
1403
1407
|
})), [
|
|
@@ -1407,7 +1411,7 @@ async function Tr(e) {
|
|
|
1407
1411
|
"no-cache"
|
|
1408
1412
|
]);
|
|
1409
1413
|
}
|
|
1410
|
-
async function
|
|
1414
|
+
async function Dr(e) {
|
|
1411
1415
|
let t = e.id, n = {
|
|
1412
1416
|
body: JSON.stringify(e),
|
|
1413
1417
|
headers: { "Content-Type": "application/json" },
|
|
@@ -1415,13 +1419,13 @@ async function Er(e) {
|
|
|
1415
1419
|
}, r = await fetch(`https://api.dpuse.app/configs/${t}`, n);
|
|
1416
1420
|
if (!r.ok) throw Error(await r.text());
|
|
1417
1421
|
}
|
|
1418
|
-
async function
|
|
1422
|
+
async function Or(e, t) {
|
|
1419
1423
|
let n = `v${e.version ?? "unknown"}`;
|
|
1420
1424
|
async function r(e, r = "") {
|
|
1421
1425
|
let i = await ee(e, { withFileTypes: !0 });
|
|
1422
1426
|
for (let a of i) {
|
|
1423
1427
|
if (a.isDirectory() || a.name.endsWith(".map")) continue;
|
|
1424
|
-
let i = `${e}/${a.name}`, o = r ? `${r}/${a.name}` : a.name, s = `${t}_${n}/${o}`.replaceAll("\\", "/"), c = a.name
|
|
1428
|
+
let i = `${e}/${a.name}`, o = r ? `${r}/${a.name}` : a.name, s = `${t}_${n}/${o}`.replaceAll("\\", "/"), c = Sr[E.extname(a.name)] ?? "application/octet-stream";
|
|
1425
1429
|
console.info(`⚙️ Uploading '${o}' → '${s}'...`), await b(void 0, "wrangler", [
|
|
1426
1430
|
"r2",
|
|
1427
1431
|
"object",
|
|
@@ -1429,7 +1433,7 @@ async function Dr(e, t) {
|
|
|
1429
1433
|
s,
|
|
1430
1434
|
`--file=${i}`,
|
|
1431
1435
|
"--content-type",
|
|
1432
|
-
|
|
1436
|
+
c,
|
|
1433
1437
|
"--jurisdiction=eu",
|
|
1434
1438
|
"--remote"
|
|
1435
1439
|
]);
|
|
@@ -1437,7 +1441,7 @@ async function Dr(e, t) {
|
|
|
1437
1441
|
}
|
|
1438
1442
|
await r("dist");
|
|
1439
1443
|
}
|
|
1440
|
-
async function
|
|
1444
|
+
async function kr(e, t) {
|
|
1441
1445
|
if (e.length === 0) return;
|
|
1442
1446
|
let n = await T.mkdtemp(E.join(ge.tmpdir(), "dpuse-r2-bulk-")), r = E.join(n, "files.json");
|
|
1443
1447
|
try {
|
|
@@ -1445,7 +1449,7 @@ async function Or(e, t) {
|
|
|
1445
1449
|
"r2",
|
|
1446
1450
|
"bulk",
|
|
1447
1451
|
"put",
|
|
1448
|
-
|
|
1452
|
+
Cr,
|
|
1449
1453
|
"--filename",
|
|
1450
1454
|
r,
|
|
1451
1455
|
...t,
|
|
@@ -1459,12 +1463,12 @@ async function Or(e, t) {
|
|
|
1459
1463
|
});
|
|
1460
1464
|
}
|
|
1461
1465
|
}
|
|
1462
|
-
async function
|
|
1466
|
+
async function Ar(e, t) {
|
|
1463
1467
|
let n = await ee(e), r = [];
|
|
1464
1468
|
for (let i of n) {
|
|
1465
1469
|
if (i.startsWith(".")) continue;
|
|
1466
1470
|
let n = `${e}/${i}`, a = `${t}/${i}`;
|
|
1467
|
-
(await h(n)).isDirectory() ? r.push(...await
|
|
1471
|
+
(await h(n)).isDirectory() ? r.push(...await Ar(n, a)) : r.push({
|
|
1468
1472
|
file: n,
|
|
1469
1473
|
key: a
|
|
1470
1474
|
});
|
|
@@ -1473,7 +1477,7 @@ async function kr(e, t) {
|
|
|
1473
1477
|
}
|
|
1474
1478
|
//#endregion
|
|
1475
1479
|
//#region src/actions/publishProject.ts
|
|
1476
|
-
async function
|
|
1480
|
+
async function jr() {
|
|
1477
1481
|
try {
|
|
1478
1482
|
l("Publish Project");
|
|
1479
1483
|
let e = await C("package.json"), t = await C("config.json"), n = g(t.id);
|
|
@@ -1483,24 +1487,24 @@ async function Ar() {
|
|
|
1483
1487
|
"app",
|
|
1484
1488
|
"kb"
|
|
1485
1489
|
].includes(n.publishedTo);
|
|
1486
|
-
i && await r("2️⃣ Deploy", "npm", ["run", "deploy"]), await
|
|
1490
|
+
i && await r("2️⃣ Deploy", "npm", ["run", "deploy"]), await Mr(i ? "3️⃣ " : "2️⃣ ", e, t, n), n.publishedTo === "sampleData" && (w("3️⃣ Upload sample data"), await Er("public")), x(`Project version '${e.version ?? "unknown"}' published.`);
|
|
1487
1491
|
} catch (e) {
|
|
1488
1492
|
console.error("❌ Error publishing project", e), process.exit(1);
|
|
1489
1493
|
}
|
|
1490
1494
|
}
|
|
1491
|
-
async function
|
|
1492
|
-
if (r.typeId === "app") w(`${e} Register module`), await
|
|
1493
|
-
else if (r.typeId === "engine") w(`${e} Register module`), await
|
|
1495
|
+
async function Mr(e, t, n, r) {
|
|
1496
|
+
if (r.typeId === "app") w(`${e} Register module`), await wr();
|
|
1497
|
+
else if (r.typeId === "engine") w(`${e} Register module`), await Or(t, `dpuse-engine-eu/${r.uploadGroupName ?? "unknown"}`), await Dr(n);
|
|
1494
1498
|
else if (r.uploadGroupName === void 0) w(`${e} Registration NOT required`);
|
|
1495
1499
|
else {
|
|
1496
1500
|
w(`${e} Register module`);
|
|
1497
1501
|
let i = n.id.split("-").slice(2).join("-");
|
|
1498
|
-
await
|
|
1502
|
+
await Or(t, `dpuse-engine-eu/${r.uploadGroupName}/${i}`), await Dr(n);
|
|
1499
1503
|
}
|
|
1500
1504
|
}
|
|
1501
1505
|
//#endregion
|
|
1502
1506
|
//#region src/actions/releaseProject.ts
|
|
1503
|
-
async function
|
|
1507
|
+
async function Nr(e = "MIT", t = !1) {
|
|
1504
1508
|
try {
|
|
1505
1509
|
l("Release Project");
|
|
1506
1510
|
let n = await C("package.json"), i = await C("config.json"), a = g(i.id);
|
|
@@ -1514,7 +1518,7 @@ async function Mr(e = "MIT", t = !1) {
|
|
|
1514
1518
|
"push",
|
|
1515
1519
|
"origin",
|
|
1516
1520
|
"main:main"
|
|
1517
|
-
]), await
|
|
1521
|
+
]), await Mr("8️⃣ ", n, o, a), a.publishedTo === "npm") {
|
|
1518
1522
|
let e = `v${n.version ?? "unknown"}`;
|
|
1519
1523
|
await r("9️⃣ Trigger GitHub release", "gh", [
|
|
1520
1524
|
"release",
|
|
@@ -1533,7 +1537,7 @@ async function Mr(e = "MIT", t = !1) {
|
|
|
1533
1537
|
}
|
|
1534
1538
|
//#endregion
|
|
1535
1539
|
//#region src/actions/syncProjectWithGitHub.ts
|
|
1536
|
-
async function
|
|
1540
|
+
async function Pr() {
|
|
1537
1541
|
try {
|
|
1538
1542
|
l("Synchronise Project with GitHub");
|
|
1539
1543
|
let e = await C("package.json"), t = await C("config.json"), n = g(t.id);
|
|
@@ -1552,12 +1556,12 @@ async function Nr() {
|
|
|
1552
1556
|
}
|
|
1553
1557
|
//#endregion
|
|
1554
1558
|
//#region src/actions/testProject.ts
|
|
1555
|
-
var
|
|
1559
|
+
var Fr = [
|
|
1556
1560
|
"1️⃣ ",
|
|
1557
1561
|
"2️⃣ ",
|
|
1558
1562
|
"3️⃣ ",
|
|
1559
1563
|
"4️⃣ "
|
|
1560
|
-
],
|
|
1564
|
+
], Ir = [{
|
|
1561
1565
|
id: "unit",
|
|
1562
1566
|
label: "Run unit tests",
|
|
1563
1567
|
command: "vitest",
|
|
@@ -1570,13 +1574,13 @@ var Pr = [
|
|
|
1570
1574
|
arguments: ["test", "--pass-with-no-tests"],
|
|
1571
1575
|
configFileName: "playwright.config.ts"
|
|
1572
1576
|
}];
|
|
1573
|
-
async function
|
|
1577
|
+
async function Lr(e = ["unit"]) {
|
|
1574
1578
|
try {
|
|
1575
1579
|
l("Test Project");
|
|
1576
1580
|
let n = 0;
|
|
1577
|
-
for (let i of
|
|
1581
|
+
for (let i of Ir) {
|
|
1578
1582
|
if (!e.includes(i.id) || await t(i.configFileName) === null) continue;
|
|
1579
|
-
let a = `${
|
|
1583
|
+
let a = `${Fr[n] ?? ""} ${i.label}`;
|
|
1580
1584
|
await r(a, i.command, i.arguments), n += 1;
|
|
1581
1585
|
}
|
|
1582
1586
|
if (n === 0) {
|
|
@@ -1590,7 +1594,7 @@ async function Ir(e = ["unit"]) {
|
|
|
1590
1594
|
}
|
|
1591
1595
|
//#endregion
|
|
1592
1596
|
//#region src/actions/triggerGitHubRelease.ts
|
|
1593
|
-
async function
|
|
1597
|
+
async function Rr() {
|
|
1594
1598
|
try {
|
|
1595
1599
|
l("Trigger GitHub Release");
|
|
1596
1600
|
let e = `v${(await C("package.json")).version ?? "unknown"}`;
|
|
@@ -1608,4 +1612,4 @@ async function Lr() {
|
|
|
1608
1612
|
}
|
|
1609
1613
|
}
|
|
1610
1614
|
//#endregion
|
|
1611
|
-
export { ye as auditDependencies, Te as buildProject, ze as checkProject, yr as documentProject, br as formatCode, xr as lintCode,
|
|
1615
|
+
export { ye as auditDependencies, Te as buildProject, ze as checkProject, yr as documentProject, br as formatCode, xr as lintCode, jr as publishProject, Nr as releaseProject, c as resolveSampleDataContentType, Pr as syncProjectWithGitHub, Lr as testProject, Rr as triggerGitHubRelease, Tr as uploadDirectoryToR2 };
|