@kubohiroya/turbowarp-camera-source 0.2.0 → 0.3.0

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.ja.md CHANGED
@@ -26,13 +26,13 @@ TurboWarp-Camera-Sourceは、MediaDevicesのカメラストリームを名前付
26
26
  次のURLをunsandboxed custom extensionとして読み込みます。
27
27
 
28
28
  ```text
29
- https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-camera-source@0.2.0/dist/camera-source.js
29
+ https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-camera-source@0.3.0/dist/camera-source.js
30
30
  ```
31
31
 
32
32
  npm hostでは次を使います。
33
33
 
34
34
  ```bash
35
- pnpm add @kubohiroya/turbowarp-camera-source@0.2.0
35
+ pnpm add @kubohiroya/turbowarp-camera-source@0.3.0
36
36
  ```
37
37
 
38
38
  ## Quick start
package/README.md CHANGED
@@ -30,13 +30,13 @@ or select separate cameras for separate roles.
30
30
  Load this URL as an unsandboxed custom extension:
31
31
 
32
32
  ```text
33
- https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-camera-source@0.2.0/dist/camera-source.js
33
+ https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-camera-source@0.3.0/dist/camera-source.js
34
34
  ```
35
35
 
36
36
  For npm hosts:
37
37
 
38
38
  ```bash
39
- pnpm add @kubohiroya/turbowarp-camera-source@0.2.0
39
+ pnpm add @kubohiroya/turbowarp-camera-source@0.3.0
40
40
  ```
41
41
 
42
42
  ## Quick Start
@@ -198,7 +198,7 @@ The generated JavaScript is a single, non-minified TurboWarp extension file with
198
198
  - `src/index.ts`: extension registration entry point
199
199
  - `src/globals.d.ts`: Scratch API declarations used by the project
200
200
  - `schemas/extension-manifest.schema.json`: JSON Schema for the generated API contract
201
- - `scripts/generate-readme.mjs`: updates the generated README block section
201
+ - `scripts/generate-readme.ts`: updates the generated README block section
202
202
  - `tests/`: unit tests
203
203
  - `vite.config.ts`: TurboWarp-compatible Vite build configuration
204
204
  - `dist/`: tracked TurboWarp JavaScript and extension API manifest
@@ -7,205 +7,283 @@
7
7
  (function (Scratch) {
8
8
  'use strict';
9
9
 
10
- const extensionConfig = {
11
- id: "kubohiroyacamerasource",
12
- name: "Camera Source"
10
+ //#region src/config.ts
11
+ var extensionConfig = {
12
+ id: "kubohiroyacamerasource",
13
+ slug: "camera-source",
14
+ name: "Camera Source",
15
+ description: "Share one MediaDevices camera stream between TurboWarp extensions.",
16
+ author: "Hiroya Kubo",
17
+ license: "MPL-2.0",
18
+ unsandboxed: true
13
19
  };
14
- const extensionName = "Camera Source";
15
- const blocks = [{ "opcode": "startSharedCamera", "blockType": "COMMAND", "text": "start shared camera [CAMERA_ID] with device ID [DEVICE_ID]", "description": "Starts or keeps a named shared MediaDevices camera stream.", "arguments": { "CAMERA_ID": { "type": "STRING", "defaultValue": "default" }, "DEVICE_ID": { "type": "STRING", "defaultValue": "" } } }, { "opcode": "stopSharedCamera", "blockType": "COMMAND", "text": "stop shared camera [CAMERA_ID]", "description": "Stops a named shared camera stream and releases its tracks.", "arguments": { "CAMERA_ID": { "type": "STRING", "defaultValue": "default" } } }, { "opcode": "isCameraRunning", "blockType": "BOOLEAN", "text": "shared camera [CAMERA_ID] is running?", "description": "Reports whether a named shared camera stream is active.", "arguments": { "CAMERA_ID": { "type": "STRING", "defaultValue": "default" } } }, { "opcode": "cameraDeviceIdReporter", "blockType": "REPORTER", "text": "shared camera [CAMERA_ID] device ID", "description": "Returns the active device ID for a named shared camera when available.", "arguments": { "CAMERA_ID": { "type": "STRING", "defaultValue": "default" } } }, { "opcode": "refreshCameraDevices", "blockType": "COMMAND", "text": "refresh camera devices", "description": "Refreshes the browser camera device list.", "arguments": {} }, { "opcode": "cameraDeviceCount", "blockType": "REPORTER", "text": "camera device count", "description": "Returns the number of known camera devices after refresh.", "arguments": {} }, { "opcode": "cameraDeviceIdAt", "blockType": "REPORTER", "text": "camera device ID at [INDEX]", "description": "Returns the one-based camera device ID at the requested index.", "arguments": { "INDEX": { "type": "STRING", "defaultValue": "1" } } }, { "opcode": "cameraDeviceLabelAt", "blockType": "REPORTER", "text": "camera device label at [INDEX]", "description": "Returns the one-based camera device label at the requested index when the browser exposes it.", "arguments": { "INDEX": { "type": "STRING", "defaultValue": "1" } } }];
16
- const definitions = {
17
- extensionName,
18
- blocks
20
+ var block_definitions_default = {
21
+ extensionName: "Camera Source",
22
+ blocks: [
23
+ {
24
+ "opcode": "startSharedCamera",
25
+ "blockType": "COMMAND",
26
+ "text": "start shared camera [CAMERA_ID] with device ID [DEVICE_ID]",
27
+ "description": "Starts or keeps a named shared MediaDevices camera stream.",
28
+ "arguments": {
29
+ "CAMERA_ID": {
30
+ "type": "STRING",
31
+ "defaultValue": "default"
32
+ },
33
+ "DEVICE_ID": {
34
+ "type": "STRING",
35
+ "defaultValue": ""
36
+ }
37
+ }
38
+ },
39
+ {
40
+ "opcode": "stopSharedCamera",
41
+ "blockType": "COMMAND",
42
+ "text": "stop shared camera [CAMERA_ID]",
43
+ "description": "Stops a named shared camera stream and releases its tracks.",
44
+ "arguments": { "CAMERA_ID": {
45
+ "type": "STRING",
46
+ "defaultValue": "default"
47
+ } }
48
+ },
49
+ {
50
+ "opcode": "isCameraRunning",
51
+ "blockType": "BOOLEAN",
52
+ "text": "shared camera [CAMERA_ID] is running?",
53
+ "description": "Reports whether a named shared camera stream is active.",
54
+ "arguments": { "CAMERA_ID": {
55
+ "type": "STRING",
56
+ "defaultValue": "default"
57
+ } }
58
+ },
59
+ {
60
+ "opcode": "cameraDeviceIdReporter",
61
+ "blockType": "REPORTER",
62
+ "text": "shared camera [CAMERA_ID] device ID",
63
+ "description": "Returns the active device ID for a named shared camera when available.",
64
+ "arguments": { "CAMERA_ID": {
65
+ "type": "STRING",
66
+ "defaultValue": "default"
67
+ } }
68
+ },
69
+ {
70
+ "opcode": "refreshCameraDevices",
71
+ "blockType": "COMMAND",
72
+ "text": "refresh camera devices",
73
+ "description": "Refreshes the browser camera device list.",
74
+ "arguments": {}
75
+ },
76
+ {
77
+ "opcode": "cameraDeviceCount",
78
+ "blockType": "REPORTER",
79
+ "text": "camera device count",
80
+ "description": "Returns the number of known camera devices after refresh.",
81
+ "arguments": {}
82
+ },
83
+ {
84
+ "opcode": "cameraDeviceIdAt",
85
+ "blockType": "REPORTER",
86
+ "text": "camera device ID at [INDEX]",
87
+ "description": "Returns the one-based camera device ID at the requested index.",
88
+ "arguments": { "INDEX": {
89
+ "type": "STRING",
90
+ "defaultValue": "1"
91
+ } }
92
+ },
93
+ {
94
+ "opcode": "cameraDeviceLabelAt",
95
+ "blockType": "REPORTER",
96
+ "text": "camera device label at [INDEX]",
97
+ "description": "Returns the one-based camera device label at the requested index when the browser exposes it.",
98
+ "arguments": { "INDEX": {
99
+ "type": "STRING",
100
+ "defaultValue": "1"
101
+ } }
102
+ }
103
+ ]
19
104
  };
20
- const blockDefinitions = definitions.blocks;
21
- const defaultCameraId = "default";
105
+ //#endregion
106
+ //#region src/extension.ts
107
+ var blockDefinitions = block_definitions_default.blocks;
108
+ var defaultCameraId = "default";
22
109
  function mediaDevices() {
23
- const devices = globalThis.navigator?.mediaDevices;
24
- if (!devices || typeof devices.getUserMedia !== "function") {
25
- throw new Error("Camera Source requires navigator.mediaDevices.getUserMedia.");
26
- }
27
- return devices;
110
+ const devices = globalThis.navigator?.mediaDevices;
111
+ if (!devices || typeof devices.getUserMedia !== "function") throw new Error("Camera Source requires navigator.mediaDevices.getUserMedia.");
112
+ return devices;
28
113
  }
29
114
  function normalizeId(value, fallback = defaultCameraId) {
30
- const text = String(value ?? "").trim();
31
- return text || fallback;
115
+ return String(value ?? "").trim() || fallback;
32
116
  }
33
117
  function optionalText(value) {
34
- return String(value ?? "").trim();
118
+ return String(value ?? "").trim();
35
119
  }
36
120
  function indexFrom(value) {
37
- const parsed = Number.parseInt(String(value ?? ""), 10);
38
- return Number.isFinite(parsed) ? parsed - 1 : -1;
121
+ const parsed = Number.parseInt(String(value ?? ""), 10);
122
+ return Number.isFinite(parsed) ? parsed - 1 : -1;
39
123
  }
40
124
  function videoConstraints(options) {
41
- if (typeof options.video === "object" && options.video !== null) {
42
- return { audio: false, video: options.video };
43
- }
44
- if (options.deviceId) {
45
- return { audio: false, video: { deviceId: { exact: options.deviceId } } };
46
- }
47
- return { audio: false, video: options.video ?? true };
48
- }
49
- class CameraSourceExtension {
50
- constructor() {
51
- this.sessions = /* @__PURE__ */ new Map();
52
- this.blockLeases = /* @__PURE__ */ new Map();
53
- this.devices = [];
54
- Scratch.vm.runtime.ext_kubohiroyacamerasource = this;
55
- }
56
- getInfo() {
57
- return {
58
- id: extensionConfig.id,
59
- name: Scratch.translate(definitions.extensionName),
60
- blocks: blockDefinitions.map((block) => this.toScratchBlock(block))
61
- };
62
- }
63
- isCameraRunning(args = {}) {
64
- const session = this.sessions.get(normalizeId(args.CAMERA_ID));
65
- return Boolean(session?.stream);
66
- }
67
- cameraDeviceIdReporter(args = {}) {
68
- return this.sessions.get(normalizeId(args.CAMERA_ID))?.activeDeviceId ?? "";
69
- }
70
- async startSharedCamera(args = {}) {
71
- const cameraId = normalizeId(args.CAMERA_ID);
72
- if (this.blockLeases.has(cameraId)) return;
73
- const deviceId = optionalText(args.DEVICE_ID);
74
- const options = { owner: "camera-source-block", cameraId };
75
- if (deviceId) options.deviceId = deviceId;
76
- const lease = await this.acquireCamera(options);
77
- this.blockLeases.set(cameraId, lease);
78
- }
79
- async acquireCamera(options = {}) {
80
- const cameraId = normalizeId(options.cameraId);
81
- const session = this.session(cameraId);
82
- const token = Symbol(String(options.owner ?? "camera-lease"));
83
- if (session.startPromise) {
84
- await session.startPromise;
85
- } else if (!session.stream) {
86
- await this.start(session, options);
87
- }
88
- session.leases.add(token);
89
- let released = false;
90
- return Object.freeze({
91
- getFrameSource: () => this.getFrameSource(session),
92
- release: async () => {
93
- if (released) return;
94
- released = true;
95
- session.leases.delete(token);
96
- if (session.leases.size === 0) this.stopCameraSession(session.cameraId);
97
- }
98
- });
99
- }
100
- stopSharedCamera(args = {}) {
101
- this.stopCameraSession(normalizeId(args.CAMERA_ID));
102
- }
103
- async refreshCameraDevices() {
104
- this.devices = (await mediaDevices().enumerateDevices()).filter(
105
- (device) => device.kind === "videoinput"
106
- );
107
- }
108
- cameraDeviceCount() {
109
- return this.devices.length;
110
- }
111
- cameraDeviceIdAt(args) {
112
- return this.devices[indexFrom(args.INDEX)]?.deviceId ?? "";
113
- }
114
- cameraDeviceLabelAt(args) {
115
- return this.devices[indexFrom(args.INDEX)]?.label ?? "";
116
- }
117
- stopAllCameras() {
118
- for (const cameraId of [...this.sessions.keys()]) {
119
- this.stopCameraSession(cameraId);
120
- }
121
- this.blockLeases.clear();
122
- }
123
- session(cameraId) {
124
- const existing = this.sessions.get(cameraId);
125
- if (existing) return existing;
126
- const session = {
127
- cameraId,
128
- leases: /* @__PURE__ */ new Set(),
129
- stream: null,
130
- video: null,
131
- startPromise: null,
132
- mirrored: false,
133
- activeDeviceId: ""
134
- };
135
- this.sessions.set(cameraId, session);
136
- return session;
137
- }
138
- async start(session, options) {
139
- session.mirrored = options.mirrored === true;
140
- session.startPromise = (async () => {
141
- const stream = await mediaDevices().getUserMedia(videoConstraints(options));
142
- const video = document.createElement("video");
143
- video.muted = true;
144
- video.playsInline = true;
145
- video.srcObject = stream;
146
- await video.play();
147
- session.stream = stream;
148
- session.video = video;
149
- this.updateActiveDevice(session);
150
- })();
151
- try {
152
- await session.startPromise;
153
- } catch (error) {
154
- this.stopCameraSession(session.cameraId);
155
- throw error;
156
- }
157
- }
158
- updateActiveDevice(session) {
159
- const track = session.stream?.getVideoTracks()[0] ?? null;
160
- const settings = track?.getSettings();
161
- session.activeDeviceId = typeof settings?.deviceId === "string" ? settings.deviceId : "";
162
- }
163
- getFrameSource(session) {
164
- if (!session.video || !session.stream) {
165
- throw new Error("Shared camera is not running.");
166
- }
167
- return Object.freeze({
168
- kind: "video",
169
- element: session.video,
170
- width: session.video.videoWidth,
171
- height: session.video.videoHeight,
172
- mirrored: session.mirrored,
173
- deviceId: session.activeDeviceId
174
- });
175
- }
176
- stopCameraSession(cameraId) {
177
- const session = this.sessions.get(cameraId);
178
- if (!session) return;
179
- session.stream?.getTracks().forEach((track) => track.stop());
180
- if (session.video) session.video.srcObject = null;
181
- session.stream = null;
182
- session.video = null;
183
- session.startPromise = null;
184
- session.activeDeviceId = "";
185
- session.leases.clear();
186
- this.sessions.delete(cameraId);
187
- this.blockLeases.delete(cameraId);
188
- }
189
- toScratchBlock(block) {
190
- return {
191
- opcode: block.opcode,
192
- blockType: Scratch.BlockType[block.blockType],
193
- text: Scratch.translate(block.text),
194
- arguments: Object.fromEntries(
195
- Object.entries(block.arguments).map(([name, argument]) => [
196
- name,
197
- {
198
- type: Scratch.ArgumentType[argument.type],
199
- defaultValue: argument.defaultValue
200
- }
201
- ])
202
- )
203
- };
204
- }
205
- }
206
- if (!Scratch.extensions.unsandboxed) {
207
- throw new Error(`${extensionConfig.name} must run unsandboxed.`);
125
+ if (typeof options.video === "object" && options.video !== null) return {
126
+ audio: false,
127
+ video: options.video
128
+ };
129
+ if (options.deviceId) return {
130
+ audio: false,
131
+ video: { deviceId: { exact: options.deviceId } }
132
+ };
133
+ return {
134
+ audio: false,
135
+ video: options.video ?? true
136
+ };
208
137
  }
138
+ var CameraSourceExtension = class {
139
+ constructor() {
140
+ this.sessions = /* @__PURE__ */ new Map();
141
+ this.blockLeases = /* @__PURE__ */ new Map();
142
+ this.devices = [];
143
+ Scratch.vm.runtime.ext_kubohiroyacamerasource = this;
144
+ }
145
+ getInfo() {
146
+ return {
147
+ id: extensionConfig.id,
148
+ name: Scratch.translate(block_definitions_default.extensionName),
149
+ blocks: blockDefinitions.map((block) => this.toScratchBlock(block))
150
+ };
151
+ }
152
+ isCameraRunning(args = {}) {
153
+ const session = this.sessions.get(normalizeId(args.CAMERA_ID));
154
+ return Boolean(session?.stream);
155
+ }
156
+ cameraDeviceIdReporter(args = {}) {
157
+ return this.sessions.get(normalizeId(args.CAMERA_ID))?.activeDeviceId ?? "";
158
+ }
159
+ async startSharedCamera(args = {}) {
160
+ const cameraId = normalizeId(args.CAMERA_ID);
161
+ if (this.blockLeases.has(cameraId)) return;
162
+ const deviceId = optionalText(args.DEVICE_ID);
163
+ const options = {
164
+ owner: "camera-source-block",
165
+ cameraId
166
+ };
167
+ if (deviceId) options.deviceId = deviceId;
168
+ const lease = await this.acquireCamera(options);
169
+ this.blockLeases.set(cameraId, lease);
170
+ }
171
+ async acquireCamera(options = {}) {
172
+ const cameraId = normalizeId(options.cameraId);
173
+ const session = this.session(cameraId);
174
+ const token = Symbol(String(options.owner ?? "camera-lease"));
175
+ if (session.startPromise) await session.startPromise;
176
+ else if (!session.stream) await this.start(session, options);
177
+ session.leases.add(token);
178
+ let released = false;
179
+ return Object.freeze({
180
+ getFrameSource: () => this.getFrameSource(session),
181
+ release: async () => {
182
+ if (released) return;
183
+ released = true;
184
+ session.leases.delete(token);
185
+ if (session.leases.size === 0) this.stopCameraSession(session.cameraId);
186
+ }
187
+ });
188
+ }
189
+ stopSharedCamera(args = {}) {
190
+ this.stopCameraSession(normalizeId(args.CAMERA_ID));
191
+ }
192
+ async refreshCameraDevices() {
193
+ this.devices = (await mediaDevices().enumerateDevices()).filter((device) => device.kind === "videoinput");
194
+ }
195
+ cameraDeviceCount() {
196
+ return this.devices.length;
197
+ }
198
+ cameraDeviceIdAt(args) {
199
+ return this.devices[indexFrom(args.INDEX)]?.deviceId ?? "";
200
+ }
201
+ cameraDeviceLabelAt(args) {
202
+ return this.devices[indexFrom(args.INDEX)]?.label ?? "";
203
+ }
204
+ stopAllCameras() {
205
+ for (const cameraId of [...this.sessions.keys()]) this.stopCameraSession(cameraId);
206
+ this.blockLeases.clear();
207
+ }
208
+ session(cameraId) {
209
+ const existing = this.sessions.get(cameraId);
210
+ if (existing) return existing;
211
+ const session = {
212
+ cameraId,
213
+ leases: /* @__PURE__ */ new Set(),
214
+ stream: null,
215
+ video: null,
216
+ startPromise: null,
217
+ mirrored: false,
218
+ activeDeviceId: ""
219
+ };
220
+ this.sessions.set(cameraId, session);
221
+ return session;
222
+ }
223
+ async start(session, options) {
224
+ session.mirrored = options.mirrored === true;
225
+ session.startPromise = (async () => {
226
+ const stream = await mediaDevices().getUserMedia(videoConstraints(options));
227
+ const video = document.createElement("video");
228
+ video.muted = true;
229
+ video.playsInline = true;
230
+ video.srcObject = stream;
231
+ await video.play();
232
+ session.stream = stream;
233
+ session.video = video;
234
+ this.updateActiveDevice(session);
235
+ })();
236
+ try {
237
+ await session.startPromise;
238
+ } catch (error) {
239
+ this.stopCameraSession(session.cameraId);
240
+ throw error;
241
+ }
242
+ }
243
+ updateActiveDevice(session) {
244
+ const settings = (session.stream?.getVideoTracks()[0] ?? null)?.getSettings();
245
+ session.activeDeviceId = typeof settings?.deviceId === "string" ? settings.deviceId : "";
246
+ }
247
+ getFrameSource(session) {
248
+ if (!session.video || !session.stream) throw new Error("Shared camera is not running.");
249
+ return Object.freeze({
250
+ kind: "video",
251
+ element: session.video,
252
+ width: session.video.videoWidth,
253
+ height: session.video.videoHeight,
254
+ mirrored: session.mirrored,
255
+ deviceId: session.activeDeviceId
256
+ });
257
+ }
258
+ stopCameraSession(cameraId) {
259
+ const session = this.sessions.get(cameraId);
260
+ if (!session) return;
261
+ session.stream?.getTracks().forEach((track) => track.stop());
262
+ if (session.video) session.video.srcObject = null;
263
+ session.stream = null;
264
+ session.video = null;
265
+ session.startPromise = null;
266
+ session.activeDeviceId = "";
267
+ session.leases.clear();
268
+ this.sessions.delete(cameraId);
269
+ this.blockLeases.delete(cameraId);
270
+ }
271
+ toScratchBlock(block) {
272
+ return {
273
+ opcode: block.opcode,
274
+ blockType: Scratch.BlockType[block.blockType],
275
+ text: Scratch.translate(block.text),
276
+ arguments: Object.fromEntries(Object.entries(block.arguments).map(([name, argument]) => [name, {
277
+ type: Scratch.ArgumentType[argument.type],
278
+ defaultValue: argument.defaultValue
279
+ }]))
280
+ };
281
+ }
282
+ };
283
+ //#endregion
284
+ //#region src/index.ts
285
+ if (extensionConfig.unsandboxed && !Scratch.extensions.unsandboxed) throw new Error(`${extensionConfig.name} must run unsandboxed.`);
209
286
  Scratch.extensions.register(new CameraSourceExtension());
287
+ //#endregion
210
288
 
211
289
  })(Scratch);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubohiroya/turbowarp-camera-source",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "author": "Hiroya Kubo <hiroya@cuc.ac.jp>",
5
5
  "description": "A TurboWarp capability extension for sharing one MediaDevices camera stream across extensions.",
6
6
  "type": "module",
@@ -29,34 +29,17 @@
29
29
  "access": "public",
30
30
  "registry": "https://registry.npmjs.org/"
31
31
  },
32
- "packageManager": "pnpm@11.18.0",
33
32
  "engines": {
34
- "node": ">=22"
35
- },
36
- "scripts": {
37
- "dev": "vite build --watch",
38
- "typecheck": "tsc --noEmit",
39
- "build": "vite build",
40
- "lint": "eslint src tests vite.config.ts",
41
- "test": "vitest run",
42
- "docs": "node scripts/generate-readme.mjs",
43
- "docs:check": "pnpm run docs && git diff --exit-code -- README.md",
44
- "docs:pages:check": "node scripts/check-pages.mjs",
45
- "repo:check": "node scripts/check-repo.mjs",
46
- "pack:check": "npm pack --dry-run --ignore-scripts",
47
- "release:check": "pnpm publish --dry-run --access public --no-git-checks",
48
- "check": "pnpm run typecheck && pnpm run lint && pnpm run test && pnpm run docs:check && pnpm run docs:pages:check && pnpm run check:dist && pnpm run repo:check && pnpm run pack:check",
49
- "check:dist": "pnpm run build && node scripts/check-dist.mjs",
50
- "prepack": "pnpm run check"
33
+ "node": ">=22.18.0"
51
34
  },
52
35
  "devDependencies": {
53
36
  "@eslint/js": "^9.39.5",
54
- "@kubohiroya/vite-plugin-turbowarp-extension": "0.1.1",
37
+ "@kubohiroya/vite-plugin-turbowarp-extension": "0.4.0",
55
38
  "@types/node": "^24.13.3",
56
39
  "eslint": "^9.39.5",
57
40
  "typescript": "^5.9.3",
58
41
  "typescript-eslint": "^8.66.0",
59
- "vite": "^7.3.6",
42
+ "vite": "^8.2.2",
60
43
  "vitest": "^4.1.10"
61
44
  },
62
45
  "keywords": [
@@ -66,5 +49,20 @@
66
49
  "camera",
67
50
  "media-devices",
68
51
  "getusermedia"
69
- ]
70
- }
52
+ ],
53
+ "scripts": {
54
+ "dev": "vite build --watch",
55
+ "typecheck": "tsc --noEmit",
56
+ "build": "vite build",
57
+ "lint": "eslint src tests vite.config.ts",
58
+ "test": "vitest run",
59
+ "docs": "node scripts/generate-readme.ts",
60
+ "docs:check": "pnpm run docs && git diff --exit-code -- README.md",
61
+ "docs:pages:check": "node scripts/check-pages.ts",
62
+ "repo:check": "node scripts/check-repo.ts",
63
+ "pack:check": "npm pack --dry-run --ignore-scripts",
64
+ "release:check": "pnpm publish --dry-run --access public --no-git-checks",
65
+ "check": "pnpm run typecheck && pnpm run lint && pnpm run test && pnpm run docs:check && pnpm run docs:pages:check && pnpm run check:dist && pnpm run repo:check && pnpm run pack:check",
66
+ "check:dist": "pnpm run build && node scripts/check-dist.ts"
67
+ }
68
+ }