Resolve module paths relative to the current module (#2976)
The current module implementation resolves module paths relative to the current working directory, but paths should be resolved relative to the currently evaluated module/source. This requires a change in the jerry_port_normalize_path port API function, so that it also takes the current module path as an argument. On the engine side, we now also create a module object for the main script, so that we can properly identify the base path for other modules. Co-authored-by: Marko Fabo <mfabo@inf.u-szeged.hu> JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
This commit is contained in:
@@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export {} from "tests/jerry/es2015/module-export-01.js";
|
||||
export {aa,} from "tests/jerry/es2015/module-export-01.js";
|
||||
export {bb as b_, cc as c_} from "tests/jerry/es2015/module-export-01.js";
|
||||
export * from "tests/jerry/es2015/module-export-01.js";
|
||||
export {} from "module-export-01.js";
|
||||
export {aa,} from "module-export-01.js";
|
||||
export {bb as b_, cc as c_} from "module-export-01.js";
|
||||
export * from "module-export-01.js";
|
||||
export default function () {return "default"};
|
||||
|
||||
@@ -23,4 +23,4 @@ export default class {
|
||||
}
|
||||
}
|
||||
|
||||
export * from "tests/jerry/es2015/module-export-02.js"
|
||||
export * from "module-export-02.js"
|
||||
|
||||
@@ -13,6 +13,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export * from "tests/jerry/es2015/module-export-01.js";
|
||||
export * from "tests/jerry/es2015/module-export-04.js";
|
||||
export * from "module-export-01.js";
|
||||
export * from "module-export-04.js";
|
||||
export default a = "str"
|
||||
|
||||
@@ -14,6 +14,6 @@
|
||||
*/
|
||||
|
||||
export {}
|
||||
export {} from "tests/jerry/es2015/module-export-01.js";
|
||||
export {} from "module-export-01.js";
|
||||
export {};
|
||||
export {} from "tests/jerry/es2015/module-export-04.js"
|
||||
export {} from "module-export-04.js"
|
||||
|
||||
@@ -13,13 +13,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import "tests/jerry/es2015/module-export-01.js";
|
||||
import def from "tests/jerry/es2015/module-export-01.js";
|
||||
import {} from "tests/jerry/es2015/module-export-01.js";
|
||||
import {aa as a,} from "tests/jerry/es2015/module-export-01.js";
|
||||
import {bb as b, cc as c} from "tests/jerry/es2015/module-export-01.js";
|
||||
import {x} from "tests/jerry/es2015/module-export-01.js";
|
||||
import * as mod from "tests/jerry/es2015/module-export-01.js";
|
||||
import "./module-export-01.js";
|
||||
import def from "module-export-01.js";
|
||||
import {} from "module-export-01.js";
|
||||
import {aa as a,} from "module-export-01.js";
|
||||
import {bb as b, cc as c} from "module-export-01.js";
|
||||
import {x} from "module-export-01.js";
|
||||
import * as mod from "module-export-01.js";
|
||||
|
||||
assert (def === "default");
|
||||
assert (a === "a");
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import def, * as mod from "tests/jerry/es2015/module-export-02.js";
|
||||
import {b_, c_,} from "tests/jerry/es2015/module-export-02.js";
|
||||
import def, * as mod from "module-export-02.js";
|
||||
import {b_, c_,} from "module-export-02.js";
|
||||
|
||||
assert (def() === "default")
|
||||
assert (mod.aa === "a")
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import incrementer, {aa, c_, x,} from "tests/jerry/es2015/module-export-03.js"
|
||||
import incrementer, {aa, c_, x,} from "module-export-03.js"
|
||||
var i = new incrementer(3);
|
||||
assert(i.incr() === 4);
|
||||
assert(i.incr() === 5);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import "tests/jerry/es2015/module-import-01.js"
|
||||
import "tests/jerry/es2015/module-export-05.js"
|
||||
import "tests/jerry/es2015/module-export-06.js"
|
||||
import "tests/jerry/es2015/module-export-07.js"
|
||||
import "module-import-01.js";
|
||||
import "module-export-05.js";
|
||||
import "module-export-06.js";
|
||||
import "module-export-07.js";
|
||||
|
||||
Reference in New Issue
Block a user