bare-module 5.0.3 → 6.0.1
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/binding.c +13 -11
- package/index.js +17 -4
- package/package.json +2 -2
- package/prebuilds/android-arm/bare-module.bare +0 -0
- package/prebuilds/android-arm64/bare-module.bare +0 -0
- package/prebuilds/android-ia32/bare-module.bare +0 -0
- package/prebuilds/android-x64/bare-module.bare +0 -0
- package/prebuilds/darwin-arm64/bare-module.bare +0 -0
- package/prebuilds/darwin-x64/bare-module.bare +0 -0
- package/prebuilds/ios-arm64/bare-module.bare +0 -0
- package/prebuilds/ios-arm64-simulator/bare-module.bare +0 -0
- package/prebuilds/ios-x64-simulator/bare-module.bare +0 -0
- package/prebuilds/linux-arm64/bare-module.bare +0 -0
- package/prebuilds/linux-x64/bare-module.bare +0 -0
- package/prebuilds/win32-arm64/bare-module.bare +0 -0
- package/prebuilds/win32-x64/bare-module.bare +0 -0
package/binding.c
CHANGED
|
@@ -66,14 +66,14 @@ err:
|
|
|
66
66
|
return NULL;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
static
|
|
69
|
+
static js_value_t *
|
|
70
70
|
bare_module__on_dynamic_import(js_env_t *env, js_value_t *specifier, js_value_t *assertions, js_value_t *referrer, void *data) {
|
|
71
71
|
bare_module_context_t *context = (bare_module_context_t *) data;
|
|
72
72
|
|
|
73
73
|
int err;
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
err =
|
|
75
|
+
js_escapable_handle_scope_t *scope;
|
|
76
|
+
err = js_open_escapable_handle_scope(env, &scope);
|
|
77
77
|
assert(err == 0);
|
|
78
78
|
|
|
79
79
|
js_value_t *ctx;
|
|
@@ -93,17 +93,16 @@ bare_module__on_dynamic_import(js_env_t *env, js_value_t *specifier, js_value_t
|
|
|
93
93
|
err = js_call_function(env, ctx, on_import, 4, args, &result);
|
|
94
94
|
if (err < 0) goto err;
|
|
95
95
|
|
|
96
|
-
|
|
97
|
-
err
|
|
98
|
-
if (err < 0) goto err;
|
|
96
|
+
err = js_escape_handle(env, scope, result, &result);
|
|
97
|
+
assert(err == 0);
|
|
99
98
|
|
|
100
|
-
err =
|
|
99
|
+
err = js_close_escapable_handle_scope(env, scope);
|
|
101
100
|
assert(err == 0);
|
|
102
101
|
|
|
103
|
-
return
|
|
102
|
+
return result;
|
|
104
103
|
|
|
105
104
|
err:
|
|
106
|
-
err =
|
|
105
|
+
err = js_close_escapable_handle_scope(env, scope);
|
|
107
106
|
assert(err == 0);
|
|
108
107
|
|
|
109
108
|
return NULL;
|
|
@@ -249,7 +248,10 @@ bare_module_init(js_env_t *env, js_callback_info_t *info) {
|
|
|
249
248
|
err = js_add_teardown_callback(env, bare_module__on_teardown, context);
|
|
250
249
|
assert(err == 0);
|
|
251
250
|
|
|
252
|
-
err = js_on_dynamic_import(env,
|
|
251
|
+
err = js_on_dynamic_import(env, NULL, NULL);
|
|
252
|
+
assert(err == 0);
|
|
253
|
+
|
|
254
|
+
err = js_on_dynamic_import_transitional(env, bare_module__on_dynamic_import, (void *) context);
|
|
253
255
|
assert(err == 0);
|
|
254
256
|
|
|
255
257
|
return result;
|
|
@@ -477,7 +479,7 @@ bare_module_run_module(js_env_t *env, js_callback_info_t *info) {
|
|
|
477
479
|
js_call_function(env, ctx, argv[2], 3, args, NULL);
|
|
478
480
|
}
|
|
479
481
|
|
|
480
|
-
return
|
|
482
|
+
return promise;
|
|
481
483
|
}
|
|
482
484
|
|
|
483
485
|
static js_value_t *
|
package/index.js
CHANGED
|
@@ -16,7 +16,7 @@ const { startsWithWindowsDriveLetter } = resolve
|
|
|
16
16
|
|
|
17
17
|
module.exports = exports = class Module {
|
|
18
18
|
static get [kind]() {
|
|
19
|
-
return
|
|
19
|
+
return 1 // Compatibility version
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
constructor(url) {
|
|
@@ -35,6 +35,7 @@ module.exports = exports = class Module {
|
|
|
35
35
|
this._source = null
|
|
36
36
|
this._function = null
|
|
37
37
|
this._names = null
|
|
38
|
+
this._promise = null
|
|
38
39
|
this._handle = null
|
|
39
40
|
|
|
40
41
|
Object.preventExtensions(this)
|
|
@@ -231,7 +232,11 @@ module.exports = exports = class Module {
|
|
|
231
232
|
|
|
232
233
|
this._synthesize()
|
|
233
234
|
|
|
234
|
-
|
|
235
|
+
this._promise = binding.runModule(
|
|
236
|
+
this._handle,
|
|
237
|
+
Module._handle,
|
|
238
|
+
Module._onrun
|
|
239
|
+
)
|
|
235
240
|
}
|
|
236
241
|
|
|
237
242
|
[Symbol.for('bare.inspect')]() {
|
|
@@ -251,8 +256,14 @@ module.exports = exports = class Module {
|
|
|
251
256
|
}
|
|
252
257
|
|
|
253
258
|
static _extensions = Object.create(null)
|
|
259
|
+
|
|
254
260
|
static _protocol = null
|
|
255
|
-
|
|
261
|
+
|
|
262
|
+
static _cache =
|
|
263
|
+
module[kind] === Module[kind]
|
|
264
|
+
? module.cache || Object.create(null)
|
|
265
|
+
: Object.create(null)
|
|
266
|
+
|
|
256
267
|
static _conditions = ['bare', 'node', Bare.platform, Bare.arch]
|
|
257
268
|
|
|
258
269
|
static _handle = binding.init(
|
|
@@ -284,7 +295,9 @@ module.exports = exports = class Module {
|
|
|
284
295
|
attributes
|
|
285
296
|
})
|
|
286
297
|
|
|
287
|
-
return
|
|
298
|
+
return isDynamicImport
|
|
299
|
+
? module._promise.then(() => binding.getNamespace(module._handle))
|
|
300
|
+
: module._handle
|
|
288
301
|
}
|
|
289
302
|
|
|
290
303
|
static _onevaluate(href) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bare-module",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"description": "Module support for JavaScript",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://github.com/holepunchto/bare-module#readme",
|
|
35
35
|
"engines": {
|
|
36
|
-
"bare": ">=1.
|
|
36
|
+
"bare": ">=1.23.0"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"bare-bundle": "^1.3.0",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|