leanweb 3.0.4 → 3.0.6

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": "leanweb",
3
- "version": "3.0.4",
3
+ "version": "3.0.6",
4
4
  "description": "Builds framework agnostic web components.",
5
5
  "bin": {
6
6
  "leanweb": "leanweb.js",
@@ -20,15 +20,15 @@
20
20
  "author": "Qian Chen",
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
- "@babel/parser": "^7.25.3",
24
- "esbuild": "^0.23.1",
25
- "fs-extra": "^11.2.0",
26
- "globby": "^14.0.2",
23
+ "@babel/parser": "^7.28.3",
24
+ "esbuild": "^0.25.9",
25
+ "fs-extra": "^11.3.1",
26
+ "globby": "^14.1.0",
27
27
  "html-minifier": "^4.0.0",
28
- "isomorphic-git": "^1.27.1",
28
+ "isomorphic-git": "^1.33.0",
29
29
  "live-server": "^1.2.2",
30
30
  "node-watch": "^0.7.4",
31
- "parse5": "^7.1.2",
32
- "semver": "^7.6.3"
31
+ "parse5": "^8.0.0",
32
+ "semver": "^7.7.2"
33
33
  }
34
34
  }
@@ -81,7 +81,8 @@ const callFunction = (node, context) => {
81
81
  args.push(evalNode(argument, context));
82
82
  }
83
83
  });
84
- return callee(...args);
84
+ const thisContext = getThisContext(context);
85
+ return callee.apply(thisContext, args);
85
86
  };
86
87
 
87
88
  const nodeHandlers = {
@@ -154,12 +155,7 @@ const nodeHandlers = {
154
155
  }
155
156
  },
156
157
  'ThisExpression': (node, context) => {
157
- if (Array.isArray(context)) {
158
- const hitContext = context.find(contextObj => 'this' in contextObj);
159
- return hitContext ? hitContext['this'] : undefined;
160
- } else if (typeof context === 'object') {
161
- return context['this'];
162
- }
158
+ return getThisContext(context);
163
159
  },
164
160
 
165
161
  'CallExpression': (node, context) => callFunction(node, context),
@@ -170,6 +166,15 @@ const nodeHandlers = {
170
166
  'DirectiveLiteral': (node, context) => node.value,
171
167
  };
172
168
 
169
+ const getThisContext = (context) => {
170
+ if (Array.isArray(context)) {
171
+ const hitContext = context.find(contextObj => 'this' in contextObj);
172
+ return hitContext ? hitContext['this'] : undefined;
173
+ } else if (typeof context === 'object') {
174
+ return context['this'];
175
+ }
176
+ };
177
+
173
178
  const immediateContext = (node, context) => {
174
179
  if (Array.isArray(context)) {
175
180
  if (context.length === 0) {