frida 16.7.14 → 16.7.16

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 (174) hide show
  1. package/README.md +1 -10
  2. package/build/BSDmakefile +6 -0
  3. package/build/Makefile +10 -0
  4. package/build/src/frida.d.ts +364 -0
  5. package/build/src/frida.js +962 -0
  6. package/build/src/frida_binding.d.ts +938 -0
  7. package/meson.build +22 -67
  8. package/package.json +30 -20
  9. package/scripts/fetch-abi-bits.py +15 -65
  10. package/scripts/install.js +5 -4
  11. package/src/addon.def +3 -0
  12. package/src/addon.symbols +2 -1
  13. package/src/addon.version +4 -0
  14. package/src/assets/meson.build +13 -0
  15. package/src/frida_bindgen/__init__.py +0 -0
  16. package/src/frida_bindgen/__main__.py +4 -0
  17. package/src/frida_bindgen/__pycache__/__init__.cpython-312.pyc +0 -0
  18. package/src/frida_bindgen/__pycache__/__main__.cpython-312.pyc +0 -0
  19. package/src/frida_bindgen/__pycache__/cli.cpython-312.pyc +0 -0
  20. package/src/frida_bindgen/__pycache__/codegen.cpython-312.pyc +0 -0
  21. package/src/frida_bindgen/__pycache__/customization.cpython-312.pyc +0 -0
  22. package/src/frida_bindgen/__pycache__/loader.cpython-312.pyc +0 -0
  23. package/src/frida_bindgen/__pycache__/model.cpython-312.pyc +0 -0
  24. package/src/frida_bindgen/assets/codegen_helpers.c +1970 -0
  25. package/src/frida_bindgen/assets/codegen_helpers.ts +100 -0
  26. package/src/frida_bindgen/assets/codegen_prototypes.h +78 -0
  27. package/src/frida_bindgen/assets/codegen_types.h +57 -0
  28. package/src/frida_bindgen/assets/customization_facade.exports +13 -0
  29. package/src/frida_bindgen/assets/customization_facade.ts +157 -0
  30. package/src/frida_bindgen/assets/customization_helpers.imports +2 -0
  31. package/src/frida_bindgen/assets/customization_helpers.ts +396 -0
  32. package/src/frida_bindgen/cli.py +96 -0
  33. package/src/frida_bindgen/codegen.py +2233 -0
  34. package/src/frida_bindgen/customization.py +924 -0
  35. package/src/frida_bindgen/loader.py +60 -0
  36. package/src/frida_bindgen/model.py +1357 -0
  37. package/src/meson.build +94 -27
  38. package/{lib/build.py → src/tsc.py} +12 -12
  39. package/src/win_delay_load_hook.c +56 -0
  40. package/subprojects/frida-core.wrap +1 -1
  41. package/test/data/index.ts +2 -2
  42. package/test/device.ts +1 -2
  43. package/test/device_manager.ts +1 -2
  44. package/test/labrat.ts +2 -2
  45. package/test/script.ts +12 -12
  46. package/test/session.ts +3 -3
  47. package/tsconfig.json +6 -11
  48. package/dist/application.d.ts +0 -81
  49. package/dist/application.js +0 -2
  50. package/dist/authentication.d.ts +0 -3
  51. package/dist/authentication.js +0 -2
  52. package/dist/bus.d.ts +0 -16
  53. package/dist/bus.js +0 -23
  54. package/dist/cancellable.d.ts +0 -15
  55. package/dist/cancellable.js +0 -41
  56. package/dist/child.d.ts +0 -16
  57. package/dist/child.js +0 -9
  58. package/dist/crash.d.ts +0 -10
  59. package/dist/crash.js +0 -2
  60. package/dist/device.d.ts +0 -156
  61. package/dist/device.js +0 -188
  62. package/dist/device_manager.d.ts +0 -25
  63. package/dist/device_manager.js +0 -42
  64. package/dist/endpoint_parameters.d.ts +0 -26
  65. package/dist/endpoint_parameters.js +0 -24
  66. package/dist/icon.d.ts +0 -14
  67. package/dist/icon.js +0 -2
  68. package/dist/index.d.ts +0 -161
  69. package/dist/index.js +0 -170
  70. package/dist/iostream.d.ts +0 -13
  71. package/dist/iostream.js +0 -73
  72. package/dist/native.d.ts +0 -1
  73. package/dist/native.js +0 -11
  74. package/dist/portal_membership.d.ts +0 -6
  75. package/dist/portal_membership.js +0 -12
  76. package/dist/portal_service.d.ts +0 -48
  77. package/dist/portal_service.js +0 -52
  78. package/dist/process.d.ts +0 -47
  79. package/dist/process.js +0 -2
  80. package/dist/relay.d.ts +0 -22
  81. package/dist/relay.js +0 -32
  82. package/dist/script.d.ts +0 -70
  83. package/dist/script.js +0 -266
  84. package/dist/service.d.ts +0 -16
  85. package/dist/service.js +0 -26
  86. package/dist/session.d.ts +0 -45
  87. package/dist/session.js +0 -73
  88. package/dist/signals.d.ts +0 -20
  89. package/dist/signals.js +0 -40
  90. package/dist/socket_address.d.ts +0 -25
  91. package/dist/socket_address.js +0 -2
  92. package/dist/spawn.d.ts +0 -4
  93. package/dist/spawn.js +0 -2
  94. package/dist/system_parameters.d.ts +0 -84
  95. package/dist/system_parameters.js +0 -2
  96. package/lib/application.ts +0 -98
  97. package/lib/authentication.ts +0 -3
  98. package/lib/bus.ts +0 -30
  99. package/lib/cancellable.ts +0 -48
  100. package/lib/child.ts +0 -15
  101. package/lib/crash.ts +0 -11
  102. package/lib/device.ts +0 -331
  103. package/lib/device_manager.ts +0 -69
  104. package/lib/endpoint_parameters.ts +0 -56
  105. package/lib/icon.ts +0 -15
  106. package/lib/index.ts +0 -316
  107. package/lib/iostream.ts +0 -78
  108. package/lib/meson.build +0 -53
  109. package/lib/native.ts +0 -9
  110. package/lib/portal_membership.ts +0 -10
  111. package/lib/portal_service.ts +0 -105
  112. package/lib/process.ts +0 -57
  113. package/lib/relay.ts +0 -44
  114. package/lib/script.ts +0 -361
  115. package/lib/service.ts +0 -34
  116. package/lib/session.ts +0 -113
  117. package/lib/signals.ts +0 -45
  118. package/lib/socket_address.ts +0 -35
  119. package/lib/spawn.ts +0 -4
  120. package/lib/system_parameters.ts +0 -103
  121. package/meson.options +0 -11
  122. package/src/addon.cc +0 -78
  123. package/src/application.cc +0 -148
  124. package/src/application.h +0 -31
  125. package/src/authentication.cc +0 -174
  126. package/src/authentication.h +0 -24
  127. package/src/bus.cc +0 -167
  128. package/src/bus.h +0 -33
  129. package/src/cancellable.cc +0 -117
  130. package/src/cancellable.h +0 -31
  131. package/src/child.cc +0 -150
  132. package/src/child.h +0 -32
  133. package/src/crash.cc +0 -122
  134. package/src/crash.h +0 -30
  135. package/src/device.cc +0 -1350
  136. package/src/device.h +0 -56
  137. package/src/device_manager.cc +0 -362
  138. package/src/device_manager.h +0 -35
  139. package/src/endpoint_parameters.cc +0 -171
  140. package/src/endpoint_parameters.h +0 -28
  141. package/src/glib_context.cc +0 -62
  142. package/src/glib_context.h +0 -29
  143. package/src/glib_object.cc +0 -25
  144. package/src/glib_object.h +0 -37
  145. package/src/iostream.cc +0 -243
  146. package/src/iostream.h +0 -30
  147. package/src/operation.h +0 -94
  148. package/src/portal_membership.cc +0 -100
  149. package/src/portal_membership.h +0 -26
  150. package/src/portal_service.cc +0 -401
  151. package/src/portal_service.h +0 -40
  152. package/src/process.cc +0 -135
  153. package/src/process.h +0 -30
  154. package/src/relay.cc +0 -139
  155. package/src/relay.h +0 -31
  156. package/src/runtime.cc +0 -568
  157. package/src/runtime.h +0 -69
  158. package/src/script.cc +0 -301
  159. package/src/script.h +0 -36
  160. package/src/service.cc +0 -224
  161. package/src/service.h +0 -36
  162. package/src/session.cc +0 -860
  163. package/src/session.h +0 -42
  164. package/src/signals.cc +0 -334
  165. package/src/signals.h +0 -47
  166. package/src/spawn.cc +0 -95
  167. package/src/spawn.h +0 -27
  168. package/src/usage_monitor.h +0 -117
  169. package/src/uv_context.cc +0 -118
  170. package/src/uv_context.h +0 -40
  171. package/src/win_delay_load_hook.cc +0 -63
  172. package/subprojects/nan.wrap +0 -9
  173. package/subprojects/packagefiles/nan.patch +0 -13
  174. /package/{scripts → src/assets}/adjust-version.py +0 -0
package/meson.build CHANGED
@@ -1,23 +1,23 @@
1
- project('frida-node', 'cpp',
1
+ project('frida-node', 'c',
2
2
  version: run_command(find_program('python3'), files('scripts' / 'detect-version.py'),
3
3
  capture: true,
4
4
  check: true).stdout().strip(),
5
5
  meson_version: '>=1.1.0',
6
6
  )
7
7
 
8
- cpp = meson.get_compiler('cpp')
9
- strip = (cpp.get_argument_syntax() == 'msvc') ? '' : find_program('strip')
8
+ cc = meson.get_compiler('c')
9
+ strip = (cc.get_argument_syntax() == 'msvc') ? '' : find_program('strip')
10
10
 
11
11
  node = find_program('node')
12
12
  npm = find_program('npm')
13
13
  python = import('python').find_installation()
14
14
 
15
15
  version = meson.project_version()
16
- runtime = get_option('runtime')
17
- target = get_option('target')
18
16
 
19
17
  system = host_machine.system()
20
18
 
19
+ napi_version = 8
20
+
21
21
  node_platforms = {
22
22
  'windows': 'win32',
23
23
  }
@@ -38,34 +38,17 @@ gyp_archs = {
38
38
  cpu_family = host_machine.cpu_family()
39
39
  gyp_arch = gyp_archs.get(cpu_family, cpu_family)
40
40
 
41
- fs = import('fs')
42
- if runtime == 'node-webkit'
43
- host_binary = 'node'
44
- if host_machine.system() == 'windows'
45
- host_binary += '.dll'
46
- endif
47
- else
48
- host_binary = 'node'
49
- if host_machine.system() == 'windows'
50
- host_binary += '.exe'
51
- endif
52
- endif
53
-
54
41
  message('Fetching ABI bits')
55
42
  metadata = run_command(python, files('scripts' / 'fetch-abi-bits.py'),
56
- runtime, target, gyp_os, gyp_arch,
57
- node, npm, meson.current_build_dir(),
43
+ gyp_os, gyp_arch, node, npm, meson.current_build_dir(),
58
44
  capture: true,
59
45
  check: true,
60
46
  ).stdout().strip().split('\n')
61
- abi = 0
62
47
  node_defines = []
63
48
  node_incdirs = []
64
49
  node_libs = []
65
50
  foreach item : metadata
66
- if item.startswith('abi: ')
67
- abi = item.substring(5)
68
- elif item.startswith('node_defines: ')
51
+ if item.startswith('node_defines: ')
69
52
  node_defines += item.substring(14).split(' ')
70
53
  elif item.startswith('node_incdir: ')
71
54
  node_incdirs += item.substring(13)
@@ -76,68 +59,57 @@ foreach item : metadata
76
59
  endif
77
60
  endforeach
78
61
 
79
- extra_cpp_args = []
62
+ extra_c_args = []
80
63
  extra_link_args = []
81
64
  extra_link_depends = []
82
65
 
83
66
  foreach d : node_defines
84
- extra_cpp_args += '-D' + d
67
+ extra_c_args += '-D' + d
85
68
  endforeach
86
69
 
87
70
  if host_machine.system() == 'windows'
88
- extra_cpp_args += [
89
- '/Zc:__cplusplus',
90
- '/Zc:inline',
91
- '/Zc:threadSafeInit-',
71
+ extra_c_args += [
92
72
  '/wd4244',
93
- '/wd4251',
94
- '/wd4275',
95
- '/wd5051',
96
- '-DNOMINMAX',
97
73
  ]
98
74
  extra_link_args += [
99
- '/DELAYLOAD:' + host_binary,
75
+ '/DELAYLOAD:node.exe',
100
76
  '-lDelayImp',
101
77
  ]
102
78
  endif
103
79
 
104
- nan_dep = dependency('nan')
105
-
106
80
  frida_core_dep = dependency('frida-core-1.0', default_options: [
107
81
  f'frida_version=@version@',
108
82
  'compiler_backend=disabled',
109
83
  ])
110
84
 
111
- subdir('src')
112
-
113
85
  pkg_install_dir = get_option('libdir') / 'node_modules' / 'frida'
114
86
 
87
+ package_json = files('package.json')
88
+ tsconfig_json = files('tsconfig.json')
89
+
90
+ subdir('src')
91
+
115
92
  binding = shared_module('frida_binding', frida_binding_sources,
116
93
  name_prefix: '',
117
94
  name_suffix: 'node',
118
95
  include_directories: include_directories(node_incdirs),
119
96
  implicit_include_directories: false,
120
- override_options: [
121
- 'cpp_std=c++17',
122
- 'cpp_eh=none',
123
- 'cpp_rtti=false',
124
- ],
125
- cpp_args: [
97
+ c_args: [
126
98
  '-DBUILDING_NODE_EXTENSION',
127
99
  '-DNODE_GYP_MODULE_NAME=frida_binding',
128
- f'-DHOST_BINARY="@host_binary@"',
129
- '-DFRIDA_' + runtime.underscorify().to_upper(),
130
- ] + extra_cpp_args,
100
+ f'-DNAPI_VERSION=@napi_version@',
101
+ ] + extra_c_args,
131
102
  link_args: node_libs + extra_link_args,
132
103
  link_depends: extra_link_depends,
133
- dependencies: [frida_core_dep, nan_dep],
104
+ dependencies: frida_core_dep,
134
105
  install: true,
135
106
  install_dir: pkg_install_dir / 'build',
107
+ vs_module_defs: 'src' / 'addon.def',
136
108
  )
137
109
 
138
110
  custom_target('prebuild',
139
111
  input: [binding],
140
- output: [f'frida-v@version@-@runtime@-v@abi@-@node_platform@-@gyp_arch@.tar.gz'],
112
+ output: [f'frida-v@version@-napi-v@napi_version@-@node_platform@-@gyp_arch@.tar.gz'],
141
113
  command: [
142
114
  python,
143
115
  files('scripts' / 'package.py'),
@@ -147,20 +119,3 @@ custom_target('prebuild',
147
119
  '@OUTPUT@',
148
120
  ],
149
121
  )
150
-
151
- package_json = custom_target('package.json',
152
- input: 'package.json',
153
- output: 'package.json',
154
- command: [
155
- python,
156
- files('scripts' / 'adjust-version.py'),
157
- version,
158
- '@INPUT@',
159
- '@OUTPUT@',
160
- ],
161
- install: true,
162
- install_dir: pkg_install_dir,
163
- )
164
- tsconfig_json = files('tsconfig.json')
165
-
166
- subdir('lib')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frida",
3
- "version": "16.7.14",
3
+ "version": "16.7.16",
4
4
  "authors": [
5
5
  "Frida Developers"
6
6
  ],
@@ -21,20 +21,24 @@
21
21
  ],
22
22
  "homepage": "https://frida.re",
23
23
  "engines": {
24
- "node": ">=16 || 14 >=14.17"
24
+ "node": ">=16"
25
25
  },
26
- "main": "./dist",
26
+ "main": "build/src/frida.js",
27
+ "exports": {
28
+ ".": "./build/src/frida.js"
29
+ },
30
+ "type": "module",
27
31
  "files": [
28
32
  "BSDmakefile",
29
33
  "Makefile",
34
+ "build/src/*.d.ts",
35
+ "build/src/*.js",
30
36
  "configure",
31
37
  "configure.bat",
32
- "dist/",
33
38
  "make.bat",
34
39
  "meson.build",
35
40
  "meson.options",
36
41
  "tsconfig.json",
37
- "lib/",
38
42
  "releng/*.py",
39
43
  "releng/*.toml",
40
44
  "releng/devkit-assets/",
@@ -51,30 +55,36 @@
51
55
  ],
52
56
  "dependencies": {
53
57
  "bindings": "^1.5.0",
54
- "minimatch": "^9.0.3",
55
- "nan": "^2.18.0",
56
- "prebuild-install": "^7.1.1"
58
+ "minimatch": "^10.0.1",
59
+ "prebuild-install": "^7.1.3"
57
60
  },
58
61
  "devDependencies": {
59
- "@types/chai": "^4.2.18",
60
- "@types/mocha": "^10.0.3",
61
- "@types/node": "^20.8.8",
62
- "chai": "^4.3.4",
63
- "mocha": "^10.0.0",
64
- "ts-node": "^10.0.0",
65
- "typescript": "^5.2.2"
62
+ "@types/bindings": "^1.5.5",
63
+ "@types/chai": "^5.2.1",
64
+ "@types/mocha": "^10.0.10",
65
+ "@types/node": "^22.13.16",
66
+ "chai": "^5.2.0",
67
+ "mocha": "^11.1.0",
68
+ "ts-node": "^10.9.2",
69
+ "typescript": "^5.8.2"
66
70
  },
67
71
  "scripts": {
68
- "prepare": "npm run build",
69
- "build": "tsc",
70
- "watch": "tsc -w",
71
72
  "install": "node scripts/install.js",
72
- "test": "node --expose-gc node_modules/mocha/bin/_mocha -r ts-node/register test/*.ts"
73
+ "test": "node --loader ts-node/esm --expose-gc node_modules/mocha/bin/_mocha --extension ts test/*.ts",
74
+ "examples:build": "tsc -p tsconfig.examples.json",
75
+ "examples:watch": "tsc -p tsconfig.examples.json -w"
73
76
  },
74
77
  "binary": {
75
78
  "host": "https://github.com",
76
79
  "remote_path": "frida/frida/releases/download/{version}",
77
- "module_path": "build"
80
+ "module_path": "build",
81
+ "napi_versions": [
82
+ 8
83
+ ]
84
+ },
85
+ "config": {
86
+ "runtime": "napi",
87
+ "target": "8"
78
88
  },
79
89
  "license": "LGPL-2.0 WITH WxWindows-exception-3.1",
80
90
  "repository": {
@@ -20,9 +20,9 @@ IMPORT_OBJECT_HDR_SIG2 = 0xffff
20
20
 
21
21
 
22
22
  def main(argv: list[str]):
23
- runtime, target, gyp_os, gyp_arch = argv[1:5]
24
- flavor = "|".join(argv[1:5])
25
- node, npm, outdir = [Path(p) for p in argv[5:8]]
23
+ gyp_os, gyp_arch = argv[1:3]
24
+ flavor = "|".join(argv[1:3])
25
+ node, npm, outdir = [Path(p) for p in argv[3:6]]
26
26
 
27
27
  abidir = outdir / "abi-bits"
28
28
  metadata_file = abidir / "abi-bits.json"
@@ -37,24 +37,17 @@ def main(argv: list[str]):
37
37
  if abidir.exists():
38
38
  shutil.rmtree(abidir)
39
39
 
40
- (node_incdirs, node_gypdir, node_libs) = load_dev_assets(runtime, target, gyp_os, gyp_arch,
41
- node, outdir, abidir)
40
+ (node_incdirs, node_gypdir, node_libs) = load_dev_assets(gyp_os, gyp_arch, node, outdir, abidir)
42
41
 
43
42
  subprocess.run([npm, "init", "-y"],
44
43
  capture_output=True,
45
44
  cwd=abidir,
46
45
  check=True)
47
- subprocess.run([npm, "install", "node-abi", "node-gyp"],
46
+ subprocess.run([npm, "install", "node-gyp"],
48
47
  capture_output=True,
49
48
  cwd=abidir,
50
49
  check=True)
51
50
 
52
- abi = subprocess.run([node, "-e", f"import('node-abi').then(abi => {{ console.log(abi.getAbi('{target}', '{runtime}')); }})"],
53
- capture_output=True,
54
- encoding="utf-8",
55
- cwd=abidir,
56
- check=True).stdout.strip()
57
-
58
51
  node_defines = load_node_defines(gyp_os, gyp_arch, node_gypdir,
59
52
  abidir / "node_modules" / "node-gyp" / "gyp" / "pylib")
60
53
 
@@ -63,7 +56,6 @@ def main(argv: list[str]):
63
56
 
64
57
  metadata = {
65
58
  "flavor": flavor,
66
- "abi": abi,
67
59
  "node_defines": node_defines,
68
60
  "node_incdirs": [str(d) for d in node_incdirs_rel],
69
61
  "node_libs": [str(l) for l in node_libs_rel],
@@ -74,7 +66,6 @@ def main(argv: list[str]):
74
66
 
75
67
 
76
68
  def print_metadata(metadata: dict[str, Union[str, list[str]]]):
77
- print("abi:", metadata["abi"])
78
69
  print("node_defines:", " ".join(metadata["node_defines"]))
79
70
  for d in metadata["node_incdirs"]:
80
71
  print("node_incdir:", d)
@@ -82,45 +73,18 @@ def print_metadata(metadata: dict[str, Union[str, list[str]]]):
82
73
  print("node_lib:", l)
83
74
 
84
75
 
85
- def load_dev_assets(runtime: str,
86
- target: str,
87
- gyp_os: str,
76
+ def load_dev_assets(gyp_os: str,
88
77
  gyp_arch: str,
89
78
  node: Path,
90
79
  outdir: Path,
91
80
  abidir: Path) -> tuple[list[Path], Path, list[Path]]:
92
- if runtime == "node" and target == "" and gyp_os != "win":
93
- node_incroot = node.parent.parent / "include"
94
- node_incdir = node_incroot / "node"
95
- if node_incdir.exists():
96
- abidir.mkdir()
97
- node_gypdir = node_incdir
98
- node_libs = []
99
- return ([node_incdir, node_incroot], node_gypdir, node_libs)
100
-
101
- if target == "":
102
- version = subprocess.run([node, "--version"], capture_output=True, encoding="utf-8").stdout.strip()
103
- else:
104
- version = f"v{target}"
105
-
81
+ version = f"v24.0.0"
106
82
  node_arch = "x86" if gyp_arch == "ia32" else gyp_arch
107
83
 
108
- if runtime == "node":
109
- base_url = f"https://nodejs.org/dist/{version}"
110
- headers_stem = f"node-{version}-headers"
111
- libs_subpath = f"/win-{node_arch}"
112
- compression_formats = ["xz", "gz"]
113
- elif runtime == "electron":
114
- base_url = f"https://electronjs.org/headers/{version}"
115
- headers_stem = f"node-{version}-headers"
116
- libs_subpath = f"/win-{node_arch}"
117
- compression_formats = ["gz"]
118
- else:
119
- assert runtime == "node-webkit"
120
- base_url = f"https://node-webkit.s3.amazonaws.com/{version}"
121
- headers_stem = f"nw-headers-{version}"
122
- libs_subpath = "" if node_arch == "x86" else f"/{node_arch}"
123
- compression_formats = ["gz"]
84
+ base_url = f"https://nodejs.org/dist/{version}"
85
+ headers_stem = f"node-{version}-headers"
86
+ libs_subpath = f"/win-{node_arch}"
87
+ compression_formats = ["xz", "gz"]
124
88
 
125
89
  download_error = None
126
90
  for compression in compression_formats:
@@ -158,25 +122,11 @@ def load_dev_assets(runtime: str,
158
122
  node_lib.write_bytes(redacted_lib.getvalue())
159
123
  node_libnames.append(node_lib.name)
160
124
 
161
- if runtime == "node-webkit":
162
- nw_lib = libdir / "nw.lib"
163
- with urllib.request.urlopen(f"{base_url}{libs_subpath}/nw.lib") as response:
164
- nw_lib.write_bytes(response.read())
165
- node_libnames.append(nw_lib.name)
166
-
167
125
  os.rename(extracted_rootdir, abidir)
168
126
 
169
- if runtime == "node-webkit":
170
- node_incdirs = [
171
- abidir / "src",
172
- abidir / "deps" / "uv" / "include",
173
- abidir / "deps" / "v8" / "include",
174
- ]
175
- node_gypdir = abidir
176
- else:
177
- incdir = abidir / "include" / "node"
178
- node_incdirs = [incdir]
179
- node_gypdir = incdir
127
+ incdir = abidir / "include" / "node"
128
+ node_incdirs = [incdir]
129
+ node_gypdir = incdir
180
130
 
181
131
  node_libs = [abidir / "lib" / name for name in node_libnames]
182
132
 
@@ -194,7 +144,7 @@ def load_node_defines(gyp_os: str, gyp_arch: str, node_gypdir: Path, gyp_pylib:
194
144
  "target_name": "frida_binding",
195
145
  "type": "loadable_module",
196
146
  "sources": [
197
- "src/addon.cc",
147
+ "src/frida_binding.c",
198
148
  ],
199
149
  },
200
150
  ],
@@ -1,8 +1,9 @@
1
- const { execSync } = require('child_process');
2
- const fs = require('fs');
3
- const path = require('path');
1
+ import { execSync } from 'child_process';
2
+ import fs from 'fs';
3
+ import path from 'path';
4
+ import { fileURLToPath } from 'url';
4
5
 
5
- const pkgRoot = path.dirname(path.dirname(__filename));
6
+ const pkgRoot = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
6
7
  const binding = path.join(pkgRoot, 'build', 'frida_binding.node');
7
8
  if (fs.existsSync(binding)) {
8
9
  process.exit(0);
package/src/addon.def ADDED
@@ -0,0 +1,3 @@
1
+ EXPORTS
2
+ node_api_module_get_api_version_v1
3
+ napi_register_module_v1
package/src/addon.symbols CHANGED
@@ -1 +1,2 @@
1
- # No exported symbols.
1
+ _node_api_module_get_api_version_v1
2
+ _napi_register_module_v1
package/src/addon.version CHANGED
@@ -1,4 +1,8 @@
1
1
  {
2
+ global:
3
+ node_api_module_get_api_version_v1;
4
+ napi_register_module_v1;
5
+
2
6
  local:
3
7
  *;
4
8
  };
@@ -0,0 +1,13 @@
1
+ adjusted_package_json = custom_target('package.json',
2
+ input: package_json,
3
+ output: 'package.json',
4
+ command: [
5
+ python,
6
+ files('adjust-version.py'),
7
+ version,
8
+ '@INPUT@',
9
+ '@OUTPUT@',
10
+ ],
11
+ install: true,
12
+ install_dir: pkg_install_dir,
13
+ )
File without changes
@@ -0,0 +1,4 @@
1
+ from .cli import main
2
+
3
+ if __name__ == "__main__":
4
+ main()