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

Method DirectFileChangeRequest

internal/dev.go:140–169  ·  view source on GitHub ↗

DirectFileChangeRequest processes a change request for a root component directly

(filePath string, component srcpack.PackComponent, opts *ChangeRequestOpts)

Source from the content-addressed store, hash-verified

138
139// DirectFileChangeRequest processes a change request for a root component directly
140func (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
172func (s *devSession) IndirectFileChangeRequest(sources []string, indirectFile string, opts *ChangeRequestOpts) error {

Callers 2

DoFileChangeRequestMethod · 0.95

Calls 9

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

Tested by

no test coverage detected