From c27234888f3d93aee842e8b30912512867071cb9 Mon Sep 17 00:00:00 2001 From: Colin Ihrig Date: Thu, 6 Oct 2022 23:51:43 -0400 Subject: fix(napi): move napi symbols file (#16179) The current location was causing failures during v1.26.1 publication. --- cli/build.rs | 6 +- cli/napi_sym/lib.rs | 3 +- cli/napi_sym/symbol_exports.json | 148 +++++++++++++++++++++++++++++++++++++++ ext/napi/README.md | 0 tools/napi/generate_link_win.js | 4 +- tools/napi/symbol_exports.json | 148 --------------------------------------- 6 files changed, 155 insertions(+), 154 deletions(-) create mode 100644 cli/napi_sym/symbol_exports.json create mode 100644 ext/napi/README.md delete mode 100644 tools/napi/symbol_exports.json diff --git a/cli/build.rs b/cli/build.rs index c1bc3305e..77c95fb17 100644 --- a/cli/build.rs +++ b/cli/build.rs @@ -351,11 +351,11 @@ fn main() { symbols: Vec, } let symbols_json = - std::fs::read_to_string("../tools/napi/symbol_exports.json").expect( - "Missing tools/napi/symbol_exports.json! This is a bug in napi_sym", + std::fs::read_to_string("./napi_sym/symbol_exports.json").expect( + "Missing ./napi_sym/symbol_exports.json! This is a bug in napi_sym", ); let symbols: Symbols = serde_json::from_str(&symbols_json) - .expect("tools/napi/symbol_exports.json is not valid JSON"); + .expect("./napi_sym/symbol_exports.json is not valid JSON"); // Don't export all symbols into the dynamic symbol table. -rdynamic exports *all* symbols introducing binary bloat. // We only need to export Node API symbols. diff --git a/cli/napi_sym/lib.rs b/cli/napi_sym/lib.rs index 769dddba9..2805c9957 100644 --- a/cli/napi_sym/lib.rs +++ b/cli/napi_sym/lib.rs @@ -4,8 +4,7 @@ use proc_macro::TokenStream; use quote::quote; use serde::Deserialize; -static NAPI_EXPORTS: &str = - include_str!("../../tools/napi/symbol_exports.json"); +static NAPI_EXPORTS: &str = include_str!("./symbol_exports.json"); #[derive(Deserialize)] struct SymbolExports { diff --git a/cli/napi_sym/symbol_exports.json b/cli/napi_sym/symbol_exports.json new file mode 100644 index 000000000..ba1bba67a --- /dev/null +++ b/cli/napi_sym/symbol_exports.json @@ -0,0 +1,148 @@ +{ + "symbols": [ + "node_api_create_syntax_error", + "napi_make_callback", + "napi_has_named_property", + "napi_async_destroy", + "napi_coerce_to_object", + "napi_get_arraybuffer_info", + "napi_detach_arraybuffer", + "napi_get_undefined", + "napi_reference_unref", + "napi_fatal_error", + "napi_open_callback_scope", + "napi_close_callback_scope", + "napi_get_value_uint32", + "napi_create_function", + "napi_create_arraybuffer", + "napi_get_value_int64", + "napi_get_all_property_names", + "napi_resolve_deferred", + "napi_is_detached_arraybuffer", + "napi_create_string_utf8", + "napi_create_threadsafe_function", + "node_api_throw_syntax_error", + "napi_create_bigint_int64", + "napi_wrap", + "napi_set_property", + "napi_get_value_bigint_int64", + "napi_open_handle_scope", + "napi_create_error", + "napi_create_buffer", + "napi_cancel_async_work", + "napi_is_exception_pending", + "napi_acquire_threadsafe_function", + "napi_create_external", + "napi_get_threadsafe_function_context", + "napi_get_null", + "napi_create_string_utf16", + "napi_get_value_bigint_uint64", + "napi_module_register", + "napi_is_typedarray", + "napi_create_external_buffer", + "napi_get_new_target", + "napi_get_instance_data", + "napi_close_handle_scope", + "napi_get_value_string_utf16", + "napi_get_property_names", + "napi_is_arraybuffer", + "napi_get_cb_info", + "napi_define_properties", + "napi_add_env_cleanup_hook", + "node_api_get_module_file_name", + "napi_get_node_version", + "napi_create_int64", + "napi_create_double", + "napi_get_and_clear_last_exception", + "napi_create_reference", + "napi_get_typedarray_info", + "napi_call_threadsafe_function", + "napi_get_last_error_info", + "napi_create_array_with_length", + "napi_coerce_to_number", + "napi_get_global", + "napi_is_error", + "napi_set_instance_data", + "napi_create_typedarray", + "napi_throw_type_error", + "napi_has_property", + "napi_get_value_external", + "napi_create_range_error", + "napi_typeof", + "napi_ref_threadsafe_function", + "napi_create_bigint_uint64", + "napi_get_prototype", + "napi_adjust_external_memory", + "napi_release_threadsafe_function", + "napi_delete_async_work", + "napi_create_string_latin1", + "napi_is_array", + "napi_unref_threadsafe_function", + "napi_throw_error", + "napi_has_own_property", + "napi_get_reference_value", + "napi_remove_env_cleanup_hook", + "napi_get_value_string_utf8", + "napi_is_promise", + "napi_get_boolean", + "napi_run_script", + "napi_get_element", + "napi_get_named_property", + "napi_get_buffer_info", + "napi_get_value_bool", + "napi_reference_ref", + "napi_create_object", + "napi_create_promise", + "napi_create_int32", + "napi_escape_handle", + "napi_open_escapable_handle_scope", + "napi_throw", + "napi_get_value_double", + "napi_set_named_property", + "napi_call_function", + "napi_create_date", + "napi_object_freeze", + "napi_get_uv_event_loop", + "napi_get_value_string_latin1", + "napi_reject_deferred", + "napi_add_finalizer", + "napi_create_array", + "napi_delete_reference", + "napi_get_date_value", + "napi_create_dataview", + "napi_get_version", + "napi_define_class", + "napi_is_date", + "napi_remove_wrap", + "napi_delete_property", + "napi_instanceof", + "napi_create_buffer_copy", + "napi_delete_element", + "napi_object_seal", + "napi_queue_async_work", + "napi_get_value_bigint_words", + "napi_is_buffer", + "napi_get_array_length", + "napi_get_property", + "napi_new_instance", + "napi_set_element", + "napi_create_bigint_words", + "napi_strict_equals", + "napi_is_dataview", + "napi_close_escapable_handle_scope", + "napi_get_dataview_info", + "napi_get_value_int32", + "napi_unwrap", + "napi_throw_range_error", + "napi_coerce_to_bool", + "napi_create_uint32", + "napi_has_element", + "napi_create_external_arraybuffer", + "napi_create_symbol", + "napi_coerce_to_string", + "napi_create_type_error", + "napi_fatal_exception", + "napi_create_async_work", + "napi_async_init" + ] +} diff --git a/ext/napi/README.md b/ext/napi/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/tools/napi/generate_link_win.js b/tools/napi/generate_link_win.js index a0bda6a42..7d16f81c3 100755 --- a/tools/napi/generate_link_win.js +++ b/tools/napi/generate_link_win.js @@ -1,7 +1,9 @@ #!/usr/bin/env -S deno run --unstable --allow-read --allow-write // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. -import exports from "./symbol_exports.json" assert { type: "json" }; +import exports from "../../cli/napi_sym/symbol_exports.json" assert { + type: "json", +}; let def = "LIBRARY\nEXPORTS\n"; for (const symbol of exports.symbols) { diff --git a/tools/napi/symbol_exports.json b/tools/napi/symbol_exports.json deleted file mode 100644 index ba1bba67a..000000000 --- a/tools/napi/symbol_exports.json +++ /dev/null @@ -1,148 +0,0 @@ -{ - "symbols": [ - "node_api_create_syntax_error", - "napi_make_callback", - "napi_has_named_property", - "napi_async_destroy", - "napi_coerce_to_object", - "napi_get_arraybuffer_info", - "napi_detach_arraybuffer", - "napi_get_undefined", - "napi_reference_unref", - "napi_fatal_error", - "napi_open_callback_scope", - "napi_close_callback_scope", - "napi_get_value_uint32", - "napi_create_function", - "napi_create_arraybuffer", - "napi_get_value_int64", - "napi_get_all_property_names", - "napi_resolve_deferred", - "napi_is_detached_arraybuffer", - "napi_create_string_utf8", - "napi_create_threadsafe_function", - "node_api_throw_syntax_error", - "napi_create_bigint_int64", - "napi_wrap", - "napi_set_property", - "napi_get_value_bigint_int64", - "napi_open_handle_scope", - "napi_create_error", - "napi_create_buffer", - "napi_cancel_async_work", - "napi_is_exception_pending", - "napi_acquire_threadsafe_function", - "napi_create_external", - "napi_get_threadsafe_function_context", - "napi_get_null", - "napi_create_string_utf16", - "napi_get_value_bigint_uint64", - "napi_module_register", - "napi_is_typedarray", - "napi_create_external_buffer", - "napi_get_new_target", - "napi_get_instance_data", - "napi_close_handle_scope", - "napi_get_value_string_utf16", - "napi_get_property_names", - "napi_is_arraybuffer", - "napi_get_cb_info", - "napi_define_properties", - "napi_add_env_cleanup_hook", - "node_api_get_module_file_name", - "napi_get_node_version", - "napi_create_int64", - "napi_create_double", - "napi_get_and_clear_last_exception", - "napi_create_reference", - "napi_get_typedarray_info", - "napi_call_threadsafe_function", - "napi_get_last_error_info", - "napi_create_array_with_length", - "napi_coerce_to_number", - "napi_get_global", - "napi_is_error", - "napi_set_instance_data", - "napi_create_typedarray", - "napi_throw_type_error", - "napi_has_property", - "napi_get_value_external", - "napi_create_range_error", - "napi_typeof", - "napi_ref_threadsafe_function", - "napi_create_bigint_uint64", - "napi_get_prototype", - "napi_adjust_external_memory", - "napi_release_threadsafe_function", - "napi_delete_async_work", - "napi_create_string_latin1", - "napi_is_array", - "napi_unref_threadsafe_function", - "napi_throw_error", - "napi_has_own_property", - "napi_get_reference_value", - "napi_remove_env_cleanup_hook", - "napi_get_value_string_utf8", - "napi_is_promise", - "napi_get_boolean", - "napi_run_script", - "napi_get_element", - "napi_get_named_property", - "napi_get_buffer_info", - "napi_get_value_bool", - "napi_reference_ref", - "napi_create_object", - "napi_create_promise", - "napi_create_int32", - "napi_escape_handle", - "napi_open_escapable_handle_scope", - "napi_throw", - "napi_get_value_double", - "napi_set_named_property", - "napi_call_function", - "napi_create_date", - "napi_object_freeze", - "napi_get_uv_event_loop", - "napi_get_value_string_latin1", - "napi_reject_deferred", - "napi_add_finalizer", - "napi_create_array", - "napi_delete_reference", - "napi_get_date_value", - "napi_create_dataview", - "napi_get_version", - "napi_define_class", - "napi_is_date", - "napi_remove_wrap", - "napi_delete_property", - "napi_instanceof", - "napi_create_buffer_copy", - "napi_delete_element", - "napi_object_seal", - "napi_queue_async_work", - "napi_get_value_bigint_words", - "napi_is_buffer", - "napi_get_array_length", - "napi_get_property", - "napi_new_instance", - "napi_set_element", - "napi_create_bigint_words", - "napi_strict_equals", - "napi_is_dataview", - "napi_close_escapable_handle_scope", - "napi_get_dataview_info", - "napi_get_value_int32", - "napi_unwrap", - "napi_throw_range_error", - "napi_coerce_to_bool", - "napi_create_uint32", - "napi_has_element", - "napi_create_external_arraybuffer", - "napi_create_symbol", - "napi_coerce_to_string", - "napi_create_type_error", - "napi_fatal_exception", - "napi_create_async_work", - "napi_async_init" - ] -} -- cgit v1.2.3