From 226097261f6db997f8813cb4953ad0235fef4233 Mon Sep 17 00:00:00 2001 From: fengmk2 Date: Wed, 5 Jun 2024 09:23:40 +0800 Subject: [PATCH] feat: support Node.js v22 (#243) --- .autod.conf.js | 2 +- .github/workflows/nodejs.yml | 2 +- README.md | 3 ++- package.json | 2 +- scripts/copy.js | 2 +- scripts/versions.js | 1 + xprofiler.js | 2 +- 7 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.autod.conf.js b/.autod.conf.js index 7105e7e..cd97779 100644 --- a/.autod.conf.js +++ b/.autod.conf.js @@ -9,7 +9,7 @@ module.exports = { dep: [ 'moment', 'nan', - '@xprofiler/node-pre-gyp', + '@mapbox/node-pre-gyp', 'uuid', 'yargs', ], diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index c3c479b..ab246cd 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -18,7 +18,7 @@ jobs: {os: "macos-latest", arch: "x64"}, {os: "ubuntu-latest", arch: "x64"}, ] - node-version: [ 12, 14, 16, 18, 20, 21 ] + node-version: [ 12, 14, 16, 18, 20, 21, 22 ] steps: - name: Set up Python uses: actions/setup-python@v4 diff --git a/README.md b/README.md index 1ec6c45..a6c821d 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ xprofiler 插件支持三大主流操作系统: - v19.x - v20.x - v21.x +- v22.x 更低的版本因为在此项目创建时已经不在官方 LTS 计划中,故正常情况下不再支持。 @@ -52,7 +53,7 @@ npm i xprofiler --save --xprofiler_binary_host_mirror=https://npmmirror.com/mirr npm i xprofiler --save --xprofiler_binary_host_mirror=http://devtoolx.com/xprofiler ``` -> 这里使用了 `@xprofiler/node-pre-gyp` 帮助开发者无需进行本地编译即可使用此插件,默认插件位于 [Github Release](https://github.com/X-Profiler/xprofiler/releases) 页面,国内访问可能较慢,你也可以自行镜像到其它位置加速安装。 +> 这里使用了 `@mapbox/node-pre-gyp` 帮助开发者无需进行本地编译即可使用此插件,默认插件位于 [Github Release](https://github.com/X-Profiler/xprofiler/releases) 页面,国内访问可能较慢,你也可以自行镜像到其它位置加速安装。 ### 嵌入项目 diff --git a/package.json b/package.json index 8112d4e..cd90a0f 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ }, "homepage": "https://github.com/X-Profiler/xprofiler#readme", "dependencies": { - "@xprofiler/node-pre-gyp": "^1.0.11", + "@mapbox/node-pre-gyp": "^1.0.11", "moment": "^2.30.1", "nan": "^2.18.0", "uuid": "^9.0.1", diff --git a/scripts/copy.js b/scripts/copy.js index 342c9f3..0128f84 100644 --- a/scripts/copy.js +++ b/scripts/copy.js @@ -6,7 +6,7 @@ const { promisify } = require('util'); const exists = promisify(fs.exists); const mkdir = promisify(fs.mkdir); const copyFile = promisify(fs.copyFile); -const versioning = require('@xprofiler/node-pre-gyp/lib/util/versioning.js'); +const versioning = require('@mapbox/node-pre-gyp/lib/util/versioning.js'); const { staged_tarball: packagePath } = versioning.evaluate(require('../package.json')); async function copy() { diff --git a/scripts/versions.js b/scripts/versions.js index e28027f..1351a44 100644 --- a/scripts/versions.js +++ b/scripts/versions.js @@ -20,4 +20,5 @@ exports.os8u = [ 'node-v19.9.0', 'node-v20.10.0', 'node-v21.5.0', + 'node-v22.1.0', ]; diff --git a/xprofiler.js b/xprofiler.js index fdb7231..ffef07f 100644 --- a/xprofiler.js +++ b/xprofiler.js @@ -10,7 +10,7 @@ const pkg = require('./package.json'); const workerThreads = require('./lib/worker_threads'); // xprofiler.node -const binary = require('@xprofiler/node-pre-gyp'); +const binary = require('@mapbox/node-pre-gyp'); const bindingPath = binary.find(path.resolve(path.join(__dirname, './package.json'))); const xprofiler = require(bindingPath); xprofiler.setup({