DirectFileChangeRequest processes a change request for a root component directly
(filePath string, component srcpack.PackComponent, opts *ChangeRequestOpts)
| 138 | |
| 139 | // DirectFileChangeRequest processes a change request for a root component directly |
| 140 | func (s *devSession) DirectFileChangeRequest(filePath string, component srcpack.PackComponent, opts *ChangeRequestOpts) error { |
| 141 | // if component is one of the root components, we will just repack that component |
| 142 | if component == nil { |
| 143 | return nil |
| 144 | } |
| 145 | |
| 146 | if filePath == "" { |
| 147 | filePath = component.OriginalFilePath() |
| 148 | } |
| 149 | |
| 150 | opts.Hook.WrapFunc(component.OriginalFilePath(), func() *webwrap.WrapStats { |
| 151 | component.Repack() |
| 152 | |
| 153 | return component.WebWrapper().Stats() |
| 154 | }) |
| 155 | |
| 156 | s.ChangeRequest.Push(filePath, component.BundleKey()) |
| 157 | |
| 158 | sourceMap, err := srcpack.New(s.WebDir, []srcpack.PackComponent{component}, &srcpack.NewSourceMapOpts{ |
| 159 | Parser: opts.Parser, |
| 160 | WebDirPath: s.WebDir, |
| 161 | }) |
| 162 | if err != nil { |
| 163 | return err |
| 164 | } |
| 165 | |
| 166 | s.SourceMap = s.SourceMap.MergeOverKey(sourceMap) |
| 167 | |
| 168 | return nil |
| 169 | } |
| 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 { |
no test coverage detected