@nxtedition/lib 14.0.14 → 14.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "14.0.14",
3
+ "version": "14.0.15",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "files": [
@@ -158,19 +158,28 @@ module.exports = ({ ds, proxify }) => {
158
158
 
159
159
  const { pre, type, body, post } = match
160
160
 
161
- const compileExpression = compilers[type]
162
- if (!compileExpression) {
163
- throw new Error('unknown expression type: ' + type)
164
- }
161
+ if (type === 'js') {
162
+ const expr = compilers.js(body)
165
163
 
166
- const expr = compileExpression(body)
164
+ if (!pre && !post) {
165
+ return (str, args$) => expr(args$)
166
+ }
167
167
 
168
- if (!pre && !post) {
169
- return (str, args$) => expr(args$)
170
- }
168
+ return (str, args$) => expr(args$).pipe(rx.map((body) => `${pre}${stringify(body)}${post}`))
169
+ } else if (type === 'nxt') {
170
+ const expr = compilers.nxt(body)
171
171
 
172
- return (str, args$) =>
173
- expr(args$).pipe(rx.map((body) => `${pre}${stringify(body, type !== 'js')}${post}`))
172
+ if (!pre && !post) {
173
+ return (str, args$) => expr(args$)
174
+ }
175
+
176
+ return (str, args$) =>
177
+ expr(args$).pipe(
178
+ rx.switchMap((body) => onResolveTemplate(`${pre}${stringify(body, true)}${post}`, args$))
179
+ )
180
+ } else {
181
+ throw new Error('unknown expression type: ' + type)
182
+ }
174
183
  }
175
184
 
176
185
  function stringify(value, escape) {