From 0c18f502be64a2c481184cc64d80e3760aecf303 Mon Sep 17 00:00:00 2001 From: Mateusz Poliwczak Date: Sun, 10 Sep 2023 19:23:23 +0200 Subject: [PATCH 1/2] Don't add analyze plugin when buildOptions == nil --- pkg/cli/cli_impl.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/cli/cli_impl.go b/pkg/cli/cli_impl.go index 8e292cc315b..b91007ee2a4 100644 --- a/pkg/cli/cli_impl.go +++ b/pkg/cli/cli_impl.go @@ -1141,12 +1141,13 @@ func runImpl(osArgs []string) int { osArgs, analyze := filterAnalyzeFlags(osArgs) buildOptions, transformOptions, extras, err := parseOptionsForRun(osArgs) - if analyze != analyzeDisabled { - addAnalyzePlugin(buildOptions, analyze, osArgs) - } switch { case buildOptions != nil: + if analyze != analyzeDisabled { + addAnalyzePlugin(buildOptions, analyze, osArgs) + } + // Read the "NODE_PATH" from the environment. This is part of node's // module resolution algorithm. Documentation for this can be found here: // https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders From 46373704ec536a2ef1a32cf78770eba1b7569df1 Mon Sep 17 00:00:00 2001 From: Mateusz Poliwczak Date: Sun, 10 Sep 2023 19:41:11 +0200 Subject: [PATCH 2/2] add error while using --analyze in transforming --- pkg/cli/cli_impl.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/cli/cli_impl.go b/pkg/cli/cli_impl.go index b91007ee2a4..660e9beeba5 100644 --- a/pkg/cli/cli_impl.go +++ b/pkg/cli/cli_impl.go @@ -1323,6 +1323,10 @@ func runImpl(osArgs []string) int { } case transformOptions != nil: + if analyze != analyzeDisabled { + logger.PrintErrorWithNoteToStderr(osArgs, "--analyze not supported while transforming", "") + return 1 + } // Read the input from stdin bytes, err := ioutil.ReadAll(os.Stdin) if err != nil {