Skip to content

Commit

Permalink
fixup rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Oct 2, 2018
1 parent a92792d commit 9b1de85
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct PackageConfig {
const IsValid is_valid;
const HasMain has_main;
const std::string main;
const PackageMode::Mode mode;
const PackageMode mode;
};
} // namespace loader

Expand Down
7 changes: 4 additions & 3 deletions src/module_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ Maybe<uv_file> CheckFile(const std::string& path,
using Exists = PackageConfig::Exists;
using IsValid = PackageConfig::IsValid;
using HasMain = PackageConfig::HasMain;
using PackageMode = PackageConfig::PackageMode;

const PackageConfig& GetPackageConfig(Environment* env,
const std::string& path) {
Expand Down Expand Up @@ -547,7 +548,7 @@ const PackageConfig& GetPackageConfig(Environment* env,
}

Local<Value> pkg_mode_v;
PackageMode::Mode pkg_mode = PackageMode::CJS;
PackageMode pkg_mode = PackageMode::CJS;
if (pkg_json->Get(env->context(), env->mode_string()).ToLocal(&pkg_mode_v) &&
pkg_mode_v->StrictEquals(env->esm_string())) {
pkg_mode = PackageMode::ESM;
Expand All @@ -559,7 +560,7 @@ const PackageConfig& GetPackageConfig(Environment* env,
return entry.first->second;
}

PackageMode::Mode GetPackageMode(Environment* env, const URL& search) {
PackageMode GetPackageMode(Environment* env, const URL& search) {
URL pjson_path("package.json", &search);
while (true) {
const PackageConfig& pkg_json =
Expand All @@ -578,7 +579,7 @@ PackageMode::Mode GetPackageMode(Environment* env, const URL& search) {
}

void SetPackageMode(Environment* env, const URL& search,
PackageMode::Mode pkg_mode) {
PackageMode pkg_mode) {
std::string pjson_path_str = URL("package.json", &search).ToFilePath();
const PackageConfig& pkg_json = GetPackageConfig(env, pjson_path_str);
if (pkg_json.mode != pkg_mode) {
Expand Down

0 comments on commit 9b1de85

Please sign in to comment.