History

Fixed Script.require

ksuprynowicz committed 3 years ago

Commit e786fd41 parent 386242d4 files · +50 −9Browse files

Showing the changes to libraries/script-engine/src/ScriptManager.cpp (1 of 4 files). Show all

Unified · Split

libraries/script-engine/src/ScriptManager.cpp+3−2
@@ -1341,7 +1341,7 @@ ScriptValue ScriptManager::newModule(const QString& modulePath, const ScriptValu · 1340 unmodified lines
13411341 // module.require is a bound version of require that always resolves relative to that module's path
13421342 auto boundRequire = _engine->evaluate("(function(id) { return Script.require(Script.require.resolve(id, this.filename)); })", "(boundRequire)");
13431343 module.setProperty("require", boundRequire, READONLY_PROP_FLAGS);
1344− qDebug() << "Module object contents" << _engine->scriptValueDebugListMembers(module);
1344+ //qDebug() << "Module object contents" << _engine->scriptValueDebugListMembers(module);
13451345 return module;
13461346 }
13471347
@@ -1421,7 +1421,7 @@ ScriptValue ScriptManager::instantiateModule(const ScriptValue& module, const QS · 73 unmodified lines
14211421 closure.setProperty("require", module.property("require"));
14221422 closure.setProperty("__filename", modulePath, READONLY_HIDDEN_PROP_FLAGS);
14231423 closure.setProperty("__dirname", QString(modulePath).replace(QRegExp("/[^/]*$"), ""), READONLY_HIDDEN_PROP_FLAGS);
1424− _engine->scriptValueDebugDetails(module);
1424+ //_engine->scriptValueDebugDetails(module);
14251425 result = _engine->evaluateInClosure(closure, _engine->newProgram( sourceCode, modulePath ));
14261426 }
14271427 _engine->maybeEmitUncaughtException(__FUNCTION__);
@@ -1531,6 +1531,7 @@ ScriptValue ScriptManager::require(const QString& moduleId) { · 103 unmodified lines
15311531 qCDebug(scriptengine_module) << "//ScriptManager::require(" << moduleId << ")";
15321532
15331533 _engine->maybeEmitUncaughtException(__FUNCTION__);
1534+ qCDebug(scriptengine_module) << "Exports: " << _engine->scriptValueDebugDetails(module.property("exports"));
15341535 return module.property("exports");
15351536 }
15361537