[gjs/ewlsh/whatwg-console: 2/5] modules: Add bootstrap file with ESM support




commit 577d998401372d6a2ef23368b6fa52963d2feaef
Author: Evan Welsh <contact evanwelsh com>
Date:   Thu Jul 1 10:18:54 2021 -0700

    modules: Add bootstrap file with ESM support

 gjs/context.cpp                   | 7 +++++++
 js.gresource.xml                  | 2 ++
 modules/esm/_bootstrap/default.js | 4 ++++
 3 files changed, 13 insertions(+)
---
diff --git a/gjs/context.cpp b/gjs/context.cpp
index 7eef665b..df0a5067 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -615,6 +615,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..ecf39325
--- /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 the supports ESM imports.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]