@turbowarp/types 0.0.13 → 0.0.14

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.
@@ -1,4 +1,4 @@
1
- name: Deploy playground
1
+ name: Deploy documentation to GitHub Pages
2
2
 
3
3
  on:
4
4
  workflow_dispatch:
@@ -13,20 +13,19 @@ jobs:
13
13
  build:
14
14
  runs-on: ubuntu-latest
15
15
  steps:
16
- - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
16
+ - uses: actions/checkout@v6
17
17
  with:
18
18
  persist-credentials: false
19
19
  - name: Install Node.js
20
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
20
+ uses: actions/setup-node@v6
21
21
  with:
22
- node-version: 20
23
- cache: npm
22
+ node-version: 24
24
23
  - name: Install dependencies
25
24
  run: npm ci
26
25
  - name: Build documentation
27
26
  run: npm run build
28
27
  - name: Upload artifact
29
- uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa
28
+ uses: actions/upload-pages-artifact@v4
30
29
  with:
31
30
  path: ./docs/
32
31
 
@@ -42,4 +41,4 @@ jobs:
42
41
  steps:
43
42
  - name: Deploy to GitHub Pages
44
43
  id: deployment
45
- uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e
44
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,22 @@
1
+ name: Publish to npm
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ permissions:
9
+ id-token: write
10
+ contents: read
11
+
12
+ jobs:
13
+ publish:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v6
17
+ - uses: actions/setup-node@v6
18
+ with:
19
+ node-version: 24
20
+ - run: npm ci
21
+ - run: npm test
22
+ - run: npm publish
@@ -9,14 +9,13 @@ jobs:
9
9
  runs-on: ubuntu-latest
10
10
 
11
11
  steps:
12
- - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
12
+ - uses: actions/checkout@v6
13
13
  with:
14
14
  persist-credentials: false
15
15
  - name: Setup Node.js
16
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
16
+ uses: actions/setup-node@v6
17
17
  with:
18
- node-version: 20
19
- cache: npm
18
+ node-version: 24
20
19
  - name: Install dependencies
21
20
  run: npm ci
22
21
  - name: Validate TypeScript
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turbowarp/types",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "description": "Type definitions for the Scratch VM and editor",
5
5
  "keywords": [
6
6
  "scratch"
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "homepage": "https://github.com/TurboWarp/types#readme",
28
28
  "devDependencies": {
29
- "typedoc": "^0.25.12",
30
- "typescript": "^4.7.4"
29
+ "typedoc": "^0.28.15",
30
+ "typescript": "^5.9.3"
31
31
  }
32
32
  }
@@ -28,7 +28,7 @@ declare namespace ScratchStorage {
28
28
  }
29
29
 
30
30
  class Asset {
31
- constructor(assetType: AssetType, assetId: string, dataFormat: DataFormat | null, data: ArrayBuffer, generateId?: boolean);
31
+ constructor(assetType: AssetType, assetId: string, dataFormat: DataFormat | null, data: Uint8Array, generateId?: boolean);
32
32
 
33
33
  assetType: AssetType;
34
34
 
@@ -39,7 +39,7 @@ declare namespace ScratchStorage {
39
39
  */
40
40
  assetId: string;
41
41
 
42
- setData(data: ArrayBuffer, dataFormat: DataFormat, generateId?: boolean): void;
42
+ setData(data: Uint8Array, dataFormat: DataFormat, generateId?: boolean): void;
43
43
  encodeTextData(text: string, dataFormat: DataFormat, generateId?: boolean): void;
44
44
 
45
45
  decodeText(): string;
@@ -55,7 +55,7 @@ declare namespace ScratchStorage {
55
55
 
56
56
  interface Helper {
57
57
  load(assetType: AssetType, assetId: string, dataFormat: DataFormat): Promise<Asset>;
58
- store(assetType: AssetType, dataFormat: DataFormat, data: ArrayBuffer, assetId: string): Promise<unknown>;
58
+ store(assetType: AssetType, dataFormat: DataFormat, data: Uint8Array, assetId: string): Promise<unknown>;
59
59
  }
60
60
  }
61
61
 
@@ -72,14 +72,14 @@ declare class ScratchStorage {
72
72
  */
73
73
  get(assetId: string): ScratchStorage.Asset | null;
74
74
 
75
- cache(assetType: ScratchStorage.AssetType, dataFormat: ScratchStorage.DataFormat, data: ArrayBuffer, assetId: string): string;
75
+ cache(assetType: ScratchStorage.AssetType, dataFormat: ScratchStorage.DataFormat, data: Uint8Array, assetId: string): string;
76
76
 
77
77
  load(assetType: ScratchStorage.AssetType, assetId: string, dataFormat: ScratchStorage.DataFormat): Promise<ScratchStorage.Asset | null>;
78
78
 
79
- store(assetType: ScratchStorage.Asset, dataFormat: ScratchStorage.DataFormat, data: ArrayBuffer, assetId: string): Promise<unknown>;
79
+ store(assetType: ScratchStorage.Asset, dataFormat: ScratchStorage.DataFormat, data: Uint8Array, assetId: string): Promise<unknown>;
80
80
 
81
- createAsset(assetType: ScratchStorage.AssetType, dataFormat: ScratchStorage.DataFormat, data: ArrayBuffer, assetId: null, generateId: true): ScratchStorage.Asset;
82
- createAsset(assetType: ScratchStorage.AssetType, dataFormat: ScratchStorage.DataFormat, data: ArrayBuffer, assetId: string, generateId?: boolean): ScratchStorage.Asset;
81
+ createAsset(assetType: ScratchStorage.AssetType, dataFormat: ScratchStorage.DataFormat, data: Uint8Array, assetId: null, generateId: true): ScratchStorage.Asset;
82
+ createAsset(assetType: ScratchStorage.AssetType, dataFormat: ScratchStorage.DataFormat, data: Uint8Array, assetId: string, generateId?: boolean): ScratchStorage.Asset;
83
83
 
84
84
  addWebStore(types: ScratchStorage.AssetType[], getFunction: ScratchStorage.UrlFunction, createFunction?: ScratchStorage.UrlFunction, updateFunction?: ScratchStorage.UrlFunction): void;
85
85
 
@@ -41,9 +41,9 @@ declare namespace VM {
41
41
  assetId: string;
42
42
 
43
43
  /**
44
- * The md5 + file extension of this asset.
44
+ * The md5 + file extension of this asset. May be missing.
45
45
  */
46
- md5: string;
46
+ md5?: string;
47
47
 
48
48
  name: string;
49
49
 
@@ -740,12 +740,33 @@ declare namespace VM {
740
740
  // TODO
741
741
  }
742
742
 
743
- interface Profiler {
744
- // TODO
743
+ interface ProfilerFrame {
744
+ id: number;
745
+ totalTime: number;
746
+ selfTime: number;
747
+ arg: unknown;
748
+ depth: number;
749
+ count: number;
745
750
  }
746
751
 
747
- interface ProfilerFrame {
748
- // TODO
752
+ type FrameCallback = (frame: ProfilerFrame) => void;
753
+
754
+ interface Profiler {
755
+ records: unknown[];
756
+ increments: ProfilerFrame[];
757
+ counters: ProfilerFrame[];
758
+ nullFrame: ProfilerFrame;
759
+ _stack: ProfilerFrame[];
760
+ onFrame: FrameCallback;
761
+ START: 0;
762
+ STOP: 1;
763
+ start(id: number, arg: unknown): void;
764
+ stop(): void;
765
+ increment(id: number): void;
766
+ frame(id: string, arg: unknown): ProfilerFrame;
767
+ reportFrames(): void;
768
+ idByName(name: string): number;
769
+ nameById(id: number): string;
749
770
  }
750
771
 
751
772
  interface Sequencer {
@@ -1181,7 +1202,7 @@ declare namespace VM {
1181
1202
 
1182
1203
  _stopThread(thread: Thread): void;
1183
1204
 
1184
- _restartThread(thread: Thread): void;
1205
+ _restartThread(thread: Thread): Thread;
1185
1206
 
1186
1207
  /**
1187
1208
  * A thread is considered active if it is in the thread list and is not STATUS_DONE.
@@ -1199,7 +1220,7 @@ declare namespace VM {
1199
1220
 
1200
1221
  _getMonitorThreadCount(threads: Thread[]): number;
1201
1222
 
1202
- startHats(opcode: string, matchFields?: Record<string, unknown>, target?: Target): Thread[];
1223
+ startHats(opcode: string, matchFields?: Record<string, unknown>, target?: Target): Thread[] | undefined;
1203
1224
 
1204
1225
  toggleScript(topBlockId: string, options?: {
1205
1226
  target?: string;