bare-module 4.7.0 → 4.8.0
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/README.md +371 -47
- package/binding.c +38 -21
- package/index.js +259 -134
- package/lib/constants.js +2 -1
- package/lib/errors.js +33 -13
- package/lib/protocol.js +9 -9
- package/package.json +4 -3
- 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/lib/constants.js
CHANGED
package/lib/errors.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module.exports = class ModuleError extends Error {
|
|
2
|
-
constructor
|
|
2
|
+
constructor(msg, code, fn = ModuleError) {
|
|
3
3
|
super(`${code}: ${msg}`)
|
|
4
4
|
this.code = code
|
|
5
5
|
|
|
@@ -8,31 +8,51 @@ module.exports = class ModuleError extends Error {
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
get name
|
|
11
|
+
get name() {
|
|
12
12
|
return 'ModuleError'
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
static MODULE_NOT_FOUND
|
|
16
|
-
return new ModuleError(
|
|
15
|
+
static MODULE_NOT_FOUND(msg) {
|
|
16
|
+
return new ModuleError(
|
|
17
|
+
msg,
|
|
18
|
+
'MODULE_NOT_FOUND',
|
|
19
|
+
ModuleError.MODULE_NOT_FOUND
|
|
20
|
+
)
|
|
17
21
|
}
|
|
18
22
|
|
|
19
|
-
static ASSET_NOT_FOUND
|
|
23
|
+
static ASSET_NOT_FOUND(msg) {
|
|
20
24
|
return new ModuleError(msg, 'ASSET_NOT_FOUND', ModuleError.ASSET_NOT_FOUND)
|
|
21
25
|
}
|
|
22
26
|
|
|
23
|
-
static UNKNOWN_PROTOCOL
|
|
24
|
-
return new ModuleError(
|
|
27
|
+
static UNKNOWN_PROTOCOL(msg) {
|
|
28
|
+
return new ModuleError(
|
|
29
|
+
msg,
|
|
30
|
+
'UNKNOWN_PROTOCOL',
|
|
31
|
+
ModuleError.UNKNOWN_PROTOCOL
|
|
32
|
+
)
|
|
25
33
|
}
|
|
26
34
|
|
|
27
|
-
static INVALID_BUNDLE_EXTENSION
|
|
28
|
-
return new ModuleError(
|
|
35
|
+
static INVALID_BUNDLE_EXTENSION(msg) {
|
|
36
|
+
return new ModuleError(
|
|
37
|
+
msg,
|
|
38
|
+
'INVALID_BUNDLE_EXTENSION',
|
|
39
|
+
ModuleError.INVALID_BUNDLE_EXTENSION
|
|
40
|
+
)
|
|
29
41
|
}
|
|
30
42
|
|
|
31
|
-
static INVALID_URL_PATH
|
|
32
|
-
return new ModuleError(
|
|
43
|
+
static INVALID_URL_PATH(msg) {
|
|
44
|
+
return new ModuleError(
|
|
45
|
+
msg,
|
|
46
|
+
'INVALID_URL_PATH',
|
|
47
|
+
ModuleError.INVALID_URL_PATH
|
|
48
|
+
)
|
|
33
49
|
}
|
|
34
50
|
|
|
35
|
-
static TYPE_INCOMPATIBLE
|
|
36
|
-
return new ModuleError(
|
|
51
|
+
static TYPE_INCOMPATIBLE(msg) {
|
|
52
|
+
return new ModuleError(
|
|
53
|
+
msg,
|
|
54
|
+
'TYPE_INCOMPATIBLE',
|
|
55
|
+
ModuleError.TYPE_INCOMPATIBLE
|
|
56
|
+
)
|
|
37
57
|
}
|
|
38
58
|
}
|
package/lib/protocol.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module.exports = class ModuleProtocol {
|
|
2
|
-
constructor
|
|
2
|
+
constructor(methods = {}, context = null) {
|
|
3
3
|
for (const name of [
|
|
4
4
|
'preresolve',
|
|
5
5
|
'postresolve',
|
|
@@ -24,33 +24,33 @@ module.exports = class ModuleProtocol {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
preresolve
|
|
27
|
+
preresolve(specifier, parentURL) {
|
|
28
28
|
return specifier
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
postresolve
|
|
31
|
+
postresolve(url) {
|
|
32
32
|
return url
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
*
|
|
35
|
+
*resolve(specifier, parentURL, imports) {}
|
|
36
36
|
|
|
37
|
-
exists
|
|
37
|
+
exists(url, type) {
|
|
38
38
|
return false
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
read
|
|
41
|
+
read(url) {
|
|
42
42
|
return null
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
addon
|
|
45
|
+
addon(url) {
|
|
46
46
|
return url
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
asset
|
|
49
|
+
asset(url) {
|
|
50
50
|
return url
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
extend
|
|
53
|
+
extend(methods) {
|
|
54
54
|
return new ModuleProtocol(methods, this)
|
|
55
55
|
}
|
|
56
56
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bare-module",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.8.0",
|
|
4
4
|
"description": "Module support for JavaScript",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
],
|
|
14
14
|
"addon": true,
|
|
15
15
|
"scripts": {
|
|
16
|
-
"test": "
|
|
16
|
+
"test": "prettier . --check && bare test.js"
|
|
17
17
|
},
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"brittle": "^3.1.1",
|
|
37
37
|
"cmake-bare": "^1.1.6",
|
|
38
|
-
"
|
|
38
|
+
"prettier": "^3.3.3",
|
|
39
|
+
"prettier-config-standard": "^7.0.0"
|
|
39
40
|
}
|
|
40
41
|
}
|
|
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
|