frida-test 0.3.0 → 0.3.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.
@@ -1 +1 @@
1
- {"version":3,"file":"bundler.d.ts","sourceRoot":"","sources":["../src/bundler.ts"],"names":[],"mappings":"AAwEA,wBAAsB,WAAW,CAAC,cAAc,EAAE,MAAM,EAAE,EAAE,IAAI,GAAE,OAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CA2DlG"}
1
+ {"version":3,"file":"bundler.d.ts","sourceRoot":"","sources":["../src/bundler.ts"],"names":[],"mappings":"AAwFA,wBAAsB,WAAW,CAAC,cAAc,EAAE,MAAM,EAAE,EAAE,IAAI,GAAE,OAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CA4DlG"}
package/dist/bundler.js CHANGED
@@ -63,6 +63,20 @@ async function deleteWorkDir(workDir) {
63
63
  logger.warn(`Failed to remove temporary work dir "${workDir}": ${err.message}`);
64
64
  }
65
65
  }
66
+ async function prepareTypeCheckConfig(projectRoot, workDir) {
67
+ const realTsconfigPath = path.join(projectRoot, "tsconfig.json");
68
+ if (!existsSync(realTsconfigPath))
69
+ return;
70
+ const scratchConfig = {
71
+ extends: realTsconfigPath.replace(/\\/g, "/"),
72
+ compilerOptions: {
73
+ rootDir: projectRoot.replace(/\\/g, "/"),
74
+ },
75
+ include: [],
76
+ exclude: [],
77
+ };
78
+ await writeFile(path.join(workDir, "tsconfig.json"), JSON.stringify(scratchConfig, null, 2), "utf8");
79
+ }
66
80
  export async function bundleAgent(testSuitePaths, keep = false) {
67
81
  if (testSuitePaths.length === 0) {
68
82
  throw new Error("bundleAgent requires at least one test suite path.");
@@ -87,19 +101,19 @@ export async function bundleAgent(testSuitePaths, keep = false) {
87
101
  .join("\n");
88
102
  await rm(entrypointPath, { force: true });
89
103
  await writeFile(entrypointPath, agentSource.replace(IMPORT_MARKER, importStatements), "utf8");
104
+ await prepareTypeCheckConfig(projectRoot, workDir);
90
105
  const outfilePath = path.join(workDir, AGENT_BUNDLE_FILENAME);
91
106
  const fridaCompile = getFridaCompileBin(projectRoot);
92
107
  const args = fridaCompile.useLocal ? [entrypointPath, "-o", outfilePath] : ["frida-compile", entrypointPath, "-o", outfilePath];
93
108
  try {
94
109
  execFileSync(fridaCompile.path, args, {
95
- cwd: projectRoot,
110
+ cwd: workDir,
96
111
  shell: process.platform === "win32",
97
- encoding: "utf8",
112
+ stdio: "inherit",
98
113
  });
99
114
  }
100
115
  catch (err) {
101
- const stderr = err.stderr?.toString().trim();
102
- throw new Error(`frida-compile failed for entrypoint "${entrypointPath}" with suites [${testSuitePaths.join(", ")}]: ${stderr || err.message}`, { cause: err });
116
+ throw new Error(`frida-compile failed for entrypoint "${entrypointPath}" with suites [${testSuitePaths.join(", ")}] (see compiler output above for details)`, { cause: err });
103
117
  }
104
118
  logger.info(`Agent bundle sucessfully created and saved at ${outfilePath}.`);
105
119
  return await readFile(outfilePath, "utf8");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frida-test",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "license": "GPL-3.0-only",
6
6
  "homepage": "https://github.com/bernhste/frida-test/blob/main/README.md",
@@ -63,6 +63,6 @@
63
63
  "typescript": "^7.0.2"
64
64
  },
65
65
  "allowScripts": {
66
- "frida@17.17.0": true
66
+ "frida@17.18.0": true
67
67
  }
68
68
  }