SkipSyntaxCheck returns true if we should skip checking the user's function file for syntax errors if it is impacted by https://github.com/GoogleCloudPlatform/functions-framework-nodejs/issues/407.
(ctx *gcp.Context, file string, pjs *PackageJSON)
| 414 | } |
| 415 | |
| 416 | // SkipSyntaxCheck returns true if we should skip checking the user's function file for syntax errors |
| 417 | // if it is impacted by https://github.com/GoogleCloudPlatform/functions-framework-nodejs/issues/407. |
| 418 | func SkipSyntaxCheck(ctx *gcp.Context, file string, pjs *PackageJSON) (bool, error) { |
| 419 | nodeVer, err := nodeVersion(ctx) |
| 420 | if err != nil { |
| 421 | return false, err |
| 422 | } |
| 423 | version, err := semver.NewVersion(nodeVer) |
| 424 | if err != nil { |
| 425 | return false, gcp.InternalErrorf("failed to detect valid Node.js version %s: %v", version, err) |
| 426 | } |
| 427 | if version.Major() != 16 { |
| 428 | return false, nil |
| 429 | } |
| 430 | if strings.HasSuffix(file, ".mjs") { |
| 431 | return true, nil |
| 432 | } |
| 433 | return (pjs != nil && pjs.Type == "module"), nil |
| 434 | } |
| 435 |
no outgoing calls