@devioarts/capacitor-mdns 0.0.3 → 0.2.0
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/CHANGELOG.md +110 -0
- package/DevioartsCapacitorMdns.podspec +3 -3
- package/Package.swift +1 -1
- package/README.md +272 -101
- package/android/build.gradle +3 -9
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/devioarts/capacitor/mdns/AndroidNsdBackend.kt +145 -0
- package/android/src/main/java/com/devioarts/capacitor/mdns/MdnsOptions.kt +32 -0
- package/android/src/main/java/com/devioarts/capacitor/mdns/MdnsValidation.kt +26 -0
- package/android/src/main/java/com/devioarts/capacitor/mdns/NsdBackend.kt +59 -0
- package/android/src/main/java/com/devioarts/capacitor/mdns/mDNS.kt +496 -175
- package/android/src/main/java/com/devioarts/capacitor/mdns/mDNSPlugin.kt +85 -49
- package/dist/docs.json +313 -15
- package/dist/esm/definitions.d.ts +89 -16
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.js +22 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +8 -1
- package/dist/esm/web.js +35 -3
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +57 -4
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +57 -4
- package/dist/plugin.js.map +1 -1
- package/docs/electron.md +91 -0
- package/docs/platform-setup.md +58 -0
- package/docs/playground.md +50 -0
- package/docs/runtime-behavior.md +80 -0
- package/electron/dist/plugin-settings.js +22 -0
- package/electron/dist/plugin-settings.js.map +1 -0
- package/electron/dist/plugin.cjs.js +774 -0
- package/electron/dist/plugin.cjs.js.map +1 -0
- package/electron/global.d.ts +2 -0
- package/electron/mdns-bridge.cjs +33 -4
- package/electron/mdns.ts +628 -107
- package/electron/rollup.config.mjs +22 -0
- package/electron/src/index.ts +2 -0
- package/electron/src/plugin-settings.ts +19 -0
- package/electron/tsconfig.json +21 -0
- package/electron/types-public/index.d.ts +47 -0
- package/ios/Sources/mDNSPlugin/mDNS.swift +481 -124
- package/ios/Sources/mDNSPlugin/mDNSPlugin.swift +85 -23
- package/ios/Tests/mDNSPluginTests/BridgeTests.swift +46 -0
- package/ios/Tests/mDNSPluginTests/MDNSTests.swift +490 -0
- package/package.json +55 -20
- package/ios/Tests/mDNSPluginTests/mDNSPluginTests.swift +0 -15
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const external = ['bonjour-service', 'electron', 'node:events', 'node:net', 'node:path', 'node:url'];
|
|
2
|
+
|
|
3
|
+
export default [
|
|
4
|
+
{
|
|
5
|
+
input: 'electron/build/electron/src/index.js',
|
|
6
|
+
output: {
|
|
7
|
+
file: 'electron/dist/plugin.cjs.js',
|
|
8
|
+
format: 'cjs',
|
|
9
|
+
sourcemap: true,
|
|
10
|
+
},
|
|
11
|
+
external,
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
input: 'electron/build/electron/src/plugin-settings.js',
|
|
15
|
+
output: {
|
|
16
|
+
file: 'electron/dist/plugin-settings.js',
|
|
17
|
+
format: 'cjs',
|
|
18
|
+
sourcemap: true,
|
|
19
|
+
},
|
|
20
|
+
external,
|
|
21
|
+
},
|
|
22
|
+
];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Metadata consumed by the capacitor-electron runtime generator (`npx cap-electron sync`).
|
|
3
|
+
*
|
|
4
|
+
* Import path for the JS layer: `@devioarts/capacitor-mdns/electron/settings`.
|
|
5
|
+
*/
|
|
6
|
+
export const pluginSettings = {
|
|
7
|
+
pluginClass: 'mDNS',
|
|
8
|
+
pluginMethods: [
|
|
9
|
+
'getPluginPlatform',
|
|
10
|
+
'startBroadcast',
|
|
11
|
+
'stopBroadcast',
|
|
12
|
+
'discover',
|
|
13
|
+
'watchServices',
|
|
14
|
+
'stopWatching',
|
|
15
|
+
] as const,
|
|
16
|
+
pluginEvents: ['serviceFound', 'serviceLost', 'watchError'] as const,
|
|
17
|
+
} as const;
|
|
18
|
+
|
|
19
|
+
export type PluginSettings = typeof pluginSettings;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"allowSyntheticDefaultImports": true,
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"esModuleInterop": true,
|
|
6
|
+
"lib": ["es2020"],
|
|
7
|
+
"module": "esnext",
|
|
8
|
+
"moduleResolution": "bundler",
|
|
9
|
+
"noImplicitAny": true,
|
|
10
|
+
"noUnusedLocals": true,
|
|
11
|
+
"noUnusedParameters": true,
|
|
12
|
+
"outDir": "build",
|
|
13
|
+
"rootDir": "..",
|
|
14
|
+
"sourceMap": true,
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
"strict": true,
|
|
17
|
+
"target": "ES2017",
|
|
18
|
+
"types": ["node"]
|
|
19
|
+
},
|
|
20
|
+
"include": ["src/**/*"]
|
|
21
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type Bonjour from 'bonjour-service';
|
|
2
|
+
import { EventEmitter } from 'node:events';
|
|
3
|
+
import type {
|
|
4
|
+
MdnsBroadcastOptions,
|
|
5
|
+
MdnsBroadcastResult,
|
|
6
|
+
MdnsDiscoverOptions,
|
|
7
|
+
MdnsDiscoverResult,
|
|
8
|
+
MdnsPluginPlatformResult,
|
|
9
|
+
MdnsStopResult,
|
|
10
|
+
MdnsWatchOptions,
|
|
11
|
+
MdnsWatchResult,
|
|
12
|
+
MdnsWatchStopResult,
|
|
13
|
+
} from '../../dist/esm/definitions';
|
|
14
|
+
|
|
15
|
+
export type BonjourLike = Pick<Bonjour, 'publish' | 'find' | 'destroy'>;
|
|
16
|
+
export interface MdnsOptions {
|
|
17
|
+
publishTimeoutMs?: number;
|
|
18
|
+
stopTimeoutMs?: number;
|
|
19
|
+
/** Exact trusted renderer origins, e.g. http://localhost:5173. */
|
|
20
|
+
trustedOrigins?: string[];
|
|
21
|
+
}
|
|
22
|
+
export declare class mDNS extends EventEmitter {
|
|
23
|
+
constructor(bonjour?: BonjourLike, options?: MdnsOptions);
|
|
24
|
+
getPluginPlatform(): Promise<MdnsPluginPlatformResult>;
|
|
25
|
+
startBroadcast(options: MdnsBroadcastOptions): Promise<MdnsBroadcastResult>;
|
|
26
|
+
stopBroadcast(): Promise<MdnsStopResult>;
|
|
27
|
+
discover(options?: MdnsDiscoverOptions): Promise<MdnsDiscoverResult>;
|
|
28
|
+
watchServices(options: MdnsWatchOptions): Promise<MdnsWatchResult>;
|
|
29
|
+
stopWatching(): Promise<MdnsWatchStopResult>;
|
|
30
|
+
init(): void;
|
|
31
|
+
destroy(): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export declare const pluginSettings: {
|
|
35
|
+
readonly pluginClass: 'mDNS';
|
|
36
|
+
readonly pluginMethods: readonly [
|
|
37
|
+
'getPluginPlatform',
|
|
38
|
+
'startBroadcast',
|
|
39
|
+
'stopBroadcast',
|
|
40
|
+
'discover',
|
|
41
|
+
'watchServices',
|
|
42
|
+
'stopWatching',
|
|
43
|
+
];
|
|
44
|
+
readonly pluginEvents: readonly ['serviceFound', 'serviceLost', 'watchError'];
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export type PluginSettings = typeof pluginSettings;
|