bare-module 4.8.2 → 4.8.4
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 +10 -6
- package/index.js +12 -3
- package/lib/errors.js +6 -2
- package/package.json +4 -1
- 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
|
@@ -282,9 +282,11 @@ bare_module_create_function(js_env_t *env, js_callback_info_t *info) {
|
|
|
282
282
|
|
|
283
283
|
js_value_t **args = malloc(sizeof(js_value_t *) * args_len);
|
|
284
284
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
285
|
+
uint32_t fetched;
|
|
286
|
+
err = js_get_array_elements(env, argv[1], args, args_len, 0, &fetched);
|
|
287
|
+
|
|
288
|
+
if (err < 0 || fetched != args_len) {
|
|
289
|
+
goto err;
|
|
288
290
|
}
|
|
289
291
|
|
|
290
292
|
js_value_t *source = argv[2];
|
|
@@ -368,9 +370,11 @@ bare_module_create_synthetic_module(js_env_t *env, js_callback_info_t *info) {
|
|
|
368
370
|
|
|
369
371
|
js_value_t **export_names = malloc(sizeof(js_value_t *) * names_len);
|
|
370
372
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
373
|
+
uint32_t fetched;
|
|
374
|
+
err = js_get_array_elements(env, argv[1], export_names, names_len, 0, &fetched);
|
|
375
|
+
|
|
376
|
+
if (err < 0 || fetched != names_len) {
|
|
377
|
+
goto err;
|
|
374
378
|
}
|
|
375
379
|
|
|
376
380
|
bare_module_context_t *context;
|
package/index.js
CHANGED
|
@@ -501,6 +501,8 @@ module.exports = exports = class Module {
|
|
|
501
501
|
|
|
502
502
|
if (resolution) return protocol.postresolve(resolution)
|
|
503
503
|
|
|
504
|
+
const candidates = []
|
|
505
|
+
|
|
504
506
|
for (const resolution of resolve(
|
|
505
507
|
resolved,
|
|
506
508
|
parentURL,
|
|
@@ -516,6 +518,8 @@ module.exports = exports = class Module {
|
|
|
516
518
|
},
|
|
517
519
|
readPackage
|
|
518
520
|
)) {
|
|
521
|
+
candidates.push(resolution)
|
|
522
|
+
|
|
519
523
|
switch (resolution.protocol) {
|
|
520
524
|
case 'builtin:':
|
|
521
525
|
return resolution
|
|
@@ -526,9 +530,14 @@ module.exports = exports = class Module {
|
|
|
526
530
|
}
|
|
527
531
|
}
|
|
528
532
|
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
)
|
|
533
|
+
let message = `Cannot find module '${specifier}' imported from '${parentURL.href}`
|
|
534
|
+
|
|
535
|
+
if (candidates.length > 0) {
|
|
536
|
+
message += '\nCandidates:'
|
|
537
|
+
message += '\n' + candidates.map((url) => '- ' + url.href).join('\n')
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
throw errors.MODULE_NOT_FOUND(message, candidates)
|
|
532
541
|
|
|
533
542
|
function readPackage(packageURL) {
|
|
534
543
|
if (protocol.exists(packageURL, constants.types.JSON)) {
|
package/lib/errors.js
CHANGED
|
@@ -12,12 +12,16 @@ module.exports = class ModuleError extends Error {
|
|
|
12
12
|
return 'ModuleError'
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
static MODULE_NOT_FOUND(msg) {
|
|
16
|
-
|
|
15
|
+
static MODULE_NOT_FOUND(msg, candidates = []) {
|
|
16
|
+
const err = new ModuleError(
|
|
17
17
|
msg,
|
|
18
18
|
'MODULE_NOT_FOUND',
|
|
19
19
|
ModuleError.MODULE_NOT_FOUND
|
|
20
20
|
)
|
|
21
|
+
|
|
22
|
+
err.candidates = candidates
|
|
23
|
+
|
|
24
|
+
return err
|
|
21
25
|
}
|
|
22
26
|
|
|
23
27
|
static ASSET_NOT_FOUND(msg) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bare-module",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.4",
|
|
4
4
|
"description": "Module support for JavaScript",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -32,6 +32,9 @@
|
|
|
32
32
|
"url": "https://github.com/holepunchto/bare-module/issues"
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://github.com/holepunchto/bare-module#readme",
|
|
35
|
+
"engines": {
|
|
36
|
+
"bare": ">=1.16.0"
|
|
37
|
+
},
|
|
35
38
|
"dependencies": {
|
|
36
39
|
"bare-bundle": "^1.3.0",
|
|
37
40
|
"bare-module-lexer": "^1.0.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
|