@tasker-systems/tasker 0.1.2 → 0.1.3
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/ffi/index.d.ts +3 -3
- package/dist/ffi/index.js +36 -12
- package/dist/ffi/index.js.map +1 -1
- package/dist/index.js +36 -13
- package/dist/index.js.map +1 -1
- package/native/libtasker_ts-darwin-arm64.dylib +0 -0
- package/native/libtasker_ts-linux-x64.so +0 -0
- package/package.json +2 -1
package/dist/ffi/index.d.ts
CHANGED
|
@@ -146,9 +146,9 @@ declare class FfiLayer {
|
|
|
146
146
|
* Static method for finding the library path without creating an instance.
|
|
147
147
|
* Useful for test utilities and pre-flight checks.
|
|
148
148
|
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
149
|
+
* Resolution order:
|
|
150
|
+
* 1. TASKER_FFI_LIBRARY_PATH environment variable (explicit override)
|
|
151
|
+
* 2. Bundled native library in the package's native/ directory
|
|
152
152
|
*
|
|
153
153
|
* @param _callerDir Deprecated parameter, kept for API compatibility
|
|
154
154
|
* @returns Path to the library if found and exists, null otherwise
|
package/dist/ffi/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { existsSync } from 'fs';
|
|
2
|
+
import { dirname, join } from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
2
4
|
|
|
3
5
|
var __create = Object.create;
|
|
4
6
|
var __defProp = Object.defineProperty;
|
|
@@ -517,8 +519,8 @@ var require_koffi19 = __commonJS2({
|
|
|
517
519
|
data = data.subarray(0, header.size);
|
|
518
520
|
if (header.type == "0" || header.type == "7") {
|
|
519
521
|
let filename3 = dest_dir + "/" + header.filename;
|
|
520
|
-
let
|
|
521
|
-
fs2.mkdirSync(
|
|
522
|
+
let dirname2 = path2.dirname(filename3);
|
|
523
|
+
fs2.mkdirSync(dirname2, { recursive: true, mode: 493 });
|
|
522
524
|
fs2.writeFileSync(filename3, data, { mode: header.mode });
|
|
523
525
|
} else if (header.type == "5") {
|
|
524
526
|
let filename3 = dest_dir + "/" + header.filename;
|
|
@@ -1829,7 +1831,10 @@ var FfiLayer = class _FfiLayer {
|
|
|
1829
1831
|
const path2 = customPath ?? this.configuredLibraryPath ?? this.discoverLibraryPath();
|
|
1830
1832
|
if (!path2) {
|
|
1831
1833
|
throw new Error(
|
|
1832
|
-
|
|
1834
|
+
`FFI library not found. No bundled native library matches this platform, and TASKER_FFI_LIBRARY_PATH is not set.
|
|
1835
|
+
Current platform: ${process.platform}-${process.arch}
|
|
1836
|
+
Supported: linux-x64, linux-arm64, darwin-arm64
|
|
1837
|
+
Override: export TASKER_FFI_LIBRARY_PATH=/path/to/libtasker_ts.dylib`
|
|
1833
1838
|
);
|
|
1834
1839
|
}
|
|
1835
1840
|
this.runtime = await this.createRuntime();
|
|
@@ -1883,23 +1888,27 @@ var FfiLayer = class _FfiLayer {
|
|
|
1883
1888
|
* Static method for finding the library path without creating an instance.
|
|
1884
1889
|
* Useful for test utilities and pre-flight checks.
|
|
1885
1890
|
*
|
|
1886
|
-
*
|
|
1887
|
-
*
|
|
1888
|
-
*
|
|
1891
|
+
* Resolution order:
|
|
1892
|
+
* 1. TASKER_FFI_LIBRARY_PATH environment variable (explicit override)
|
|
1893
|
+
* 2. Bundled native library in the package's native/ directory
|
|
1889
1894
|
*
|
|
1890
1895
|
* @param _callerDir Deprecated parameter, kept for API compatibility
|
|
1891
1896
|
* @returns Path to the library if found and exists, null otherwise
|
|
1892
1897
|
*/
|
|
1893
1898
|
static findLibraryPath(_callerDir) {
|
|
1894
1899
|
const envPath = process.env.TASKER_FFI_LIBRARY_PATH;
|
|
1895
|
-
if (
|
|
1896
|
-
|
|
1900
|
+
if (envPath) {
|
|
1901
|
+
if (!existsSync(envPath)) {
|
|
1902
|
+
console.warn(`TASKER_FFI_LIBRARY_PATH is set to "${envPath}" but the file does not exist`);
|
|
1903
|
+
return null;
|
|
1904
|
+
}
|
|
1905
|
+
return envPath;
|
|
1897
1906
|
}
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
return
|
|
1907
|
+
const bundledPath = findBundledNativeLibrary();
|
|
1908
|
+
if (bundledPath && existsSync(bundledPath)) {
|
|
1909
|
+
return bundledPath;
|
|
1901
1910
|
}
|
|
1902
|
-
return
|
|
1911
|
+
return null;
|
|
1903
1912
|
}
|
|
1904
1913
|
/**
|
|
1905
1914
|
* Discover the FFI library path.
|
|
@@ -1935,6 +1944,21 @@ var FfiLayer = class _FfiLayer {
|
|
|
1935
1944
|
}
|
|
1936
1945
|
}
|
|
1937
1946
|
};
|
|
1947
|
+
var BUNDLED_LIBRARIES = {
|
|
1948
|
+
"linux-x64": "libtasker_ts-linux-x64.so",
|
|
1949
|
+
"linux-arm64": "libtasker_ts-linux-arm64.so",
|
|
1950
|
+
"darwin-arm64": "libtasker_ts-darwin-arm64.dylib"
|
|
1951
|
+
};
|
|
1952
|
+
function findBundledNativeLibrary() {
|
|
1953
|
+
const key = `${process.platform}-${process.arch}`;
|
|
1954
|
+
const filename2 = BUNDLED_LIBRARIES[key];
|
|
1955
|
+
if (!filename2) {
|
|
1956
|
+
return null;
|
|
1957
|
+
}
|
|
1958
|
+
const thisDir = dirname(fileURLToPath(import.meta.url));
|
|
1959
|
+
const packageRoot = join(thisDir, "..", "..");
|
|
1960
|
+
return join(packageRoot, "native", filename2);
|
|
1961
|
+
}
|
|
1938
1962
|
|
|
1939
1963
|
// src/ffi/index.ts
|
|
1940
1964
|
init_node_runtime();
|