-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move engine-related code to separate files
- Loading branch information
Showing
5 changed files
with
54 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package api | ||
|
||
import "github.com/evanw/esbuild/internal/compat" | ||
|
||
type EngineName uint8 | ||
|
||
const ( | ||
EngineChrome EngineName = iota | ||
EngineEdge | ||
EngineFirefox | ||
EngineIE | ||
EngineIOS | ||
EngineNode | ||
EngineOpera | ||
EngineSafari | ||
) | ||
|
||
func convertEngineName(engine EngineName) compat.Engine { | ||
switch engine { | ||
case EngineChrome: | ||
return compat.Chrome | ||
case EngineEdge: | ||
return compat.Edge | ||
case EngineFirefox: | ||
return compat.Firefox | ||
case EngineIE: | ||
return compat.IE | ||
case EngineIOS: | ||
return compat.IOS | ||
case EngineNode: | ||
return compat.Node | ||
case EngineOpera: | ||
return compat.Opera | ||
case EngineSafari: | ||
return compat.Safari | ||
default: | ||
panic("Invalid engine name") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package cli | ||
|
||
import "github.com/evanw/esbuild/pkg/api" | ||
|
||
var validEngines = map[string]api.EngineName{ | ||
"chrome": api.EngineChrome, | ||
"edge": api.EngineEdge, | ||
"firefox": api.EngineFirefox, | ||
"ie": api.EngineIE, | ||
"ios": api.EngineIOS, | ||
"node": api.EngineNode, | ||
"opera": api.EngineOpera, | ||
"safari": api.EngineSafari, | ||
} |