Skip to content

Commit e4aa5b5

Browse files
committed
docs(parser/napi, linter/plugins): add JSDoc comments to raw transfer constants (#20286)
Comments-only change. Add JSDoc comments to the constants related to raw transfer in generated files `constants.js` / `constants.ts`. There are now a lot of constants, and it wasn't clear what they all mean.
1 parent f339f10 commit e4aa5b5

File tree

3 files changed

+141
-0
lines changed

3 files changed

+141
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,62 @@
11
// Auto-generated code, DO NOT EDIT DIRECTLY!
22
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/raw_transfer.rs`.
33

4+
/**
5+
* Total size of the transfer buffer in bytes (block size minus allocator metadata).
6+
*/
47
export const BUFFER_SIZE = 2147483616;
8+
9+
/**
10+
* Required alignment of the transfer buffer (4 GiB).
11+
*/
512
export const BUFFER_ALIGN = 4294967296;
13+
14+
/**
15+
* Size of the active data area in bytes (buffer size minus raw metadata and chunk footer).
16+
*/
617
export const ACTIVE_SIZE = 2147483552;
18+
19+
/**
20+
* Byte offset of the data pointer within the buffer, divided by 4 (for `Uint32Array` indexing).
21+
*/
722
export const DATA_POINTER_POS_32 = 536870900;
23+
24+
/**
25+
* Byte offset of the `is_ts` flag within the buffer.
26+
*/
827
export const IS_TS_FLAG_POS = 2147483612;
28+
29+
/**
30+
* Byte offset of the `is_jsx` flag within the buffer.
31+
*/
932
export const IS_JSX_FLAG_POS = 2147483613;
33+
34+
/**
35+
* Byte offset of the `has_bom` flag within the buffer.
36+
*/
1037
export const HAS_BOM_FLAG_POS = 2147483614;
38+
39+
/**
40+
* Byte offset of the tokens offset within the buffer, divided by 4 (for `Uint32Array` indexing).
41+
*/
1142
export const TOKENS_OFFSET_POS_32 = 536870901;
43+
44+
/**
45+
* Byte offset of the tokens length within the buffer, divided by 4 (for `Uint32Array` indexing).
46+
*/
1247
export const TOKENS_LEN_POS_32 = 536870902;
48+
49+
/**
50+
* Byte offset of the `program` field, relative to start of `RawTransferData`.
51+
*/
1352
export const PROGRAM_OFFSET = 0;
53+
54+
/**
55+
* Byte offset of pointer to start of source text, relative to start of `Program`.
56+
*/
1457
export const SOURCE_START_OFFSET = 8;
58+
59+
/**
60+
* Byte offset of length of source text, relative to start of `Program`.
61+
*/
1562
export const SOURCE_LEN_OFFSET = 16;
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,62 @@
11
// Auto-generated code, DO NOT EDIT DIRECTLY!
22
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/raw_transfer.rs`.
33

4+
/**
5+
* Total size of the transfer buffer in bytes (block size minus allocator metadata).
6+
*/
47
export const BUFFER_SIZE = 2147483616;
8+
9+
/**
10+
* Required alignment of the transfer buffer (4 GiB).
11+
*/
512
export const BUFFER_ALIGN = 4294967296;
13+
14+
/**
15+
* Size of the active data area in bytes (buffer size minus raw metadata and chunk footer).
16+
*/
617
export const ACTIVE_SIZE = 2147483552;
18+
19+
/**
20+
* Byte offset of the data pointer within the buffer, divided by 4 (for `Uint32Array` indexing).
21+
*/
722
export const DATA_POINTER_POS_32 = 536870900;
23+
24+
/**
25+
* Byte offset of the `is_ts` flag within the buffer.
26+
*/
827
export const IS_TS_FLAG_POS = 2147483612;
28+
29+
/**
30+
* Byte offset of the `is_jsx` flag within the buffer.
31+
*/
932
export const IS_JSX_FLAG_POS = 2147483613;
33+
34+
/**
35+
* Byte offset of the `has_bom` flag within the buffer.
36+
*/
1037
export const HAS_BOM_FLAG_POS = 2147483614;
38+
39+
/**
40+
* Byte offset of the tokens offset within the buffer, divided by 4 (for `Uint32Array` indexing).
41+
*/
1142
export const TOKENS_OFFSET_POS_32 = 536870901;
43+
44+
/**
45+
* Byte offset of the tokens length within the buffer, divided by 4 (for `Uint32Array` indexing).
46+
*/
1247
export const TOKENS_LEN_POS_32 = 536870902;
48+
49+
/**
50+
* Byte offset of the `program` field, relative to start of `RawTransferData`.
51+
*/
1352
export const PROGRAM_OFFSET = 0;
53+
54+
/**
55+
* Byte offset of pointer to start of source text, relative to start of `Program`.
56+
*/
1457
export const SOURCE_START_OFFSET = 8;
58+
59+
/**
60+
* Byte offset of length of source text, relative to start of `Program`.
61+
*/
1562
export const SOURCE_LEN_OFFSET = 16;

tasks/ast_tools/src/generators/raw_transfer.rs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,17 +1343,64 @@ fn generate_constants(consts: Constants) -> (String, TokenStream) {
13431343

13441344
#[rustfmt::skip]
13451345
let js_output = format!("
1346+
/**
1347+
* Total size of the transfer buffer in bytes (block size minus allocator metadata).
1348+
*/
13461349
export const BUFFER_SIZE = {buffer_size};
1350+
1351+
/**
1352+
* Required alignment of the transfer buffer (4 GiB).
1353+
*/
13471354
export const BUFFER_ALIGN = {BLOCK_ALIGN};
1355+
1356+
/**
1357+
* Size of the active data area in bytes (buffer size minus raw metadata and chunk footer).
1358+
*/
13481359
export const ACTIVE_SIZE = {active_size};
1360+
1361+
/**
1362+
* Byte offset of the data pointer within the buffer, divided by 4 (for `Uint32Array` indexing).
1363+
*/
13491364
export const DATA_POINTER_POS_32 = {data_pointer_pos_32};
1365+
1366+
/**
1367+
* Byte offset of the `is_ts` flag within the buffer.
1368+
*/
13501369
export const IS_TS_FLAG_POS = {is_ts_pos};
1370+
1371+
/**
1372+
* Byte offset of the `is_jsx` flag within the buffer.
1373+
*/
13511374
export const IS_JSX_FLAG_POS = {is_jsx_pos};
1375+
1376+
/**
1377+
* Byte offset of the `has_bom` flag within the buffer.
1378+
*/
13521379
export const HAS_BOM_FLAG_POS = {has_bom_pos};
1380+
1381+
/**
1382+
* Byte offset of the tokens offset within the buffer, divided by 4 (for `Uint32Array` indexing).
1383+
*/
13531384
export const TOKENS_OFFSET_POS_32 = {tokens_offset_pos_32};
1385+
1386+
/**
1387+
* Byte offset of the tokens length within the buffer, divided by 4 (for `Uint32Array` indexing).
1388+
*/
13541389
export const TOKENS_LEN_POS_32 = {tokens_len_pos_32};
1390+
1391+
/**
1392+
* Byte offset of the `program` field, relative to start of `RawTransferData`.
1393+
*/
13551394
export const PROGRAM_OFFSET = {program_offset};
1395+
1396+
/**
1397+
* Byte offset of pointer to start of source text, relative to start of `Program`.
1398+
*/
13561399
export const SOURCE_START_OFFSET = {source_start_offset};
1400+
1401+
/**
1402+
* Byte offset of length of source text, relative to start of `Program`.
1403+
*/
13571404
export const SOURCE_LEN_OFFSET = {source_len_offset};
13581405
");
13591406

0 commit comments

Comments
 (0)