summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Welsh <contact@evanwelsh.com>2021-07-01 10:18:54 -0700
committerPhilip Chimento <philip.chimento@gmail.com>2021-07-12 17:34:11 -0700
commit83aab56f178b4e15ddf185693b8e20aa2f4cfc5d (patch)
treed6b99ab45d0b80cf6aaa4dab781930f894e8b9cc
parent1e6cc6892fdb3adb2bbdbf872477e0c2aab87123 (diff)
downloadgjs-83aab56f178b4e15ddf185693b8e20aa2f4cfc5d.tar.gz
modules: Add bootstrap file with ESM support
-rw-r--r--gjs/context.cpp7
-rw-r--r--js.gresource.xml2
-rw-r--r--modules/esm/_bootstrap/default.js4
3 files changed, 13 insertions, 0 deletions
diff --git a/gjs/context.cpp b/gjs/context.cpp
index 726dad27..ce0692b1 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -627,6 +627,13 @@ GjsContextPrivate::GjsContextPrivate(JSContext* cx, GjsContext* public_context)
load_context_module(cx,
"resource:///org/gnome/gjs/modules/internal/loader.js",
"module loader");
+
+ {
+ JSAutoRealm ar(cx, global);
+ load_context_module(
+ cx, "resource:///org/gnome/gjs/modules/esm/_bootstrap/default.js",
+ "ESM bootstrap");
+ }
}
void GjsContextPrivate::set_args(std::vector<std::string>&& args) {
diff --git a/js.gresource.xml b/js.gresource.xml
index fc55e597..47be6425 100644
--- a/js.gresource.xml
+++ b/js.gresource.xml
@@ -8,6 +8,8 @@
<file>modules/internal/loader.js</file>
<!-- ESM-based modules -->
+ <file>modules/esm/_bootstrap/default.js</file>
+
<file>modules/esm/cairo.js</file>
<file>modules/esm/gettext.js</file>
<file>modules/esm/gi.js</file>
diff --git a/modules/esm/_bootstrap/default.js b/modules/esm/_bootstrap/default.js
new file mode 100644
index 00000000..fefeb51b
--- /dev/null
+++ b/modules/esm/_bootstrap/default.js
@@ -0,0 +1,4 @@
+// SPDX-License-Identifier: MIT OR LGPL-2.0-or-later
+// SPDX-FileCopyrightText: 2021 Evan Welsh <contact@evanwelsh.com>
+
+// Bootstrap file which supports ESM imports.