fune/toolkit/components/certviewer/content/bundle.sh
Noemi Erli e287ab9d9a Backed out 2 changesets (bug 1811633) for causing lint bustage CLOSED TREE
Backed out changeset 3ef0fe45b191 (bug 1811633)
Backed out changeset 92a7ec78a4ce (bug 1811633)
2023-01-26 02:26:54 +02:00

19 lines
758 B
Bash
Executable file

#!/bin/bash
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Helper script to bundle the given library and amend it to be loadable in more
# contexts.
WHICH="${1}"
# Run the browserify command
./node_modules/browserify/bin/cmd.js "$WHICH".js --standalone "$WHICH" -o ./vendor/"$WHICH"_bundle.jsm
# Amend 'this' in the first line to 'globalThis'
sed -e '1s/{g=this}/{g=globalThis}/' -i "" ./vendor/"$WHICH"_bundle.jsm
# Append code to export the library
echo "var $WHICH = globalThis.$WHICH;" >> ./vendor/"$WHICH"_bundle.jsm
echo "var EXPORTED_SYMBOLS = [\"$WHICH\"];" >> ./vendor/"$WHICH"_bundle.jsm