-
Notifications
You must be signed in to change notification settings - Fork 660
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[add] Support for JIT mode in SUI component imports ( dev )
- Loading branch information
Showing
12 changed files
with
208 additions
and
29 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
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,54 @@ | ||
package core | ||
|
||
// NewBuildContext create a new build context | ||
func NewBuildContext(global *GlobalBuildContext) *BuildContext { | ||
return &BuildContext{ | ||
components: map[string]bool{}, | ||
sequence: 1, | ||
scripts: []string{}, | ||
styles: []string{}, | ||
jitComponents: map[string]bool{}, | ||
global: global, | ||
} | ||
} | ||
|
||
// NewGlobalBuildContext create a new global build context | ||
func NewGlobalBuildContext() *GlobalBuildContext { | ||
return &GlobalBuildContext{ | ||
jitComponents: map[string]bool{}, | ||
} | ||
} | ||
|
||
// GetJitComponents get the just in time components | ||
func (ctx *BuildContext) GetJitComponents() []string { | ||
if ctx.jitComponents == nil { | ||
return []string{} | ||
} | ||
jitComponents := []string{} | ||
for name := range ctx.jitComponents { | ||
jitComponents = append(jitComponents, name) | ||
} | ||
return jitComponents | ||
} | ||
|
||
// GetJitComponents get the just in time components | ||
func (globalCtx *GlobalBuildContext) GetJitComponents() []string { | ||
if globalCtx.jitComponents == nil { | ||
return []string{} | ||
} | ||
|
||
jitComponents := []string{} | ||
for name := range globalCtx.jitComponents { | ||
jitComponents = append(jitComponents, name) | ||
} | ||
return jitComponents | ||
} | ||
|
||
func (ctx *BuildContext) addJitComponent(name string) { | ||
name = stmtRe.ReplaceAllString(name, "*") | ||
name = propRe.ReplaceAllString(name, "*") | ||
ctx.jitComponents[name] = true | ||
if ctx.global != nil { | ||
ctx.global.jitComponents[name] = true | ||
} | ||
} |
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
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
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