Repository navigation
Expand file tree
/
Copy pathTransitional.h
More file actions
33 lines (26 loc) · 1.57 KB
/
Copy pathTransitional.h
File metadata and controls
33 lines (26 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef NATIVESCRIPT_COMMON_LOADER_TRANSITIONAL_H_
#define NATIVESCRIPT_COMMON_LOADER_TRANSITIONAL_H_
#include <v8.h>
#include <string>
// Up-calls into each runtime's module code while step 6 moves that code into
// the core. Each one names the unit that deletes it. Implemented once by each
// runtime, like ns/Platform.h.
namespace nativescript::common::platform {
// module.exports of the CommonJS file at `path` (canonical), loaded by the
// runtime's require() with the cache require() uses: run now unless it is
// cached already, as a module still running is, with its exports so far.
// Empty, with an exception pending, when it cannot be loaded or throws;
// never throws C++. Isolate thread, in `context`. Deleted by step 8, which
// moves the CommonJS loader.
v8::MaybeLocal<v8::Value> RequireFileForImport(v8::Local<v8::Context> context,
const std::string& path);
// Adds `createRequire(baseDir, pumping, deadlineSeconds, throwOnTimeout,
// pumpRunLoop)` to the ns:module binding: the runtime's CommonJS require
// bound to `baseDir`, pumping the loop while an ES module it loads settles
// when `pumping` is true. The last three may be undefined, for the default;
// ns-module.js has validated them. False, with an exception pending, when it
// could not. Deleted by step 8, which moves the CommonJS loader.
bool InstallCreateRequireBinding(v8::Local<v8::Context> context,
v8::Local<v8::Object> binding);
} // namespace nativescript::common::platform
#endif // NATIVESCRIPT_COMMON_LOADER_TRANSITIONAL_H_