Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/sync-headers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Header Sync

on:
workflow_dispatch: null
schedule:
- cron: "0 0 * * *"

permissions:
contents: write
pull-requests: write

jobs:
build:
runs-on: ubuntu-latest
name: Update headers from nodejs/node
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- shell: bash
id: check-changes
name: Check Changes
run: |
COMMIT_MESSAGE=$(npm run --silent update-headers)
VERSION=${COMMIT_MESSAGE##* }
echo $COMMIT_MESSAGE
npm run --silent write-symbols
CHANGED_FILES=$(git diff --name-only)
BRANCH_NAME="update-headers/${VERSION}"
if [ -z "$CHANGED_FILES" ]; then
echo "No changes exist. Nothing to do."
else
echo "Changes exist. Checking if branch exists: $BRANCH_NAME"
if git ls-remote --exit-code --heads $GITHUB_SERVER_URL/$GITHUB_REPOSITORY $BRANCH_NAME >/dev/null; then
echo "Branch exists. Nothing to do."
else
echo "Branch does not exists."
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_OUTPUT
echo "COMMIT_MESSAGE=$COMMIT_MESSAGE" >> $GITHUB_OUTPUT
fi
fi
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
if: ${{ steps.check-changes.outputs.BRANCH_NAME }}
with:
branch: ${{ steps.check-changes.outputs.BRANCH_NAME }}
commit-message: ${{ steps.check-changes.outputs.COMMIT_MESSAGE }}
title: ${{ steps.check-changes.outputs.COMMIT_MESSAGE }}
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
body: null
delete-branch: true
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
scripts/
.github/
762 changes: 380 additions & 382 deletions include/js_native_api.h

Large diffs are not rendered by default.

27 changes: 17 additions & 10 deletions include/js_native_api_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@
#include <stdint.h> // NOLINT(modernize-deprecated-headers)

#if !defined __cplusplus || (defined(_MSC_VER) && _MSC_VER < 1900)
typedef uint16_t char16_t;
typedef uint16_t char16_t;
#endif

#ifndef NAPI_CDECL
#ifdef _WIN32
#define NAPI_CDECL __cdecl
#else
#define NAPI_CDECL
#endif
#endif

// JSVM API types are all opaque pointers for ABI stability
Expand Down Expand Up @@ -36,9 +44,7 @@ typedef enum {
napi_default_method = napi_writable | napi_configurable,

// Default for object properties, like in JS obj[prop].
napi_default_jsproperty = napi_writable |
napi_enumerable |
napi_configurable,
napi_default_jsproperty = napi_writable | napi_enumerable | napi_configurable,
#endif // NAPI_VERSION >= 8
} napi_property_attributes;

Expand Down Expand Up @@ -92,7 +98,8 @@ typedef enum {
napi_date_expected,
napi_arraybuffer_expected,
napi_detachable_arraybuffer_expected,
napi_would_deadlock // unused
napi_would_deadlock, // unused
napi_no_external_buffers_allowed
} napi_status;
// Note: when adding a new enum value to `napi_status`, please also update
// * `const int last_status` in the definition of `napi_get_last_error_info()'
Expand All @@ -102,11 +109,11 @@ typedef enum {
// * the definition of `napi_status` in doc/api/n-api.md to reflect the newly
// added value(s).

typedef napi_value (*napi_callback)(napi_env env,
napi_callback_info info);
typedef void (*napi_finalize)(napi_env env,
void* finalize_data,
void* finalize_hint);
typedef napi_value(NAPI_CDECL* napi_callback)(napi_env env,
napi_callback_info info);
typedef void(NAPI_CDECL* napi_finalize)(napi_env env,
void* finalize_data,
void* finalize_hint);

typedef struct {
// One of utf8name or name should be NULL.
Expand Down
Loading