Repository navigation
Expand file tree
/
Copy pathLoaderConfig.h
More file actions
65 lines (57 loc) · 2.74 KB
/
Copy pathLoaderConfig.h
File metadata and controls
65 lines (57 loc) · 2.74 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef NATIVESCRIPT_COMMON_LOADER_CONFIG_H_
#define NATIVESCRIPT_COMMON_LOADER_CONFIG_H_
#include <memory>
#include <string>
#include <utility>
#include <vector>
namespace nativescript::common {
// The module loader's per-process settings. HTTP settings live apart, in
// http::HttpLoaderConfig.
struct LoaderConfig {
// Absolute, lexically normalized, no trailing slash: what "/" and "~/" in a
// specifier name.
std::string appRoot;
// Other absolute spellings of appRoot's directory or of one of its
// ancestors, each paired with the spelling appRoot uses: a path under
// `first` is keyed as the same path under `second`. Android:
// /data/data/<pkg> for /data/user/0/<pkg>; iOS: /private/var for /var.
std::vector<std::pair<std::string, std::string>> appRootAliases;
// Paths that a file: URL may name the app root by ("/app",
// "/android_asset/app"): file:///app/x names <appRoot>/x. No trailing
// slash.
std::vector<std::string> virtualFileRoots;
// What the script origin of a file under appRoot starts with, followed by
// the file's path relative to appRoot: app:///foo.mjs. Files elsewhere get
// file://<absolute path>.
std::string appRootOrigin = "app://";
// True: origins write paths verbatim, not percent-encoded, import.meta.url
// is the origin, import.meta.dirname the directory the origin spells, and
// there is no import.meta.filename. False: origins are percent-encoded and
// import.meta.url, .filename and .dirname name the file's real path.
bool legacyOrigins = false;
// Stripped from the front of reported script origins (iOS: the bundle's
// base directory; Android: empty).
std::string reportedPathPrefix;
// Diagnostics only. It must never change what JS observes: errors throw the
// same way in both builds.
bool isDebug = false;
// Import attributes checked as Node and browsers check them: a JSON module
// needs `with { type: "json" }`, and `type: "json"` on any other module or
// an unsupported `type` rejects the import with a TypeError. Off, the
// import goes on, and a debug build logs each mismatch once per module.
bool enforceImportAttributes = false;
bool codeCacheEnabled = false;
// Absolute, no trailing slash; writable.
std::string codeCacheDir;
// The string passed to v8::V8::SetFlagsFromString (see ns/V8Flags.h).
std::string v8Flags;
};
namespace platform {
// The configuration a new main runtime loads with (loader::InstallLoader).
// Each snapshot is immutable: a runtime that changes its configuration between
// runs publishes a new one, and isolates of an earlier run keep theirs. Any
// thread.
std::shared_ptr<const LoaderConfig> LoaderSnapshot();
} // namespace platform
} // namespace nativescript::common
#endif // NATIVESCRIPT_COMMON_LOADER_CONFIG_H_