mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
ci: fix typechecking in ci
This commit is contained in:
6
.github/workflows/tests.yml
vendored
6
.github/workflows/tests.yml
vendored
@@ -72,10 +72,12 @@ jobs:
|
|||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: yarn workspaces focus ${{ matrix.package }}
|
run: yarn install --immutable
|
||||||
|
|
||||||
- name: Build dependencies
|
- name: Build dependencies
|
||||||
run: yarn workspace ${{ matrix.package }} build
|
run: |
|
||||||
|
yarn workspace @discordjs/docgen build
|
||||||
|
yarn workspaces foreach --parallel --topological --recursive --from ${{ matrix.package }} build
|
||||||
|
|
||||||
- name: ESLint
|
- name: ESLint
|
||||||
run: yarn workspace ${{ matrix.package }} lint
|
run: yarn workspace ${{ matrix.package }} lint
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"*": "prettier --ignore-unknown --write",
|
"*": "prettier --ignore-unknown --write",
|
||||||
"{src/**,__tests__/**}.{mjs,js,ts}": "eslint --ext mjs,js,ts --fix",
|
"{src/**,__tests__/**}.{mjs,js,ts}": "eslint --ext mjs,js,ts --fix",
|
||||||
"src/**.ts": "vitest related"
|
"src/**.ts": "vitest related --run"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { relative, resolve } from 'node:path';
|
import { relative, resolve } from 'node:path';
|
||||||
import glob from 'fast-glob';
|
import glob from 'fast-glob';
|
||||||
|
import isCi from 'is-ci';
|
||||||
import typescript from 'rollup-plugin-typescript2';
|
import typescript from 'rollup-plugin-typescript2';
|
||||||
import { defineBuildConfig, BuildEntry } from 'unbuild';
|
import { defineBuildConfig, BuildEntry } from 'unbuild';
|
||||||
|
|
||||||
@@ -26,7 +27,7 @@ export function createUnbuildConfig({
|
|||||||
preserveModules = true,
|
preserveModules = true,
|
||||||
preserveModulesRoot = 'src',
|
preserveModulesRoot = 'src',
|
||||||
declaration = true,
|
declaration = true,
|
||||||
typeCheck = false,
|
typeCheck = isCi,
|
||||||
}: Partial<ConfigOptions> = {}) {
|
}: Partial<ConfigOptions> = {}) {
|
||||||
const files = glob
|
const files = glob
|
||||||
.sync('**', { cwd: 'src' })
|
.sync('**', { cwd: 'src' })
|
||||||
@@ -45,6 +46,7 @@ export function createUnbuildConfig({
|
|||||||
cjsBridge,
|
cjsBridge,
|
||||||
json: {
|
json: {
|
||||||
namedExports: false,
|
namedExports: false,
|
||||||
|
preferConst: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
"@commitlint/config-angular": "^17.0.3",
|
"@commitlint/config-angular": "^17.0.3",
|
||||||
"@favware/cliff-jumper": "^1.8.6",
|
"@favware/cliff-jumper": "^1.8.6",
|
||||||
"@favware/npm-deprecate": "^1.0.5",
|
"@favware/npm-deprecate": "^1.0.5",
|
||||||
|
"@types/is-ci": "^3.0.0",
|
||||||
"conventional-changelog-cli": "^2.2.2",
|
"conventional-changelog-cli": "^2.2.2",
|
||||||
"fast-glob": "^3.2.11",
|
"fast-glob": "^3.2.11",
|
||||||
"husky": "^8.0.1",
|
"husky": "^8.0.1",
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
"tslib": "^2.4.0"
|
"tslib": "^2.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^16.11.47",
|
"@types/node": "^16.11.48",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
||||||
"@typescript-eslint/parser": "^5.33.0",
|
"@typescript-eslint/parser": "^5.33.0",
|
||||||
"c8": "^7.12.0",
|
"c8": "^7.12.0",
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
"prettier": "^2.7.1",
|
"prettier": "^2.7.1",
|
||||||
"rollup-plugin-typescript2": "0.32.1",
|
"rollup-plugin-typescript2": "0.32.1",
|
||||||
"typescript": "^4.7.4",
|
"typescript": "^4.7.4",
|
||||||
"unbuild": "^0.8.4",
|
"unbuild": "^0.8.8",
|
||||||
"vitest": "^0.21.1"
|
"vitest": "^0.21.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
@@ -64,7 +64,7 @@
|
|||||||
"@discordjs/docgen": "workspace:^",
|
"@discordjs/docgen": "workspace:^",
|
||||||
"@favware/cliff-jumper": "^1.8.6",
|
"@favware/cliff-jumper": "^1.8.6",
|
||||||
"@microsoft/api-extractor": "^7.29.2",
|
"@microsoft/api-extractor": "^7.29.2",
|
||||||
"@types/node": "^16.11.47",
|
"@types/node": "^16.11.48",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
||||||
"@typescript-eslint/parser": "^5.33.0",
|
"@typescript-eslint/parser": "^5.33.0",
|
||||||
"c8": "^7.12.0",
|
"c8": "^7.12.0",
|
||||||
@@ -77,7 +77,7 @@
|
|||||||
"prettier": "^2.7.1",
|
"prettier": "^2.7.1",
|
||||||
"rollup-plugin-typescript2": "0.32.1",
|
"rollup-plugin-typescript2": "0.32.1",
|
||||||
"typescript": "^4.7.4",
|
"typescript": "^4.7.4",
|
||||||
"unbuild": "^0.8.4",
|
"unbuild": "^0.8.8",
|
||||||
"vitest": "^0.21.1"
|
"vitest": "^0.21.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
"@discordjs/docgen": "workspace:^",
|
"@discordjs/docgen": "workspace:^",
|
||||||
"@favware/cliff-jumper": "^1.8.6",
|
"@favware/cliff-jumper": "^1.8.6",
|
||||||
"@microsoft/api-extractor": "^7.29.2",
|
"@microsoft/api-extractor": "^7.29.2",
|
||||||
"@types/node": "^16.11.47",
|
"@types/node": "^16.11.48",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
||||||
"@typescript-eslint/parser": "^5.33.0",
|
"@typescript-eslint/parser": "^5.33.0",
|
||||||
"c8": "^7.12.0",
|
"c8": "^7.12.0",
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
"prettier": "^2.7.1",
|
"prettier": "^2.7.1",
|
||||||
"rollup-plugin-typescript2": "0.32.1",
|
"rollup-plugin-typescript2": "0.32.1",
|
||||||
"typescript": "^4.7.4",
|
"typescript": "^4.7.4",
|
||||||
"unbuild": "^0.8.4",
|
"unbuild": "^0.8.8",
|
||||||
"vitest": "^0.21.1"
|
"vitest": "^0.21.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
@@ -64,7 +64,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@discordjs/docgen": "workspace:^",
|
"@discordjs/docgen": "workspace:^",
|
||||||
"@favware/cliff-jumper": "^1.8.6",
|
"@favware/cliff-jumper": "^1.8.6",
|
||||||
"@types/node": "^16.11.47",
|
"@types/node": "^16.11.48",
|
||||||
"dtslint": "^4.2.1",
|
"dtslint": "^4.2.1",
|
||||||
"eslint": "^8.22.0",
|
"eslint": "^8.22.0",
|
||||||
"jest": "^28.1.3",
|
"jest": "^28.1.3",
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
import { createUnbuildConfig } from '../../build.config';
|
import { createUnbuildConfig } from '../../build.config';
|
||||||
|
|
||||||
export default createUnbuildConfig({ minify: true, externals: ['package.cjs', 'package.mjs'] });
|
export default createUnbuildConfig({
|
||||||
|
entries: [
|
||||||
|
{ builder: 'rollup', input: 'src/index' },
|
||||||
|
{ builder: 'rollup', input: 'src/cli' },
|
||||||
|
],
|
||||||
|
minify: true,
|
||||||
|
});
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/docgen/*'",
|
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/docgen/*'",
|
||||||
"release": "cliff-jumper"
|
"release": "cliff-jumper"
|
||||||
},
|
},
|
||||||
"bin": "./dist/index.cjs",
|
"bin": "./dist/cli.cjs",
|
||||||
"directories": {
|
"directories": {
|
||||||
"lib": "src"
|
"lib": "src"
|
||||||
},
|
},
|
||||||
|
|||||||
25
packages/docgen/src/cli.ts
Normal file
25
packages/docgen/src/cli.ts
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
import { createCommand } from 'commander';
|
||||||
|
import { build } from './index.js';
|
||||||
|
import packageFile from '../package.json';
|
||||||
|
|
||||||
|
export interface CLIOptions {
|
||||||
|
input: string[];
|
||||||
|
custom: string;
|
||||||
|
root: string;
|
||||||
|
output: string;
|
||||||
|
typescript: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const command = createCommand()
|
||||||
|
.version(packageFile.version)
|
||||||
|
.option('-i, --input <string...>', 'Source directories to parse JSDocs in')
|
||||||
|
.option('-c, --custom <string>', 'Custom docs definition file to use')
|
||||||
|
.option('-r, --root [string]', 'Root directory of the project', '.')
|
||||||
|
.option('-o, --output <string>', 'Path to output file')
|
||||||
|
.option('--typescript', '', false);
|
||||||
|
|
||||||
|
const program = command.parse(process.argv);
|
||||||
|
const options = program.opts<CLIOptions>();
|
||||||
|
|
||||||
|
build(options);
|
||||||
@@ -1,20 +1,10 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
import { readFileSync, writeFileSync } from 'node:fs';
|
import { readFileSync, writeFileSync } from 'node:fs';
|
||||||
import { join, basename, extname, dirname, relative } from 'node:path';
|
import { dirname, join, extname, basename, relative } from 'node:path';
|
||||||
import { createCommand } from 'commander';
|
|
||||||
import jsdoc2md from 'jsdoc-to-markdown';
|
import jsdoc2md from 'jsdoc-to-markdown';
|
||||||
import { Application, DeclarationReflection, TSConfigReader } from 'typedoc';
|
import { type DeclarationReflection, Application, TSConfigReader } from 'typedoc';
|
||||||
import { Documentation } from './documentation.js';
|
import type { CLIOptions } from './cli';
|
||||||
import type { ChildTypes, CustomDocs, RootTypes } from './interfaces/index.js';
|
import { Documentation } from './documentation';
|
||||||
import packageFile from '../package.json';
|
import type { RootTypes, ChildTypes, CustomDocs } from './interfaces';
|
||||||
|
|
||||||
interface CLIOptions {
|
|
||||||
input: string[];
|
|
||||||
custom: string;
|
|
||||||
root: string;
|
|
||||||
output: string;
|
|
||||||
typescript: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface CustomFiles {
|
interface CustomFiles {
|
||||||
id?: string;
|
id?: string;
|
||||||
@@ -27,79 +17,70 @@ interface CustomFiles {
|
|||||||
}[];
|
}[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const command = createCommand()
|
export function build({ input, custom: customDocs, root, output, typescript }: CLIOptions) {
|
||||||
.version(packageFile.version)
|
let data: (RootTypes & ChildTypes)[] | DeclarationReflection[] = [];
|
||||||
.option('-i, --input <string...>', 'Source directories to parse JSDocs in')
|
if (typescript) {
|
||||||
.option('-c, --custom <string>', 'Custom docs definition file to use')
|
console.log('Parsing Typescript in source files...');
|
||||||
.option('-r, --root [string]', 'Root directory of the project', '.')
|
const app = new Application();
|
||||||
.option('-o, --output <string>', 'Path to output file')
|
app.options.addReader(new TSConfigReader());
|
||||||
.option('--typescript', '', false);
|
app.bootstrap({ entryPoints: input });
|
||||||
|
const project = app.convert();
|
||||||
const program = command.parse(process.argv);
|
if (project) {
|
||||||
const options = program.opts<CLIOptions>();
|
// @ts-expect-error
|
||||||
|
data = app.serializer.toObject(project).children!;
|
||||||
let data: (RootTypes & ChildTypes)[] | DeclarationReflection[] = [];
|
console.log(`${data.length} items parsed.`);
|
||||||
if (options.typescript) {
|
|
||||||
console.log('Parsing Typescript in source files...');
|
|
||||||
const app = new Application();
|
|
||||||
app.options.addReader(new TSConfigReader());
|
|
||||||
app.bootstrap({ entryPoints: options.input });
|
|
||||||
const project = app.convert();
|
|
||||||
if (project) {
|
|
||||||
// @ts-expect-error
|
|
||||||
data = app.serializer.toObject(project).children!;
|
|
||||||
console.log(`${data.length} items parsed.`);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.log('Parsing JSDocs in source files...');
|
|
||||||
data = jsdoc2md.getTemplateDataSync({ files: options.input }) as (RootTypes & ChildTypes)[];
|
|
||||||
console.log(`${data.length} JSDoc items parsed.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const custom: Record<string, CustomDocs> = {};
|
|
||||||
if (options.custom) {
|
|
||||||
console.log('Loading custom docs files...');
|
|
||||||
const customDir = dirname(options.custom);
|
|
||||||
const file = readFileSync(options.custom, 'utf-8');
|
|
||||||
const data = JSON.parse(file) as CustomFiles[];
|
|
||||||
|
|
||||||
for (const category of data) {
|
|
||||||
const categoryId = category.id ?? category.name.toLowerCase();
|
|
||||||
const dir = join(customDir, category.path ?? categoryId);
|
|
||||||
custom[categoryId] = {
|
|
||||||
name: category.name || category.id!,
|
|
||||||
files: {},
|
|
||||||
};
|
|
||||||
|
|
||||||
for (const f of category.files) {
|
|
||||||
const fileRootPath = join(dir, f.path);
|
|
||||||
const extension = extname(f.path);
|
|
||||||
const fileId = f.id ?? basename(f.path, extension);
|
|
||||||
const fileData = readFileSync(fileRootPath, 'utf-8');
|
|
||||||
custom[categoryId]!.files[fileId] = {
|
|
||||||
name: f.name,
|
|
||||||
type: extension.toLowerCase().replace(/^\./, ''),
|
|
||||||
content: fileData,
|
|
||||||
path: relative(options.root, fileRootPath).replace(/\\/g, '/'),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
console.log('Parsing JSDocs in source files...');
|
||||||
|
data = jsdoc2md.getTemplateDataSync({ files: input }) as (RootTypes & ChildTypes)[];
|
||||||
|
console.log(`${data.length} JSDoc items parsed.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const fileCount = Object.keys(custom)
|
const custom: Record<string, CustomDocs> = {};
|
||||||
.map((k) => Object.keys(custom[k]!))
|
if (customDocs) {
|
||||||
.reduce((prev, c) => prev + c.length, 0);
|
console.log('Loading custom docs files...');
|
||||||
const categoryCount = Object.keys(custom).length;
|
const customDir = dirname(customDocs);
|
||||||
console.log(
|
const file = readFileSync(customDocs, 'utf-8');
|
||||||
`${fileCount} custom docs file${fileCount === 1 ? '' : 's'} in ` +
|
const data = JSON.parse(file) as CustomFiles[];
|
||||||
`${categoryCount} categor${categoryCount === 1 ? 'y' : 'ies'} loaded.`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(`Serializing documentation with format version ${Documentation.FORMAT_VERSION}...`);
|
for (const category of data) {
|
||||||
const docs = new Documentation(data, options, custom);
|
const categoryId = category.id ?? category.name.toLowerCase();
|
||||||
|
const dir = join(customDir, category.path ?? categoryId);
|
||||||
|
custom[categoryId] = {
|
||||||
|
name: category.name || category.id!,
|
||||||
|
files: {},
|
||||||
|
};
|
||||||
|
|
||||||
if (options.output) {
|
for (const f of category.files) {
|
||||||
console.log(`Writing to ${options.output}...`);
|
const fileRootPath = join(dir, f.path);
|
||||||
writeFileSync(options.output, JSON.stringify(docs.serialize()));
|
const extension = extname(f.path);
|
||||||
|
const fileId = f.id ?? basename(f.path, extension);
|
||||||
|
const fileData = readFileSync(fileRootPath, 'utf-8');
|
||||||
|
custom[categoryId]!.files[fileId] = {
|
||||||
|
name: f.name,
|
||||||
|
type: extension.toLowerCase().replace(/^\./, ''),
|
||||||
|
content: fileData,
|
||||||
|
path: relative(root, fileRootPath).replace(/\\/g, '/'),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const fileCount = Object.keys(custom)
|
||||||
|
.map((k) => Object.keys(custom[k]!))
|
||||||
|
.reduce((prev, c) => prev + c.length, 0);
|
||||||
|
const categoryCount = Object.keys(custom).length;
|
||||||
|
console.log(
|
||||||
|
`${fileCount} custom docs file${fileCount === 1 ? '' : 's'} in ` +
|
||||||
|
`${categoryCount} categor${categoryCount === 1 ? 'y' : 'ies'} loaded.`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`Serializing documentation with format version ${Documentation.FORMAT_VERSION}...`);
|
||||||
|
const docs = new Documentation(data, { input, custom: customDocs, root, output, typescript }, custom);
|
||||||
|
|
||||||
|
if (output) {
|
||||||
|
console.log(`Writing to ${output}...`);
|
||||||
|
writeFileSync(output, JSON.stringify(docs.serialize()));
|
||||||
|
}
|
||||||
|
console.log('Done!');
|
||||||
}
|
}
|
||||||
console.log('Done!');
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { Type } from './index.js';
|
import type { Type } from './index.js';
|
||||||
|
|
||||||
export interface Return {
|
export interface Return {
|
||||||
type: Type;
|
type: Required<Type>;
|
||||||
nullable?: boolean;
|
nullable?: boolean;
|
||||||
description?: string;
|
description?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
export interface Type {
|
export interface Type {
|
||||||
names?: string[];
|
names?: string[] | undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { Type } from './index.js';
|
import type { Type } from './index.js';
|
||||||
|
|
||||||
export interface VarType extends Type {
|
export interface VarType extends Type {
|
||||||
type?: Required<Type>;
|
type?: Required<Type> | undefined;
|
||||||
description?: string;
|
description?: string | undefined;
|
||||||
nullable?: boolean;
|
nullable?: boolean | undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
"tslib": "^2.4.0"
|
"tslib": "^2.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^16.11.47",
|
"@types/node": "^16.11.48",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
||||||
"@typescript-eslint/parser": "^5.33.0",
|
"@typescript-eslint/parser": "^5.33.0",
|
||||||
"eslint": "^8.22.0",
|
"eslint": "^8.22.0",
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
"prettier": "^2.7.1",
|
"prettier": "^2.7.1",
|
||||||
"rollup-plugin-typescript2": "0.32.1",
|
"rollup-plugin-typescript2": "0.32.1",
|
||||||
"typescript": "^4.7.4",
|
"typescript": "^4.7.4",
|
||||||
"unbuild": "^0.8.4"
|
"unbuild": "^0.8.8"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.9.0"
|
"node": ">=16.9.0"
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
"@discordjs/docgen": "workspace:^",
|
"@discordjs/docgen": "workspace:^",
|
||||||
"@favware/cliff-jumper": "^1.8.6",
|
"@favware/cliff-jumper": "^1.8.6",
|
||||||
"@microsoft/api-extractor": "^7.29.2",
|
"@microsoft/api-extractor": "^7.29.2",
|
||||||
"@types/node": "^16.11.47",
|
"@types/node": "^16.11.48",
|
||||||
"@types/supertest": "^2.0.12",
|
"@types/supertest": "^2.0.12",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
||||||
"@typescript-eslint/parser": "^5.33.0",
|
"@typescript-eslint/parser": "^5.33.0",
|
||||||
@@ -77,7 +77,7 @@
|
|||||||
"rollup-plugin-typescript2": "0.32.1",
|
"rollup-plugin-typescript2": "0.32.1",
|
||||||
"supertest": "^6.2.4",
|
"supertest": "^6.2.4",
|
||||||
"typescript": "^4.7.4",
|
"typescript": "^4.7.4",
|
||||||
"unbuild": "^0.8.4",
|
"unbuild": "^0.8.8",
|
||||||
"vitest": "^0.21.1"
|
"vitest": "^0.21.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {
|
|
||||||
"exactOptionalPropertyTypes": false
|
|
||||||
},
|
|
||||||
"include": ["src/**/*.ts"]
|
"include": ["src/**/*.ts"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@
|
|||||||
"@discordjs/docgen": "workspace:^",
|
"@discordjs/docgen": "workspace:^",
|
||||||
"@favware/cliff-jumper": "^1.8.6",
|
"@favware/cliff-jumper": "^1.8.6",
|
||||||
"@microsoft/api-extractor": "^7.29.2",
|
"@microsoft/api-extractor": "^7.29.2",
|
||||||
"@types/node": "^16.11.47",
|
"@types/node": "^16.11.48",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
||||||
"@typescript-eslint/parser": "^5.33.0",
|
"@typescript-eslint/parser": "^5.33.0",
|
||||||
"c8": "^7.12.0",
|
"c8": "^7.12.0",
|
||||||
@@ -77,7 +77,7 @@
|
|||||||
"prettier": "^2.7.1",
|
"prettier": "^2.7.1",
|
||||||
"rollup-plugin-typescript2": "0.32.1",
|
"rollup-plugin-typescript2": "0.32.1",
|
||||||
"typescript": "^4.7.4",
|
"typescript": "^4.7.4",
|
||||||
"unbuild": "^0.8.4",
|
"unbuild": "^0.8.8",
|
||||||
"vitest": "^0.21.1"
|
"vitest": "^0.21.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
"tslib": "^2.4.0"
|
"tslib": "^2.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^16.11.47",
|
"@types/node": "^16.11.48",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
||||||
"@typescript-eslint/parser": "^5.33.0",
|
"@typescript-eslint/parser": "^5.33.0",
|
||||||
"c8": "^7.12.0",
|
"c8": "^7.12.0",
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
"prettier": "^2.7.1",
|
"prettier": "^2.7.1",
|
||||||
"rollup-plugin-typescript2": "0.32.1",
|
"rollup-plugin-typescript2": "0.32.1",
|
||||||
"typescript": "^4.7.4",
|
"typescript": "^4.7.4",
|
||||||
"unbuild": "^0.8.4",
|
"unbuild": "^0.8.8",
|
||||||
"vitest": "^0.21.1"
|
"vitest": "^0.21.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
@@ -67,7 +67,7 @@
|
|||||||
"@favware/cliff-jumper": "^1.8.6",
|
"@favware/cliff-jumper": "^1.8.6",
|
||||||
"@microsoft/api-extractor": "^7.29.2",
|
"@microsoft/api-extractor": "^7.29.2",
|
||||||
"@types/jest": "^28.1.6",
|
"@types/jest": "^28.1.6",
|
||||||
"@types/node": "^16.11.47",
|
"@types/node": "^16.11.48",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
||||||
"@typescript-eslint/parser": "^5.33.0",
|
"@typescript-eslint/parser": "^5.33.0",
|
||||||
"downlevel-dts": "^0.10.0",
|
"downlevel-dts": "^0.10.0",
|
||||||
@@ -83,7 +83,7 @@
|
|||||||
"rollup-plugin-typescript2": "0.32.1",
|
"rollup-plugin-typescript2": "0.32.1",
|
||||||
"tweetnacl": "^1.0.3",
|
"tweetnacl": "^1.0.3",
|
||||||
"typescript": "^4.7.4",
|
"typescript": "^4.7.4",
|
||||||
"unbuild": "^0.8.4"
|
"unbuild": "^0.8.8"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.9.0"
|
"node": ">=16.9.0"
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ export enum VoiceConnectionStatus {
|
|||||||
*/
|
*/
|
||||||
export interface VoiceConnectionSignallingState {
|
export interface VoiceConnectionSignallingState {
|
||||||
status: VoiceConnectionStatus.Signalling;
|
status: VoiceConnectionStatus.Signalling;
|
||||||
subscription?: PlayerSubscription;
|
subscription?: PlayerSubscription | undefined;
|
||||||
adapter: DiscordGatewayAdapterImplementerMethods;
|
adapter: DiscordGatewayAdapterImplementerMethods;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ export enum VoiceConnectionDisconnectReason {
|
|||||||
*/
|
*/
|
||||||
export interface VoiceConnectionDisconnectedBaseState {
|
export interface VoiceConnectionDisconnectedBaseState {
|
||||||
status: VoiceConnectionStatus.Disconnected;
|
status: VoiceConnectionStatus.Disconnected;
|
||||||
subscription?: PlayerSubscription;
|
subscription?: PlayerSubscription | undefined;
|
||||||
adapter: DiscordGatewayAdapterImplementerMethods;
|
adapter: DiscordGatewayAdapterImplementerMethods;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ export type VoiceConnectionDisconnectedState =
|
|||||||
export interface VoiceConnectionConnectingState {
|
export interface VoiceConnectionConnectingState {
|
||||||
status: VoiceConnectionStatus.Connecting;
|
status: VoiceConnectionStatus.Connecting;
|
||||||
networking: Networking;
|
networking: Networking;
|
||||||
subscription?: PlayerSubscription;
|
subscription?: PlayerSubscription | undefined;
|
||||||
adapter: DiscordGatewayAdapterImplementerMethods;
|
adapter: DiscordGatewayAdapterImplementerMethods;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,7 +139,7 @@ export interface VoiceConnectionConnectingState {
|
|||||||
export interface VoiceConnectionReadyState {
|
export interface VoiceConnectionReadyState {
|
||||||
status: VoiceConnectionStatus.Ready;
|
status: VoiceConnectionStatus.Ready;
|
||||||
networking: Networking;
|
networking: Networking;
|
||||||
subscription?: PlayerSubscription;
|
subscription?: PlayerSubscription | undefined;
|
||||||
adapter: DiscordGatewayAdapterImplementerMethods;
|
adapter: DiscordGatewayAdapterImplementerMethods;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -688,7 +688,7 @@ export class VoiceConnection extends EventEmitter {
|
|||||||
*
|
*
|
||||||
* @param subscription - The removed subscription
|
* @param subscription - The removed subscription
|
||||||
*/
|
*/
|
||||||
private onSubscriptionRemoved(subscription: PlayerSubscription) {
|
protected onSubscriptionRemoved(subscription: PlayerSubscription) {
|
||||||
if (this.state.status !== VoiceConnectionStatus.Destroyed && this.state.subscription === subscription) {
|
if (this.state.status !== VoiceConnectionStatus.Destroyed && this.state.subscription === subscription) {
|
||||||
this.state = {
|
this.state = {
|
||||||
...this.state,
|
...this.state,
|
||||||
|
|||||||
@@ -13,6 +13,6 @@ export class AudioPlayerError extends Error {
|
|||||||
super(error.message);
|
super(error.message);
|
||||||
this.resource = resource;
|
this.resource = resource;
|
||||||
this.name = error.name;
|
this.name = error.name;
|
||||||
this.stack = error.stack;
|
this.stack = error.stack!;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ export class AudioResource<T = unknown> {
|
|||||||
/**
|
/**
|
||||||
* The audio player that the resource is subscribed to, if any.
|
* The audio player that the resource is subscribed to, if any.
|
||||||
*/
|
*/
|
||||||
public audioPlayer?: AudioPlayer;
|
public audioPlayer?: AudioPlayer | undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The playback duration of this audio resource, given in milliseconds.
|
* The playback duration of this audio resource, given in milliseconds.
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export interface CreateVoiceConnectionOptions {
|
|||||||
* If true, debug messages will be enabled for the voice connection and its
|
* If true, debug messages will be enabled for the voice connection and its
|
||||||
* related components. Defaults to false.
|
* related components. Defaults to false.
|
||||||
*/
|
*/
|
||||||
debug?: boolean;
|
debug?: boolean | undefined;
|
||||||
|
|
||||||
adapterCreator: DiscordGatewayAdapterCreator;
|
adapterCreator: DiscordGatewayAdapterCreator;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ export interface NetworkingReadyState {
|
|||||||
udp: VoiceUDPSocket;
|
udp: VoiceUDPSocket;
|
||||||
connectionOptions: ConnectionOptions;
|
connectionOptions: ConnectionOptions;
|
||||||
connectionData: ConnectionData;
|
connectionData: ConnectionData;
|
||||||
preparedPacket?: Buffer;
|
preparedPacket?: Buffer | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -94,7 +94,7 @@ export interface NetworkingResumingState {
|
|||||||
udp: VoiceUDPSocket;
|
udp: VoiceUDPSocket;
|
||||||
connectionOptions: ConnectionOptions;
|
connectionOptions: ConnectionOptions;
|
||||||
connectionData: ConnectionData;
|
connectionData: ConnectionData;
|
||||||
preparedPacket?: Buffer;
|
preparedPacket?: Buffer | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {
|
|
||||||
"exactOptionalPropertyTypes": false
|
|
||||||
},
|
|
||||||
"include": ["src/**/*.ts"]
|
"include": ["src/**/*.ts"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,8 +51,8 @@
|
|||||||
"@microsoft/tsdoc": "0.14.1",
|
"@microsoft/tsdoc": "0.14.1",
|
||||||
"@microsoft/tsdoc-config": "0.16.1",
|
"@microsoft/tsdoc-config": "0.16.1",
|
||||||
"@vscode/codicons": "^0.0.32",
|
"@vscode/codicons": "^0.0.32",
|
||||||
"framer-motion": "^7.0.1",
|
"framer-motion": "^7.1.0",
|
||||||
"next": "^12.2.4",
|
"next": "^12.2.5",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-icons": "^4.4.0",
|
"react-icons": "^4.4.0",
|
||||||
@@ -65,15 +65,15 @@
|
|||||||
"@testing-library/jest-dom": "^5.16.5",
|
"@testing-library/jest-dom": "^5.16.5",
|
||||||
"@testing-library/react": "^13.3.0",
|
"@testing-library/react": "^13.3.0",
|
||||||
"@testing-library/user-event": "^14.4.3",
|
"@testing-library/user-event": "^14.4.3",
|
||||||
"@types/node": "^16.11.47",
|
"@types/node": "^16.11.48",
|
||||||
"@types/react-dom": "^18.0.6",
|
"@types/react-dom": "^18.0.6",
|
||||||
"@types/react-syntax-highlighter": "^15.5.4",
|
"@types/react-syntax-highlighter": "^15.5.4",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
||||||
"@typescript-eslint/parser": "^5.33.0",
|
"@typescript-eslint/parser": "^5.33.0",
|
||||||
"@unocss/cli": "^0.45.5",
|
"@unocss/cli": "^0.45.6",
|
||||||
"@unocss/preset-web-fonts": "^0.45.5",
|
"@unocss/preset-web-fonts": "^0.45.6",
|
||||||
"@unocss/reset": "^0.45.5",
|
"@unocss/reset": "^0.45.6",
|
||||||
"@vitejs/plugin-react": "^2.0.0",
|
"@vitejs/plugin-react": "^2.0.1",
|
||||||
"c8": "^7.12.0",
|
"c8": "^7.12.0",
|
||||||
"concurrently": "^7.3.0",
|
"concurrently": "^7.3.0",
|
||||||
"cypress": "^10.4.0",
|
"cypress": "^10.4.0",
|
||||||
@@ -88,8 +88,8 @@
|
|||||||
"msw": "^0.44.2",
|
"msw": "^0.44.2",
|
||||||
"prettier": "^2.7.1",
|
"prettier": "^2.7.1",
|
||||||
"typescript": "^4.7.4",
|
"typescript": "^4.7.4",
|
||||||
"unocss": "^0.45.5",
|
"unocss": "^0.45.6",
|
||||||
"vercel": "^27.4.0",
|
"vercel": "^28.0.1",
|
||||||
"vitest": "^0.21.1"
|
"vitest": "^0.21.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
"@discordjs/docgen": "workspace:^",
|
"@discordjs/docgen": "workspace:^",
|
||||||
"@favware/cliff-jumper": "^1.8.6",
|
"@favware/cliff-jumper": "^1.8.6",
|
||||||
"@microsoft/api-extractor": "^7.29.2",
|
"@microsoft/api-extractor": "^7.29.2",
|
||||||
"@types/node": "^16.11.47",
|
"@types/node": "^16.11.48",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
||||||
"@typescript-eslint/parser": "^5.33.0",
|
"@typescript-eslint/parser": "^5.33.0",
|
||||||
"c8": "^7.12.0",
|
"c8": "^7.12.0",
|
||||||
@@ -78,7 +78,7 @@
|
|||||||
"prettier": "^2.7.1",
|
"prettier": "^2.7.1",
|
||||||
"rollup-plugin-typescript2": "0.32.1",
|
"rollup-plugin-typescript2": "0.32.1",
|
||||||
"typescript": "^4.7.4",
|
"typescript": "^4.7.4",
|
||||||
"unbuild": "^0.8.4",
|
"unbuild": "^0.8.8",
|
||||||
"undici": "^5.8.2",
|
"undici": "^5.8.2",
|
||||||
"vitest": "^0.21.1",
|
"vitest": "^0.21.1",
|
||||||
"zlib-sync": "^0.1.7"
|
"zlib-sync": "^0.1.7"
|
||||||
|
|||||||
Reference in New Issue
Block a user