@delance/builder 0.3.7 → 0.3.9

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 +42 -18
  2. package/package.json +13 -13
package/dist/index.js CHANGED
@@ -2843,9 +2843,15 @@ var mod = capture(identifier());
2843
2843
  var exp = capture(identifier());
2844
2844
  var req = capture(identifier());
2845
2845
  var functionExpr = (args) => or(functionExpression(null, args, blockStatement(), false, false), arrowFunctionExpression(args, blockStatement(), false));
2846
- function chunk(id) {
2846
+ function webpackChunk(id) {
2847
2847
  return objectProperty(numericLiteral(id), or(functionExpr([]), functionExpr([mod]), functionExpr([mod, exp]), functionExpr([mod, exp, req])));
2848
2848
  }
2849
+ function rspackChunk(id) {
2850
+ return objectMethod(predicate((x) => x === "method"), numericLiteral(id), or(tupleOf(), tupleOf(mod), tupleOf(mod, exp), tupleOf(mod, exp, req)), anything(), false, false, false);
2851
+ }
2852
+ function chunk(id) {
2853
+ return or(webpackChunk(id), rspackChunk(id));
2854
+ }
2849
2855
  var chunks = objectExpression(anyList(oneOrMore(chunk())));
2850
2856
  var chunk_default = chunk();
2851
2857
 
@@ -2854,7 +2860,7 @@ var entry = capture(numericLiteral());
2854
2860
  var requireEntry = callExpression(identifier("require"), [entry]);
2855
2861
  var main = callExpression(memberExpression(or(requireEntry, identifier()), identifier("main"), false), [booleanLiteral(true)]);
2856
2862
  var verifyClient = assignmentExpression("=", memberExpression(identifier("exports"), identifier("verifyClient")), or(functionExpression(null, [identifier()]), identifier()));
2857
- var vsda = ifStatement(containerOf(stringLiteral("vsda")));
2863
+ var invalidClient = memberExpression(memberExpression(identifier(), identifier("EventName")), identifier("LANGUAGE_SERVER_INVALID_CLIENT"));
2858
2864
  var antifeature_default = {
2859
2865
  name: "anti-feature",
2860
2866
  tags: ["unsafe"],
@@ -2884,17 +2890,23 @@ var antifeature_default = {
2884
2890
  });
2885
2891
  }
2886
2892
  t22.assertNumericLiteral(entry.current);
2887
- const _target = $.find((p) => chunk_default.match(p.node));
2893
+ const _target = $.findParent((p) => chunk_default.match(p.node));
2888
2894
  if (!_target) {
2889
2895
  throw new Error("Could not find module chunk");
2890
2896
  }
2891
- const $target = _target;
2892
- $target.assertObjectProperty();
2893
- const $value = $target.get("value");
2894
- $value.assertFunction();
2895
- $value.get("body").replaceWith(tmpl.statement.ast`{
2896
- require(${entry.current}).main(false);
2897
- }`);
2897
+ let $target;
2898
+ if (_target.isObjectProperty()) {
2899
+ const $func = _target.get("value");
2900
+ $func.assertFunction();
2901
+ $target = $func;
2902
+ } else {
2903
+ const $func = _target;
2904
+ $func.assertObjectMethod();
2905
+ $target = $func;
2906
+ }
2907
+ $target.get("body").replaceWith(tmpl.statement.ast`{
2908
+ require(${entry.current}).main(Boolean(process.env["VSCODE_NLS_CONFIG"]));
2909
+ }`);
2898
2910
  $.stop();
2899
2911
  this.changes++;
2900
2912
  }
@@ -2924,17 +2936,23 @@ var antifeature_default = {
2924
2936
  return;
2925
2937
  }
2926
2938
  $function.replaceWith(tmpl.statement.ast`{
2927
- return;
2928
- }`);
2939
+ return;
2940
+ }`);
2929
2941
  this.changes++;
2930
2942
  }
2931
2943
  },
2932
- IfStatement: {
2944
+ MemberExpression: {
2933
2945
  exit($) {
2934
- if (!vsda.match($.node)) {
2946
+ if (!invalidClient.match($.node)) {
2935
2947
  return;
2936
2948
  }
2937
- $.remove();
2949
+ const _target = $.findParent((p) => p.isIfStatement());
2950
+ if (!_target) {
2951
+ throw new Error("Could not find parent if");
2952
+ }
2953
+ const $target = _target;
2954
+ $target.assertIfStatement();
2955
+ $target.remove();
2938
2956
  this.changes++;
2939
2957
  }
2940
2958
  }
@@ -3298,9 +3316,15 @@ var module_helper_default = {
3298
3316
  const unders = "_".repeat(level - 1);
3299
3317
  const $chunks = $.get("properties");
3300
3318
  for (const $chunk of $chunks) {
3301
- $chunk.assertObjectProperty();
3302
- const $function = $chunk.get("value");
3303
- $function.assertFunction();
3319
+ let $function;
3320
+ if ($chunk.isObjectProperty()) {
3321
+ const $func = $chunk.get("value");
3322
+ $func.assertFunction();
3323
+ $function = $func;
3324
+ } else {
3325
+ $chunk.assertObjectMethod();
3326
+ $function = $chunk;
3327
+ }
3304
3328
  const $p = $function.get("params");
3305
3329
  $p.forEach(($parameter, i) => {
3306
3330
  $parameter.assertIdentifier();
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@delance/builder",
3
3
  "type": "module",
4
- "version": "0.3.7",
5
- "packageManager": "pnpm@10.15.1+sha512.34e538c329b5553014ca8e8f4535997f96180a1d0f614339357449935350d924e22f8614682191264ec33d1462ac21561aff97f6bb18065351c162c7e8f6de67",
4
+ "version": "0.3.9",
5
+ "packageManager": "pnpm@10.28.1+sha512.7d7dbbca9e99447b7c3bf7a73286afaaf6be99251eb9498baefa7d406892f67b879adb3a1d7e687fc4ccc1a388c7175fbaae567a26ab44d1067b54fcb0d6a316",
6
6
  "description": "A spear to the Python language server built with black magic",
7
7
  "author": "mochaaP <npm@mochaa.ws>",
8
8
  "license": "0BSD",
@@ -39,12 +39,12 @@
39
39
  "debug": "^4.4.0"
40
40
  },
41
41
  "dependencies": {
42
- "@babel/core": "^7.28.4",
43
- "@babel/generator": "^7.28.3",
44
- "@babel/parser": "^7.28.4",
45
- "@babel/template": "^7.27.2",
46
- "@babel/traverse": "^7.28.4",
47
- "@babel/types": "^7.28.4",
42
+ "@babel/core": "^7.28.6",
43
+ "@babel/generator": "^7.28.6",
44
+ "@babel/parser": "^7.28.6",
45
+ "@babel/template": "^7.28.6",
46
+ "@babel/traverse": "^7.28.6",
47
+ "@babel/types": "^7.28.6",
48
48
  "quickjs-emscripten": "^0.31.0"
49
49
  },
50
50
  "devDependencies": {
@@ -52,17 +52,17 @@
52
52
  "@codemod/matchers": "npm:@codemod-esm/matchers@^1.7.2",
53
53
  "@codemod/parser": "npm:@codemod-esm/parser@^1.4.3",
54
54
  "@codemod/utils": "npm:@codemod-esm/utils@^1.1.2",
55
- "@mochaa/eslintrc": "^0.1.13",
55
+ "@mochaa/eslintrc": "^0.1.19",
56
56
  "@types/babel__core": "^7.20.5",
57
57
  "@types/babel__generator": "^7.27.0",
58
58
  "@types/babel__helper-validator-identifier": "^7.15.2",
59
59
  "@types/babel__template": "^7.4.4",
60
60
  "@types/babel__traverse": "^7.28.0",
61
- "@types/bun": "^1.2.21",
61
+ "@types/bun": "^1.3.6",
62
62
  "@types/debug": "^4.1.12",
63
- "bun": "^1.2.21",
64
- "eslint": "^9.35.0",
65
- "typescript": "^5.9.2",
63
+ "bun": "^1.3.6",
64
+ "eslint": "^9.39.2",
65
+ "typescript": "^5.9.3",
66
66
  "webcrack": "github:j4k0xb/webcrack"
67
67
  },
68
68
  "pnpm": {