diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 60d425d..4454fc9 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -49,3 +49,9 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} if: ${{ steps.release.outputs.release_created }} + + - name: Publish to JSR + run: | + npm run build --if-present + npx jsr publish + if: ${{ steps.release.outputs.release_created }} \ No newline at end of file diff --git a/jsr.json b/jsr.json new file mode 100644 index 0000000..66b1a93 --- /dev/null +++ b/jsr.json @@ -0,0 +1,21 @@ +{ + "name": "@luanrt/googlevideo", + "version": "1.1.0", + "exports": "./src/index.ts", + "imports": { + "@bufbuild/protobuf": "npm:@bufbuild/protobuf@^2.0.0" + }, + "publish": { + "include": [ + "LICENSE", + "README.md", + "protos/generated/**/*.ts", + "src/**/*.ts" + ], + "exclude": [ + "test", + "scripts", + "examples" + ] + } +} \ No newline at end of file diff --git a/package.json b/package.json index 6260a78..617c144 100644 --- a/package.json +++ b/package.json @@ -7,34 +7,35 @@ "types": "./dist/src/index.d.ts", "module": "./dist/src/index.js", "scripts": { + "watch": "npx tsc --watch", "lint": "npx eslint ./src/**/*.ts", "lint:fix": "npx eslint --fix ./src/**/*.ts", - "clean": "npx rimraf ./dist ./bundle ./protos/generated", - "build": "npm run clean && npm run lint && npm run build:proto && npm run build:esm && npm run bundle:node", + "clean": "npx rimraf ./dist ./protos/generated", + "build": "npm run clean && npm run lint && npm run build:proto && npm run build:esm", "build:esm": "npx tsc", "build:proto": "node ./dev-scripts/generate-proto.mjs", - "bundle:node": "npx esbuild ./dist/src/index.js --bundle --outfile=./bundle/index.cjs --platform=node --target=node16 --format=cjs --sourcemap --banner:js=\"/* eslint-disable */\"", "prepare": "npm run build" }, - "repository": { - "type": "git", - "url": "git+https://github.com/LuanRT/GoogleVideo.git" - }, + "author": "LuanRT (https://github.com/LuanRT)", + "funding": [ + "https://github.com/sponsors/LuanRT" + ], "keywords": [ "UMP", "SABR", "Google", "YouTube" ], - "author": "LuanRT (https://github.com/LuanRT)", "license": "MIT", - "bugs": { - "url": "https://github.com/LuanRT/GoogleVideo/issues" + "exports": { + ".": { + "node": { + "import": "./dist/src/index.js" + }, + "types": "./dist/src/index.d.ts", + "default": "./dist/src/index.js" + } }, - "homepage": "https://github.com/LuanRT/GoogleVideo#readme", - "funding": [ - "https://github.com/sponsors/LuanRT" - ], "devDependencies": { "@eslint/js": "^9.9.0", "@stylistic/eslint-plugin": "^2.6.4", @@ -46,14 +47,15 @@ "typescript": "^5.5.4", "typescript-eslint": "^8.2.0" }, - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js", - "require": "./bundle/index.cjs" - } - }, "dependencies": { "@bufbuild/protobuf": "^2.0.0" + }, + "bugs": { + "url": "https://github.com/LuanRT/GoogleVideo/issues" + }, + "homepage": "https://github.com/LuanRT/GoogleVideo#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/LuanRT/GoogleVideo.git" } -} +} \ No newline at end of file diff --git a/src/core/UMP.ts b/src/core/UMP.ts index 6d7f071..9bad348 100644 --- a/src/core/UMP.ts +++ b/src/core/UMP.ts @@ -113,7 +113,6 @@ export class UMP { } public canReadFromCurrentChunk(offset: number, length: number): boolean { - this.chunkedDataBuffer.isFocused(offset); return offset - this.chunkedDataBuffer.currentChunkOffset + length <= this.chunkedDataBuffer.chunks[this.chunkedDataBuffer.currentChunkIndex].length; } diff --git a/src/utils/helpers.ts b/src/utils/helpers.ts index 94a0c79..8fbd91b 100644 --- a/src/utils/helpers.ts +++ b/src/utils/helpers.ts @@ -90,7 +90,7 @@ export class CustomEvent extends Event { this.#detail = options?.detail ?? null; } - get detail() { + get detail(): any[] | null { return this.#detail; } } \ No newline at end of file