Created
January 7, 2012 02:01
-
-
Save bitmage/1573477 to your computer and use it in GitHub Desktop.
Compilation for RZR load macro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
================================================================ | |
# Key | |
<- indicates a dependency | |
-> indicates a result | |
================================================================ | |
# pre-build (all settings default to user dotfile, then factory settings) | |
<- find project root | |
<- require project config | |
<- require macro definitions file | |
# loading a module | |
load 'foo.fooService' | |
<- macro definition | |
-> require([resolve getModulePath 'project-root', 'foo.fooService']); | |
# general resolve-at-compile-time macro | |
resolve getModulePath 'project-root', 'foo.fooService' | |
-> eval compile["getModulePath 'project-root', 'foo.fooService'"] | |
# return string of eval | |
eval "getModulePath('project-root', 'foo.fooService');" | |
-> '../../domain/foo/services/fooService.js' | |
# result of load 'foo.fooService' | |
-> require('../../domain/foo/services/fooService.js'); | |
# NOTES: | |
# 1. If we create a function with the same signature as the macro that resolves the load path at run time, we can gracefully depricate if someone disables the macro. Perhaps there's a general way to do this for all the defined macros. | |
# 2. Finding/loading macro definitions in prebuild means they'll be available for compile time eval() context. Conversely, anything *not* loaded into the macro definitions will *not* be available. getModulePath would have to be defined or referenced from the macro file. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment