cargo-messages 0.0.67 → 0.0.68
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/lib/load.cjs +12 -7
- package/package.json +1 -1
package/lib/load.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const { currentTarget } = require('@neon-rs/load');
|
|
2
2
|
|
|
3
|
+
/*
|
|
3
4
|
function lazy(loaders, exports) {
|
|
4
5
|
let loaded = null;
|
|
5
6
|
|
|
@@ -23,8 +24,17 @@ function lazy(loaders, exports) {
|
|
|
23
24
|
|
|
24
25
|
return module;
|
|
25
26
|
}
|
|
27
|
+
*/
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
function choose(loaders) {
|
|
30
|
+
const target = currentTarget();
|
|
31
|
+
if (!loaders.hasOwnProperty(target)) {
|
|
32
|
+
throw new Error(`no precompiled module found for ${target}`);
|
|
33
|
+
}
|
|
34
|
+
return loaders[target]();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
module.exports = choose({
|
|
28
38
|
'darwin-x64': () => require('@cargo-messages/darwin-x64'),
|
|
29
39
|
'win32-x64-msvc': () => require('@cargo-messages/win32-x64-msvc'),
|
|
30
40
|
'aarch64-pc-windows-msvc': () => require('@cargo-messages/win32-arm64-msvc'),
|
|
@@ -33,9 +43,4 @@ module.exports = lazy({
|
|
|
33
43
|
'linux-x64-gnu': () => require('@cargo-messages/linux-x64-gnu'),
|
|
34
44
|
'linux-arm-gnueabihf': () => require('@cargo-messages/linux-arm-gnueabihf'),
|
|
35
45
|
'android-arm-eabi': () => require('@cargo-messages/android-arm-eabi')
|
|
36
|
-
}
|
|
37
|
-
'fromFile',
|
|
38
|
-
'fromStdin',
|
|
39
|
-
'findArtifact',
|
|
40
|
-
'findFileByCrateType'
|
|
41
|
-
]);
|
|
46
|
+
});
|