@@ -10,6 +10,8 @@ const processLocals = require('./locals');
10
10
const processAttributes = require ( './attributes' ) ;
11
11
const { processPushes, processStacks} = require ( './stacks' ) ;
12
12
const { setFilledSlots, processSlotContent, processFillContent} = require ( './slots' ) ;
13
+ const mergeWith = require ( 'lodash/mergeWith' ) ;
14
+ const template = require ( 'lodash/template' ) ;
13
15
14
16
// const {inspect} = require('util');
15
17
// const debug = true;
@@ -35,14 +37,18 @@ module.exports = (options = {}) => tree => {
35
37
options . slotSeparator = options . slotSeparator || ':' ;
36
38
options . push = options . push || 'push' ;
37
39
options . stack = options . stack || 'stack' ;
38
- options . localsAttr = options . localsAttr || 'props' ;
40
+ options . propsScriptAttribute = options . propsScriptAttribute || 'props' ;
41
+ options . propsContext = options . propsContext || 'props' ;
42
+ options . propsAttribute = options . propsAttribute || 'props' ;
43
+ options . propsSlot = options . propsSlot || 'props' ;
39
44
options . expressions = options . expressions || { } ;
40
45
options . plugins = options . plugins || [ ] ;
41
46
options . attrsParserRules = options . attrsParserRules || { } ;
42
47
options . strict = typeof options . strict === 'undefined' ? true : options . strict ;
48
+ options . utilities = options . utilities || { merge : mergeWith , template} ;
43
49
44
50
// Merge customizer callback passed to lodash mergeWith
45
- // for merge attribute `locals ` and all attributes starting with `merge:`
51
+ // for merge attribute `props ` and all attributes starting with `merge:`
46
52
// @see https://lodash.com/docs/4.17.15#mergeWith
47
53
options . mergeCustomizer = options . mergeCustomizer || ( ( objectValue , sourceValue ) => {
48
54
if ( Array . isArray ( objectValue ) ) {
@@ -86,7 +92,7 @@ module.exports = (options = {}) => tree => {
86
92
}
87
93
} ) ;
88
94
89
- options . locals = { ...options . expressions . locals } ;
95
+ options . props = { ...options . expressions . locals } ;
90
96
options . aware = { } ;
91
97
92
98
const pushedContent = { } ;
@@ -140,10 +146,10 @@ function processTree(options) {
140
146
setFilledSlots ( currentNode , filledSlots , options ) ;
141
147
// setFilledSlots(nextNode, filledSlots, options);
142
148
143
- // Reset previous locals with passed global and keep aware locals
144
- options . expressions . locals = { ...options . locals , ...options . aware } ;
149
+ // Reset options.expressions. locals and keep aware locals
150
+ options . expressions . locals = { ...options . props , ...options . aware } ;
145
151
146
- const { attributes, locals } = processLocals ( currentNode , nextNode , filledSlots , options ) ;
152
+ const { attributes, props } = processLocals ( currentNode , nextNode , filledSlots , options ) ;
147
153
148
154
options . expressions . locals = attributes ;
149
155
options . expressions . locals . $slots = filledSlots ;
@@ -172,11 +178,11 @@ function processTree(options) {
172
178
currentNode . tag = false ;
173
179
currentNode . content = content ;
174
180
175
- processAttributes ( currentNode , attributes , locals , options ) ;
181
+ processAttributes ( currentNode , attributes , props , options ) ;
176
182
177
183
// log(currentNode, 'currentNode', 'currentNode')
178
184
// currentNode.attrs.counter = processCounter;
179
- // currentNode.attrs.data = JSON.stringify({ attributes, locals });
185
+ // currentNode.attrs.data = JSON.stringify({ attributes, props });
180
186
181
187
// messages.push({
182
188
// type: 'dependency',
0 commit comments