@rolldown/binding-wasm32-wasi 1.0.0-beta.24 → 1.0.0-beta.26

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rolldown/binding-wasm32-wasi",
3
- "version": "1.0.0-beta.24",
3
+ "version": "1.0.0-beta.26",
4
4
  "cpu": [
5
5
  "wasm32"
6
6
  ],
@@ -102,7 +102,7 @@ export const BindingWatcherEvent = __napiModule.exports.BindingWatcherEvent
102
102
  export const ParallelJsPluginRegistry = __napiModule.exports.ParallelJsPluginRegistry
103
103
  export const BindingAttachDebugInfo = __napiModule.exports.BindingAttachDebugInfo
104
104
  export const BindingBuiltinPluginName = __napiModule.exports.BindingBuiltinPluginName
105
- export const BindingHookSideEffects = __napiModule.exports.BindingHookSideEffects
105
+ export const BindingChunkModuleOrderBy = __napiModule.exports.BindingChunkModuleOrderBy
106
106
  export const BindingJsx = __napiModule.exports.BindingJsx
107
107
  export const BindingLogLevel = __napiModule.exports.BindingLogLevel
108
108
  export const BindingPluginOrder = __napiModule.exports.BindingPluginOrder
@@ -65,6 +65,29 @@ const { instance: __napiInstance, module: __wasiModule, napiModule: __napiModule
65
65
  worker.onmessage = ({ data }) => {
66
66
  __wasmCreateOnMessageForFsProxy(__nodeFs)(data)
67
67
  }
68
+
69
+ // The main thread of Node.js waits for all the active handles before exiting.
70
+ // But Rust threads are never waited without `thread::join`.
71
+ // So here we hack the code of Node.js to prevent the workers from being referenced (active).
72
+ // According to https://github.com/nodejs/node/blob/19e0d472728c79d418b74bddff588bea70a403d0/lib/internal/worker.js#L415,
73
+ // a worker is consist of two handles: kPublicPort and kHandle.
74
+ {
75
+ const kPublicPort = Object.getOwnPropertySymbols(worker).find(s =>
76
+ s.toString().includes("kPublicPort")
77
+ );
78
+ if (kPublicPort) {
79
+ worker[kPublicPort].ref = () => {};
80
+ }
81
+
82
+ const kHandle = Object.getOwnPropertySymbols(worker).find(s =>
83
+ s.toString().includes("kHandle")
84
+ );
85
+ if (kPublicPort) {
86
+ worker[kHandle].ref = () => {};
87
+ }
88
+
89
+ worker.unref();
90
+ }
68
91
  return worker
69
92
  },
70
93
  overwriteImports(importObject) {
@@ -126,7 +149,7 @@ module.exports.BindingWatcherEvent = __napiModule.exports.BindingWatcherEvent
126
149
  module.exports.ParallelJsPluginRegistry = __napiModule.exports.ParallelJsPluginRegistry
127
150
  module.exports.BindingAttachDebugInfo = __napiModule.exports.BindingAttachDebugInfo
128
151
  module.exports.BindingBuiltinPluginName = __napiModule.exports.BindingBuiltinPluginName
129
- module.exports.BindingHookSideEffects = __napiModule.exports.BindingHookSideEffects
152
+ module.exports.BindingChunkModuleOrderBy = __napiModule.exports.BindingChunkModuleOrderBy
130
153
  module.exports.BindingJsx = __napiModule.exports.BindingJsx
131
154
  module.exports.BindingLogLevel = __napiModule.exports.BindingLogLevel
132
155
  module.exports.BindingPluginOrder = __napiModule.exports.BindingPluginOrder
Binary file