@posthog/core 1.5.1 → 1.5.2
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.
- package/dist/process/index.d.ts +1 -0
- package/dist/process/index.d.ts.map +1 -1
- package/dist/process/index.js +15 -2
- package/dist/process/index.mjs +2 -0
- package/dist/process/spawn-local.d.ts +1 -3
- package/dist/process/spawn-local.d.ts.map +1 -1
- package/dist/process/spawn-local.js +3 -12
- package/dist/process/spawn-local.mjs +3 -12
- package/dist/process/utils.d.ts +4 -1
- package/dist/process/utils.d.ts.map +1 -1
- package/dist/process/utils.js +3 -3
- package/dist/process/utils.mjs +3 -3
- package/package.json +1 -1
- package/src/process/index.ts +1 -0
- package/src/process/spawn-local.ts +3 -18
- package/src/process/utils.ts +10 -3
package/dist/process/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/process/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/process/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA"}
|
package/dist/process/index.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
var __webpack_modules__ = {
|
|
3
3
|
"./spawn-local": function(module) {
|
|
4
4
|
module.exports = require("./spawn-local.js");
|
|
5
|
+
},
|
|
6
|
+
"./utils?198b": function(module) {
|
|
7
|
+
module.exports = require("./utils.js");
|
|
5
8
|
}
|
|
6
9
|
};
|
|
7
10
|
var __webpack_module_cache__ = {};
|
|
@@ -47,14 +50,24 @@ function __webpack_require__(moduleId) {
|
|
|
47
50
|
var __webpack_exports__ = {};
|
|
48
51
|
(()=>{
|
|
49
52
|
__webpack_require__.r(__webpack_exports__);
|
|
53
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
54
|
+
resolveBinaryPath: ()=>_utils__WEBPACK_IMPORTED_MODULE_1__.resolveBinaryPath
|
|
55
|
+
});
|
|
50
56
|
var _spawn_local__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./spawn-local");
|
|
51
57
|
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
52
|
-
for(var __WEBPACK_IMPORT_KEY__ in _spawn_local__WEBPACK_IMPORTED_MODULE_0__)if (
|
|
58
|
+
for(var __WEBPACK_IMPORT_KEY__ in _spawn_local__WEBPACK_IMPORTED_MODULE_0__)if ([
|
|
59
|
+
"resolveBinaryPath",
|
|
60
|
+
"default"
|
|
61
|
+
].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
53
62
|
return _spawn_local__WEBPACK_IMPORTED_MODULE_0__[key];
|
|
54
63
|
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
55
64
|
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
65
|
+
var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./utils?198b");
|
|
56
66
|
})();
|
|
57
|
-
|
|
67
|
+
exports.resolveBinaryPath = __webpack_exports__.resolveBinaryPath;
|
|
68
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
69
|
+
"resolveBinaryPath"
|
|
70
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
58
71
|
Object.defineProperty(exports, '__esModule', {
|
|
59
72
|
value: true
|
|
60
73
|
});
|
package/dist/process/index.mjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
export declare function spawnLocal(
|
|
1
|
+
export declare function spawnLocal(executable: string, args: string[], options: {
|
|
2
2
|
env: NodeJS.ProcessEnv;
|
|
3
3
|
stdio: 'inherit' | 'ignore';
|
|
4
|
-
resolveFrom: string;
|
|
5
4
|
cwd: string;
|
|
6
|
-
onBinaryFound?: (binaryLocation: string) => void;
|
|
7
5
|
}): Promise<void>;
|
|
8
6
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"spawn-local.d.ts","sourceRoot":"","sources":["../../src/process/spawn-local.ts"],"names":[],"mappings":"AAEA,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;IAC3B,GAAG,EAAE,MAAM,CAAA;CACZ,GACA,OAAO,CAAC,IAAI,CAAC,CAoBf"}
|
|
@@ -27,20 +27,11 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
27
27
|
spawnLocal: ()=>spawnLocal
|
|
28
28
|
});
|
|
29
29
|
const external_cross_spawn_namespaceObject = require("cross-spawn");
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
let binaryLocation;
|
|
33
|
-
try {
|
|
34
|
-
binaryLocation = (0, external_utils_js_namespaceObject.resolveBinaryPath)(options.env.PATH ?? '', options.resolveFrom, binaryName);
|
|
35
|
-
options.onBinaryFound?.(binaryLocation);
|
|
36
|
-
} catch (e) {
|
|
37
|
-
console.error(e);
|
|
38
|
-
throw new Error(`Binary ${binaryName} not found. Make sure postinstall script was allowed if it installs the binary`);
|
|
39
|
-
}
|
|
40
|
-
const child = (0, external_cross_spawn_namespaceObject.spawn)(binaryLocation, [
|
|
30
|
+
async function spawnLocal(executable, args, options) {
|
|
31
|
+
const child = (0, external_cross_spawn_namespaceObject.spawn)(executable, [
|
|
41
32
|
...args
|
|
42
33
|
], {
|
|
43
|
-
stdio: options
|
|
34
|
+
stdio: options.stdio ?? 'inherit',
|
|
44
35
|
env: options.env,
|
|
45
36
|
cwd: options.cwd
|
|
46
37
|
});
|
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
import { spawn } from "cross-spawn";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
let binaryLocation;
|
|
5
|
-
try {
|
|
6
|
-
binaryLocation = resolveBinaryPath(options.env.PATH ?? '', options.resolveFrom, binaryName);
|
|
7
|
-
options.onBinaryFound?.(binaryLocation);
|
|
8
|
-
} catch (e) {
|
|
9
|
-
console.error(e);
|
|
10
|
-
throw new Error(`Binary ${binaryName} not found. Make sure postinstall script was allowed if it installs the binary`);
|
|
11
|
-
}
|
|
12
|
-
const child = spawn(binaryLocation, [
|
|
2
|
+
async function spawnLocal(executable, args, options) {
|
|
3
|
+
const child = spawn(executable, [
|
|
13
4
|
...args
|
|
14
5
|
], {
|
|
15
|
-
stdio: options
|
|
6
|
+
stdio: options.stdio ?? 'inherit',
|
|
16
7
|
env: options.env,
|
|
17
8
|
cwd: options.cwd
|
|
18
9
|
});
|
package/dist/process/utils.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export declare const buildLocalBinaryPaths: (cwd: string) => string[];
|
|
2
|
-
export declare function resolveBinaryPath(
|
|
2
|
+
export declare function resolveBinaryPath(binName: string, options: {
|
|
3
|
+
path: string;
|
|
4
|
+
cwd: string;
|
|
5
|
+
}): string;
|
|
3
6
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/process/utils.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,qBAAqB,GAAI,KAAK,MAAM,KAAG,MAAM,EAKzD,CAAA;AAED,wBAAgB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/process/utils.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,qBAAqB,GAAI,KAAK,MAAM,KAAG,MAAM,EAKzD,CAAA;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;IACP,IAAI,EAAE,MAAM,CAAA;IAEZ,GAAG,EAAE,MAAM,CAAA;CACZ,GACA,MAAM,CAWR"}
|
package/dist/process/utils.js
CHANGED
|
@@ -55,9 +55,9 @@ const buildLocalBinaryPaths = (cwd)=>{
|
|
|
55
55
|
const localPaths = getLocalPaths(external_node_path_default().resolve(cwd)).map((localPath)=>external_node_path_default().join(localPath, 'node_modules/.bin'));
|
|
56
56
|
return localPaths;
|
|
57
57
|
};
|
|
58
|
-
function resolveBinaryPath(
|
|
59
|
-
const envLocations =
|
|
60
|
-
const localLocations = buildLocalBinaryPaths(cwd);
|
|
58
|
+
function resolveBinaryPath(binName, options) {
|
|
59
|
+
const envLocations = options.path.split(external_node_path_default().delimiter);
|
|
60
|
+
const localLocations = buildLocalBinaryPaths(options.cwd);
|
|
61
61
|
const directories = [
|
|
62
62
|
...new Set([
|
|
63
63
|
...localLocations,
|
package/dist/process/utils.mjs
CHANGED
|
@@ -15,9 +15,9 @@ const buildLocalBinaryPaths = (cwd)=>{
|
|
|
15
15
|
const localPaths = getLocalPaths(node_path.resolve(cwd)).map((localPath)=>node_path.join(localPath, 'node_modules/.bin'));
|
|
16
16
|
return localPaths;
|
|
17
17
|
};
|
|
18
|
-
function resolveBinaryPath(
|
|
19
|
-
const envLocations =
|
|
20
|
-
const localLocations = buildLocalBinaryPaths(cwd);
|
|
18
|
+
function resolveBinaryPath(binName, options) {
|
|
19
|
+
const envLocations = options.path.split(node_path.delimiter);
|
|
20
|
+
const localLocations = buildLocalBinaryPaths(options.cwd);
|
|
21
21
|
const directories = [
|
|
22
22
|
...new Set([
|
|
23
23
|
...localLocations,
|
package/package.json
CHANGED
package/src/process/index.ts
CHANGED
|
@@ -1,31 +1,16 @@
|
|
|
1
1
|
import { spawn } from 'cross-spawn'
|
|
2
|
-
import { resolveBinaryPath } from './utils'
|
|
3
2
|
|
|
4
3
|
export async function spawnLocal(
|
|
5
|
-
|
|
4
|
+
executable: string,
|
|
6
5
|
args: string[],
|
|
7
6
|
options: {
|
|
8
7
|
env: NodeJS.ProcessEnv
|
|
9
8
|
stdio: 'inherit' | 'ignore'
|
|
10
|
-
// We start traversing the file system tree from this directory and we go up until we find the binary
|
|
11
|
-
resolveFrom: string
|
|
12
9
|
cwd: string
|
|
13
|
-
onBinaryFound?: (binaryLocation: string) => void
|
|
14
10
|
}
|
|
15
11
|
): Promise<void> {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
binaryLocation = resolveBinaryPath(options.env.PATH ?? '', options.resolveFrom, binaryName)
|
|
19
|
-
options.onBinaryFound?.(binaryLocation)
|
|
20
|
-
} catch (e) {
|
|
21
|
-
console.error(e)
|
|
22
|
-
throw new Error(
|
|
23
|
-
`Binary ${binaryName} not found. Make sure postinstall script was allowed if it installs the binary`
|
|
24
|
-
)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const child = spawn(binaryLocation, [...args], {
|
|
28
|
-
stdio: options?.stdio ?? 'inherit',
|
|
12
|
+
const child = spawn(executable, [...args], {
|
|
13
|
+
stdio: options.stdio ?? 'inherit',
|
|
29
14
|
env: options.env,
|
|
30
15
|
cwd: options.cwd,
|
|
31
16
|
})
|
package/src/process/utils.ts
CHANGED
|
@@ -27,9 +27,16 @@ export const buildLocalBinaryPaths = (cwd: string): string[] => {
|
|
|
27
27
|
return localPaths
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export function resolveBinaryPath(
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
export function resolveBinaryPath(
|
|
31
|
+
binName: string,
|
|
32
|
+
options: {
|
|
33
|
+
path: string
|
|
34
|
+
// We start traversing the file system tree from this directory and we go up until we find the binary
|
|
35
|
+
cwd: string
|
|
36
|
+
}
|
|
37
|
+
): string {
|
|
38
|
+
const envLocations = options.path.split(path.delimiter)
|
|
39
|
+
const localLocations = buildLocalBinaryPaths(options.cwd)
|
|
33
40
|
const directories = [...new Set([...localLocations, ...envLocations])]
|
|
34
41
|
for (const directory of directories) {
|
|
35
42
|
const binaryPath = path.join(directory, binName)
|