Skip to content

Commit

Permalink
引入dts-generator生成类型声明文件
Browse files Browse the repository at this point in the history
  • Loading branch information
niyuancheng committed Apr 5, 2023
1 parent 8a3ae51 commit a36a423
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 4 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "niplayer",
"version": "1.3.6",
"version": "1.4.0",
"description": "This is a TS library for video player",
"main": "./dist/player.esm.js",
"types": "./dist/index.d.ts",
"scripts": {
"dev": "rollup -c script/rollup.config.dev.js --watch",
"build": "rollup -c script/rollup.config.prod.js",
"build:tsc": "tsc",
"build:dts": "dts-bundle-generator -o ./dist/index.d.ts ./src/index.ts --project tsconfig.json --no-check",
"test": "vitest",
"coverage": "vitest run --coverage"
},
Expand All @@ -31,6 +32,7 @@
"@types/node": "^18.13.0",
"@vitest/coverage-c8": "^0.27.2",
"autoprefixer": "^8.0.0",
"dts-bundle-generator": "^8.0.0",
"less": "^4.1.3",
"postcss": "^8.4.21",
"rollup": "^2.79.1",
Expand Down
44 changes: 44 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/class/HTMLMediaElementWithCaputreStream.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
interface HTMLMediaElementWithCaputreStream extends HTMLMediaElement {
export interface HTMLMediaElementWithCaputreStream extends HTMLMediaElement {
captureStream(fps?: number): MediaStream;
}
1 change: 1 addition & 0 deletions src/component/ToolBar/BottomBar/parts/VideoShot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { storeControlComponent } from "@/utils/store";
import { Toast } from "@/component/Toast/Toast";
import { confirmPath, countdownPath, videoShotPath$1 } from "@/svg/index";
import { Options } from "./Options";
import { HTMLMediaElementWithCaputreStream } from "@/class/HTMLMediaElementWithCaputreStream";
export class VideoShot extends Options {
readonly id = "VideoShot";
player: Player;
Expand Down
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"module": "ES6", /* Specify what module code is generated. */
// "rootDir": "./src", /* Specify the root folder within your source files. */
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
"baseUrl": ".", /* Specify the base directory to resolve non-relative module names. */
"baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
"paths": {
"@/*": ["./src/*"]
}, /* Specify a set of entries that re-map imports to additional lookup locations. */
Expand All @@ -55,7 +55,8 @@
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */

/* Emit */
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
// "declarationDir": "./dist/types",
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
Expand Down

0 comments on commit a36a423

Please sign in to comment.