@nxtedition/lib 14.0.13 → 14.0.14
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
package/util/template/index.js
CHANGED
|
@@ -10,6 +10,10 @@ const weakCache = require('../../weakCache')
|
|
|
10
10
|
module.exports = ({ ds, proxify }) => {
|
|
11
11
|
const compiler = {
|
|
12
12
|
current: null,
|
|
13
|
+
resolveTemplate,
|
|
14
|
+
onResolveTemplate,
|
|
15
|
+
compileTemplate,
|
|
16
|
+
isTemplate,
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
const compilers = {
|
|
@@ -216,10 +220,5 @@ module.exports = ({ ds, proxify }) => {
|
|
|
216
220
|
}
|
|
217
221
|
}
|
|
218
222
|
|
|
219
|
-
return
|
|
220
|
-
resolveTemplate,
|
|
221
|
-
onResolveTemplate,
|
|
222
|
-
compileTemplate,
|
|
223
|
-
isTemplate,
|
|
224
|
-
})
|
|
223
|
+
return compiler
|
|
225
224
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const assert = require('node:assert')
|
|
1
2
|
const weakCache = require('../../weakCache')
|
|
2
3
|
const rxjs = require('rxjs')
|
|
3
4
|
const vm = require('node:vm')
|
|
@@ -174,10 +175,13 @@ const globals = {
|
|
|
174
175
|
}
|
|
175
176
|
|
|
176
177
|
function proxify(value, expression, handler) {
|
|
178
|
+
assert(expression)
|
|
179
|
+
assert(handler)
|
|
180
|
+
|
|
177
181
|
if (!value) {
|
|
178
182
|
return value
|
|
179
183
|
} else if (rxjs.isObservable(value)) {
|
|
180
|
-
return proxify(expression.observe(value), expression)
|
|
184
|
+
return proxify(expression.observe(value), expression, handler)
|
|
181
185
|
} else if (typeof value?.then === 'function') {
|
|
182
186
|
return proxify(expression.wait(value), expression, handler)
|
|
183
187
|
} else if (typeof value === 'object') {
|
|
@@ -191,7 +195,7 @@ const MAP_POOL = []
|
|
|
191
195
|
|
|
192
196
|
function makeWrapper(expression) {
|
|
193
197
|
const handler = {
|
|
194
|
-
get: (target, prop) => proxify(target[prop],
|
|
198
|
+
get: (target, prop) => proxify(target[prop], expression, handler),
|
|
195
199
|
}
|
|
196
200
|
return (value) => proxify(value, expression, handler)
|
|
197
201
|
}
|
|
@@ -319,8 +323,11 @@ module.exports = ({ ds, proxify, compiler }) => {
|
|
|
319
323
|
// TODO (fix): freeze?
|
|
320
324
|
self._context.$ = self._args
|
|
321
325
|
self._context.nxt = self
|
|
326
|
+
|
|
327
|
+
const previous = compiler.current
|
|
328
|
+
compiler.current = self
|
|
329
|
+
|
|
322
330
|
try {
|
|
323
|
-
compiler.current = this
|
|
324
331
|
const value = self._script.runInContext(self._context)
|
|
325
332
|
if (value !== self._value) {
|
|
326
333
|
self._value = value
|
|
@@ -338,7 +345,7 @@ module.exports = ({ ds, proxify, compiler }) => {
|
|
|
338
345
|
})
|
|
339
346
|
)
|
|
340
347
|
} finally {
|
|
341
|
-
compiler.current =
|
|
348
|
+
compiler.current = previous
|
|
342
349
|
|
|
343
350
|
self._context.$ = null
|
|
344
351
|
self._context.nxt = null
|