]> git.proxmox.com Git - mirror_novnc.git/commitdiff
Clean up handling of untransformed files
authorPierre Ossman <ossman@cendio.se>
Mon, 11 Nov 2019 12:33:47 +0000 (13:33 +0100)
committerPierre Ossman <ossman@cendio.se>
Mon, 11 Nov 2019 12:33:47 +0000 (13:33 +0100)
This control flow is difficult enough as it is to follow. Move the
handling of the untransformed files to a separate block to make it
slightly easier to understand.

utils/use_require.js

index d6b0df63ea6ef39f23a55100d363190143d46979..4cb6296d068cee1f96577e03f23fb99817df4c82 100755 (executable)
@@ -172,9 +172,17 @@ function make_lib_files(import_format, source_maps, with_app_dir, only_legacy) {
                 return;  // skip non-javascript files
             }
 
+            if (no_transform_files.has(filename)) {
+                return ensureDir(path.dirname(out_path))
+                    .then(() => {
+                        console.log(`Writing ${out_path}`);
+                        return copy(filename, out_path);
+                    });
+            }
+
             return Promise.resolve()
                 .then(() => {
-                    if (only_legacy && !no_transform_files.has(filename)) {
+                    if (only_legacy) {
                         return;
                     }
                     return ensureDir(path.dirname(out_path))
@@ -185,10 +193,6 @@ function make_lib_files(import_format, source_maps, with_app_dir, only_legacy) {
                 })
                 .then(() => ensureDir(path.dirname(legacy_path)))
                 .then(() => {
-                    if (no_transform_files.has(filename)) {
-                        return;
-                    }
-
                     const opts = babel_opts();
                     if (helper && helpers.optionsOverride) {
                         helper.optionsOverride(opts);