@crossbind/port-zlib 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/LICENSE +21 -0
- package/README.md +66 -0
- package/build.mjs +9 -0
- package/mergeConfig.mjs +16 -0
- package/package.json +37 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Buğra Sarı and crossbind contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# @crossbind/port-zlib
|
|
2
|
+
**Precompiled zlib 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-zlib">
|
|
5
|
+
<img alt="NPM version" src="https://img.shields.io/npm/v/@crossbind/port-zlib?style=for-the-badge" />
|
|
6
|
+
</a>
|
|
7
|
+
<a href="https://zlib.net/">
|
|
8
|
+
<img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Funpkg.com%2F%40crossbind%2Fpackage-zlib%2Fpackage.json&query=%24.nativeVersion&style=for-the-badge&label=zlib" />
|
|
9
|
+
</a>
|
|
10
|
+
<a href="https://zlib.net/zlib_license.html">
|
|
11
|
+
<img alt="License" src="https://img.shields.io/npm/l/%40crossbind%2Fpackage-zlib?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-zlib @crossbind/port-zlib-wasm @crossbind/port-zlib-android @crossbind/port-zlib-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 zlibWasm from '@crossbind/port-zlib-wasm/crossbind.config.js';
|
|
27
|
+
+import zlibAndroid from '@crossbind/port-zlib-android/crossbind.config.js';
|
|
28
|
+
+import zlibIos from '@crossbind/port-zlib-ios/crossbind.config.js';
|
|
29
|
+
|
|
30
|
+
export default {
|
|
31
|
+
dependencies: [
|
|
32
|
+
+ zlibWasm,
|
|
33
|
+
+ zlibAndroid,
|
|
34
|
+
+ zlibIos,
|
|
35
|
+
],
|
|
36
|
+
paths: {
|
|
37
|
+
config: import.meta.url,
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
Below are the steps to use the zlib in your C++ or JavaScript code.
|
|
44
|
+
|
|
45
|
+
### Usage in C++ Code
|
|
46
|
+
```diff
|
|
47
|
+
+#include <zlib.h>
|
|
48
|
+
|
|
49
|
+
std::string Native::sample() {
|
|
50
|
+
+ return std::string(zlibVersion());
|
|
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-zlib-wasm`](https://www.npmjs.com/package/@crossbind/port-zlib-wasm) | `wasm32` — single-threaded & multi-threaded |
|
|
60
|
+
| Android | [`@crossbind/port-zlib-android`](https://www.npmjs.com/package/@crossbind/port-zlib-android) | `arm64-v8a` (64-bit ARM), `x86_64` (emulator) |
|
|
61
|
+
| iOS | [`@crossbind/port-zlib-ios`](https://www.npmjs.com/package/@crossbind/port-zlib-ios) | device (`arm64`), simulator (`arm64`) |
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
This project includes the precompiled zlib library, which is distributed under the [zlib License](https://zlib.net/zlib_license.html).
|
|
65
|
+
|
|
66
|
+
Zlib Homepage: [https://zlib.net/](https://zlib.net/)
|
package/build.mjs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
sha256: 'bb329a0a2cd0274d05519d61c667c062e06990d72e125ee2dfa8de64f0119d16', // zlib-1.3.2.tar.gz
|
|
3
|
+
getURL: (version) => `https://zlib.net/zlib-${version}.tar.gz`,
|
|
4
|
+
buildType: 'cmake',
|
|
5
|
+
getBuildParams: (target) => [
|
|
6
|
+
target.platform === 'android' ? '-DZLIB_BUILD_STATIC=OFF' : '-DZLIB_BUILD_SHARED=OFF',
|
|
7
|
+
'-DZLIB_BUILD_TESTING=OFF',
|
|
8
|
+
],
|
|
9
|
+
};
|
package/mergeConfig.mjs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default (newConfig = {}) => ({
|
|
2
|
+
...newConfig,
|
|
3
|
+
general: {
|
|
4
|
+
name: 'z',
|
|
5
|
+
alias: { package: '@crossbind/port-zlib' },
|
|
6
|
+
},
|
|
7
|
+
export: {
|
|
8
|
+
type: 'cmake',
|
|
9
|
+
bundle: false,
|
|
10
|
+
...(newConfig.export || {}),
|
|
11
|
+
},
|
|
12
|
+
paths: {
|
|
13
|
+
output: 'dist',
|
|
14
|
+
...(newConfig.paths || {}),
|
|
15
|
+
},
|
|
16
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@crossbind/port-zlib",
|
|
3
|
+
"version": "2.0.0-beta.50",
|
|
4
|
+
"nativeVersion": "1.3.2",
|
|
5
|
+
"description": "This package provides the precompiled zlib library, built using crossbind, for easy integration into JavaScript, WebAssembly and React Native projects. It offers compression and decompression functionalities through the zlib API, ensuring high performance and cross-platform compatibility. Ideal for use in web and mobile applications.",
|
|
6
|
+
"homepage": "https://github.com/crossbind/crossbind/tree/main/ports/zlib#readme",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/crossbind/crossbind.git"
|
|
10
|
+
},
|
|
11
|
+
"license": "Zlib",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"zlib",
|
|
15
|
+
"libz",
|
|
16
|
+
"compression",
|
|
17
|
+
"crossbind",
|
|
18
|
+
"crossbind-package",
|
|
19
|
+
"webassembly",
|
|
20
|
+
"wasm",
|
|
21
|
+
"android",
|
|
22
|
+
"ios",
|
|
23
|
+
"react-native"
|
|
24
|
+
],
|
|
25
|
+
"crossbind": {
|
|
26
|
+
"upstream": {
|
|
27
|
+
"license": {
|
|
28
|
+
"declared": "Zlib",
|
|
29
|
+
"selected": null,
|
|
30
|
+
"files": [
|
|
31
|
+
"LICENSE"
|
|
32
|
+
],
|
|
33
|
+
"copyright": null
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|