Migrates javascript_metadata/ to esm
Bug: 1006759
Change-Id: I91c9f30d63e36995e7fa14b49072f2dcc6c37af6
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1937028
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
diff --git a/scripts/javascript_natives/index.js b/scripts/javascript_natives/index.js
index 2dd1ee7..b6b5041 100644
--- a/scripts/javascript_natives/index.js
+++ b/scripts/javascript_natives/index.js
@@ -188,5 +188,14 @@
fs.writeFileSync(
path.join(__dirname, '..', '..', 'front_end', 'javascript_metadata', 'NativeFunctions.js'),
`// Generated from ${path.relative(path.join(__dirname, '..', '..'), __filename)}
-JavaScriptMetadata.NativeFunctions = ${JSON.stringify(functions)};`);
+export const NativeFunctions = ${JSON.stringify(functions)};
+
+/* Legacy exported object */
+self.JavaScriptMetadata = self.JavaScriptMetadata || {};
+
+/* Legacy exported object */
+JavaScriptMetadata = JavaScriptMetadata || {};
+
+JavaScriptMetadata.NativeFunctions = NativeFunctions;
+`);
}