MCPcopy Create free account
hub / github.com/GuyARoss/orbit / IndirectFileChangeRequest

Method IndirectFileChangeRequest

internal/dev.go:172–202  ·  view source on GitHub ↗

IndirectFileChangeRequest processes a change request for a file that may be a dependency of a root component

(sources []string, indirectFile string, opts *ChangeRequestOpts)

Source from the content-addressed store, hash-verified

170
171// IndirectFileChangeRequest processes a change request for a file that may be a dependency of a root component
172func (s *devSession) IndirectFileChangeRequest(sources []string, indirectFile string, opts *ChangeRequestOpts) error {
173 // we iterate through each of the root sources for the source until the component bundle has been found.
174 for _, source := range sources {
175 component := s.RootComponents.Find(source)
176
177 if !opts.HotReload.IsActiveBundle(component.BundleKey()) {
178 continue
179 }
180
181 opts.Hook.WrapFunc(component.OriginalFilePath(), func() *webwrap.WrapStats {
182 component.Repack()
183
184 return component.WebWrapper().Stats()
185 })
186
187 s.ChangeRequest.Push(indirectFile, component.BundleKey())
188
189 sourceMap, err := srcpack.New(s.WebDir, []srcpack.PackComponent{component}, &srcpack.NewSourceMapOpts{
190 Parser: opts.Parser,
191 WebDirPath: s.WebDir,
192 })
193 if err != nil {
194 return err
195 }
196
197 s.SourceMap = s.SourceMap.MergeOverKey(sourceMap)
198 return nil
199 }
200
201 return nil
202}
203
204var ErrCannotBuildAssetKeys = errors.New("cannot build asset keys")
205

Callers 1

DoFileChangeRequestMethod · 0.95

Calls 11

NewFunction · 0.92
FindMethod · 0.80
WrapFuncMethod · 0.80
PushMethod · 0.80
MergeOverKeyMethod · 0.80
IsActiveBundleMethod · 0.65
BundleKeyMethod · 0.65
OriginalFilePathMethod · 0.65
RepackMethod · 0.65
StatsMethod · 0.65
WebWrapperMethod · 0.65

Tested by

no test coverage detected