diff --git a/deno2/.gclient b/deno2/.gclient index 7524a255c5..e597912f2c 100644 --- a/deno2/.gclient +++ b/deno2/.gclient @@ -11,7 +11,6 @@ solutions = [{ 'v8/testing/gmock': None, 'v8/tools/swarming_client': None, 'v8/third_party/instrumented_libraries': None, - 'v8/tools/gyp': None, 'v8/third_party/android_tools': None, 'v8/test/wasm-js': None, 'v8/test/benchmarks/data': None, diff --git a/deno2/BUILD.gn b/deno2/BUILD.gn index 58859293ff..749667d3ac 100644 --- a/deno2/BUILD.gn +++ b/deno2/BUILD.gn @@ -88,7 +88,7 @@ run_node("bundle") { ":run_tsc", ] args = [ - "./node_modules/.bin/browserify", + "./node_modules/browserify/bin/cmd.js", rebase_path(main_source, root_build_dir), "-o", rebase_path(main_output, root_build_dir), @@ -112,7 +112,7 @@ run_node("run_tsc") { ":pbjs_hack", ] args = [ - "./node_modules/.bin/tsc", + "./node_modules/typescript/bin/tsc", "-p", rebase_path("js/tsconfig.json", root_build_dir), "--outDir", diff --git a/deno2/deno.cc b/deno2/deno.cc index 991654612e..521eb7cf9f 100644 --- a/deno2/deno.cc +++ b/deno2/deno.cc @@ -243,7 +243,7 @@ v8::StartupData MakeSnapshot(v8::StartupData* prev_natives_blob, CHECK(global->Set(context, deno::v8_str("denoPub"), pub_val).FromJust()); bool r = Execute(context, js_filename, js_source); - assert(r); + CHECK(r); creator->SetDefaultContext(context, v8::SerializeInternalFieldsCallback( SerializeInternalFields, nullptr)); diff --git a/deno2/js/package.json b/deno2/js/package.json index 03987fe085..f11e25f13e 100644 --- a/deno2/js/package.json +++ b/deno2/js/package.json @@ -1,7 +1,10 @@ { "devDependencies": { + "@types/base64-js": "^1.2.5", + "@types/source-map-support": "^0.4.1", "browserify": "^16.2.2", "protobufjs": "^6.8.6", + "source-map-support": "^0.5.6", "typescript": "^2.9.1" } } diff --git a/deno2/js/pbjs_hack.py b/deno2/js/pbjs_hack.py index a4cc7dfb35..354f3a5a14 100755 --- a/deno2/js/pbjs_hack.py +++ b/deno2/js/pbjs_hack.py @@ -11,9 +11,9 @@ import os js_path = os.path.dirname(os.path.realpath(__file__)) #bin_path = os.path.join(js_path, "deno_protobufjs", "bin") -bin_path = os.path.join(js_path, "node_modules", ".bin") -pbjs_bin = os.path.join(bin_path, "pbjs") -pbts_bin = os.path.join(bin_path, "pbts") +pbjs_path = os.path.join(js_path, "node_modules", "protobufjs", "bin") +pbjs_bin = os.path.join(pbjs_path, "pbjs") +pbts_bin = os.path.join(pbjs_path, "pbts") msg_pbjs_out = os.path.join(js_path, "msg.pb.js") msg_pbts_out = os.path.join(js_path, "msg.pb.d.ts") assert os.path.exists(pbjs_bin) @@ -29,10 +29,11 @@ def touch(fname): open(fname, 'a').close() subprocess.check_call([ + "node", pbjs_bin, #"--dependency=./deno_protobufjs/minimal", "--target=static-module", - "--wraper=commonjs", + "--wrapper=commonjs", "--out=" + msg_pbjs_out, proto_in ]) diff --git a/deno2/js/run_node.py b/deno2/js/run_node.py index 1a1dc5cc71..8f650a5348 100755 --- a/deno2/js/run_node.py +++ b/deno2/js/run_node.py @@ -6,13 +6,26 @@ import subprocess import sys import os +def symlink(target, name, target_is_dir=False): + if os.name == "nt": + from ctypes import windll, WinError + CreateSymbolicLinkW = windll.kernel32.CreateSymbolicLinkW + flags = 0x02 # SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE + if (target_is_dir): + flags |= 0x01 # SYMBOLIC_LINK_FLAG_DIRECTORY + if not CreateSymbolicLinkW(name.encode('utf-16le'), + target.encode('utf-16le'), + flags): + raise 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") # root_out_dir if not os.path.exists("node_modules"): - os.symlink(node_modules_path, "node_modules") + symlink(node_modules_path, "node_modules", True) args = ["node"] + sys.argv[1:] sys.exit(subprocess.call(args)) diff --git a/deno2/js/yarn.lock b/deno2/js/yarn.lock index aa93de3f09..10e28c9464 100644 --- a/deno2/js/yarn.lock +++ b/deno2/js/yarn.lock @@ -45,14 +45,28 @@ version "1.1.0" resolved "https://registry.yarnpkg.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570" +"@types/base64-js@^1.2.5": + version "1.2.5" + resolved "https://registry.yarnpkg.com/@types/base64-js/-/base64-js-1.2.5.tgz#582b2476169a6cba460a214d476c744441d873d5" + "@types/long@^3.0.32": version "3.0.32" resolved "https://registry.yarnpkg.com/@types/long/-/long-3.0.32.tgz#f4e5af31e9e9b196d8e5fca8a5e2e20aa3d60b69" +"@types/node@*": + version "10.3.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.3.2.tgz#3840ec6c12556fdda6e0e6d036df853101d732a4" + "@types/node@^8.9.4": version "8.10.19" resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.19.tgz#66b5b6325c048cbf4512b7a88b0e79c2ee99d3d2" +"@types/source-map-support@^0.4.1": + version "0.4.1" + resolved "https://registry.yarnpkg.com/@types/source-map-support/-/source-map-support-0.4.1.tgz#ad77158e8c6695a16629ef82b9fb9dfe7c610ac0" + dependencies: + "@types/node" "*" + JSONStream@^1.0.3: version "1.3.3" resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.3.tgz#27b4b8fbbfeab4e71bcf551e7f27be8d952239bf" @@ -826,6 +840,17 @@ shell-quote@^1.6.1: array-reduce "~0.0.0" jsonify "~0.0.0" +source-map-support@^0.5.6: + version "0.5.6" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.6.tgz#4435cee46b1aab62b8e8610ce60f788091c51c13" + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + +source-map@^0.6.0: + version "0.6.1" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + source-map@~0.5.3: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" diff --git a/deno2/snapshot_creator.cc b/deno2/snapshot_creator.cc index 8441e766f2..1cd39cce54 100644 --- a/deno2/snapshot_creator.cc +++ b/deno2/snapshot_creator.cc @@ -130,12 +130,14 @@ int main(int argc, char** argv) { v8::V8::SetFlagsFromCommandLine(&argc, argv, true); auto js_data = ReadFile(js_fn); + // Ensure js_source is null-terminated. + std::string js_source(js_data.data, js_data.raw_size); auto natives_blob = ReadFile(natives_in_bin); auto snapshot_in_blob = ReadFile(snapshot_in_bin); deno_init(); auto snapshot_blob = - deno::MakeSnapshot(&natives_blob, &snapshot_in_blob, js_fn, js_data.data); + deno::MakeSnapshot(&natives_blob, &snapshot_in_blob, js_fn, js_source.c_str()); StartupDataCppWriter nativesWriter("natives", natives_out_cc, natives_blob); nativesWriter.Write();