Skip to content

Commit

Permalink
Merge branch 'master' into magnetic-manatee
Browse files Browse the repository at this point in the history
  • Loading branch information
rotu committed Jun 18, 2024
2 parents d7372f5 + af3534c commit 1aa6a05
Show file tree
Hide file tree
Showing 17 changed files with 213 additions and 351 deletions.
115 changes: 0 additions & 115 deletions .travis.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"llvm-vs-code-extensions.vscode-clangd",
"xadillax.gyp",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
"esbenp.prettier-vscode",
"vadimcn.vscode-lldb"
]
}
46 changes: 46 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"configurations": [
{
"name": "JS-Attach",
"type": "node",
"request": "attach",
"port": 9229,
"continueOnAttach": true,
"autoAttachChildProcesses": true,
"resolveSourceMapLocations": [
"!**/node_modules/**",
"!**/.vscode/extensions/hbenl.vscode-mocha-test-adapter-*/**"
],
"skipFiles": [
"<node_internals>/**"
],
},
{
"type": "lldb",
"request": "launch",
"name": "Native-Launch",
"preLaunchTask": "clean_build_debug",
"program": "node",
"suppressMultipleSessionWarning": true,
"sourceLanguages": [
"cpp"
],
"args": [
"--inspect-brk=9229",
"--expose-gc",
"-r",
"ts-node/register",
"${workspaceFolder}/test/debug.ts"
],
}
],
"compounds": [
{
"name": "Node-Launch",
"configurations": [
"Native-Launch",
"JS-Attach",
]
}
]
}
6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"mochaExplorer.parallel": true,
"mochaExplorer.globImplementation": "vscode"
"mochaExplorer.globImplementation": "vscode",
"mochaExplorer.nodeArgv": [
"--expose-gc"
],
"mochaExplorer.debuggerConfig": "JS-Attach"
}
10 changes: 10 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "clean_build_debug",
"type": "shell",
"command": "pnpm clean.release && pnpm build.debug",
}
]
}
10 changes: 0 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,3 @@ tool similar to Cmake. GYP was originally created to generate native IDE project
files (Visual Studio, Xcode) for building Chromium.

The `.gyp` file is structured as a Python dictionary.

## Weak-napi

https://www.npmjs.com/package/weak-napi On certain rarer occasions, you run into
the need to be notified when a JavaScript object is going to be garbage
collected. This feature is exposed to V8's C++ API, but not to JavaScript.

That's where weak-napi comes in! This module exports the JS engine's GC tracking
functionality to JavaScript. This allows you to create weak references, and
optionally attach a callback function to any arbitrary JS object.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# ZeroMQ.js Next Generation

[![Latest version](https://img.shields.io/npm/v/zeromq?label=version)](https://www.npmjs.com/package/zeromq)
[![Greenkeeper monitoring](https://img.shields.io/badge/dependencies-monitored-brightgreen)](https://greenkeeper.io/)
[![Travis build status](https://img.shields.io/travis/zeromq/zeromq.js)](https://travis-ci.org/zeromq/zeromq.js)

## ⚠️ Version 6.0.0 (in beta) features a brand new API that solves many fundamental issues and is recommended for new projects. ⚠️

Expand Down
12 changes: 0 additions & 12 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,6 @@
],
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'GCC_ENABLE_EXCEPTIONS': 'YES',
'OTHER_CFLAGS': [
"<!(echo \"-arch ${ARCH:=x86_64}\")",
],
'OTHER_LDFLAGS': [
"<!(echo \"-arch ${ARCH:=x86_64}\")",
]
},
}],

Expand Down Expand Up @@ -227,12 +221,6 @@
'DEAD_CODE_STRIPPING': 'YES',
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'GCC_ENABLE_EXCEPTIONS': 'YES',
'OTHER_CFLAGS': [
"<!(echo \"-arch ${ARCH:=x86_64}\")",
],
'OTHER_LDFLAGS': [
"<!(echo \"-arch ${ARCH:=x86_64}\")",
]
},
}],

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
"scripts": {
"install": "(shx test -f ./script/build.js || run-s build.js) && cross-env npm_config_build_from_source=true aminya-node-gyp-build",
"clean": "shx rm -rf ./build ./lib/ ./prebuilds ./script/*.js ./script/*.js.map ./script/*.d.ts ./script/*.tsbuildinfo",
"clean.release": "shx rm -rf ./build/Release",
"clean.temp": "shx rm -rf ./tmp && shx mkdir -p ./tmp",
"build.library": "tsc -p ./src/tsconfig.json",
"build.script": "tsc -p ./script/tsconfig.json && tsc -p ./script/tsconfig.esm.json",
Expand All @@ -95,10 +96,9 @@
"build.native.debug": "node-gyp configure --debug && node-gyp configure --debug -- -f compile_commands_json && cross-env CMAKE_BUILD_TYPE=Debug node-gyp build --debug",
"build": "run-s build.js build.native",
"build.debug": "run-s build.js build.native.debug",
"test.deps": "cd test && pnpm install && cd ..",
"test": "run-s clean.temp test.deps build && mocha",
"test.skip_gc_tests": "run-s clean.temp test.deps build.debug && cross-env SKIP_GC_TESTS=true mocha",
"test.electron.main": "run-s clean.temp test.deps build && electron-mocha",
"test": "run-s clean.temp build && mocha",
"test.skip_gc_tests": "run-s clean.temp build.debug && cross-env SKIP_GC_TESTS=true mocha",
"test.electron.main": "run-s clean.temp build && electron-mocha",
"format": "prettier --write .",
"test.electron.renderer": "run-s build && electron-mocha --renderer",
"lint.clang-format": "clang-format -i -style=file ./src/*.cc ./src/*.h ./src/util/*.h",
Expand Down
26 changes: 26 additions & 0 deletions test/debug.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import * as zmq from "../src"

import {getGcOrSkipTest} from "./unit/helpers"

async function main() {
const gc = getGcOrSkipTest()

let weakRef: undefined | WeakRef<zmq.Context>
const task = async () => {
const context: zmq.Context | undefined = new zmq.Context()
const dealer = new zmq.Dealer({context, linger: 0})
weakRef = new WeakRef(context)

// dealer.close()
}

await task()
await gc()

console.log(weakRef?.deref())
}

main().catch(err => {
console.error(err)
process.exit(1)
})
6 changes: 0 additions & 6 deletions test/package.json

This file was deleted.

81 changes: 0 additions & 81 deletions test/pnpm-lock.yaml

This file was deleted.

4 changes: 3 additions & 1 deletion test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"extends": "../tsconfig.json",
"include": ["**/*.ts"]
"include": [
"**/*.ts"
]
}
Loading

0 comments on commit 1aa6a05

Please sign in to comment.