This repository has been archived by the owner on May 25, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Developing
Drew Folta edited this page Jun 17, 2013
·
3 revisions
Here are some details about the locator code itself.
See the CONTRIBUTE.md file and LICENSE.txt file for information.
-
_fileQueue
is a queue of file events- value in queue is specifically designed to be full path, which makes
watch()
easy to implement
- value in queue is specifically designed to be full path, which makes
-
_processFileQueue()
returns a promise fulfilled when the queue is empty- will also process the
bundleUpdated
queue
- will also process the
-
_onFile()
handles each file- registers the file in the bundle
- calls all plugins that handle file events
- determines if the file is a resource (matches a rule in the ruleset)
- queues up a
bundleUpdated
event
-
_onResource()
handles each resource- registers the resource in the bundle
- calls all plugins that handle resource events
- queues up a
bundleUpdated
event
Since the file events have a full path, we need the following as support:
-
_makeBundle(path)
to create a bundle, if it doesn't already exist -
_getBundleNameByPath(path)
to determine the bundle name from a path
- making
watch()
easy to implement affected how rest of code (queues/methods) was organized - keeping track of which directories belong to which bundles is unfortunately a bit tricky
- whether or not the build directory should be watched has subtle implications
- it's expected that the application code path (basically: set of plugins used) is the same in production as develop, despite the fact that no files are created by plugins in production (because they're made during a build step prior to deploying to production)