mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-15 20:44:01 +02:00
js/esbuild: Add runners after scripts
This commit is contained in:
@@ -476,18 +476,10 @@ func (b *batcher) doBuild(ctx context.Context) (*Package, error) {
|
|||||||
|
|
||||||
for _, g := range b.scriptGroups.Sorted() {
|
for _, g := range b.scriptGroups.Sorted() {
|
||||||
keyPath := g.id
|
keyPath := g.id
|
||||||
var runners []scriptRunnerTemplateContext
|
|
||||||
for _, vv := range g.runnersOptions.ByKey() {
|
|
||||||
runnerKeyPath := keyPath + "_" + vv.Key().String()
|
|
||||||
runnerImpPath := paths.AddLeadingSlash(runnerKeyPath + "_runner" + vv.Compiled().Resource.MediaType().FirstSuffix.FullSuffix)
|
|
||||||
runners = append(runners, scriptRunnerTemplateContext{opts: vv, Import: runnerImpPath})
|
|
||||||
addResource(g.id, runnerImpPath, vv.Compiled().Resource, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
t := &batchGroupTemplateContext{
|
t := &batchGroupTemplateContext{
|
||||||
keyPath: keyPath,
|
keyPath: keyPath,
|
||||||
ID: g.id,
|
ID: g.id,
|
||||||
Runners: runners,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
instances := g.instancesOptions.ByKey()
|
instances := g.instancesOptions.ByKey()
|
||||||
@@ -521,6 +513,13 @@ func (b *batcher) doBuild(ctx context.Context) (*Package, error) {
|
|||||||
t.Scripts = append(t.Scripts, bt)
|
t.Scripts = append(t.Scripts, bt)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, vv := range g.runnersOptions.ByKey() {
|
||||||
|
runnerKeyPath := keyPath + "_" + vv.Key().String()
|
||||||
|
runnerImpPath := paths.AddLeadingSlash(runnerKeyPath + "_runner" + vv.Compiled().Resource.MediaType().FirstSuffix.FullSuffix)
|
||||||
|
t.Runners = append(t.Runners, scriptRunnerTemplateContext{opts: vv, Import: runnerImpPath})
|
||||||
|
addResource(g.id, runnerImpPath, vv.Compiled().Resource, false)
|
||||||
|
}
|
||||||
|
|
||||||
r, s, err := b.client.buildBatchGroup(ctx, t)
|
r, s, err := b.client.buildBatchGroup(ctx, t)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to build JS batch: %w", err)
|
return nil, fmt.Errorf("failed to build JS batch: %w", err)
|
||||||
|
Reference in New Issue
Block a user