@delance/builder 0.2.7 → 0.2.8

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.
Files changed (2) hide show
  1. package/dist/index.js +39 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4683,8 +4683,9 @@ var stringaes_default = {
4683
4683
  import * as t46 from "@babel/types";
4684
4684
  import tmpl6 from "@babel/template";
4685
4685
  var entry = capture(numericLiteral());
4686
- var main = callExpression(memberExpression(callExpression(identifier("require"), [entry]), identifier("main"), false), [booleanLiteral(true)]);
4687
- var verifyClient = assignmentExpression("=", memberExpression(identifier("exports"), identifier("verifyClient")), functionExpression(null, [identifier()]));
4686
+ var requireEntry = callExpression(identifier("require"), [entry]);
4687
+ var main = callExpression(memberExpression(or(requireEntry, identifier()), identifier("main"), false), [booleanLiteral(true)]);
4688
+ var verifyClient = assignmentExpression("=", memberExpression(identifier("exports"), identifier("verifyClient")), or(functionExpression(null, [identifier()]), identifier()));
4688
4689
  var vsda = ifStatement(containerOf(stringLiteral("vsda")));
4689
4690
  var antifeature_default = {
4690
4691
  name: "anti-feature",
@@ -4695,6 +4696,23 @@ var antifeature_default = {
4695
4696
  if (!main.match($.node)) {
4696
4697
  return;
4697
4698
  }
4699
+ const $callee = $.get("callee");
4700
+ if ($callee.isMemberExpression()) {
4701
+ const $main = $callee.get("object");
4702
+ $main.assertIdentifier();
4703
+ const $binding = $.scope.getBinding($main.node.name);
4704
+ if (!$binding) {
4705
+ return;
4706
+ }
4707
+ const $path = $binding.path;
4708
+ $path.traverse({
4709
+ CallExpression: {
4710
+ exit($call) {
4711
+ requireEntry.match($call.node);
4712
+ }
4713
+ }
4714
+ });
4715
+ }
4698
4716
  t46.assertNumericLiteral(entry.current);
4699
4717
  const _target = $.find((p2) => chunk_default.match(p2.node));
4700
4718
  if (!_target) {
@@ -4717,8 +4735,25 @@ var antifeature_default = {
4717
4735
  return;
4718
4736
  }
4719
4737
  const $value = $.get("right");
4720
- $value.assertFunction();
4721
- $value.get("body").replaceWith(tmpl6.statement.ast`{
4738
+ let $func;
4739
+ if ($value.isIdentifier()) {
4740
+ const $binding = $.scope.getBinding($value.node.name);
4741
+ if (!$binding) {
4742
+ return;
4743
+ }
4744
+ const $path = $binding.path;
4745
+ $path.assertFunction();
4746
+ const $body = $path.get("body");
4747
+ $body.assertBlockStatement();
4748
+ $func = $body;
4749
+ } else if ($value.isFunction()) {
4750
+ const $body = $value.get("body");
4751
+ $body.assertBlockStatement();
4752
+ $func = $body;
4753
+ } else {
4754
+ return;
4755
+ }
4756
+ $func.replaceWith(tmpl6.statement.ast`{
4722
4757
  return;
4723
4758
  }`);
4724
4759
  this.changes++;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@delance/builder",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "A spear to the Python language server built with black magic",
5
5
  "license": "0BSD",
6
6
  "author": "mochaaP <npm@mochaa.ws>",