summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/BUILD.gn2
-rw-r--r--src/js/mock_runtime.js2
-rwxr-xr-xsrc/js/pbjs_hack.py26
-rwxr-xr-xsrc/js/run_node.py35
-rwxr-xr-xsrc/tools/format.sh2
5 files changed, 31 insertions, 36 deletions
diff --git a/src/BUILD.gn b/src/BUILD.gn
index 7693d4c27..c433bda26 100644
--- a/src/BUILD.gn
+++ b/src/BUILD.gn
@@ -4,7 +4,7 @@ import("//v8/snapshot_toolchain.gni")
import("deno.gni")
config("deno_config") {
- include_dirs = [ "v8" ] # This allows us to v8/src/base/ libraries.
+ include_dirs = [ "v8" ] # This allows us to v8/src/base/ libraries.
configs = [ "v8:external_config" ]
}
diff --git a/src/js/mock_runtime.js b/src/js/mock_runtime.js
index 1e7a6afe2..166df5fc5 100644
--- a/src/js/mock_runtime.js
+++ b/src/js/mock_runtime.js
@@ -7,7 +7,7 @@ function assert(cond) {
if (!cond) throw Error("mock_runtime.js assert failed");
}
-global.typedArrayToArrayBuffer = (ta) => {
+global.typedArrayToArrayBuffer = ta => {
return ta.buffer.slice(ta.byteOffset, ta.byteOffset + ta.byteLength);
};
diff --git a/src/js/pbjs_hack.py b/src/js/pbjs_hack.py
index e0e1ab06f..19b7c1691 100755
--- a/src/js/pbjs_hack.py
+++ b/src/js/pbjs_hack.py
@@ -27,28 +27,22 @@ assert os.path.exists(pbts_bin)
proto_in = sys.argv[1]
stamp_file = sys.argv[2]
+
def touch(fname):
- if os.path.exists(fname):
- os.utime(fname, None)
- else:
- open(fname, 'a').close()
+ if os.path.exists(fname):
+ os.utime(fname, None)
+ else:
+ open(fname, 'a').close()
+
subprocess.check_call([
- "node",
- pbjs_bin,
- "--target=static-module",
- "--wrapper=commonjs",
- "--out=" + msg_pbjs_out,
- proto_in
+ "node", pbjs_bin, "--target=static-module", "--wrapper=commonjs",
+ "--out=" + msg_pbjs_out, proto_in
])
assert os.path.exists(msg_pbjs_out)
-subprocess.check_call([
- "node",
- pbts_bin,
- "--out=" + msg_pbts_out,
- msg_pbjs_out
-])
+subprocess.check_call(
+ ["node", pbts_bin, "--out=" + msg_pbts_out, msg_pbjs_out])
assert os.path.exists(msg_pbts_out)
touch(stamp_file)
diff --git a/src/js/run_node.py b/src/js/run_node.py
index 3125bfc2f..bdf132ae5 100755
--- a/src/js/run_node.py
+++ b/src/js/run_node.py
@@ -8,30 +8,31 @@ import subprocess
import sys
import os
+
def symlink(target, name, target_is_dir=False):
- if os.name == "nt":
- import ctypes
- CreateSymbolicLinkW = ctypes.windll.kernel32.CreateSymbolicLinkW
- CreateSymbolicLinkW.restype = ctypes.c_ubyte
- CreateSymbolicLinkW.argtypes = (ctypes.c_wchar_p,
- ctypes.c_wchar_p,
- ctypes.c_uint32)
+ if os.name == "nt":
+ import ctypes
+ CreateSymbolicLinkW = ctypes.windll.kernel32.CreateSymbolicLinkW
+ CreateSymbolicLinkW.restype = ctypes.c_ubyte
+ CreateSymbolicLinkW.argtypes = (ctypes.c_wchar_p, ctypes.c_wchar_p,
+ ctypes.c_uint32)
+
+ flags = 0x02 # SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE
+ if (target_is_dir):
+ flags |= 0x01 # SYMBOLIC_LINK_FLAG_DIRECTORY
+ if not CreateSymbolicLinkW(name, target, flags):
+ raise ctypes.WinError()
+ else:
+ os.symlink(target, name)
- flags = 0x02 # SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE
- if (target_is_dir):
- flags |= 0x01 # SYMBOLIC_LINK_FLAG_DIRECTORY
- if not CreateSymbolicLinkW(name, target, flags):
- raise ctypes.WinError()
- else:
- os.symlink(target, name)
js_path = os.path.dirname(os.path.realpath(__file__))
node_modules_path = os.path.join(js_path, "node_modules")
if not os.path.lexists("node_modules"):
- if os.path.exists("node_modules"):
- os.unlink("node_modules")
- symlink(node_modules_path, "node_modules", True)
+ if os.path.exists("node_modules"):
+ os.unlink("node_modules")
+ symlink(node_modules_path, "node_modules", True)
args = ["node"] + sys.argv[1:]
sys.exit(subprocess.call(args))
diff --git a/src/tools/format.sh b/src/tools/format.sh
index 59f8d1be0..fec9fab39 100755
--- a/src/tools/format.sh
+++ b/src/tools/format.sh
@@ -4,7 +4,7 @@ clang-format -i -style Google *.cc *.h include/*.h
gn format BUILD.gn
gn format deno.gni
gn format .gn
-yapf -i tools/*.py
+yapf -i tools/*.py js/*.py
prettier --write \
js/deno.d.ts \
js/main.ts \