@posthog/core 1.5.0 → 1.5.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.
@@ -3,6 +3,6 @@ export declare function spawnLocal(binaryName: string, args: string[], options:
3
3
  stdio: 'inherit' | 'ignore';
4
4
  resolveFrom: string;
5
5
  cwd: string;
6
- onBinaryFound: (binaryLocation: string) => void;
6
+ onBinaryFound?: (binaryLocation: string) => void;
7
7
  }): Promise<void>;
8
8
  //# sourceMappingURL=spawn-local.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"spawn-local.d.ts","sourceRoot":"","sources":["../../src/process/spawn-local.ts"],"names":[],"mappings":"AAGA,wBAAsB,UAAU,CAC9B,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE;IACP,GAAG,EAAE,MAAM,CAAC,UAAU,CAAA;IACtB,KAAK,EAAE,SAAS,GAAG,QAAQ,CAAA;IAE3B,WAAW,EAAE,MAAM,CAAA;IACnB,GAAG,EAAE,MAAM,CAAA;IACX,aAAa,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAA;CAChD,GACA,OAAO,CAAC,IAAI,CAAC,CAgCf"}
1
+ {"version":3,"file":"spawn-local.d.ts","sourceRoot":"","sources":["../../src/process/spawn-local.ts"],"names":[],"mappings":"AAGA,wBAAsB,UAAU,CAC9B,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE;IACP,GAAG,EAAE,MAAM,CAAC,UAAU,CAAA;IACtB,KAAK,EAAE,SAAS,GAAG,QAAQ,CAAA;IAE3B,WAAW,EAAE,MAAM,CAAA;IACnB,GAAG,EAAE,MAAM,CAAA;IACX,aAAa,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAA;CACjD,GACA,OAAO,CAAC,IAAI,CAAC,CA+Bf"}
@@ -26,21 +26,20 @@ __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
27
  spawnLocal: ()=>spawnLocal
28
28
  });
29
- const external_node_child_process_namespaceObject = require("node:child_process");
29
+ const external_cross_spawn_namespaceObject = require("cross-spawn");
30
30
  const external_utils_js_namespaceObject = require("./utils.js");
31
31
  async function spawnLocal(binaryName, args, options) {
32
32
  let binaryLocation;
33
33
  try {
34
34
  binaryLocation = (0, external_utils_js_namespaceObject.resolveBinaryPath)(options.env.PATH ?? '', options.resolveFrom, binaryName);
35
- options.onBinaryFound(binaryLocation);
35
+ options.onBinaryFound?.(binaryLocation);
36
36
  } catch (e) {
37
37
  console.error(e);
38
38
  throw new Error(`Binary ${binaryName} not found. Make sure postinstall script was allowed if it installs the binary`);
39
39
  }
40
- const child = (0, external_node_child_process_namespaceObject.spawn)(binaryLocation, [
40
+ const child = (0, external_cross_spawn_namespaceObject.spawn)(binaryLocation, [
41
41
  ...args
42
42
  ], {
43
- shell: true,
44
43
  stdio: options?.stdio ?? 'inherit',
45
44
  env: options.env,
46
45
  cwd: options.cwd
@@ -1,10 +1,10 @@
1
- import { spawn } from "node:child_process";
1
+ import { spawn } from "cross-spawn";
2
2
  import { resolveBinaryPath } from "./utils.mjs";
3
3
  async function spawnLocal(binaryName, args, options) {
4
4
  let binaryLocation;
5
5
  try {
6
6
  binaryLocation = resolveBinaryPath(options.env.PATH ?? '', options.resolveFrom, binaryName);
7
- options.onBinaryFound(binaryLocation);
7
+ options.onBinaryFound?.(binaryLocation);
8
8
  } catch (e) {
9
9
  console.error(e);
10
10
  throw new Error(`Binary ${binaryName} not found. Make sure postinstall script was allowed if it installs the binary`);
@@ -12,7 +12,6 @@ async function spawnLocal(binaryName, args, options) {
12
12
  const child = spawn(binaryLocation, [
13
13
  ...args
14
14
  ], {
15
- shell: true,
16
15
  stdio: options?.stdio ?? 'inherit',
17
16
  env: options.env,
18
17
  cwd: options.cwd
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@posthog/core",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -49,9 +49,13 @@
49
49
  },
50
50
  "devDependencies": {
51
51
  "@rslib/core": "^0.10.5",
52
+ "@types/cross-spawn": "^6.0.6",
52
53
  "jest": "^29.7.0",
53
54
  "@posthog-tooling/tsconfig-base": "1.0.0"
54
55
  },
56
+ "dependencies": {
57
+ "cross-spawn": "^7.0.6"
58
+ },
55
59
  "scripts": {
56
60
  "clean": "rimraf dist",
57
61
  "lint": "eslint src",
@@ -1,4 +1,4 @@
1
- import { spawn } from 'node:child_process'
1
+ import { spawn } from 'cross-spawn'
2
2
  import { resolveBinaryPath } from './utils'
3
3
 
4
4
  export async function spawnLocal(
@@ -10,13 +10,13 @@ export async function spawnLocal(
10
10
  // We start traversing the file system tree from this directory and we go up until we find the binary
11
11
  resolveFrom: string
12
12
  cwd: string
13
- onBinaryFound: (binaryLocation: string) => void
13
+ onBinaryFound?: (binaryLocation: string) => void
14
14
  }
15
15
  ): Promise<void> {
16
16
  let binaryLocation
17
17
  try {
18
18
  binaryLocation = resolveBinaryPath(options.env.PATH ?? '', options.resolveFrom, binaryName)
19
- options.onBinaryFound(binaryLocation)
19
+ options.onBinaryFound?.(binaryLocation)
20
20
  } catch (e) {
21
21
  console.error(e)
22
22
  throw new Error(
@@ -25,7 +25,6 @@ export async function spawnLocal(
25
25
  }
26
26
 
27
27
  const child = spawn(binaryLocation, [...args], {
28
- shell: true,
29
28
  stdio: options?.stdio ?? 'inherit',
30
29
  env: options.env,
31
30
  cwd: options.cwd,