From c58937aa9fad45dd2dcbd5f2118f14a0e54d98a2 Mon Sep 17 00:00:00 2001 From: Stephanie DiBenedetto Date: Mon, 10 Oct 2022 18:19:45 +0000 Subject: [PATCH 1/2] Return to using default closure optimization level ADVANCED_OPTIMIZATION mode is breaking CommonJS users. As a spot fix, we'll return to using SIMPLE_OPTIMIZATION mode. --- gulpfile.js | 12 +++--------- package-lock.json | 6 +++--- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 7317e88..10f0730 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -117,12 +117,7 @@ function genproto_group3_commonjs_strict(cb) { } -function getClosureCompilerCommand(exportsFile, outputFile, keepSymbols) { - let compilationLevel = 'ADVANCED'; - if (keepSymbols === true) { - compilationLevel = 'SIMPLE'; - } - +function getClosureCompilerCommand(exportsFile, outputFile) { const closureLib = 'node_modules/google-closure-library'; return [ 'node_modules/.bin/google-closure-compiler', @@ -139,13 +134,13 @@ function getClosureCompilerCommand(exportsFile, outputFile, keepSymbols) { '--js=binary/utils.js', '--js=binary/writer.js', `--js=${exportsFile}`, - `--compilation_level="${compilationLevel}"`, '--generate_exports', '--export_local_property_definitions', `--entry_point=${exportsFile}`, `> ${outputFile}` ].join(' '); } + function gen_google_protobuf_js(cb) { exec( getClosureCompilerCommand('commonjs/export.js', 'google-protobuf.js'), @@ -157,8 +152,7 @@ function commonjs_testdeps(cb) { 'mkdir -p commonjs_out/test_node_modules && ' + getClosureCompilerCommand( 'commonjs/export_testdeps.js', - 'commonjs_out/test_node_modules/testdeps_commonjs.js', - true), + 'commonjs_out/test_node_modules/testdeps_commonjs.js'), make_exec_logging_callback(cb)); } diff --git a/package-lock.json b/package-lock.json index 58fa470..1a8e71f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,13 +1,13 @@ { "name": "google-protobuf", - "version": "3.21.0", + "version": "3.21.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "google-protobuf", - "version": "3.21.0", - "license": "BSD-3-Clause", + "version": "3.21.1", + "license": "(BSD-3-Clause AND Apache-2.0)", "devDependencies": { "glob": "~7.1.4", "google-closure-compiler": "~20190819.0.0", From 0466dbcd6889fd6295968002b8be624f451c2acb Mon Sep 17 00:00:00 2001 From: Stephanie DiBenedetto Date: Mon, 10 Oct 2022 19:25:57 +0000 Subject: [PATCH 2/2] Add comment about default optimization level --- gulpfile.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gulpfile.js b/gulpfile.js index 10f0730..6960e5b 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -118,6 +118,8 @@ function genproto_group3_commonjs_strict(cb) { function getClosureCompilerCommand(exportsFile, outputFile) { + // Use the default optimization level: SIMPLE_OPTIMIZATIONS: + // https://developers.google.com/closure/compiler/docs/compilation_levels#simple_optimizations const closureLib = 'node_modules/google-closure-library'; return [ 'node_modules/.bin/google-closure-compiler',