node-linux-ppc64le 21.7.3 → 22.0.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +335 -1514
  2. package/README.md +22 -18
  3. package/bin/node +0 -0
  4. package/include/node/common.gypi +29 -2
  5. package/include/node/config.gypi +6 -4
  6. package/include/node/cppgc/internal/api-constants.h +1 -1
  7. package/include/node/cppgc/type-traits.h +25 -4
  8. package/include/node/node.h +23 -2
  9. package/include/node/node_api.h +1 -1
  10. package/include/node/node_buffer.h +1 -1
  11. package/include/node/node_version.h +4 -4
  12. package/include/node/v8-array-buffer.h +6 -0
  13. package/include/node/v8-callbacks.h +6 -12
  14. package/include/node/v8-container.h +54 -0
  15. package/include/node/v8-context.h +51 -22
  16. package/include/node/v8-embedder-heap.h +19 -3
  17. package/include/node/v8-embedder-state-scope.h +2 -1
  18. package/include/node/v8-exception.h +15 -9
  19. package/include/node/v8-forward.h +1 -0
  20. package/include/node/v8-function-callback.h +129 -20
  21. package/include/node/v8-handle-base.h +32 -80
  22. package/include/node/v8-internal.h +472 -65
  23. package/include/node/v8-isolate.h +86 -51
  24. package/include/node/v8-local-handle.h +257 -31
  25. package/include/node/v8-memory-span.h +157 -2
  26. package/include/node/v8-message.h +22 -3
  27. package/include/node/v8-object.h +29 -10
  28. package/include/node/v8-persistent-handle.h +5 -3
  29. package/include/node/v8-platform.h +81 -44
  30. package/include/node/v8-script.h +61 -11
  31. package/include/node/v8-snapshot.h +94 -23
  32. package/include/node/v8-statistics.h +10 -24
  33. package/include/node/v8-template.h +410 -131
  34. package/include/node/v8-traced-handle.h +81 -46
  35. package/include/node/v8-typed-array.h +115 -7
  36. package/include/node/v8-value.h +92 -4
  37. package/include/node/v8-version.h +4 -4
  38. package/include/node/v8config.h +35 -10
  39. package/package.json +1 -1
  40. package/share/doc/node/gdbinit +77 -38
  41. package/share/doc/node/lldb_commands.py +59 -29
  42. package/share/man/man1/node.1 +7 -6
package/README.md CHANGED
@@ -195,7 +195,7 @@ For information about the governance of the Node.js project, see
195
195
  * [ronag](https://github.com/ronag) -
196
196
  **Robert Nagy** <<ronagy@icloud.com>>
197
197
  * [ruyadorno](https://github.com/ruyadorno) -
198
- **Ruy Adorno** <<ruyadorno@google.com>> (he/him)
198
+ **Ruy Adorno** <<ruy@vlt.sh>> (he/him)
199
199
  * [ShogunPanda](https://github.com/ShogunPanda) -
200
200
  **Paolo Insogna** <<paolo@cowtech.it>> (he/him)
201
201
  * [targos](https://github.com/targos) -
@@ -215,20 +215,10 @@ For information about the governance of the Node.js project, see
215
215
  **Colin Ihrig** <<cjihrig@gmail.com>> (he/him)
216
216
  * [codebytere](https://github.com/codebytere) -
217
217
  **Shelley Vohr** <<shelley.vohr@gmail.com>> (she/her)
218
- * [danbev](https://github.com/danbev) -
219
- **Daniel Bevenius** <<daniel.bevenius@gmail.com>> (he/him)
220
218
  * [danielleadams](https://github.com/danielleadams) -
221
219
  **Danielle Adams** <<adamzdanielle@gmail.com>> (she/her)
222
- * [fhinkel](https://github.com/fhinkel) -
223
- **Franziska Hinkelmann** <<franziska.hinkelmann@gmail.com>> (she/her)
224
- * [gabrielschulhof](https://github.com/gabrielschulhof) -
225
- **Gabriel Schulhof** <<gabrielschulhof@gmail.com>>
226
- * [mscdex](https://github.com/mscdex) -
227
- **Brian White** <<mscdex@mscdex.net>>
228
220
  * [MylesBorins](https://github.com/MylesBorins) -
229
221
  **Myles Borins** <<myles.borins@gmail.com>> (he/him)
230
- * [rvagg](https://github.com/rvagg) -
231
- **Rod Vagg** <<r@va.gg>>
232
222
  * [TimothyGu](https://github.com/TimothyGu) -
233
223
  **Tiancheng "Timothy" Gu** <<timothygu99@gmail.com>> (he/him)
234
224
  * [Trott](https://github.com/Trott) -
@@ -244,10 +234,16 @@ For information about the governance of the Node.js project, see
244
234
  **Anna Henningsen** <<anna@addaleax.net>> (she/her)
245
235
  * [chrisdickinson](https://github.com/chrisdickinson) -
246
236
  **Chris Dickinson** <<christopher.s.dickinson@gmail.com>>
237
+ * [danbev](https://github.com/danbev) -
238
+ **Daniel Bevenius** <<daniel.bevenius@gmail.com>> (he/him)
247
239
  * [evanlucas](https://github.com/evanlucas) -
248
240
  **Evan Lucas** <<evanlucas@me.com>> (he/him)
241
+ * [fhinkel](https://github.com/fhinkel) -
242
+ **Franziska Hinkelmann** <<franziska.hinkelmann@gmail.com>> (she/her)
249
243
  * [Fishrock123](https://github.com/Fishrock123) -
250
244
  **Jeremiah Senkpiel** <<fishrock123@rocketmail.com>> (he/they)
245
+ * [gabrielschulhof](https://github.com/gabrielschulhof) -
246
+ **Gabriel Schulhof** <<gabrielschulhof@gmail.com>>
251
247
  * [gibfahn](https://github.com/gibfahn) -
252
248
  **Gibson Fahnestock** <<gibfahn@gmail.com>> (he/him)
253
249
  * [indutny](https://github.com/indutny) -
@@ -258,6 +254,8 @@ For information about the governance of the Node.js project, see
258
254
  **Josh Gavant** <<josh.gavant@outlook.com>>
259
255
  * [mmarchini](https://github.com/mmarchini) -
260
256
  **Mary Marchini** <<oss@mmarchini.me>> (she/her)
257
+ * [mscdex](https://github.com/mscdex) -
258
+ **Brian White** <<mscdex@mscdex.net>>
261
259
  * [nebrius](https://github.com/nebrius) -
262
260
  **Bryan Hughes** <<bryan@nebri.us>>
263
261
  * [ofrobots](https://github.com/ofrobots) -
@@ -268,6 +266,8 @@ For information about the governance of the Node.js project, see
268
266
  **Bert Belder** <<bertbelder@gmail.com>>
269
267
  * [RaisinTen](https://github.com/RaisinTen) -
270
268
  **Darshan Sen** <<raisinten@gmail.com>> (he/him)
269
+ * [rvagg](https://github.com/rvagg) -
270
+ **Rod Vagg** <<r@va.gg>>
271
271
  * [sam-github](https://github.com/sam-github) -
272
272
  **Sam Roberts** <<vieuxtech@gmail.com>>
273
273
  * [shigeki](https://github.com/shigeki) -
@@ -365,8 +365,6 @@ For information about the governance of the Node.js project, see
365
365
  **Harshitha K P** <<harshitha014@gmail.com>> (she/her)
366
366
  * [himself65](https://github.com/himself65) -
367
367
  **Zeyu "Alex" Yang** <<himself65@outlook.com>> (he/him)
368
- * [iansu](https://github.com/iansu) -
369
- **Ian Sutherland** <<ian@iansutherland.ca>>
370
368
  * [JakobJingleheimer](https://github.com/JakobJingleheimer) -
371
369
  **Jacob Smith** <<jacob@frende.me>> (he/him)
372
370
  * [jasnell](https://github.com/jasnell) -
@@ -440,7 +438,7 @@ For information about the governance of the Node.js project, see
440
438
  * [ronag](https://github.com/ronag) -
441
439
  **Robert Nagy** <<ronagy@icloud.com>>
442
440
  * [ruyadorno](https://github.com/ruyadorno) -
443
- **Ruy Adorno** <<ruyadorno@google.com>> (he/him)
441
+ **Ruy Adorno** <<ruy@vlt.sh>> (he/him)
444
442
  * [ryzokuken](https://github.com/ryzokuken) -
445
443
  **Ujjwal Sharma** <<ryzokuken@disroot.org>> (he/him)
446
444
  * [santigimeno](https://github.com/santigimeno) -
@@ -465,6 +463,8 @@ For information about the governance of the Node.js project, see
465
463
  **Trivikram Kamat** <<trivikr.dev@gmail.com>>
466
464
  * [Trott](https://github.com/Trott) -
467
465
  **Rich Trott** <<rtrott@gmail.com>> (he/him)
466
+ * [UlisesGascon](https://github.com/ulisesgascon) -
467
+ **Ulises Gascón** <<ulisesgascongonzalez@gmail.com>> (he/him)
468
468
  * [vdeturckheim](https://github.com/vdeturckheim) -
469
469
  **Vladimir de Turckheim** <<vlad2t@hotmail.com>> (he/him)
470
470
  * [vmoroz](https://github.com/vmoroz) -
@@ -480,7 +480,7 @@ For information about the governance of the Node.js project, see
480
480
  * [ZYSzys](https://github.com/ZYSzys) -
481
481
  **Yongsheng Zhang** <<zyszys98@gmail.com>> (he/him)
482
482
  * [zcbenz](https://github.com/zcbenz) -
483
- **Cheng Zhao** <zcbenz@gmail.com> (he/him)
483
+ **Cheng Zhao** <<zcbenz@gmail.com>> (he/him)
484
484
 
485
485
  <details>
486
486
 
@@ -553,6 +553,8 @@ For information about the governance of the Node.js project, see
553
553
  **Yang Guo** <<yangguo@chromium.org>> (he/him)
554
554
  * [hiroppy](https://github.com/hiroppy) -
555
555
  **Yuta Hiroto** <<hello@hiroppy.me>> (he/him)
556
+ * [iansu](https://github.com/iansu) -
557
+ **Ian Sutherland** <<ian@iansutherland.ca>>
556
558
  * [iarna](https://github.com/iarna) -
557
559
  **Rebecca Turner** <<me@re-becca.org>>
558
560
  * [imran-iq](https://github.com/imran-iq) -
@@ -761,6 +763,8 @@ Primary GPG keys for Node.js Releasers (some Releasers sign with subkeys):
761
763
  `74F12602B6F1C4E913FAA37AD3A89613643B6201`
762
764
  * **Juan José Arboleda** <<soyjuanarbol@gmail.com>>
763
765
  `DD792F5973C6DE52C432CBDAC77ABFA00DDBF2B7`
766
+ * **Marco Ippolito** <<marcoippolito54@gmail.com>>
767
+ `CC68F5A3106FF448322E48ED27F5E38D5B0A215F`
764
768
  * **Michaël Zasso** <<targos@protonmail.com>>
765
769
  `8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600`
766
770
  * **Myles Borins** <<myles.borins@gmail.com>>
@@ -782,6 +786,7 @@ gpg --keyserver hkps://keys.openpgp.org --recv-keys 4ED778F539E3634C779C87C6D706
782
786
  gpg --keyserver hkps://keys.openpgp.org --recv-keys 141F07595B7B3FFE74309A937405533BE57C7D57
783
787
  gpg --keyserver hkps://keys.openpgp.org --recv-keys 74F12602B6F1C4E913FAA37AD3A89613643B6201
784
788
  gpg --keyserver hkps://keys.openpgp.org --recv-keys DD792F5973C6DE52C432CBDAC77ABFA00DDBF2B7
789
+ gpg --keyserver hkps://keys.openpgp.org --recv-keys CC68F5A3106FF448322E48ED27F5E38D5B0A215F
785
790
  gpg --keyserver hkps://keys.openpgp.org --recv-keys 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600
786
791
  gpg --keyserver hkps://keys.openpgp.org --recv-keys C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8
787
792
  gpg --keyserver hkps://keys.openpgp.org --recv-keys 890C08DB8579162FEE0DF9DB8BEAB4DFCF555EF4
@@ -843,12 +848,11 @@ releases on a rotation basis as outlined in the
843
848
  * Datadog
844
849
  * [bengl](https://github.com/bengl) -
845
850
  **Bryan English** <<bryan@bryanenglish.com>> (he/him)
846
- * NearForm
847
- * [RafaelGSS](https://github.com/RafaelGSS) -
848
- **Rafael Gonzaga** <<rafael.nunu@hotmail.com>> (he/him)
849
851
  * NodeSource
850
852
  * [juanarbol](https://github.com/juanarbol) -
851
853
  **Juan José Arboleda** <<soyjuanarbol@gmail.com>> (he/him)
854
+ * [RafaelGSS](https://github.com/RafaelGSS) -
855
+ **Rafael Gonzaga** <<rafael.nunu@hotmail.com>> (he/him)
852
856
  * Platformatic
853
857
  * [mcollina](https://github.com/mcollina) -
854
858
  **Matteo Collina** <<matteo.collina@gmail.com>> (he/him)
package/bin/node CHANGED
Binary file
@@ -2,6 +2,7 @@
2
2
  'variables': {
3
3
  'configuring_node%': 0,
4
4
  'asan%': 0,
5
+ 'ubsan%': 0,
5
6
  'werror': '', # Turn off -Werror in V8 build.
6
7
  'visibility%': 'hidden', # V8's visibility setting
7
8
  'target_arch%': 'ia32', # set v8's target architecture
@@ -36,7 +37,7 @@
36
37
 
37
38
  # Reset this number to 0 on major V8 upgrades.
38
39
  # Increment by one for each non-official patch applied to deps/v8.
39
- 'v8_embedder_string': '-node.20',
40
+ 'v8_embedder_string': '-node.10',
40
41
 
41
42
  ##### V8 defaults for Node.js #####
42
43
 
@@ -285,7 +286,10 @@
285
286
  'VCCLCompilerTool': {
286
287
  'AdditionalOptions': [
287
288
  '/Zc:__cplusplus',
288
- '-std:c++17'
289
+ # The following option enables c++20 on Windows. This is needed for V8 v12.4+
290
+ '-std:c++20',
291
+ # The following option reduces the "error C1060: compiler is out of heap space"
292
+ '/Zm2000',
289
293
  ],
290
294
  'BufferSecurityCheck': 'true',
291
295
  'DebugInformationFormat': 1, # /Z7 embed info in .obj files
@@ -374,6 +378,29 @@
374
378
  }],
375
379
  ],
376
380
  }],
381
+ ['ubsan == 1 and OS != "mac" and OS != "zos"', {
382
+ 'cflags+': [
383
+ '-fno-omit-frame-pointer',
384
+ '-fsanitize=undefined',
385
+ ],
386
+ 'defines': [ 'UNDEFINED_SANITIZER'],
387
+ 'cflags!': [ '-fno-omit-frame-pointer' ],
388
+ 'ldflags': [ '-fsanitize=undefined' ],
389
+ }],
390
+ ['ubsan == 1 and OS == "mac"', {
391
+ 'xcode_settings': {
392
+ 'OTHER_CFLAGS+': [
393
+ '-fno-omit-frame-pointer',
394
+ '-fsanitize=undefined',
395
+ '-DUNDEFINED_SANITIZER'
396
+ ],
397
+ },
398
+ 'target_conditions': [
399
+ ['_type!="static_library"', {
400
+ 'xcode_settings': {'OTHER_LDFLAGS': ['-fsanitize=undefined']},
401
+ }],
402
+ ],
403
+ }],
377
404
  # The defines bellow must include all things from the external_v8_defines
378
405
  # list in v8/BUILD.gn.
379
406
  ['v8_enable_v8_checks == 1', {
@@ -127,6 +127,7 @@
127
127
  'lib/internal/error_serdes.js',
128
128
  'lib/internal/errors.js',
129
129
  'lib/internal/event_target.js',
130
+ 'lib/internal/events/abort_listener.js',
130
131
  'lib/internal/events/symbols.js',
131
132
  'lib/internal/file.js',
132
133
  'lib/internal/fixed_queue.js',
@@ -164,6 +165,7 @@
164
165
  'lib/internal/main/print_help.js',
165
166
  'lib/internal/main/prof_process.js',
166
167
  'lib/internal/main/repl.js',
168
+ 'lib/internal/main/run.js',
167
169
  'lib/internal/main/run_main_module.js',
168
170
  'lib/internal/main/test_runner.js',
169
171
  'lib/internal/main/watch_mode.js',
@@ -175,7 +177,6 @@
175
177
  'lib/internal/modules/esm/fetch_module.js',
176
178
  'lib/internal/modules/esm/formats.js',
177
179
  'lib/internal/modules/esm/get_format.js',
178
- 'lib/internal/modules/esm/handle_process_exit.js',
179
180
  'lib/internal/modules/esm/hooks.js',
180
181
  'lib/internal/modules/esm/initialize_import_meta.js',
181
182
  'lib/internal/modules/esm/load.js',
@@ -209,7 +210,6 @@
209
210
  'lib/internal/policy/manifest.js',
210
211
  'lib/internal/policy/sri.js',
211
212
  'lib/internal/priority_queue.js',
212
- 'lib/internal/process/esm_loader.js',
213
213
  'lib/internal/process/execution.js',
214
214
  'lib/internal/process/per_thread.js',
215
215
  'lib/internal/process/permission.js',
@@ -232,6 +232,7 @@
232
232
  'lib/internal/repl/await.js',
233
233
  'lib/internal/repl/history.js',
234
234
  'lib/internal/repl/utils.js',
235
+ 'lib/internal/shell.js',
235
236
  'lib/internal/socket_list.js',
236
237
  'lib/internal/socketaddress.js',
237
238
  'lib/internal/source_map/prepare_stack_trace.js',
@@ -345,7 +346,7 @@
345
346
  'lib/wasi.js',
346
347
  'lib/worker_threads.js',
347
348
  'lib/zlib.js'],
348
- 'node_module_version': 120,
349
+ 'node_module_version': 127,
349
350
  'node_no_browser_globals': 'false',
350
351
  'node_prefix': '/',
351
352
  'node_release_urlbase': 'https://nodejs.org/download/release/',
@@ -373,9 +374,10 @@
373
374
  'openssl_is_fips': 'false',
374
375
  'openssl_quic': 'true',
375
376
  'ossfuzz': 'false',
376
- 'shlib_suffix': 'so.120',
377
+ 'shlib_suffix': 'so.127',
377
378
  'single_executable_application': 'true',
378
379
  'target_arch': 'ppc64',
380
+ 'ubsan': 0,
379
381
  'use_prefix_to_find_headers': 'false',
380
382
  'v8_enable_31bit_smis_on_64bit_arch': 0,
381
383
  'v8_enable_extensible_ro_snapshot': 0,
@@ -32,7 +32,7 @@ static constexpr uint16_t kFullyConstructedBitMask = uint16_t{1};
32
32
 
33
33
  static constexpr size_t kPageSize = size_t{1} << 17;
34
34
 
35
- #if defined(V8_TARGET_ARCH_ARM64) && defined(V8_OS_DARWIN)
35
+ #if defined(V8_HOST_ARCH_ARM64) && defined(V8_OS_DARWIN)
36
36
  constexpr size_t kGuardPageSize = 0;
37
37
  #else
38
38
  constexpr size_t kGuardPageSize = 4096;
@@ -128,13 +128,13 @@ struct IsSubclassOfBasicMemberTemplate {
128
128
  private:
129
129
  template <typename T, typename CheckingPolicy, typename StorageType>
130
130
  static std::true_type SubclassCheck(
131
- BasicMember<T, WeaknessTag, WriteBarrierPolicy, CheckingPolicy,
132
- StorageType>*);
131
+ const BasicMember<T, WeaknessTag, WriteBarrierPolicy, CheckingPolicy,
132
+ StorageType>*);
133
133
  static std::false_type SubclassCheck(...);
134
134
 
135
135
  public:
136
- static constexpr bool value =
137
- decltype(SubclassCheck(std::declval<BasicMemberCandidate*>()))::value;
136
+ static constexpr bool value = decltype(SubclassCheck(
137
+ std::declval<std::decay_t<BasicMemberCandidate>*>()))::value;
138
138
  };
139
139
 
140
140
  template <typename T,
@@ -180,6 +180,14 @@ constexpr bool IsStrictlyBaseOfV =
180
180
  std::is_base_of_v<std::decay_t<B>, std::decay_t<D>> &&
181
181
  !IsDecayedSameV<B, D>;
182
182
 
183
+ template <typename T>
184
+ constexpr bool IsAnyMemberTypeV = false;
185
+
186
+ template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
187
+ typename CheckingPolicy, typename StorageType>
188
+ constexpr bool IsAnyMemberTypeV<internal::BasicMember<
189
+ T, WeaknessTag, WriteBarrierPolicy, CheckingPolicy, StorageType>> = true;
190
+
183
191
  } // namespace internal
184
192
 
185
193
  /**
@@ -245,6 +253,19 @@ constexpr bool IsWeakV = internal::IsWeak<T>::value;
245
253
  template <typename T>
246
254
  constexpr bool IsCompleteV = internal::IsComplete<T>::value;
247
255
 
256
+ /**
257
+ * Value is true for member types `Member<T>` and `WeakMember<T>`.
258
+ */
259
+ template <typename T>
260
+ constexpr bool IsMemberOrWeakMemberTypeV =
261
+ IsMemberTypeV<T> || IsWeakMemberTypeV<T>;
262
+
263
+ /**
264
+ * Value is true for any member type.
265
+ */
266
+ template <typename T>
267
+ constexpr bool IsAnyMemberTypeV = internal::IsAnyMemberTypeV<std::decay_t<T>>;
268
+
248
269
  } // namespace cppgc
249
270
 
250
271
  #endif // INCLUDE_CPPGC_TYPE_TRAITS_H_
@@ -731,12 +731,33 @@ struct StartExecutionCallbackInfo {
731
731
 
732
732
  using StartExecutionCallback =
733
733
  std::function<v8::MaybeLocal<v8::Value>(const StartExecutionCallbackInfo&)>;
734
+ using EmbedderPreloadCallback =
735
+ std::function<void(Environment* env,
736
+ v8::Local<v8::Value> process,
737
+ v8::Local<v8::Value> require)>;
734
738
 
739
+ // Run initialization for the environment.
740
+ //
741
+ // The |preload| function, usually used by embedders to inject scripts,
742
+ // will be run by Node.js before Node.js executes the entry point.
743
+ // The function is guaranteed to run before the user land module loader running
744
+ // any user code, so it is safe to assume that at this point, no user code has
745
+ // been run yet.
746
+ // The function will be executed with preload(process, require), and the passed
747
+ // require function has access to internal Node.js modules. There is no
748
+ // stability guarantee about the internals exposed to the internal require
749
+ // function. Expect breakages when updating Node.js versions if the embedder
750
+ // imports internal modules with the internal require function.
751
+ // Worker threads created in the environment will also respect The |preload|
752
+ // function, so make sure the function is thread-safe.
735
753
  NODE_EXTERN v8::MaybeLocal<v8::Value> LoadEnvironment(
736
754
  Environment* env,
737
- StartExecutionCallback cb);
755
+ StartExecutionCallback cb,
756
+ EmbedderPreloadCallback preload = nullptr);
738
757
  NODE_EXTERN v8::MaybeLocal<v8::Value> LoadEnvironment(
739
- Environment* env, std::string_view main_script_source_utf8);
758
+ Environment* env,
759
+ std::string_view main_script_source_utf8,
760
+ EmbedderPreloadCallback preload = nullptr);
740
761
  NODE_EXTERN void FreeEnvironment(Environment* env);
741
762
 
742
763
  // Set a callback that is called when process.exit() is called from JS,
@@ -209,7 +209,7 @@ napi_create_threadsafe_function(napi_env env,
209
209
  size_t max_queue_size,
210
210
  size_t initial_thread_count,
211
211
  void* thread_finalize_data,
212
- node_api_nogc_finalize thread_finalize_cb,
212
+ napi_finalize thread_finalize_cb,
213
213
  void* context,
214
214
  napi_threadsafe_function_call_js call_js_cb,
215
215
  napi_threadsafe_function* result);
@@ -29,7 +29,7 @@ namespace node {
29
29
 
30
30
  namespace Buffer {
31
31
 
32
- static const size_t kMaxLength = v8::TypedArray::kMaxLength;
32
+ static const size_t kMaxLength = v8::Uint8Array::kMaxLength;
33
33
 
34
34
  typedef void (*FreeCallback)(char* data, void* hint);
35
35
 
@@ -22,9 +22,9 @@
22
22
  #ifndef SRC_NODE_VERSION_H_
23
23
  #define SRC_NODE_VERSION_H_
24
24
 
25
- #define NODE_MAJOR_VERSION 21
26
- #define NODE_MINOR_VERSION 7
27
- #define NODE_PATCH_VERSION 3
25
+ #define NODE_MAJOR_VERSION 22
26
+ #define NODE_MINOR_VERSION 0
27
+ #define NODE_PATCH_VERSION 0
28
28
 
29
29
  #define NODE_VERSION_IS_LTS 0
30
30
  #define NODE_VERSION_LTS_CODENAME ""
@@ -95,7 +95,7 @@
95
95
  #if defined(NODE_EMBEDDER_MODULE_VERSION)
96
96
  #define NODE_MODULE_VERSION NODE_EMBEDDER_MODULE_VERSION
97
97
  #else
98
- #define NODE_MODULE_VERSION 120
98
+ #define NODE_MODULE_VERSION 127
99
99
  #endif
100
100
 
101
101
  // The NAPI_VERSION supported by the runtime. This is the inclusive range of
@@ -318,6 +318,12 @@ class V8_EXPORT ArrayBuffer : public Object {
318
318
  */
319
319
  std::shared_ptr<BackingStore> GetBackingStore();
320
320
 
321
+ /**
322
+ * More efficient shortcut for
323
+ * GetBackingStore()->IsResizableByUserJavaScript().
324
+ */
325
+ bool IsResizableByUserJavaScript() const;
326
+
321
327
  /**
322
328
  * More efficient shortcut for GetBackingStore()->Data(). The returned pointer
323
329
  * is valid as long as the ArrayBuffer is alive.
@@ -327,10 +327,6 @@ using WasmAsyncResolvePromiseCallback = void (*)(
327
327
  using WasmLoadSourceMapCallback = Local<String> (*)(Isolate* isolate,
328
328
  const char* name);
329
329
 
330
- // --- Callback for checking if WebAssembly GC is enabled ---
331
- // If the callback returns true, it will also enable Wasm stringrefs.
332
- using WasmGCEnabledCallback = bool (*)(Local<Context> context);
333
-
334
330
  // --- Callback for checking if WebAssembly imported strings are enabled ---
335
331
  using WasmImportedStringsEnabledCallback = bool (*)(Local<Context> context);
336
332
 
@@ -342,6 +338,9 @@ using SharedArrayBufferConstructorEnabledCallback =
342
338
  using JavaScriptCompileHintsMagicEnabledCallback =
343
339
  bool (*)(Local<Context> context);
344
340
 
341
+ // --- Callback for checking if WebAssembly JSPI is enabled ---
342
+ using WasmJSPIEnabledCallback = bool (*)(Local<Context> context);
343
+
345
344
  /**
346
345
  * HostImportModuleDynamicallyCallback is called when we
347
346
  * require the embedder to load a module. This is used as part of the dynamic
@@ -352,11 +351,11 @@ using JavaScriptCompileHintsMagicEnabledCallback =
352
351
  *
353
352
  * The specifier is the name of the module that should be imported.
354
353
  *
355
- * The import_assertions are import assertions for this request in the form:
354
+ * The import_attributes are import attributes for this request in the form:
356
355
  * [key1, value1, key2, value2, ...] where the keys and values are of type
357
356
  * v8::String. Note, unlike the FixedArray passed to ResolveModuleCallback and
358
357
  * returned from ModuleRequest::GetImportAssertions(), this array does not
359
- * contain the source Locations of the assertions.
358
+ * contain the source Locations of the attributes.
360
359
  *
361
360
  * The embedder must compile, instantiate, evaluate the Module, and
362
361
  * obtain its namespace object.
@@ -368,15 +367,10 @@ using JavaScriptCompileHintsMagicEnabledCallback =
368
367
  * fails (e.g. due to stack overflow), the embedder must propagate
369
368
  * that exception by returning an empty MaybeLocal.
370
369
  */
371
- using HostImportModuleDynamicallyWithImportAssertionsCallback =
372
- MaybeLocal<Promise> (*)(Local<Context> context,
373
- Local<ScriptOrModule> referrer,
374
- Local<String> specifier,
375
- Local<FixedArray> import_assertions);
376
370
  using HostImportModuleDynamicallyCallback = MaybeLocal<Promise> (*)(
377
371
  Local<Context> context, Local<Data> host_defined_options,
378
372
  Local<Value> resource_name, Local<String> specifier,
379
- Local<FixedArray> import_assertions);
373
+ Local<FixedArray> import_attributes);
380
374
 
381
375
  /**
382
376
  * Callback for requesting a compile hint for a function from the embedder. The
@@ -8,6 +8,8 @@
8
8
  #include <stddef.h>
9
9
  #include <stdint.h>
10
10
 
11
+ #include <functional>
12
+
11
13
  #include "v8-local-handle.h" // NOLINT(build/include_directory)
12
14
  #include "v8-object.h" // NOLINT(build/include_directory)
13
15
  #include "v8config.h" // NOLINT(build/include_directory)
@@ -43,6 +45,58 @@ class V8_EXPORT Array : public Object {
43
45
  return static_cast<Array*>(value);
44
46
  }
45
47
 
48
+ /**
49
+ * Creates a JavaScript array from a provided callback.
50
+ *
51
+ * \param context The v8::Context to create the array in.
52
+ * \param length The length of the array to be created.
53
+ * \param next_value_callback The callback that is invoked to retrieve
54
+ * elements for the array. The embedder can signal that the array
55
+ * initialization should be aborted by throwing an exception and returning
56
+ * an empty MaybeLocal.
57
+ * \returns The v8::Array if all elements were constructed successfully and an
58
+ * empty MaybeLocal otherwise.
59
+ */
60
+ static MaybeLocal<Array> New(
61
+ Local<Context> context, size_t length,
62
+ std::function<MaybeLocal<v8::Value>()> next_value_callback);
63
+
64
+ enum class CallbackResult {
65
+ kException,
66
+ kBreak,
67
+ kContinue,
68
+ };
69
+ using IterationCallback = CallbackResult (*)(uint32_t index,
70
+ Local<Value> element,
71
+ void* data);
72
+
73
+ /**
74
+ * Calls {callback} for every element of this array, passing {callback_data}
75
+ * as its {data} parameter.
76
+ * This function will typically be faster than calling {Get()} repeatedly.
77
+ * As a consequence of being optimized for low overhead, the provided
78
+ * callback must adhere to the following restrictions:
79
+ * - It must not allocate any V8 objects and continue iterating; it may
80
+ * allocate (e.g. an error message/object) and then immediately terminate
81
+ * the iteration.
82
+ * - It must not modify the array being iterated.
83
+ * - It must not call back into V8 (unless it can guarantee that such a
84
+ * call does not violate the above restrictions, which is difficult).
85
+ * - The {Local<Value> element} must not "escape", i.e. must not be assigned
86
+ * to any other {Local}. Creating a {Global} from it, or updating a
87
+ * v8::TypecheckWitness with it, is safe.
88
+ * These restrictions may be lifted in the future if use cases arise that
89
+ * justify a slower but more robust implementation.
90
+ *
91
+ * Returns {Nothing} on exception; use a {TryCatch} to catch and handle this
92
+ * exception.
93
+ * When the {callback} returns {kException}, iteration is terminated
94
+ * immediately, returning {Nothing}. By returning {kBreak}, the callback
95
+ * can request non-exceptional early termination of the iteration.
96
+ */
97
+ Maybe<void> Iterate(Local<Context> context, IterationCallback callback,
98
+ void* callback_data);
99
+
46
100
  private:
47
101
  Array();
48
102
  static void CheckCast(Value* obj);
@@ -84,6 +84,29 @@ class V8_EXPORT Context : public Data {
84
84
  * created by a previous call to Context::New with the same global
85
85
  * template. The state of the global object will be completely reset
86
86
  * and only object identify will remain.
87
+ *
88
+ * \param internal_fields_deserializer An optional callback used
89
+ * to deserialize fields set by
90
+ * v8::Object::SetAlignedPointerInInternalField() in wrapper objects
91
+ * from the default context snapshot. It should match the
92
+ * SerializeInternalFieldsCallback() used by
93
+ * v8::SnapshotCreator::SetDefaultContext() when the default context
94
+ * snapshot is created. It does not need to be configured if the default
95
+ * context snapshot contains no wrapper objects with pointer internal
96
+ * fields, or if no custom startup snapshot is configured
97
+ * in the v8::CreateParams used to create the isolate.
98
+ *
99
+ * \param microtask_queue An optional microtask queue used to manage
100
+ * the microtasks created in this context. If not set the per-isolate
101
+ * default microtask queue would be used.
102
+ *
103
+ * \param context_data_deserializer An optional callback used
104
+ * to deserialize embedder data set by
105
+ * v8::Context::SetAlignedPointerInEmbedderData() in the default
106
+ * context from the default context snapshot. It does not need to be
107
+ * configured if the default context snapshot contains no pointer embedder
108
+ * data, or if no custom startup snapshot is configured in the
109
+ * v8::CreateParams used to create the isolate.
87
110
  */
88
111
  static Local<Context> New(
89
112
  Isolate* isolate, ExtensionConfiguration* extensions = nullptr,
@@ -91,7 +114,9 @@ class V8_EXPORT Context : public Data {
91
114
  MaybeLocal<Value> global_object = MaybeLocal<Value>(),
92
115
  DeserializeInternalFieldsCallback internal_fields_deserializer =
93
116
  DeserializeInternalFieldsCallback(),
94
- MicrotaskQueue* microtask_queue = nullptr);
117
+ MicrotaskQueue* microtask_queue = nullptr,
118
+ DeserializeContextDataCallback context_data_deserializer =
119
+ DeserializeContextDataCallback());
95
120
 
96
121
  /**
97
122
  * Create a new context from a (non-default) context snapshot. There
@@ -103,21 +128,37 @@ class V8_EXPORT Context : public Data {
103
128
  * \param context_snapshot_index The index of the context snapshot to
104
129
  * deserialize from. Use v8::Context::New for the default snapshot.
105
130
  *
106
- * \param embedder_fields_deserializer Optional callback to deserialize
107
- * internal fields. It should match the SerializeInternalFieldCallback used
108
- * to serialize.
131
+ * \param internal_fields_deserializer An optional callback used
132
+ * to deserialize fields set by
133
+ * v8::Object::SetAlignedPointerInInternalField() in wrapper objects
134
+ * from the default context snapshot. It does not need to be
135
+ * configured if there are no wrapper objects with no internal
136
+ * pointer fields in the default context snapshot or if no startup
137
+ * snapshot is configured when the isolate is created.
109
138
  *
110
139
  * \param extensions See v8::Context::New.
111
140
  *
112
141
  * \param global_object See v8::Context::New.
142
+ *
143
+ * \param internal_fields_deserializer Similar to
144
+ * internal_fields_deserializer in v8::Context::New but applies to
145
+ * the context specified by the context_snapshot_index.
146
+ *
147
+ * \param microtask_queue See v8::Context::New.
148
+ *
149
+ * \param context_data_deserializer Similar to
150
+ * context_data_deserializer in v8::Context::New but applies to
151
+ * the context specified by the context_snapshot_index.
113
152
  */
114
153
  static MaybeLocal<Context> FromSnapshot(
115
154
  Isolate* isolate, size_t context_snapshot_index,
116
- DeserializeInternalFieldsCallback embedder_fields_deserializer =
155
+ DeserializeInternalFieldsCallback internal_fields_deserializer =
117
156
  DeserializeInternalFieldsCallback(),
118
157
  ExtensionConfiguration* extensions = nullptr,
119
158
  MaybeLocal<Value> global_object = MaybeLocal<Value>(),
120
- MicrotaskQueue* microtask_queue = nullptr);
159
+ MicrotaskQueue* microtask_queue = nullptr,
160
+ DeserializeContextDataCallback context_data_deserializer =
161
+ DeserializeContextDataCallback());
121
162
 
122
163
  /**
123
164
  * Returns an global object that isn't backed by an actual context.
@@ -182,7 +223,7 @@ class V8_EXPORT Context : public Data {
182
223
  * parameter. Returns true if the operation completed successfully.
183
224
  */
184
225
  virtual bool FreezeEmbedderObjectAndGetChildren(
185
- Local<Object> obj, std::vector<Local<Object>>& children_out) = 0;
226
+ Local<Object> obj, LocalVector<Object>& children_out) = 0;
186
227
  };
187
228
 
188
229
  /**
@@ -309,18 +350,6 @@ class V8_EXPORT Context : public Data {
309
350
  Local<Context> context);
310
351
  void SetAbortScriptExecution(AbortScriptExecutionCallback callback);
311
352
 
312
- /**
313
- * Returns the value that was set or restored by
314
- * SetContinuationPreservedEmbedderData(), if any.
315
- */
316
- Local<Value> GetContinuationPreservedEmbedderData() const;
317
-
318
- /**
319
- * Sets a value that will be stored on continuations and reset while the
320
- * continuation runs.
321
- */
322
- void SetContinuationPreservedEmbedderData(Local<Value> context);
323
-
324
353
  /**
325
354
  * Set or clear hooks to be invoked for promise lifecycle operations.
326
355
  * To clear a hook, set it to an empty v8::Function. Each function will
@@ -436,12 +465,12 @@ void* Context::GetAlignedPointerFromEmbedderData(int index) {
436
465
 
437
466
  template <class T>
438
467
  MaybeLocal<T> Context::GetDataFromSnapshotOnce(size_t index) {
439
- auto slot = GetDataFromSnapshotOnce(index);
440
- if (slot) {
468
+ if (auto slot = GetDataFromSnapshotOnce(index); slot) {
441
469
  internal::PerformCastCheck(
442
470
  internal::ValueHelper::SlotAsValue<T, false>(slot));
471
+ return Local<T>::FromSlot(slot);
443
472
  }
444
- return Local<T>::FromSlot(slot);
473
+ return {};
445
474
  }
446
475
 
447
476
  Context* Context::Cast(v8::Data* data) {