bare-module 4.8.4 → 4.8.6
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/index.js +19 -15
- package/lib/constants.d.ts +1 -0
- package/lib/constants.js +2 -1
- package/package.json +1 -1
- 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/win32-arm64/bare-module.bare +0 -0
- package/prebuilds/win32-x64/bare-module.bare +0 -0
package/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* global Bare */
|
|
2
1
|
const path = require('bare-path')
|
|
3
2
|
const resolve = require('bare-module-resolve')
|
|
4
3
|
const lex = require('bare-module-lexer')
|
|
@@ -114,14 +113,9 @@ module.exports = exports = class Module {
|
|
|
114
113
|
Module._modules.delete(this)
|
|
115
114
|
}
|
|
116
115
|
|
|
117
|
-
_run() {
|
|
118
|
-
binding.runModule(this._handle, Module._handle, Module._onrun)
|
|
119
|
-
}
|
|
120
|
-
|
|
121
116
|
_transform(isImport, isDynamicImport) {
|
|
122
117
|
if (isDynamicImport) {
|
|
123
|
-
this.
|
|
124
|
-
this._evaluate(true /* eagerRun */)
|
|
118
|
+
this._run()
|
|
125
119
|
} else if (isImport) {
|
|
126
120
|
this._synthesize()
|
|
127
121
|
} else {
|
|
@@ -205,7 +199,7 @@ module.exports = exports = class Module {
|
|
|
205
199
|
)
|
|
206
200
|
}
|
|
207
201
|
|
|
208
|
-
_evaluate(
|
|
202
|
+
_evaluate() {
|
|
209
203
|
if ((this._state & constants.states.EVALUATED) !== 0) return
|
|
210
204
|
|
|
211
205
|
this._state |= constants.states.EVALUATED
|
|
@@ -224,17 +218,23 @@ module.exports = exports = class Module {
|
|
|
224
218
|
urlToPath(this._url),
|
|
225
219
|
urlToDirname(this._url)
|
|
226
220
|
)
|
|
227
|
-
|
|
228
|
-
if (eagerRun) this._run()
|
|
229
221
|
} else if (this._type === constants.types.MODULE) {
|
|
230
222
|
this._run()
|
|
231
223
|
|
|
232
224
|
this._exports = binding.getNamespace(this._handle)
|
|
233
|
-
} else if (eagerRun) {
|
|
234
|
-
this._run()
|
|
235
225
|
}
|
|
236
226
|
}
|
|
237
227
|
|
|
228
|
+
_run() {
|
|
229
|
+
if ((this._state & constants.states.RUN) !== 0) return
|
|
230
|
+
|
|
231
|
+
this._state |= constants.states.RUN
|
|
232
|
+
|
|
233
|
+
this._synthesize()
|
|
234
|
+
|
|
235
|
+
binding.runModule(this._handle, Module._handle, Module._onrun)
|
|
236
|
+
}
|
|
237
|
+
|
|
238
238
|
[Symbol.for('bare.inspect')]() {
|
|
239
239
|
return {
|
|
240
240
|
__proto__: { constructor: Module },
|
|
@@ -978,7 +978,9 @@ Module._protocol = new Protocol({
|
|
|
978
978
|
postresolve(url) {
|
|
979
979
|
switch (url.protocol) {
|
|
980
980
|
case 'file:':
|
|
981
|
-
return pathToFileURL(
|
|
981
|
+
return pathToFileURL(
|
|
982
|
+
binding.realpath(path.toNamespacedPath(fileURLToPath(url)))
|
|
983
|
+
)
|
|
982
984
|
default:
|
|
983
985
|
return url
|
|
984
986
|
}
|
|
@@ -988,7 +990,7 @@ Module._protocol = new Protocol({
|
|
|
988
990
|
switch (url.protocol) {
|
|
989
991
|
case 'file:':
|
|
990
992
|
return binding.exists(
|
|
991
|
-
fileURLToPath(url),
|
|
993
|
+
path.toNamespacedPath(fileURLToPath(url)),
|
|
992
994
|
type === constants.types.ASSET
|
|
993
995
|
? binding.FILE | binding.DIR
|
|
994
996
|
: binding.FILE
|
|
@@ -1001,7 +1003,9 @@ Module._protocol = new Protocol({
|
|
|
1001
1003
|
read(url) {
|
|
1002
1004
|
switch (url.protocol) {
|
|
1003
1005
|
case 'file:':
|
|
1004
|
-
return Buffer.from(
|
|
1006
|
+
return Buffer.from(
|
|
1007
|
+
binding.read(path.toNamespacedPath(fileURLToPath(url)))
|
|
1008
|
+
)
|
|
1005
1009
|
default:
|
|
1006
1010
|
throw errors.UNKNOWN_PROTOCOL(`Cannot load module '${url.href}'`)
|
|
1007
1011
|
}
|
package/lib/constants.d.ts
CHANGED
package/lib/constants.js
CHANGED
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|