mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-08 08:39:59 +00:00
Fix pkg build
This commit is contained in:
@@ -35,7 +35,7 @@ const argv = await yargs()
|
|||||||
})
|
})
|
||||||
.option("node-version", {
|
.option("node-version", {
|
||||||
describe: "Node.js version to target",
|
describe: "Node.js version to target",
|
||||||
default: "16"
|
default: "22"
|
||||||
})
|
})
|
||||||
.conflicts("use-pkg", "package")
|
.conflicts("use-pkg", "package")
|
||||||
.parse(process.argv);
|
.parse(process.argv);
|
||||||
@@ -111,7 +111,7 @@ async function build() {
|
|||||||
* Workaround for pkg asset detection
|
* Workaround for pkg asset detection
|
||||||
* https://github.com/thibauts/node-castv2/issues/46
|
* https://github.com/thibauts/node-castv2/issues/46
|
||||||
*/
|
*/
|
||||||
assets: "../../node_modules/castv2/lib/cast_channel.proto"
|
assets: "../../../node_modules/castv2/lib/cast_channel.proto"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { EventEmitter } from "events";
|
import { EventEmitter } from "events";
|
||||||
import { DnsSdBrowser } from "../../../dns_sd";
|
import { DnsSdBrowser } from "../../../dns_sd/index";
|
||||||
import type { ReceiverDevice } from "../../messagingTypes";
|
import type { ReceiverDevice } from "../../messagingTypes";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,20 @@
|
|||||||
|
import path from "path";
|
||||||
import { EventEmitter } from "events";
|
import { EventEmitter } from "events";
|
||||||
|
|
||||||
const native = require("bindings")("dns_sd");
|
let native: any;
|
||||||
|
if ((process as any).pkg) {
|
||||||
|
// Seems to be some breaking change with the way bindings paths are resolved
|
||||||
|
// in @yao-pkg/pkg, so use `process.dlopen` directly when running in a pkg
|
||||||
|
// bundle.
|
||||||
|
native = { exports: {} } as any;
|
||||||
|
process.dlopen(
|
||||||
|
native,
|
||||||
|
path.join(path.dirname(process.execPath), "dns_sd.node")
|
||||||
|
);
|
||||||
|
native = native.exports;
|
||||||
|
} else {
|
||||||
|
native = require("bindings")("dns_sd");
|
||||||
|
}
|
||||||
|
|
||||||
export interface Service {
|
export interface Service {
|
||||||
/** Service instance name */
|
/** Service instance name */
|
||||||
|
|||||||
Reference in New Issue
Block a user