@fnet/cli 0.128.0 → 0.128.1

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": "@fnet/cli",
3
- "version": "0.128.0",
3
+ "version": "0.128.1",
4
4
  "files": [
5
5
  "dist",
6
6
  "template"
@@ -55,7 +55,7 @@ export default function Block(context){
55
55
 
56
56
  {# If 'call' is specified, get the method from instance #}
57
57
  {% if context.transform.call %}
58
- const callLib = instance.{{context.transform.call}}.bind(instance);
58
+ const callLib = instance.{{context.transform.call}};
59
59
  {% else %}
60
60
  {# No method call, just return the instance #}
61
61
  const callLib = () => instance;
@@ -64,7 +64,6 @@ export default function Block(context){
64
64
  {% else %}
65
65
  {# EXISTING: Normal function/method call (no 'new') #}
66
66
  {% if context.lib.type==='atom'%}
67
- // HELLO
68
67
  const lib=LIBRARY;
69
68
  {% elseif context.lib.type==='subworkflow' %}
70
69
  const lib={{context.lib.codeKey}};
@@ -97,10 +96,20 @@ export default function Block(context){
97
96
  const callArgs ={{ context.transform.args | safe }} ;
98
97
  {% endif %}
99
98
 
100
- const result = Array.isArray(callArgs)? await callLib.apply(_this,callArgs): await callLib.call(_this,callArgs);
99
+ {% if context.transform.new !== undefined %}
100
+ {# For constructor calls, use instance as context #}
101
+ const result = Array.isArray(callArgs)? await callLib.apply(instance,callArgs): await callLib.call(instance,callArgs);
102
+ {% else %}
103
+ {# For regular calls, use _this as context #}
104
+ const result = Array.isArray(callArgs)? await callLib.apply(_this,callArgs): await callLib.call(_this,callArgs);
105
+ {% endif %}
101
106
 
102
107
  {% else %}
103
- const result = await callLib.call(_this);
108
+ {% if context.transform.new !== undefined %}
109
+ const result = await callLib.call(instance);
110
+ {% else %}
111
+ const result = await callLib.call(_this);
112
+ {% endif %}
104
113
  {% endif %}
105
114
 
106
115
  {% for assign in context.transform.result %}