@crossbind/port-zstd 2.0.0-beta.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/LICENSE +30 -0
- package/README.md +66 -0
- package/build.mjs +21 -0
- package/mergeConfig.mjs +18 -0
- package/package.json +39 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# @crossbind/port-zstd
|
|
2
|
+
|
|
3
|
+
## 2.0.0-beta.50
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Rebuilt in the 1.0.2 toolchain image — Rust 1.98.0, Emscripten 6.0.2. The recipe and the
|
|
8
|
+
upstream source are unchanged; what moved is the compiler the binaries were produced by.
|
|
9
|
+
|
|
10
|
+
## 1.0.0
|
|
11
|
+
|
|
12
|
+
- 🚀 first release
|
package/LICENSE
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
BSD License
|
|
2
|
+
|
|
3
|
+
For Zstandard software
|
|
4
|
+
|
|
5
|
+
Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
|
|
6
|
+
|
|
7
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
8
|
+
are permitted provided that the following conditions are met:
|
|
9
|
+
|
|
10
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
11
|
+
list of conditions and the following disclaimer.
|
|
12
|
+
|
|
13
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
14
|
+
this list of conditions and the following disclaimer in the documentation
|
|
15
|
+
and/or other materials provided with the distribution.
|
|
16
|
+
|
|
17
|
+
* Neither the name Facebook, nor Meta, nor the names of its contributors may
|
|
18
|
+
be used to endorse or promote products derived from this software without
|
|
19
|
+
specific prior written permission.
|
|
20
|
+
|
|
21
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
22
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
23
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
24
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
25
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
26
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
27
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
28
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
29
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
30
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# @crossbind/port-zstd
|
|
2
|
+
**Precompiled Zstandard (zstd) library built with crossbind for seamless integration in JavaScript, WebAssembly and React Native projects.**
|
|
3
|
+
|
|
4
|
+
<a href="https://www.npmjs.com/package/@crossbind/port-zstd">
|
|
5
|
+
<img alt="NPM version" src="https://img.shields.io/npm/v/@crossbind/port-zstd?style=for-the-badge" />
|
|
6
|
+
</a>
|
|
7
|
+
<a href="https://github.com/facebook/zstd">
|
|
8
|
+
<img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Funpkg.com%2F%40crossbind%2Fpackage-zstd%2Fpackage.json&query=%24.nativeVersion&style=for-the-badge&label=ZSTD" />
|
|
9
|
+
</a>
|
|
10
|
+
<a href="https://github.com/facebook/zstd/blob/dev/LICENSE">
|
|
11
|
+
<img alt="License" src="https://img.shields.io/npm/l/%40crossbind%2Fpackage-zstd?style=for-the-badge" />
|
|
12
|
+
</a>
|
|
13
|
+
|
|
14
|
+
> Use it together with **[crossbind](https://crossbind.dev)** — the toolchain for using C++ libraries from JavaScript, TypeScript, WebAssembly, Node.js and React Native. Learn more at **[crossbind.dev](https://crossbind.dev)**.
|
|
15
|
+
|
|
16
|
+
## Integration
|
|
17
|
+
Install the main package together with the platform builds:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
npm install @crossbind/port-zstd @crossbind/port-zstd-wasm @crossbind/port-zstd-android @crossbind/port-zstd-ios
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Then import all three platforms in `crossbind.config.js` — crossbind compiles only the one matching each build target:
|
|
24
|
+
|
|
25
|
+
```diff
|
|
26
|
+
+import zstdWasm from '@crossbind/port-zstd-wasm/crossbind.config.js';
|
|
27
|
+
+import zstdAndroid from '@crossbind/port-zstd-android/crossbind.config.js';
|
|
28
|
+
+import zstdIos from '@crossbind/port-zstd-ios/crossbind.config.js';
|
|
29
|
+
|
|
30
|
+
export default {
|
|
31
|
+
dependencies: [
|
|
32
|
+
+ zstdWasm,
|
|
33
|
+
+ zstdAndroid,
|
|
34
|
+
+ zstdIos,
|
|
35
|
+
],
|
|
36
|
+
paths: {
|
|
37
|
+
config: import.meta.url,
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
Below are the steps to use zstd in your C++ or JavaScript code.
|
|
44
|
+
|
|
45
|
+
### Usage in C++ Code
|
|
46
|
+
```diff
|
|
47
|
+
+#include <zstd.h>
|
|
48
|
+
|
|
49
|
+
std::string Native::sample() {
|
|
50
|
+
+ return ZSTD_versionString();
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Supported platforms
|
|
55
|
+
This is the main package; the precompiled binaries are shipped per platform:
|
|
56
|
+
|
|
57
|
+
| Platform | Package | Targets |
|
|
58
|
+
|---|---|---|
|
|
59
|
+
| WebAssembly | [`@crossbind/port-zstd-wasm`](https://www.npmjs.com/package/@crossbind/port-zstd-wasm) | `wasm32` — single-threaded & multi-threaded |
|
|
60
|
+
| Android | [`@crossbind/port-zstd-android`](https://www.npmjs.com/package/@crossbind/port-zstd-android) | `arm64-v8a` (64-bit ARM), `x86_64` (emulator) |
|
|
61
|
+
| iOS | [`@crossbind/port-zstd-ios`](https://www.npmjs.com/package/@crossbind/port-zstd-ios) | device (`arm64`), simulator (`arm64`) |
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
This project includes the precompiled zstd library, which is distributed under the [zstd License](https://github.com/facebook/zstd/blob/dev/LICENSE).
|
|
65
|
+
|
|
66
|
+
zstd Homepage: [https://facebook.github.io/zstd/](https://facebook.github.io/zstd/)
|
package/build.mjs
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
sha256: 'eb33e51f49a15e023950cd7825ca74a4a2b43db8354825ac24fc1b7ee09e6fa3', // zstd-1.5.7.tar.gz
|
|
3
|
+
getURL: (version) => `https://github.com/facebook/zstd/releases/download/v${version}/zstd-${version}.tar.gz`,
|
|
4
|
+
// zstd ships its CMake project under build/cmake/, not at the source root.
|
|
5
|
+
// copyToSource places a thin wrapper CMakeLists.txt at the extracted
|
|
6
|
+
// source root that simply add_subdirectory()s build/cmake.
|
|
7
|
+
copyToSource: { 'assets/CMakeLists.txt': 'CMakeLists.txt' },
|
|
8
|
+
buildType: 'cmake',
|
|
9
|
+
getBuildParams: (target) => {
|
|
10
|
+
const shared = target.platform === 'android';
|
|
11
|
+
return [
|
|
12
|
+
`-DZSTD_BUILD_SHARED=${shared ? 'ON' : 'OFF'}`,
|
|
13
|
+
`-DZSTD_BUILD_STATIC=${shared ? 'OFF' : 'ON'}`,
|
|
14
|
+
'-DZSTD_BUILD_PROGRAMS=OFF',
|
|
15
|
+
'-DZSTD_BUILD_TESTS=OFF',
|
|
16
|
+
'-DZSTD_LEGACY_SUPPORT=OFF',
|
|
17
|
+
'-DZSTD_MULTITHREAD_SUPPORT=OFF',
|
|
18
|
+
'-DZSTD_DISABLE_ASM=ON',
|
|
19
|
+
];
|
|
20
|
+
},
|
|
21
|
+
};
|
package/mergeConfig.mjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export default (newConfig = {}) => ({
|
|
2
|
+
...newConfig,
|
|
3
|
+
general: {
|
|
4
|
+
name: 'zstd',
|
|
5
|
+
alias: { package: '@crossbind/port-zstd' },
|
|
6
|
+
},
|
|
7
|
+
export: {
|
|
8
|
+
type: 'cmake',
|
|
9
|
+
bundle: false,
|
|
10
|
+
libName: ['zstd'],
|
|
11
|
+
...(newConfig.export || {}),
|
|
12
|
+
},
|
|
13
|
+
paths: {
|
|
14
|
+
output: 'dist',
|
|
15
|
+
base: '../..',
|
|
16
|
+
...(newConfig.paths || {}),
|
|
17
|
+
},
|
|
18
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@crossbind/port-zstd",
|
|
3
|
+
"version": "2.0.0-beta.50",
|
|
4
|
+
"nativeVersion": "1.5.7",
|
|
5
|
+
"description": "This package provides a libzstd library compiled with crossbind, enabling seamless usage of Zstandard (de)compression functionalities in JavaScript, WebAssembly and React Native projects.",
|
|
6
|
+
"homepage": "https://github.com/crossbind/crossbind/tree/main/ports/zstd#readme",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/crossbind/crossbind.git"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"license": "BSD-3-Clause",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"zstd",
|
|
15
|
+
"zstandard",
|
|
16
|
+
"libzstd",
|
|
17
|
+
"compression",
|
|
18
|
+
"crossbind",
|
|
19
|
+
"crossbind-package",
|
|
20
|
+
"webassembly",
|
|
21
|
+
"wasm",
|
|
22
|
+
"android",
|
|
23
|
+
"ios",
|
|
24
|
+
"react-native"
|
|
25
|
+
],
|
|
26
|
+
"crossbind": {
|
|
27
|
+
"upstream": {
|
|
28
|
+
"license": {
|
|
29
|
+
"declared": "BSD-3-Clause OR GPL-2.0-only",
|
|
30
|
+
"selected": null,
|
|
31
|
+
"files": [
|
|
32
|
+
"LICENSE",
|
|
33
|
+
"COPYING"
|
|
34
|
+
],
|
|
35
|
+
"copyright": null
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|