Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniomuso committed Nov 28, 2021
1 parent d2949a1 commit 6e3cb03
Show file tree
Hide file tree
Showing 35 changed files with 3,129 additions and 263 deletions.
202 changes: 134 additions & 68 deletions .github/workflows/CI.yaml

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"branches": ["main"],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/npm",
[
"@semantic-release/git",
{
"assets": ["CHANGELOG.md", "package.json", "yarn.lock"]
}
],
"@semantic-release/github"
]
}
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# 1.0.0 (2021-11-27)


### Features

* added exporting ([4fd604c](https://github.com/antoniomuso/lz4-napi/commit/4fd604c94087fb0f0c6c79bb092a43d43d8c9b6f))
* changed package name ([c2d229d](https://github.com/antoniomuso/lz4-napi/commit/c2d229dbdb3ce5140a8b95198b546331af7b7b3d))
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
authors = ["antoniomuso <[email protected]>"]
edition = "2021"
name = "lz4"
name = "lz4-napi"
version = "0.1.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Fastest lz4 compression library in Node.js, powered by [napi-rs](https://napi.rs
## Install this package

```bash
yarn add napi-lz4
yarn add lz4-napi
```

## API
Expand Down
10 changes: 1 addition & 9 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
const { loadBinding } = require('@node-rs/helper')

/**
* __dirname means load native addon from current dir
* 'package-template' means native addon name is `package-template`
* the first arguments was decided by `napi.name` field in `package.json`
* the second arguments was decided by `name` field in `package.json`
* loadBinding helper will load `package-template.[PLATFORM].node` from `__dirname` first
* If failed to load addon, it will fallback to load from `@napi-rs/package-template-[PLATFORM]`
*/
const {
compress: _compress,
uncompress: _uncompress,
compress_sync,
uncompress_sync,
} = loadBinding(__dirname, 'package-template', '@napi-rs/package-template')
} = loadBinding(__dirname, 'lz4-napi', '@antoniomuso/lz4-napi')

module.exports.compress = function compress(data) {
return _compress(Buffer.isBuffer(data) ? data : Buffer.from(data))
Expand Down
20 changes: 20 additions & 0 deletions memory-leak-detect.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { displayMemoryUsageFromNode } = require('./util')

const { compress } = require('./index')

const initial = process.memoryUsage()

async function main() {
for (let i = 0; i <= 1000000; i++) {
await compress(Buffer.from('hello'))
if (i % 10000 === 0) {
displayMemoryUsageFromNode(initial)
}

if (process.memoryUsage().rss - initial.rss >= 1024 * 1024 * 100) {
throw new Error('Memory limit reached')
}
}
}

main()
4 changes: 2 additions & 2 deletions npm/android-arm64/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# `@napi-rs/package-template-android-arm64`
# `@napi-rs/lz4-napi-android-arm64`

This is the **aarch64-linux-android** binary for `@napi-rs/package-template`
This is the **aarch64-linux-android** binary for `@napi-rs/lz4-napi`
27 changes: 20 additions & 7 deletions npm/android-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
{
"name": "@napi-rs/package-template-android-arm64",
"name": "@antoniomuso/lz4-napi-android-arm64",
"version": "1.0.0",
"os": ["android"],
"cpu": ["arm64"],
"main": "package-template.android-arm64.node",
"files": ["package-template.android-arm64.node"],
"os": [
"android"
],
"cpu": [
"arm64"
],
"main": "lz4-napi.android-arm64.node",
"files": [
"lz4-napi.android-arm64.node"
],
"description": "Template project for writing node package with napi-rs",
"keywords": ["napi-rs", "NAPI", "N-API", "Rust", "node-addon", "node-addon-api"],
"keywords": [
"napi-rs",
"NAPI",
"N-API",
"Rust",
"node-addon",
"node-addon-api"
],
"license": "MIT",
"engines": {
"node": ">= 10"
Expand All @@ -15,5 +28,5 @@
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": "[email protected]:napi-rs/package-template.git"
"repository": "[email protected]:antoniomuso/lz4-napi.git"
}
4 changes: 2 additions & 2 deletions npm/darwin-arm64/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# `@napi-rs/package-template-darwin-arm64`
# `@napi-rs/lz4-napi-darwin-arm64`

This is the **aarch64-apple-darwin** binary for `@napi-rs/package-template`
This is the **aarch64-apple-darwin** binary for `@napi-rs/lz4-napi`
27 changes: 20 additions & 7 deletions npm/darwin-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
{
"name": "@napi-rs/package-template-darwin-arm64",
"name": "@antoniomuso/lz4-napi-darwin-arm64",
"version": "1.0.0",
"os": ["darwin"],
"cpu": ["arm64"],
"main": "package-template.darwin-arm64.node",
"files": ["package-template.darwin-arm64.node"],
"os": [
"darwin"
],
"cpu": [
"arm64"
],
"main": "lz4-napi.darwin-arm64.node",
"files": [
"lz4-napi.darwin-arm64.node"
],
"description": "Template project for writing node package with napi-rs",
"keywords": ["napi-rs", "NAPI", "N-API", "Rust", "node-addon", "node-addon-api"],
"keywords": [
"napi-rs",
"NAPI",
"N-API",
"Rust",
"node-addon",
"node-addon-api"
],
"license": "MIT",
"engines": {
"node": ">= 10"
Expand All @@ -15,5 +28,5 @@
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": "[email protected]:napi-rs/package-template.git"
"repository": "[email protected]:antoniomuso/lz4-napi.git"
}
4 changes: 2 additions & 2 deletions npm/darwin-x64/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# `@napi-rs/package-template-darwin-x64`
# `@napi-rs/lz4-napi-darwin-x64`

This is the **x86_64-apple-darwin** binary for `@napi-rs/package-template`
This is the **x86_64-apple-darwin** binary for `@napi-rs/lz4-napi`
27 changes: 20 additions & 7 deletions npm/darwin-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
{
"name": "@napi-rs/package-template-darwin-x64",
"name": "@antoniomuso/lz4-napi-darwin-x64",
"version": "1.0.0",
"os": ["darwin"],
"cpu": ["x64"],
"main": "package-template.darwin-x64.node",
"files": ["package-template.darwin-x64.node"],
"os": [
"darwin"
],
"cpu": [
"x64"
],
"main": "lz4-napi.darwin-x64.node",
"files": [
"lz4-napi.darwin-x64.node"
],
"description": "Template project for writing node package with napi-rs",
"keywords": ["napi-rs", "NAPI", "N-API", "Rust", "node-addon", "node-addon-api"],
"keywords": [
"napi-rs",
"NAPI",
"N-API",
"Rust",
"node-addon",
"node-addon-api"
],
"license": "MIT",
"engines": {
"node": ">= 10"
Expand All @@ -15,5 +28,5 @@
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": "[email protected]:napi-rs/package-template.git"
"repository": "[email protected]:antoniomuso/lz4-napi.git"
}
4 changes: 2 additions & 2 deletions npm/freebsd-x64/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# `@napi-rs/package-template-freebsd-x64`
# `@napi-rs/lz4-napi-freebsd-x64`

This is the **x86_64-unknown-freebsd** binary for `@napi-rs/package-template`
This is the **x86_64-unknown-freebsd** binary for `@napi-rs/lz4-napi`
27 changes: 20 additions & 7 deletions npm/freebsd-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
{
"name": "@napi-rs/package-template-freebsd-x64",
"name": "@antoniomuso/lz4-napi-freebsd-x64",
"version": "1.0.0",
"os": ["freebsd"],
"cpu": ["x64"],
"main": "package-template.freebsd-x64.node",
"files": ["package-template.freebsd-x64.node"],
"os": [
"freebsd"
],
"cpu": [
"x64"
],
"main": "lz4-napi.freebsd-x64.node",
"files": [
"lz4-napi.freebsd-x64.node"
],
"description": "Template project for writing node package with napi-rs",
"keywords": ["napi-rs", "NAPI", "N-API", "Rust", "node-addon", "node-addon-api"],
"keywords": [
"napi-rs",
"NAPI",
"N-API",
"Rust",
"node-addon",
"node-addon-api"
],
"license": "MIT",
"engines": {
"node": ">= 10"
Expand All @@ -15,5 +28,5 @@
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": "[email protected]:napi-rs/package-template.git"
"repository": "[email protected]:antoniomuso/lz4-napi.git"
}
4 changes: 2 additions & 2 deletions npm/linux-arm-gnueabihf/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# `@napi-rs/package-template-linux-arm-gnueabihf`
# `@napi-rs/lz4-napi-linux-arm-gnueabihf`

This is the **armv7-unknown-linux-gnueabihf** binary for `@napi-rs/package-template`
This is the **armv7-unknown-linux-gnueabihf** binary for `@napi-rs/lz4-napi`
27 changes: 20 additions & 7 deletions npm/linux-arm-gnueabihf/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
{
"name": "@napi-rs/package-template-linux-arm-gnueabihf",
"name": "@antoniomuso/lz4-napi-linux-arm-gnueabihf",
"version": "1.0.0",
"os": ["linux"],
"cpu": ["arm"],
"main": "package-template.linux-arm-gnueabihf.node",
"files": ["package-template.linux-arm-gnueabihf.node"],
"os": [
"linux"
],
"cpu": [
"arm"
],
"main": "lz4-napi.linux-arm-gnueabihf.node",
"files": [
"lz4-napi.linux-arm-gnueabihf.node"
],
"description": "Template project for writing node package with napi-rs",
"keywords": ["napi-rs", "NAPI", "N-API", "Rust", "node-addon", "node-addon-api"],
"keywords": [
"napi-rs",
"NAPI",
"N-API",
"Rust",
"node-addon",
"node-addon-api"
],
"license": "MIT",
"engines": {
"node": ">= 10"
Expand All @@ -15,5 +28,5 @@
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": "[email protected]:napi-rs/package-template.git"
"repository": "[email protected]:antoniomuso/lz4-napi.git"
}
4 changes: 2 additions & 2 deletions npm/linux-arm64-gnu/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# `@napi-rs/package-template-linux-arm64-gnu`
# `@napi-rs/lz4-napi-linux-arm64-gnu`

This is the **aarch64-unknown-linux-gnu** binary for `@napi-rs/package-template`
This is the **aarch64-unknown-linux-gnu** binary for `@napi-rs/lz4-napi`
27 changes: 20 additions & 7 deletions npm/linux-arm64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
{
"name": "@napi-rs/package-template-linux-arm64-gnu",
"name": "@antoniomuso/lz4-napi-linux-arm64-gnu",
"version": "1.0.0",
"os": ["linux"],
"cpu": ["arm64"],
"main": "package-template.linux-arm64-gnu.node",
"files": ["package-template.linux-arm64-gnu.node"],
"os": [
"linux"
],
"cpu": [
"arm64"
],
"main": "lz4-napi.linux-arm64-gnu.node",
"files": [
"lz4-napi.linux-arm64-gnu.node"
],
"description": "Template project for writing node package with napi-rs",
"keywords": ["napi-rs", "NAPI", "N-API", "Rust", "node-addon", "node-addon-api"],
"keywords": [
"napi-rs",
"NAPI",
"N-API",
"Rust",
"node-addon",
"node-addon-api"
],
"license": "MIT",
"engines": {
"node": ">= 10"
Expand All @@ -15,5 +28,5 @@
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": "[email protected]:napi-rs/package-template.git"
"repository": "[email protected]:antoniomuso/lz4-napi.git"
}
4 changes: 2 additions & 2 deletions npm/linux-arm64-musl/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# `@napi-rs/package-template-linux-arm64-musl`
# `@napi-rs/lz4-napi-linux-arm64-musl`

This is the **aarch64-unknown-linux-musl** binary for `@napi-rs/package-template`
This is the **aarch64-unknown-linux-musl** binary for `@napi-rs/lz4-napi`
27 changes: 20 additions & 7 deletions npm/linux-arm64-musl/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
{
"name": "@napi-rs/package-template-linux-arm64-musl",
"name": "@antoniomuso/lz4-napi-linux-arm64-musl",
"version": "1.0.0",
"os": ["linux"],
"cpu": ["arm64"],
"main": "package-template.linux-arm64-musl.node",
"files": ["package-template.linux-arm64-musl.node"],
"os": [
"linux"
],
"cpu": [
"arm64"
],
"main": "lz4-napi.linux-arm64-musl.node",
"files": [
"lz4-napi.linux-arm64-musl.node"
],
"description": "Template project for writing node package with napi-rs",
"keywords": ["napi-rs", "NAPI", "N-API", "Rust", "node-addon", "node-addon-api"],
"keywords": [
"napi-rs",
"NAPI",
"N-API",
"Rust",
"node-addon",
"node-addon-api"
],
"license": "MIT",
"engines": {
"node": ">= 10"
Expand All @@ -15,5 +28,5 @@
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": "[email protected]:napi-rs/package-template.git"
"repository": "[email protected]:antoniomuso/lz4-napi.git"
}
Loading

0 comments on commit 6e3cb03

Please sign in to comment.