@crossbind/port-curl-standalone-napi 2.0.0-beta.63 → 2.0.0-beta.65

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 CHANGED
@@ -14,7 +14,7 @@ advice; the compliance assessment is yours.
14
14
 
15
15
  ## crossbind — MIT
16
16
 
17
- - package: crossbind@2.0.0-beta.63
17
+ - package: crossbind@2.0.0-beta.65
18
18
  - source: https://github.com/crossbind/crossbind
19
19
  - note: the embind-jsi and embind-napi runtime and the bindings crossbind generates
20
20
 
@@ -44,7 +44,7 @@ SOFTWARE.
44
44
 
45
45
  ## curl — curl
46
46
 
47
- - package: @crossbind/port-curl-darwin@2.0.0-beta.63
47
+ - package: @crossbind/port-curl-darwin@2.0.0-beta.65
48
48
  - native version: 8.22.0
49
49
  - source: https://curl.se/download/curl-8.22.0.tar.gz (sha256: d54dd598bf05927a726deb38df31c6a255ba83ff1de57c5d1464dac3ed8f44a1)
50
50
 
@@ -77,7 +77,7 @@ in this Software without prior written authorization of the copyright holder.
77
77
 
78
78
  ## emscripten-embind — MIT OR NCSA
79
79
 
80
- - package: @crossbind/core-embind-jsi@2.0.0-beta.63
80
+ - package: @crossbind/core-embind-jsi@2.0.0-beta.65
81
81
  - source: https://github.com/emscripten-core/emscripten
82
82
  - no license election recorded; the declared expression applies and all texts are included
83
83
  - note: Emscripten's embind, adapted by @crossbind/core-embind-jsi
@@ -184,7 +184,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
184
184
 
185
185
  ## openssl — Apache-2.0
186
186
 
187
- - package: @crossbind/port-openssl-darwin@2.0.0-beta.63
187
+ - package: @crossbind/port-openssl-darwin@2.0.0-beta.65
188
188
  - native version: 4.0.3
189
189
  - source: https://github.com/openssl/openssl/releases/download/openssl-4.0.3/openssl-4.0.3.tar.gz (sha256: 325b5c806167c13b40b1ffeadfe0248197c00eccc4cf123ec1e28d2d2fd216d9)
190
190
 
@@ -1970,7 +1970,13 @@ function makeClassHandle(prototype, record) {
1970
1970
  },
1971
1971
  }));
1972
1972
  }
1973
+ // A value C++ returns by copy crosses through the converter `isReference` marks, though the handle it makes is
1974
+ // typed as a pointer to the object's own class: JavaScript owns that copy (ownHandle).
1973
1975
  function RegisteredPointer_fromWireType(ptr) {
1976
+ var handle = handleFromWire.call(this, ptr);
1977
+ return this.isReference && handle ? ownHandle(handle) : handle;
1978
+ }
1979
+ function handleFromWire(ptr) {
1974
1980
  //console.log('RegisteredPointer_fromWireType', ptr);
1975
1981
  // ptr is a raw pointer (or a raw smartpointer)
1976
1982
  // ptr = bigintToI53Checked(ptr);
@@ -2067,16 +2073,17 @@ function attachFinalizer(handle) {
2067
2073
  // https://github.com/tc39/proposal-weakrefs), then attach finalizers
2068
2074
  // for class handles. We check for the presence of FinalizationRegistry
2069
2075
  // at run-time, not build-time.
2070
- // A collected handle is released without the warning upstream prints under ASSERTIONS, as a release wasm build
2071
- // does: JavaScript never has to call .delete() on what crossbind hands it.
2076
+ // A collected handle is released without the warning upstream prints under ASSERTIONS: it is freed by design.
2072
2077
  finalizationRegistry = new FinalizationRegistry((info) => {
2073
2078
  releaseClassHandle(info.$$);
2074
2079
  });
2075
2080
  attachFinalizer = (handle) => {
2076
2081
  var $$ = handle.$$;
2077
2082
  var hasSmartPtr = !!$$.smartPtr;
2078
- if (hasSmartPtr) {
2079
- // We should not call the destructor on raw pointers in case other code expects the pointee to live
2083
+ // JavaScript owns an object behind a smart pointer, and one ownHandle marked on the count a handle shares with
2084
+ // its clones, as the wasm glue does after utils/embindObjectLifetime.js. A raw pointer stays its library's:
2085
+ // other code may expect the pointee to live.
2086
+ if (hasSmartPtr || $$.count.owned) {
2080
2087
  finalizationRegistry.register(handle, { $$: $$ }, handle);
2081
2088
  }
2082
2089
  return handle;
@@ -2084,6 +2091,16 @@ function attachFinalizer(handle) {
2084
2091
  detachFinalizer = (handle) => finalizationRegistry.unregister(handle);
2085
2092
  return attachFinalizer(handle);
2086
2093
  }
2094
+ // A copy embind made of a returned value and an object JavaScript constructed through a raw constructor (a vector,
2095
+ // a Rust class) are released as one behind a smart pointer is.
2096
+ function ownHandle(handle) {
2097
+ var $$ = handle.$$;
2098
+ if (!$$.smartPtr && !$$.count.owned) {
2099
+ $$.count.owned = true;
2100
+ if (finalizationRegistry) finalizationRegistry.register(handle, { $$: $$ }, handle);
2101
+ }
2102
+ return handle;
2103
+ }
2087
2104
  function ClassHandle_clone() {
2088
2105
  if (!this.$$.ptr) {
2089
2106
  throwInstanceAlreadyDeleted(this);
@@ -2481,7 +2498,7 @@ function __embind_register_class(rawType,
2481
2498
  if (undefined === body) {
2482
2499
  throw new BindingError(`Tried to invoke ctor of ${name} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(registeredClass.constructor_body).toString()}) parameters instead!`);
2483
2500
  }
2484
- return body.apply(this, arguments);
2501
+ return ownHandle(body.apply(this, arguments));
2485
2502
  });
2486
2503
 
2487
2504
  var instancePrototype = Object.create(basePrototype, {
@@ -3716,7 +3733,8 @@ function toArray(vector) {
3716
3733
  return output;
3717
3734
  }
3718
3735
 
3719
- function toVector(VectorClass, array = []) {
3736
+ function toVector(classOrName, array = []) {
3737
+ const VectorClass = typeof classOrName === 'string' ? Module[classOrName] : classOrName;
3720
3738
  const vector = new VectorClass();
3721
3739
  array.forEach((item) => {
3722
3740
  vector.push_back(item);
@@ -3727,7 +3745,7 @@ function toVector(VectorClass, array = []) {
3727
3745
  globalThis.Module.toArray = toArray;
3728
3746
  globalThis.Module.toVector = toVector;
3729
3747
 
3730
- var systemConfig = {"env":{"darwin-arm64":{},"darwin-x64":{},"linux-arm64":{},"linux-x64":{},"linuxmusl-arm64":{},"linuxmusl-x64":{},"win32-arm64":{},"win32-x64":{}},"general":{"name":"curl-standalone-napi"},"paths":{"addon":"curl-standalone-napi.{platform}-{arch}.node","addonPackage":"@crossbind/port-curl-standalone-napi-{platform}-{arch}"}};
3748
+ var systemConfig = {"env":{"darwin-arm64":{"CURL_CA_BUNDLE":"_CROSSBIND_DATA_PATH_/certs/cacert.pem"},"darwin-x64":{"CURL_CA_BUNDLE":"_CROSSBIND_DATA_PATH_/certs/cacert.pem"},"linux-arm64":{"CURL_CA_BUNDLE":"_CROSSBIND_DATA_PATH_/certs/cacert.pem"},"linux-x64":{"CURL_CA_BUNDLE":"_CROSSBIND_DATA_PATH_/certs/cacert.pem"},"linuxmusl-arm64":{"CURL_CA_BUNDLE":"_CROSSBIND_DATA_PATH_/certs/cacert.pem"},"linuxmusl-x64":{"CURL_CA_BUNDLE":"_CROSSBIND_DATA_PATH_/certs/cacert.pem"},"win32-arm64":{"CURL_CA_BUNDLE":"_CROSSBIND_DATA_PATH_/certs/cacert.pem"},"win32-x64":{"CURL_CA_BUNDLE":"_CROSSBIND_DATA_PATH_/certs/cacert.pem"}},"general":{"name":"curl-standalone-napi"},"paths":{"addon":"curl-standalone-napi.{platform}-{arch}.node","addonPackage":"@crossbind/port-curl-standalone-napi-{platform}-{arch}"}};
3731
3749
 
3732
3750
  // The platform part of an addon file name. Node reports musl and glibc systems alike as 'linux'; a
3733
3751
  // process linked against glibc names that glibc in its report header, a musl one does not.
@@ -6,6 +6,7 @@ export declare class curl_httppost {
6
6
  contentslength: number;
7
7
  bufferlength: number;
8
8
  flags: number;
9
+ delete(): void;
9
10
  }
10
11
  export declare class curl_fileinfo {
11
12
  constructor();
@@ -15,6 +16,7 @@ export declare class curl_fileinfo {
15
16
  flags: number;
16
17
  b_size: number;
17
18
  b_used: number;
19
+ delete(): void;
18
20
  }
19
21
  export declare class curl_sockaddr {
20
22
  constructor();
@@ -22,35 +24,44 @@ export declare class curl_sockaddr {
22
24
  socktype: number;
23
25
  protocol: number;
24
26
  addrlen: number;
27
+ delete(): void;
25
28
  }
26
29
  export declare class curl_khkey {
27
30
  constructor();
28
31
  len: number;
32
+ delete(): void;
29
33
  }
30
34
  export declare class curl_hstsentry {
31
35
  constructor();
32
36
  namelen: number;
37
+ delete(): void;
33
38
  }
34
39
  export declare class curl_index {
35
40
  constructor();
36
41
  index: number;
37
42
  total: number;
43
+ delete(): void;
38
44
  }
39
45
  export declare class curl_forms {
40
46
  constructor();
47
+ delete(): void;
41
48
  }
42
49
  export declare class curl_slist {
43
50
  constructor();
51
+ delete(): void;
44
52
  }
45
53
  export declare class curl_ssl_backend {
46
54
  constructor();
55
+ delete(): void;
47
56
  }
48
57
  export declare class curl_certinfo {
49
58
  constructor();
50
59
  num_of_certs: number;
60
+ delete(): void;
51
61
  }
52
62
  export declare class curl_tlssessioninfo {
53
63
  constructor();
64
+ delete(): void;
54
65
  }
55
66
  export declare class curl_version_info_data {
56
67
  constructor();
@@ -62,35 +73,42 @@ export declare class curl_version_info_data {
62
73
  brotli_ver_num: number;
63
74
  nghttp2_ver_num: number;
64
75
  zstd_ver_num: number;
76
+ delete(): void;
65
77
  }
66
78
  export declare class curl_blob {
67
79
  constructor();
68
80
  len: number;
69
81
  flags: number;
82
+ delete(): void;
70
83
  }
71
84
  export declare class CURLMsg {
72
85
  constructor();
86
+ delete(): void;
73
87
  }
74
88
  export declare class curl_waitfd {
75
89
  constructor();
76
90
  events: number;
77
91
  revents: number;
92
+ delete(): void;
78
93
  }
79
94
  export declare class curl_easyoption {
80
95
  constructor();
81
96
  flags: number;
97
+ delete(): void;
82
98
  }
83
99
  export declare class curl_header {
84
100
  constructor();
85
101
  amount: number;
86
102
  index: number;
87
103
  origin: number;
104
+ delete(): void;
88
105
  }
89
106
  export declare class curl_ws_frame {
90
107
  constructor();
91
108
  age: number;
92
109
  flags: number;
93
110
  len: number;
111
+ delete(): void;
94
112
  }
95
113
  export declare const CURL_SOCKET_BAD: any;
96
114
  export declare const curl_sslbackend: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crossbind/port-curl-standalone-napi",
3
- "version": "2.0.0-beta.63",
3
+ "version": "2.0.0-beta.65",
4
4
  "nativeVersion": "8.22.0",
5
5
  "homepage": "https://crossbind.dev/ports/curl/",
6
6
  "repository": {
@@ -27,21 +27,21 @@
27
27
  "sbom.cdx.json"
28
28
  ],
29
29
  "optionalDependencies": {
30
- "@crossbind/port-curl-standalone-napi-darwin-arm64": "2.0.0-beta.63",
31
- "@crossbind/port-curl-standalone-napi-darwin-x64": "2.0.0-beta.63",
32
- "@crossbind/port-curl-standalone-napi-linux-arm64": "2.0.0-beta.63",
33
- "@crossbind/port-curl-standalone-napi-linux-x64": "2.0.0-beta.63",
34
- "@crossbind/port-curl-standalone-napi-linuxmusl-arm64": "2.0.0-beta.63",
35
- "@crossbind/port-curl-standalone-napi-linuxmusl-x64": "2.0.0-beta.63",
36
- "@crossbind/port-curl-standalone-napi-win32-arm64": "2.0.0-beta.63",
37
- "@crossbind/port-curl-standalone-napi-win32-x64": "2.0.0-beta.63"
30
+ "@crossbind/port-curl-standalone-napi-darwin-arm64": "2.0.0-beta.65",
31
+ "@crossbind/port-curl-standalone-napi-darwin-x64": "2.0.0-beta.65",
32
+ "@crossbind/port-curl-standalone-napi-linux-arm64": "2.0.0-beta.65",
33
+ "@crossbind/port-curl-standalone-napi-linux-x64": "2.0.0-beta.65",
34
+ "@crossbind/port-curl-standalone-napi-linuxmusl-arm64": "2.0.0-beta.65",
35
+ "@crossbind/port-curl-standalone-napi-linuxmusl-x64": "2.0.0-beta.65",
36
+ "@crossbind/port-curl-standalone-napi-win32-arm64": "2.0.0-beta.65",
37
+ "@crossbind/port-curl-standalone-napi-win32-x64": "2.0.0-beta.65"
38
38
  },
39
39
  "devDependencies": {
40
- "crossbind": "^2.0.0-beta.63",
41
- "@crossbind/port-curl-darwin": "^2.0.0-beta.63",
42
- "@crossbind/port-curl-linux": "^2.0.0-beta.63",
43
- "@crossbind/port-curl-linuxmusl": "^2.0.0-beta.63",
44
- "@crossbind/port-curl-win32": "^2.0.0-beta.63"
40
+ "crossbind": "^2.0.0-beta.65",
41
+ "@crossbind/port-curl-darwin": "^2.0.0-beta.65",
42
+ "@crossbind/port-curl-linux": "^2.0.0-beta.65",
43
+ "@crossbind/port-curl-linuxmusl": "^2.0.0-beta.65",
44
+ "@crossbind/port-curl-win32": "^2.0.0-beta.65"
45
45
  },
46
46
  "keywords": [
47
47
  "curl",
package/sbom.cdx.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "component": {
7
7
  "type": "library",
8
8
  "name": "@crossbind/port-curl-standalone-napi",
9
- "version": "2.0.0-beta.63"
9
+ "version": "2.0.0-beta.65"
10
10
  }
11
11
  },
12
12
  "components": [