@types/node 20.12.3 → 20.12.5
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.
- node/README.md +1 -1
- node/http2.d.ts +6 -0
- node/index.d.ts +1 -0
- node/package.json +2 -2
- node/sea.d.ts +153 -0
node/README.md
CHANGED
|
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Fri, 05 Apr 2024 22:07:19 GMT
|
|
12
12
|
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
|
13
13
|
|
|
14
14
|
# Credits
|
node/http2.d.ts
CHANGED
|
@@ -2094,7 +2094,13 @@ declare module "http2" {
|
|
|
2094
2094
|
const HTTP2_HEADER_ACCEPT_LANGUAGE: string;
|
|
2095
2095
|
const HTTP2_HEADER_ACCEPT_RANGES: string;
|
|
2096
2096
|
const HTTP2_HEADER_ACCEPT: string;
|
|
2097
|
+
const HTTP2_HEADER_ACCESS_CONTROL_ALLOW_CREDENTIALS: string;
|
|
2098
|
+
const HTTP2_HEADER_ACCESS_CONTROL_ALLOW_HEADERS: string;
|
|
2099
|
+
const HTTP2_HEADER_ACCESS_CONTROL_ALLOW_METHODS: string;
|
|
2097
2100
|
const HTTP2_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN: string;
|
|
2101
|
+
const HTTP2_HEADER_ACCESS_CONTROL_EXPOSE_HEADERS: string;
|
|
2102
|
+
const HTTP2_HEADER_ACCESS_CONTROL_REQUEST_HEADERS: string;
|
|
2103
|
+
const HTTP2_HEADER_ACCESS_CONTROL_REQUEST_METHOD: string;
|
|
2098
2104
|
const HTTP2_HEADER_AGE: string;
|
|
2099
2105
|
const HTTP2_HEADER_ALLOW: string;
|
|
2100
2106
|
const HTTP2_HEADER_AUTHORIZATION: string;
|
node/index.d.ts
CHANGED
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
/// <reference path="readline.d.ts" />
|
|
67
67
|
/// <reference path="readline/promises.d.ts" />
|
|
68
68
|
/// <reference path="repl.d.ts" />
|
|
69
|
+
/// <reference path="sea.d.ts" />
|
|
69
70
|
/// <reference path="stream.d.ts" />
|
|
70
71
|
/// <reference path="stream/promises.d.ts" />
|
|
71
72
|
/// <reference path="stream/consumers.d.ts" />
|
node/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "20.12.
|
|
3
|
+
"version": "20.12.5",
|
|
4
4
|
"description": "TypeScript definitions for node",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
|
6
6
|
"license": "MIT",
|
|
@@ -212,6 +212,6 @@
|
|
|
212
212
|
"dependencies": {
|
|
213
213
|
"undici-types": "~5.26.4"
|
|
214
214
|
},
|
|
215
|
-
"typesPublisherContentHash": "
|
|
215
|
+
"typesPublisherContentHash": "f9a85b9cb14aca71630c642fb895730f6aa88fce83f053df4ded37225b6b0558",
|
|
216
216
|
"typeScriptVersion": "4.7"
|
|
217
217
|
}
|
node/sea.d.ts
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This feature allows the distribution of a Node.js application conveniently to a
|
|
3
|
+
* system that does not have Node.js installed.
|
|
4
|
+
*
|
|
5
|
+
* Node.js supports the creation of [single executable applications](https://github.com/nodejs/single-executable) by allowing
|
|
6
|
+
* the injection of a blob prepared by Node.js, which can contain a bundled script,
|
|
7
|
+
* into the `node` binary. During start up, the program checks if anything has been
|
|
8
|
+
* injected. If the blob is found, it executes the script in the blob. Otherwise
|
|
9
|
+
* Node.js operates as it normally does.
|
|
10
|
+
*
|
|
11
|
+
* The single executable application feature currently only supports running a
|
|
12
|
+
* single embedded script using the `CommonJS` module system.
|
|
13
|
+
*
|
|
14
|
+
* Users can create a single executable application from their bundled script
|
|
15
|
+
* with the `node` binary itself and any tool which can inject resources into the
|
|
16
|
+
* binary.
|
|
17
|
+
*
|
|
18
|
+
* Here are the steps for creating a single executable application using one such
|
|
19
|
+
* tool, [postject](https://github.com/nodejs/postject):
|
|
20
|
+
*
|
|
21
|
+
* 1. Create a JavaScript file:
|
|
22
|
+
* ```bash
|
|
23
|
+
* echo 'console.log(`Hello, ${process.argv[2]}!`);' > hello.js
|
|
24
|
+
* ```
|
|
25
|
+
* 2. Create a configuration file building a blob that can be injected into the
|
|
26
|
+
* single executable application (see `Generating single executable preparation blobs` for details):
|
|
27
|
+
* ```bash
|
|
28
|
+
* echo '{ "main": "hello.js", "output": "sea-prep.blob" }' > sea-config.json
|
|
29
|
+
* ```
|
|
30
|
+
* 3. Generate the blob to be injected:
|
|
31
|
+
* ```bash
|
|
32
|
+
* node --experimental-sea-config sea-config.json
|
|
33
|
+
* ```
|
|
34
|
+
* 4. Create a copy of the `node` executable and name it according to your needs:
|
|
35
|
+
* * On systems other than Windows:
|
|
36
|
+
* ```bash
|
|
37
|
+
* cp $(command -v node) hello
|
|
38
|
+
* ```
|
|
39
|
+
* * On Windows:
|
|
40
|
+
* ```text
|
|
41
|
+
* node -e "require('fs').copyFileSync(process.execPath, 'hello.exe')"
|
|
42
|
+
* ```
|
|
43
|
+
* The `.exe` extension is necessary.
|
|
44
|
+
* 5. Remove the signature of the binary (macOS and Windows only):
|
|
45
|
+
* * On macOS:
|
|
46
|
+
* ```bash
|
|
47
|
+
* codesign --remove-signature hello
|
|
48
|
+
* ```
|
|
49
|
+
* * On Windows (optional):
|
|
50
|
+
* [signtool](https://learn.microsoft.com/en-us/windows/win32/seccrypto/signtool) can be used from the installed [Windows SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/).
|
|
51
|
+
* If this step is
|
|
52
|
+
* skipped, ignore any signature-related warning from postject.
|
|
53
|
+
* ```powershell
|
|
54
|
+
* signtool remove /s hello.exe
|
|
55
|
+
* ```
|
|
56
|
+
* 6. Inject the blob into the copied binary by running `postject` with
|
|
57
|
+
* the following options:
|
|
58
|
+
* * `hello` / `hello.exe` \- The name of the copy of the `node` executable
|
|
59
|
+
* created in step 4.
|
|
60
|
+
* * `NODE_SEA_BLOB` \- The name of the resource / note / section in the binary
|
|
61
|
+
* where the contents of the blob will be stored.
|
|
62
|
+
* * `sea-prep.blob` \- The name of the blob created in step 1.
|
|
63
|
+
* * `--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2` \- The [fuse](https://www.electronjs.org/docs/latest/tutorial/fuses) used by the Node.js project to detect if a file has been
|
|
64
|
+
* injected.
|
|
65
|
+
* * `--macho-segment-name NODE_SEA` (only needed on macOS) - The name of the
|
|
66
|
+
* segment in the binary where the contents of the blob will be
|
|
67
|
+
* stored.
|
|
68
|
+
* To summarize, here is the required command for each platform:
|
|
69
|
+
* * On Linux:
|
|
70
|
+
* ```bash
|
|
71
|
+
* npx postject hello NODE_SEA_BLOB sea-prep.blob \
|
|
72
|
+
* --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
|
|
73
|
+
* ```
|
|
74
|
+
* * On Windows - PowerShell:
|
|
75
|
+
* ```powershell
|
|
76
|
+
* npx postject hello.exe NODE_SEA_BLOB sea-prep.blob `
|
|
77
|
+
* --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
|
|
78
|
+
* ```
|
|
79
|
+
* * On Windows - Command Prompt:
|
|
80
|
+
* ```text
|
|
81
|
+
* npx postject hello.exe NODE_SEA_BLOB sea-prep.blob ^
|
|
82
|
+
* --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
|
|
83
|
+
* ```
|
|
84
|
+
* * On macOS:
|
|
85
|
+
* ```bash
|
|
86
|
+
* npx postject hello NODE_SEA_BLOB sea-prep.blob \
|
|
87
|
+
* --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 \
|
|
88
|
+
* --macho-segment-name NODE_SEA
|
|
89
|
+
* ```
|
|
90
|
+
* 7. Sign the binary (macOS and Windows only):
|
|
91
|
+
* * On macOS:
|
|
92
|
+
* ```bash
|
|
93
|
+
* codesign --sign - hello
|
|
94
|
+
* ```
|
|
95
|
+
* * On Windows (optional):
|
|
96
|
+
* A certificate needs to be present for this to work. However, the unsigned
|
|
97
|
+
* binary would still be runnable.
|
|
98
|
+
* ```powershell
|
|
99
|
+
* signtool sign /fd SHA256 hello.exe
|
|
100
|
+
* ```
|
|
101
|
+
* 8. Run the binary:
|
|
102
|
+
* * On systems other than Windows
|
|
103
|
+
* ```console
|
|
104
|
+
* $ ./hello world
|
|
105
|
+
* Hello, world!
|
|
106
|
+
* ```
|
|
107
|
+
* * On Windows
|
|
108
|
+
* ```console
|
|
109
|
+
* $ .\hello.exe world
|
|
110
|
+
* Hello, world!
|
|
111
|
+
* ```
|
|
112
|
+
* @since v19.7.0, v18.16.0
|
|
113
|
+
* @experimental
|
|
114
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.12.0/src/node_sea.cc)
|
|
115
|
+
*/
|
|
116
|
+
declare module "node:sea" {
|
|
117
|
+
type AssetKey = string;
|
|
118
|
+
/**
|
|
119
|
+
* @since v20.12.0
|
|
120
|
+
* @return Whether this script is running inside a single-executable application.
|
|
121
|
+
*/
|
|
122
|
+
function isSea(): boolean;
|
|
123
|
+
/**
|
|
124
|
+
* This method can be used to retrieve the assets configured to be bundled into the
|
|
125
|
+
* single-executable application at build time.
|
|
126
|
+
* An error is thrown when no matching asset can be found.
|
|
127
|
+
* @since v20.12.0
|
|
128
|
+
*/
|
|
129
|
+
function getAsset(key: AssetKey): ArrayBuffer;
|
|
130
|
+
function getAsset(key: AssetKey, encoding: string): string;
|
|
131
|
+
/**
|
|
132
|
+
* Similar to `sea.getAsset()`, but returns the result in a [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob).
|
|
133
|
+
* An error is thrown when no matching asset can be found.
|
|
134
|
+
* @since v20.12.0
|
|
135
|
+
*/
|
|
136
|
+
function getAssetAsBlob(key: AssetKey, options?: {
|
|
137
|
+
type: string;
|
|
138
|
+
}): Blob;
|
|
139
|
+
/**
|
|
140
|
+
* This method can be used to retrieve the assets configured to be bundled into the
|
|
141
|
+
* single-executable application at build time.
|
|
142
|
+
* An error is thrown when no matching asset can be found.
|
|
143
|
+
*
|
|
144
|
+
* Unlike `sea.getRawAsset()` or `sea.getAssetAsBlob()`, this method does not
|
|
145
|
+
* return a copy. Instead, it returns the raw asset bundled inside the executable.
|
|
146
|
+
*
|
|
147
|
+
* For now, users should avoid writing to the returned array buffer. If the
|
|
148
|
+
* injected section is not marked as writable or not aligned properly,
|
|
149
|
+
* writes to the returned array buffer is likely to result in a crash.
|
|
150
|
+
* @since v20.12.0
|
|
151
|
+
*/
|
|
152
|
+
function getRawAsset(key: AssetKey): string | ArrayBuffer;
|
|
153
|
+
}
|