@@ -8,12 +8,12 @@ const htmlParser = require('./html');
88const scriptParser = require ( './script' ) ;
99
1010
11- function componentParser ( templatePath : string , defaults : Object , type : string ) : Promise < Object > {
11+ function componentParser ( templatePath : string , defaults : Object , type : string , Cache : Object ) : Promise < Object > {
1212 return new Promise ( function ( resolve , reject ) {
1313 // try to get the component content from the cache
14- const cachedComponentContentObject = defaults . cache . get ( templatePath ) ;
14+ const cachedComponentContentObject = Cache . get ( templatePath ) ;
1515 if ( cachedComponentContentObject ) {
16- scriptParser ( cachedComponentContentObject . parsedContent . script , defaults , type ) . then ( parsedScriptObject => {
16+ scriptParser ( cachedComponentContentObject . parsedContent . script , defaults , type , Cache ) . then ( parsedScriptObject => {
1717 cachedComponentContentObject . script = parsedScriptObject ;
1818 cachedComponentContentObject . script . template = cachedComponentContentObject . template ;
1919 resolve ( cachedComponentContentObject ) ;
@@ -26,9 +26,9 @@ function componentParser(templatePath: string, defaults: Object, type: string):
2626 let error = `Could Not Find Component, I was expecting it to live here \n${ templatePath } \nBut I couldn't find it there, ¯\\_(ツ)_/¯\n\n` ;
2727 reject ( error ) ;
2828 } else {
29- parseContent ( content , templatePath , defaults , type ) . then ( contentObject => {
29+ parseContent ( content , templatePath , defaults , type , Cache ) . then ( contentObject => {
3030 // set the cache for the component
31- defaults . cache . set ( templatePath , contentObject ) ;
31+ Cache . set ( templatePath , contentObject ) ;
3232 resolve ( contentObject ) ;
3333 } ) . catch ( error => {
3434 reject ( error ) ;
@@ -39,7 +39,7 @@ function componentParser(templatePath: string, defaults: Object, type: string):
3939 } ) ;
4040}
4141
42- function parseContent ( content : string , templatePath : string , defaults : Object , type : string ) : Promise < Object > {
42+ function parseContent ( content : string , templatePath : string , defaults : Object , type : string , Cache : Object ) : Promise < Object > {
4343 return new Promise ( ( resolve , reject ) => {
4444 const templateArray = templatePath . split ( '/' ) ;
4545 if ( templateArray . length === 0 ) {
@@ -57,7 +57,7 @@ function parseContent(content: string, templatePath: string, defaults: Object, t
5757
5858 const promiseArray = [
5959 htmlParser ( parsedContent . template , true ) ,
60- scriptParser ( parsedContent . script , defaults , type ) ,
60+ scriptParser ( parsedContent . script , defaults , type , Cache ) ,
6161 styleParser ( parsedContent . styles )
6262 ] ;
6363
0 commit comments