@crossbind/port-expat-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
  ## emscripten-embind — MIT OR NCSA
46
46
 
47
- - package: @crossbind/core-embind-jsi@2.0.0-beta.63
47
+ - package: @crossbind/core-embind-jsi@2.0.0-beta.65
48
48
  - source: https://github.com/emscripten-core/emscripten
49
49
  - no license election recorded; the declared expression applies and all texts are included
50
50
  - note: Emscripten's embind, adapted by @crossbind/core-embind-jsi
@@ -151,7 +151,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
151
151
 
152
152
  ## expat — MIT
153
153
 
154
- - package: @crossbind/port-expat-darwin@2.0.0-beta.63
154
+ - package: @crossbind/port-expat-darwin@2.0.0-beta.65
155
155
  - native version: 2.9.0
156
156
  - source: https://github.com/libexpat/libexpat/releases/download/R_2_9_0/expat-2.9.0.tar.gz (sha256: 16afbb9cefead2aa278105cf27d9f597bde7fbf3dbb85015857ca7ca6a4e89ba)
157
157
 
@@ -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);
@@ -3,24 +3,30 @@
3
3
  export declare class XML_cp {
4
4
  constructor();
5
5
  numchildren: number;
6
+ delete(): void;
6
7
  }
7
8
  export declare class XML_Memory_Handling_Suite {
8
9
  constructor();
10
+ delete(): void;
9
11
  }
10
12
  export declare class XML_Encoding {
11
13
  constructor();
14
+ delete(): void;
12
15
  }
13
16
  export declare class XML_ParsingStatus {
14
17
  constructor();
18
+ delete(): void;
15
19
  }
16
20
  export declare class XML_Expat_Version {
17
21
  constructor();
18
22
  major: number;
19
23
  minor: number;
20
24
  micro: number;
25
+ delete(): void;
21
26
  }
22
27
  export declare class XML_Feature {
23
28
  constructor();
29
+ delete(): void;
24
30
  }
25
31
  export declare const Expat_INCLUDED: any;
26
32
  export declare const XML_Status: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crossbind/port-expat-standalone-napi",
3
- "version": "2.0.0-beta.63",
3
+ "version": "2.0.0-beta.65",
4
4
  "nativeVersion": "2.9.0",
5
5
  "homepage": "https://crossbind.dev/ports/expat/",
6
6
  "repository": {
@@ -27,21 +27,21 @@
27
27
  "sbom.cdx.json"
28
28
  ],
29
29
  "optionalDependencies": {
30
- "@crossbind/port-expat-standalone-napi-darwin-arm64": "2.0.0-beta.63",
31
- "@crossbind/port-expat-standalone-napi-darwin-x64": "2.0.0-beta.63",
32
- "@crossbind/port-expat-standalone-napi-linux-arm64": "2.0.0-beta.63",
33
- "@crossbind/port-expat-standalone-napi-linux-x64": "2.0.0-beta.63",
34
- "@crossbind/port-expat-standalone-napi-linuxmusl-arm64": "2.0.0-beta.63",
35
- "@crossbind/port-expat-standalone-napi-linuxmusl-x64": "2.0.0-beta.63",
36
- "@crossbind/port-expat-standalone-napi-win32-arm64": "2.0.0-beta.63",
37
- "@crossbind/port-expat-standalone-napi-win32-x64": "2.0.0-beta.63"
30
+ "@crossbind/port-expat-standalone-napi-darwin-arm64": "2.0.0-beta.65",
31
+ "@crossbind/port-expat-standalone-napi-darwin-x64": "2.0.0-beta.65",
32
+ "@crossbind/port-expat-standalone-napi-linux-arm64": "2.0.0-beta.65",
33
+ "@crossbind/port-expat-standalone-napi-linux-x64": "2.0.0-beta.65",
34
+ "@crossbind/port-expat-standalone-napi-linuxmusl-arm64": "2.0.0-beta.65",
35
+ "@crossbind/port-expat-standalone-napi-linuxmusl-x64": "2.0.0-beta.65",
36
+ "@crossbind/port-expat-standalone-napi-win32-arm64": "2.0.0-beta.65",
37
+ "@crossbind/port-expat-standalone-napi-win32-x64": "2.0.0-beta.65"
38
38
  },
39
39
  "devDependencies": {
40
- "crossbind": "^2.0.0-beta.63",
41
- "@crossbind/port-expat-darwin": "^2.0.0-beta.63",
42
- "@crossbind/port-expat-linux": "^2.0.0-beta.63",
43
- "@crossbind/port-expat-linuxmusl": "^2.0.0-beta.63",
44
- "@crossbind/port-expat-win32": "^2.0.0-beta.63"
40
+ "crossbind": "^2.0.0-beta.65",
41
+ "@crossbind/port-expat-darwin": "^2.0.0-beta.65",
42
+ "@crossbind/port-expat-linux": "^2.0.0-beta.65",
43
+ "@crossbind/port-expat-linuxmusl": "^2.0.0-beta.65",
44
+ "@crossbind/port-expat-win32": "^2.0.0-beta.65"
45
45
  },
46
46
  "keywords": [
47
47
  "expat",
package/sbom.cdx.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "component": {
7
7
  "type": "library",
8
8
  "name": "@crossbind/port-expat-standalone-napi",
9
- "version": "2.0.0-beta.63"
9
+ "version": "2.0.0-beta.65"
10
10
  }
11
11
  },
12
12
  "components": [