@rspack/binding-wasm32-wasi 1.4.7 → 1.4.9
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 +2 -2
- package/rspack.wasi-browser.js +60 -5
- package/rspack.wasi.cjs +55 -14
- package/rspack.wasm32-wasi.wasm +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/binding-wasm32-wasi",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Node binding for rspack",
|
|
6
6
|
"main": "rspack.wasi.cjs",
|
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
"wasi-worker-browser.mjs"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@napi-rs/wasm-runtime": "^0.
|
|
29
|
+
"@napi-rs/wasm-runtime": "^1.0.1"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/rspack.wasi-browser.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createOnMessage as __wasmCreateOnMessageForFsProxy,
|
|
3
3
|
getDefaultContext as __emnapiGetDefaultContext,
|
|
4
|
-
|
|
4
|
+
instantiateNapiModule as __emnapiInstantiateNapiModule,
|
|
5
5
|
WASI as __WASI,
|
|
6
6
|
} from '@napi-rs/wasm-runtime'
|
|
7
|
-
import { memfs } from '@napi-rs/wasm-runtime/fs'
|
|
8
|
-
|
|
7
|
+
import { memfs, Buffer } from '@napi-rs/wasm-runtime/fs'
|
|
8
|
+
|
|
9
9
|
|
|
10
10
|
export const { fs: __fs, vol: __volume } = memfs()
|
|
11
11
|
|
|
@@ -17,7 +17,9 @@ const __wasi = new __WASI({
|
|
|
17
17
|
},
|
|
18
18
|
})
|
|
19
19
|
|
|
20
|
+
const __wasmUrl = new URL('./rspack.wasm32-wasi.wasm', import.meta.url).href
|
|
20
21
|
const __emnapiContext = __emnapiGetDefaultContext()
|
|
22
|
+
__emnapiContext.feature.Buffer = Buffer
|
|
21
23
|
|
|
22
24
|
const __sharedMemory = new WebAssembly.Memory({
|
|
23
25
|
initial: 16384,
|
|
@@ -31,7 +33,7 @@ const {
|
|
|
31
33
|
instance: __napiInstance,
|
|
32
34
|
module: __wasiModule,
|
|
33
35
|
napiModule: __napiModule,
|
|
34
|
-
} =
|
|
36
|
+
} = await __emnapiInstantiateNapiModule(__wasmFile, {
|
|
35
37
|
context: __emnapiContext,
|
|
36
38
|
asyncWorkPoolSize: 4,
|
|
37
39
|
wasi: __wasi,
|
|
@@ -60,4 +62,57 @@ const {
|
|
|
60
62
|
}
|
|
61
63
|
},
|
|
62
64
|
})
|
|
63
|
-
export default __napiModule.exports
|
|
65
|
+
export default __napiModule.exports
|
|
66
|
+
export const Assets = __napiModule.exports.Assets
|
|
67
|
+
export const AsyncDependenciesBlock = __napiModule.exports.AsyncDependenciesBlock
|
|
68
|
+
export const Chunk = __napiModule.exports.Chunk
|
|
69
|
+
export const ChunkGraph = __napiModule.exports.ChunkGraph
|
|
70
|
+
export const ChunkGroup = __napiModule.exports.ChunkGroup
|
|
71
|
+
export const Chunks = __napiModule.exports.Chunks
|
|
72
|
+
export const CodeGenerationResult = __napiModule.exports.CodeGenerationResult
|
|
73
|
+
export const CodeGenerationResults = __napiModule.exports.CodeGenerationResults
|
|
74
|
+
export const ConcatenatedModule = __napiModule.exports.ConcatenatedModule
|
|
75
|
+
export const ContextModule = __napiModule.exports.ContextModule
|
|
76
|
+
export const Dependency = __napiModule.exports.Dependency
|
|
77
|
+
export const Diagnostics = __napiModule.exports.Diagnostics
|
|
78
|
+
export const EntryDataDto = __napiModule.exports.EntryDataDto
|
|
79
|
+
export const EntryDataDTO = __napiModule.exports.EntryDataDTO
|
|
80
|
+
export const EntryDependency = __napiModule.exports.EntryDependency
|
|
81
|
+
export const EntryOptionsDto = __napiModule.exports.EntryOptionsDto
|
|
82
|
+
export const EntryOptionsDTO = __napiModule.exports.EntryOptionsDTO
|
|
83
|
+
export const ExternalModule = __napiModule.exports.ExternalModule
|
|
84
|
+
export const JsCompilation = __napiModule.exports.JsCompilation
|
|
85
|
+
export const JsCompiler = __napiModule.exports.JsCompiler
|
|
86
|
+
export const JsContextModuleFactoryAfterResolveData = __napiModule.exports.JsContextModuleFactoryAfterResolveData
|
|
87
|
+
export const JsContextModuleFactoryBeforeResolveData = __napiModule.exports.JsContextModuleFactoryBeforeResolveData
|
|
88
|
+
export const JsDependencies = __napiModule.exports.JsDependencies
|
|
89
|
+
export const JsEntries = __napiModule.exports.JsEntries
|
|
90
|
+
export const JsExportsInfo = __napiModule.exports.JsExportsInfo
|
|
91
|
+
export const JsModuleGraph = __napiModule.exports.JsModuleGraph
|
|
92
|
+
export const JsResolver = __napiModule.exports.JsResolver
|
|
93
|
+
export const JsResolverFactory = __napiModule.exports.JsResolverFactory
|
|
94
|
+
export const JsStats = __napiModule.exports.JsStats
|
|
95
|
+
export const KnownBuildInfo = __napiModule.exports.KnownBuildInfo
|
|
96
|
+
export const Module = __napiModule.exports.Module
|
|
97
|
+
export const ModuleGraphConnection = __napiModule.exports.ModuleGraphConnection
|
|
98
|
+
export const NativeWatcher = __napiModule.exports.NativeWatcher
|
|
99
|
+
export const NativeWatchResult = __napiModule.exports.NativeWatchResult
|
|
100
|
+
export const NormalModule = __napiModule.exports.NormalModule
|
|
101
|
+
export const RawExternalItemFnCtx = __napiModule.exports.RawExternalItemFnCtx
|
|
102
|
+
export const ReadonlyResourceData = __napiModule.exports.ReadonlyResourceData
|
|
103
|
+
export const Sources = __napiModule.exports.Sources
|
|
104
|
+
export const BuiltinPluginName = __napiModule.exports.BuiltinPluginName
|
|
105
|
+
export const cleanupGlobalTrace = __napiModule.exports.cleanupGlobalTrace
|
|
106
|
+
export const EXPECTED_RSPACK_CORE_VERSION = __napiModule.exports.EXPECTED_RSPACK_CORE_VERSION
|
|
107
|
+
export const formatDiagnostic = __napiModule.exports.formatDiagnostic
|
|
108
|
+
export const JsLoaderState = __napiModule.exports.JsLoaderState
|
|
109
|
+
export const JsRspackSeverity = __napiModule.exports.JsRspackSeverity
|
|
110
|
+
export const loadBrowserslist = __napiModule.exports.loadBrowserslist
|
|
111
|
+
export const minify = __napiModule.exports.minify
|
|
112
|
+
export const minifySync = __napiModule.exports.minifySync
|
|
113
|
+
export const RawRuleSetConditionType = __napiModule.exports.RawRuleSetConditionType
|
|
114
|
+
export const registerGlobalTrace = __napiModule.exports.registerGlobalTrace
|
|
115
|
+
export const RegisterJsTapKind = __napiModule.exports.RegisterJsTapKind
|
|
116
|
+
export const syncTraceEvent = __napiModule.exports.syncTraceEvent
|
|
117
|
+
export const transform = __napiModule.exports.transform
|
|
118
|
+
export const transformSync = __napiModule.exports.transformSync
|
package/rspack.wasi.cjs
CHANGED
|
@@ -66,18 +66,6 @@ const { instance: __napiInstance, module: __wasiModule, napiModule: __napiModule
|
|
|
66
66
|
__wasmCreateOnMessageForFsProxy(__nodeFs)(data)
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
// We have enabled `reuseWorker` so normally the workers never exit, unless there's any exception.
|
|
70
|
-
// For Rust threads, aborting one thread means aborting the process, but actually aborting Node.js workers doesn't abort the main thread.
|
|
71
|
-
// I'm not sure whether it's the expected behavior of Node.js workers, or the behavior has been controlled by emnapi.
|
|
72
|
-
// Anyway, this code is used for fix the bug:
|
|
73
|
-
// When the main thread holds a strong tsfn that prevents the Node.js event loop exiting,
|
|
74
|
-
// if the worker responsible for unref the tsfn terminates, then the main thread will never exits.
|
|
75
|
-
worker.on('exit', (code) => {
|
|
76
|
-
if (code !== 0) {
|
|
77
|
-
process.exit(code);
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
|
|
81
69
|
// The main thread of Node.js waits for all the active handles before exiting.
|
|
82
70
|
// But Rust threads are never waited without `thread::join`.
|
|
83
71
|
// So here we hack the code of Node.js to prevent the workers from being referenced (active).
|
|
@@ -94,7 +82,7 @@ const { instance: __napiInstance, module: __wasiModule, napiModule: __napiModule
|
|
|
94
82
|
const kHandle = Object.getOwnPropertySymbols(worker).find(s =>
|
|
95
83
|
s.toString().includes("kHandle")
|
|
96
84
|
);
|
|
97
|
-
if (
|
|
85
|
+
if (kHandle) {
|
|
98
86
|
worker[kHandle].ref = () => {};
|
|
99
87
|
}
|
|
100
88
|
|
|
@@ -119,4 +107,57 @@ const { instance: __napiInstance, module: __wasiModule, napiModule: __napiModule
|
|
|
119
107
|
}
|
|
120
108
|
},
|
|
121
109
|
})
|
|
122
|
-
module.exports = __napiModule.exports
|
|
110
|
+
module.exports = __napiModule.exports
|
|
111
|
+
module.exports.Assets = __napiModule.exports.Assets
|
|
112
|
+
module.exports.AsyncDependenciesBlock = __napiModule.exports.AsyncDependenciesBlock
|
|
113
|
+
module.exports.Chunk = __napiModule.exports.Chunk
|
|
114
|
+
module.exports.ChunkGraph = __napiModule.exports.ChunkGraph
|
|
115
|
+
module.exports.ChunkGroup = __napiModule.exports.ChunkGroup
|
|
116
|
+
module.exports.Chunks = __napiModule.exports.Chunks
|
|
117
|
+
module.exports.CodeGenerationResult = __napiModule.exports.CodeGenerationResult
|
|
118
|
+
module.exports.CodeGenerationResults = __napiModule.exports.CodeGenerationResults
|
|
119
|
+
module.exports.ConcatenatedModule = __napiModule.exports.ConcatenatedModule
|
|
120
|
+
module.exports.ContextModule = __napiModule.exports.ContextModule
|
|
121
|
+
module.exports.Dependency = __napiModule.exports.Dependency
|
|
122
|
+
module.exports.Diagnostics = __napiModule.exports.Diagnostics
|
|
123
|
+
module.exports.EntryDataDto = __napiModule.exports.EntryDataDto
|
|
124
|
+
module.exports.EntryDataDTO = __napiModule.exports.EntryDataDTO
|
|
125
|
+
module.exports.EntryDependency = __napiModule.exports.EntryDependency
|
|
126
|
+
module.exports.EntryOptionsDto = __napiModule.exports.EntryOptionsDto
|
|
127
|
+
module.exports.EntryOptionsDTO = __napiModule.exports.EntryOptionsDTO
|
|
128
|
+
module.exports.ExternalModule = __napiModule.exports.ExternalModule
|
|
129
|
+
module.exports.JsCompilation = __napiModule.exports.JsCompilation
|
|
130
|
+
module.exports.JsCompiler = __napiModule.exports.JsCompiler
|
|
131
|
+
module.exports.JsContextModuleFactoryAfterResolveData = __napiModule.exports.JsContextModuleFactoryAfterResolveData
|
|
132
|
+
module.exports.JsContextModuleFactoryBeforeResolveData = __napiModule.exports.JsContextModuleFactoryBeforeResolveData
|
|
133
|
+
module.exports.JsDependencies = __napiModule.exports.JsDependencies
|
|
134
|
+
module.exports.JsEntries = __napiModule.exports.JsEntries
|
|
135
|
+
module.exports.JsExportsInfo = __napiModule.exports.JsExportsInfo
|
|
136
|
+
module.exports.JsModuleGraph = __napiModule.exports.JsModuleGraph
|
|
137
|
+
module.exports.JsResolver = __napiModule.exports.JsResolver
|
|
138
|
+
module.exports.JsResolverFactory = __napiModule.exports.JsResolverFactory
|
|
139
|
+
module.exports.JsStats = __napiModule.exports.JsStats
|
|
140
|
+
module.exports.KnownBuildInfo = __napiModule.exports.KnownBuildInfo
|
|
141
|
+
module.exports.Module = __napiModule.exports.Module
|
|
142
|
+
module.exports.ModuleGraphConnection = __napiModule.exports.ModuleGraphConnection
|
|
143
|
+
module.exports.NativeWatcher = __napiModule.exports.NativeWatcher
|
|
144
|
+
module.exports.NativeWatchResult = __napiModule.exports.NativeWatchResult
|
|
145
|
+
module.exports.NormalModule = __napiModule.exports.NormalModule
|
|
146
|
+
module.exports.RawExternalItemFnCtx = __napiModule.exports.RawExternalItemFnCtx
|
|
147
|
+
module.exports.ReadonlyResourceData = __napiModule.exports.ReadonlyResourceData
|
|
148
|
+
module.exports.Sources = __napiModule.exports.Sources
|
|
149
|
+
module.exports.BuiltinPluginName = __napiModule.exports.BuiltinPluginName
|
|
150
|
+
module.exports.cleanupGlobalTrace = __napiModule.exports.cleanupGlobalTrace
|
|
151
|
+
module.exports.EXPECTED_RSPACK_CORE_VERSION = __napiModule.exports.EXPECTED_RSPACK_CORE_VERSION
|
|
152
|
+
module.exports.formatDiagnostic = __napiModule.exports.formatDiagnostic
|
|
153
|
+
module.exports.JsLoaderState = __napiModule.exports.JsLoaderState
|
|
154
|
+
module.exports.JsRspackSeverity = __napiModule.exports.JsRspackSeverity
|
|
155
|
+
module.exports.loadBrowserslist = __napiModule.exports.loadBrowserslist
|
|
156
|
+
module.exports.minify = __napiModule.exports.minify
|
|
157
|
+
module.exports.minifySync = __napiModule.exports.minifySync
|
|
158
|
+
module.exports.RawRuleSetConditionType = __napiModule.exports.RawRuleSetConditionType
|
|
159
|
+
module.exports.registerGlobalTrace = __napiModule.exports.registerGlobalTrace
|
|
160
|
+
module.exports.RegisterJsTapKind = __napiModule.exports.RegisterJsTapKind
|
|
161
|
+
module.exports.syncTraceEvent = __napiModule.exports.syncTraceEvent
|
|
162
|
+
module.exports.transform = __napiModule.exports.transform
|
|
163
|
+
module.exports.transformSync = __napiModule.exports.transformSync
|
package/rspack.wasm32-wasi.wasm
CHANGED
|
Binary file
|