IndirectFileChangeRequest processes a change request for a file that may be a dependency of a root component
(sources []string, indirectFile string, opts *ChangeRequestOpts)
| 170 | |
| 171 | // IndirectFileChangeRequest processes a change request for a file that may be a dependency of a root component |
| 172 | func (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 | |
| 204 | var ErrCannotBuildAssetKeys = errors.New("cannot build asset keys") |
| 205 |
no test coverage detected