@cparra/apex-reflection 2.22.0-dev.20251224085115 → 2.22.0-dev.20251224093546

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 +23 -11
  2. package/package.json +2 -6
package/dist/index.js CHANGED
@@ -4,9 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.reflectTrigger = exports.reflect = void 0;
7
- const shelljs_1 = __importDefault(require("shelljs"));
8
7
  const path_1 = __importDefault(require("path"));
9
8
  const fs_1 = __importDefault(require("fs"));
9
+ const child_process_1 = require("child_process");
10
10
  function resolveNativeBinaryPath() {
11
11
  const platform = process.platform;
12
12
  const arch = process.arch;
@@ -42,13 +42,19 @@ function resolveNativeBinaryPath() {
42
42
  throw new Error(`Native binary not found. Expected one of:\n- ${downloadedPath}\n- ${devBuiltPath}\n\nIf you just installed this package, ensure postinstall succeeded.\nIf you're developing locally, run the dev build to create the host binary.`);
43
43
  }
44
44
  function reflect(declarationBody) {
45
- // NOTE: `declarationBody` is unused for now (prototype phase).
46
45
  const binaryPath = resolveNativeBinaryPath();
47
- const execResult = shelljs_1.default.exec(`"${binaryPath}" --type=reflectType --source "${declarationBody}"`, { silent: true });
48
- if (execResult.code !== 0) {
49
- throw new Error(`apex-reflection native binary failed (code=${execResult.code}). stderr:\n${execResult.stderr}`);
46
+ const result = (0, child_process_1.spawnSync)(binaryPath, ["--type=reflectType"], {
47
+ input: declarationBody,
48
+ encoding: "utf8",
49
+ maxBuffer: 1024 * 1024 * 50,
50
+ });
51
+ if (result.error) {
52
+ throw new Error(`apex-reflection native binary failed to start. error:\n${String(result.error)}`);
50
53
  }
51
- const stdout = (execResult.stdout ?? "").toString().trim();
54
+ if (result.status !== 0) {
55
+ throw new Error(`apex-reflection native binary failed (code=${result.status}). stderr:\n${result.stderr ?? ""}`);
56
+ }
57
+ const stdout = (result.stdout ?? "").toString().trim();
52
58
  if (!stdout) {
53
59
  throw new Error("apex-reflection native binary produced no output on stdout.");
54
60
  }
@@ -61,13 +67,19 @@ function reflect(declarationBody) {
61
67
  }
62
68
  exports.reflect = reflect;
63
69
  function reflectTrigger(declarationBody) {
64
- // NOTE: `declarationBody` is unused for now (prototype phase).
65
70
  const binaryPath = resolveNativeBinaryPath();
66
- const execResult = shelljs_1.default.exec(`"${binaryPath}" --type=reflectTrigger --source "${declarationBody}"`, { silent: true });
67
- if (execResult.code !== 0) {
68
- throw new Error(`apex-reflection native binary failed (code=${execResult.code}). stderr:\n${execResult.stderr}`);
71
+ const result = (0, child_process_1.spawnSync)(binaryPath, ["--type=reflectTrigger"], {
72
+ input: declarationBody,
73
+ encoding: "utf8",
74
+ maxBuffer: 1024 * 1024 * 50,
75
+ });
76
+ if (result.error) {
77
+ throw new Error(`apex-reflection native binary failed to start. error:\n${String(result.error)}`);
78
+ }
79
+ if (result.status !== 0) {
80
+ throw new Error(`apex-reflection native binary failed (code=${result.status}). stderr:\n${result.stderr ?? ""}`);
69
81
  }
70
- const stdout = (execResult.stdout ?? "").toString().trim();
82
+ const stdout = (result.stdout ?? "").toString().trim();
71
83
  if (!stdout) {
72
84
  throw new Error("apex-reflection native binary produced no output on stdout.");
73
85
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cparra/apex-reflection",
3
- "version": "2.22.0-dev.20251224085115",
3
+ "version": "2.22.0-dev.20251224093546",
4
4
  "description": "Provides tools for reflecting Apex code, the language used in Salesforce development.",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -27,7 +27,6 @@
27
27
  "devDependencies": {
28
28
  "@types/jest": "^27.0.2",
29
29
  "@types/node": "^16.18.98",
30
- "@types/shelljs": "^0.10.0",
31
30
  "@types/typescript": "^2.0.0",
32
31
  "jest": "^27.2.4",
33
32
  "rimraf": "^6.0.1",
@@ -39,8 +38,5 @@
39
38
  "dist/index.js",
40
39
  "dist/index.d.ts",
41
40
  "publish-scripts/postinstall.js"
42
- ],
43
- "dependencies": {
44
- "shelljs": "^0.10.0"
45
- }
41
+ ]
46
42
  }