js/esbuild: Build groups in order of their ID
We already do this for scripts e.g. inside a group. This makes sure that group A's entry points gets added before B's, which can be an important property, see https://github.com/evanw/esbuild/issues/399#issuecomment-1458680887
This commit is contained in:
parent
4f130f6e4f
commit
a834bb9f7e
1 changed files with 10 additions and 10 deletions
|
@ -474,25 +474,25 @@ func (b *batcher) doBuild(ctx context.Context) (*Package, error) {
|
||||||
entryPoints = append(entryPoints, pth)
|
entryPoints = append(entryPoints, pth)
|
||||||
}
|
}
|
||||||
|
|
||||||
for k, v := range b.scriptGroups {
|
for _, g := range b.scriptGroups.Sorted() {
|
||||||
keyPath := k
|
keyPath := g.id
|
||||||
var runners []scriptRunnerTemplateContext
|
var runners []scriptRunnerTemplateContext
|
||||||
for _, vv := range v.runnersOptions.ByKey() {
|
for _, vv := range g.runnersOptions.ByKey() {
|
||||||
runnerKeyPath := keyPath + "_" + vv.Key().String()
|
runnerKeyPath := keyPath + "_" + vv.Key().String()
|
||||||
runnerImpPath := paths.AddLeadingSlash(runnerKeyPath + "_runner" + vv.Compiled().Resource.MediaType().FirstSuffix.FullSuffix)
|
runnerImpPath := paths.AddLeadingSlash(runnerKeyPath + "_runner" + vv.Compiled().Resource.MediaType().FirstSuffix.FullSuffix)
|
||||||
runners = append(runners, scriptRunnerTemplateContext{opts: vv, Import: runnerImpPath})
|
runners = append(runners, scriptRunnerTemplateContext{opts: vv, Import: runnerImpPath})
|
||||||
addResource(k, runnerImpPath, vv.Compiled().Resource, false)
|
addResource(g.id, runnerImpPath, vv.Compiled().Resource, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
t := &batchGroupTemplateContext{
|
t := &batchGroupTemplateContext{
|
||||||
keyPath: keyPath,
|
keyPath: keyPath,
|
||||||
ID: v.id,
|
ID: g.id,
|
||||||
Runners: runners,
|
Runners: runners,
|
||||||
}
|
}
|
||||||
|
|
||||||
instances := v.instancesOptions.ByKey()
|
instances := g.instancesOptions.ByKey()
|
||||||
|
|
||||||
for _, vv := range v.scriptsOptions.ByKey() {
|
for _, vv := range g.scriptsOptions.ByKey() {
|
||||||
keyPath := keyPath + "_" + vv.Key().String()
|
keyPath := keyPath + "_" + vv.Key().String()
|
||||||
opts := vv.Compiled()
|
opts := vv.Compiled()
|
||||||
impPath := path.Join(PrefixHugoVirtual, opts.Dir(), keyPath+opts.Resource.MediaType().FirstSuffix.FullSuffix)
|
impPath := path.Join(PrefixHugoVirtual, opts.Dir(), keyPath+opts.Resource.MediaType().FirstSuffix.FullSuffix)
|
||||||
|
@ -502,7 +502,7 @@ func (b *batcher) doBuild(ctx context.Context) (*Package, error) {
|
||||||
name: keyPath,
|
name: keyPath,
|
||||||
resourceGetter: impCtx,
|
resourceGetter: impCtx,
|
||||||
scriptOptions: opts,
|
scriptOptions: opts,
|
||||||
dm: v.dependencyManager,
|
dm: g.dependencyManager,
|
||||||
})
|
})
|
||||||
|
|
||||||
bt := scriptBatchTemplateContext{
|
bt := scriptBatchTemplateContext{
|
||||||
|
@ -528,10 +528,10 @@ func (b *batcher) doBuild(ctx context.Context) (*Package, error) {
|
||||||
state.importerImportContext.Set(s, importContext{
|
state.importerImportContext.Set(s, importContext{
|
||||||
name: s,
|
name: s,
|
||||||
resourceGetter: nil,
|
resourceGetter: nil,
|
||||||
dm: v.dependencyManager,
|
dm: g.dependencyManager,
|
||||||
})
|
})
|
||||||
|
|
||||||
addResource(v.id, s, r, true)
|
addResource(g.id, s, r, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
mediaTypes := b.client.d.ResourceSpec.MediaTypes()
|
mediaTypes := b.client.d.ResourceSpec.MediaTypes()
|
||||||
|
|
Loading…
Add table
Reference in a new issue