Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
module: empty object fix in InternalModuleReadJSON for #30245
  • Loading branch information
guybedford committed Nov 5, 2019
commit 528cbb5ccd169abf8b206ea7695ed024d93fa3cd
1 change: 1 addition & 0 deletions src/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ constexpr size_t kFsStatsBufferLength =
V(done_string, "done") \
V(duration_string, "duration") \
V(emit_warning_string, "emitWarning") \
V(empty_object_string, "{}") \
V(encoding_string, "encoding") \
V(entries_string, "entries") \
V(entry_type_string, "entryType") \
Expand Down
3 changes: 1 addition & 2 deletions src/node_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

#include "node_file.h"
#include "aliased_buffer.h"
#include "memory_tracker-inl.h"
Expand Down Expand Up @@ -787,7 +786,7 @@ static void InternalModuleReadJSON(const FunctionCallbackInfo<Value>& args) {
size == SearchString(&chars[start], size, "\"main\"") &&
size == SearchString(&chars[start], size, "\"exports\"") &&
size == SearchString(&chars[start], size, "\"type\""))) {
return;
args.GetReturnValue().Set(env->empty_object_string());
} else {
Local<String> chars_string =
String::NewFromUtf8(isolate,
Expand Down
8 changes: 8 additions & 0 deletions test/es-module/test-esm-default-type.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Flags: --experimental-modules
import '../common/index.mjs';
import { strictEqual } from 'assert';

import asdf from
'../fixtures/es-modules/package-type-module/nested-default-type/module.js';

strictEqual(asdf, 'asdf');
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = 'asdf';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}