@sublime-ui/desktop 0.1.0 → 0.1.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.
@@ -1,5 +1,5 @@
1
- import { resolve } from "../registry";
2
- import { NativeError, serializeError } from "../errors";
1
+ import { resolve } from "../registry.js";
2
+ import { NativeError, serializeError } from "../errors.js";
3
3
  function installNativeRouter(ipcMain) {
4
4
  ipcMain.handle(
5
5
  "native:invoke",
package/dist/client.js CHANGED
@@ -1,11 +1,11 @@
1
- import { defineNative } from "./define-native";
1
+ import { defineNative } from "./define-native.js";
2
2
  import {
3
3
  NativeError,
4
4
  serializeError,
5
5
  deserializeError
6
- } from "./errors";
7
- import { useNative } from "./use-native";
8
- import { createProxy } from "./bridge/proxy";
6
+ } from "./errors.js";
7
+ import { useNative } from "./use-native.js";
8
+ import { createProxy } from "./bridge/proxy.js";
9
9
  export {
10
10
  NativeError,
11
11
  createProxy,
package/dist/index.js CHANGED
@@ -1,31 +1,31 @@
1
- import { defineNative } from "./define-native";
2
- import { registerNative } from "./registry";
1
+ import { defineNative } from "./define-native.js";
2
+ import { registerNative } from "./registry.js";
3
3
  import {
4
4
  NativeError,
5
5
  serializeError,
6
6
  deserializeError
7
- } from "./errors";
8
- import { useNative } from "./use-native";
9
- import { createProxy } from "./bridge/proxy";
7
+ } from "./errors.js";
8
+ import { useNative } from "./use-native.js";
9
+ import { createProxy } from "./bridge/proxy.js";
10
10
  import {
11
11
  installNativeRouter
12
- } from "./bridge/main-router";
12
+ } from "./bridge/main-router.js";
13
13
  import {
14
14
  exposeNativeBridge
15
- } from "./bridge/preload";
15
+ } from "./bridge/preload.js";
16
16
  import {
17
17
  createWindow
18
- } from "./shell/create-window";
18
+ } from "./shell/create-window.js";
19
19
  import {
20
20
  startDesktop
21
- } from "./shell/main";
21
+ } from "./shell/main.js";
22
22
  import {
23
23
  fs,
24
24
  dialog,
25
25
  shell,
26
26
  clipboard,
27
27
  notifications
28
- } from "./services/index";
28
+ } from "./services/index.js";
29
29
  export {
30
30
  NativeError,
31
31
  clipboard,
@@ -1,5 +1,5 @@
1
- import { defineNative } from "../define-native";
2
- import { getElectron } from "./get-electron";
1
+ import { defineNative } from "../define-native.js";
2
+ import { getElectron } from "./get-electron.js";
3
3
  const clipboard = defineNative("clipboard", {
4
4
  readText: async () => {
5
5
  const { clipboard: c } = await getElectron();
@@ -1,5 +1,5 @@
1
- import { defineNative } from "../define-native";
2
- import { getElectron } from "./get-electron";
1
+ import { defineNative } from "../define-native.js";
2
+ import { getElectron } from "./get-electron.js";
3
3
  const dialog = defineNative("dialog", {
4
4
  openFile: async () => {
5
5
  const { dialog: d } = await getElectron();
@@ -1,5 +1,5 @@
1
1
  import { readFile, writeFile, readdir, mkdir as mkdirFs, rm, access } from "node:fs/promises";
2
- import { defineNative } from "../define-native";
2
+ import { defineNative } from "../define-native.js";
3
3
  const fs = defineNative("fs", {
4
4
  readFile: (path) => readFile(path, "utf8"),
5
5
  writeFile: async (path, data) => {
@@ -1,8 +1,8 @@
1
- import { fs } from "./fs";
2
- import { dialog } from "./dialog";
3
- import { shell } from "./shell";
4
- import { clipboard } from "./clipboard";
5
- import { notifications } from "./notifications";
1
+ import { fs } from "./fs.js";
2
+ import { dialog } from "./dialog.js";
3
+ import { shell } from "./shell.js";
4
+ import { clipboard } from "./clipboard.js";
5
+ import { notifications } from "./notifications.js";
6
6
  export {
7
7
  clipboard,
8
8
  dialog,
@@ -1,5 +1,5 @@
1
- import { defineNative } from "../define-native";
2
- import { getElectron } from "./get-electron";
1
+ import { defineNative } from "../define-native.js";
2
+ import { getElectron } from "./get-electron.js";
3
3
  const notifications = defineNative("notifications", {
4
4
  notify: async ({ title, body }) => {
5
5
  const { Notification } = await getElectron();
@@ -1,5 +1,5 @@
1
- import { defineNative } from "../define-native";
2
- import { getElectron } from "./get-electron";
1
+ import { defineNative } from "../define-native.js";
2
+ import { getElectron } from "./get-electron.js";
3
3
  const shell = defineNative("shell", {
4
4
  openExternal: async (url) => {
5
5
  const { shell: s } = await getElectron();
@@ -1,5 +1,5 @@
1
- import { createWindow } from "./create-window";
2
- import { installNativeRouter } from "../bridge/main-router";
1
+ import { createWindow } from "./create-window.js";
2
+ import { installNativeRouter } from "../bridge/main-router.js";
3
3
  function startDesktop(opts) {
4
4
  const onError = opts.onError ?? ((error) => {
5
5
  console.error("[sublime/desktop] startDesktop failed:", error);
@@ -1,5 +1,5 @@
1
- import { createProxy } from "./bridge/proxy";
2
- import { deserializeError } from "./errors";
1
+ import { createProxy } from "./bridge/proxy.js";
2
+ import { deserializeError } from "./errors.js";
3
3
  function isNativeErrorEnvelope(value) {
4
4
  return typeof value === "object" && value !== null && "__nativeError" in value;
5
5
  }
package/package.json CHANGED
@@ -1,35 +1,69 @@
1
- {
2
- "name": "@sublime-ui/desktop",
3
- "version": "0.1.0",
4
- "description": "Electron desktop packaging and a secure native bridge (defineNative/useNative over one IPC channel) for Sublime UI apps.",
5
- "keywords": ["sublime-ui", "electron", "desktop", "ipc", "native-bridge", "electron-forge", "cross-platform", "typescript"],
6
- "homepage": "https://sublime-ui.github.io/sublime-ui/",
7
- "bugs": "https://github.com/sublime-ui/sublime-ui/issues",
8
- "repository": { "type": "git", "url": "git+https://github.com/sublime-ui/sublime-ui.git", "directory": "desktop" },
9
- "license": "MIT",
10
- "author": "Aaron Mkandawire",
11
- "publishConfig": { "access": "public" },
12
- "type": "module",
13
- "sideEffects": false,
14
- "exports": {
15
- ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" },
16
- "./client": { "types": "./dist/client.d.ts", "import": "./dist/client.js" }
17
- },
18
- "files": ["dist", "src"],
19
- "scripts": {
20
- "build": "tsup",
21
- "typecheck": "tsc --noEmit",
22
- "test": "vitest run --passWithNoTests",
23
- "lint": "eslint src"
24
- },
25
- "peerDependencies": { "electron": ">=30", "react": ">=18" },
26
- "peerDependenciesMeta": { "electron": { "optional": true }, "react": { "optional": true } },
27
- "devDependencies": {
28
- "@types/node": "^22",
29
- "@types/react": "^18.3.12",
30
- "electron": "^33.0.0",
31
- "react": "^18.3.1",
32
- "@testing-library/react": "^16.0.1",
33
- "jsdom": "^25.0.1"
34
- }
35
- }
1
+ {
2
+ "name": "@sublime-ui/desktop",
3
+ "version": "0.1.2",
4
+ "description": "Electron desktop packaging and a secure native bridge (defineNative/useNative over one IPC channel) for Sublime UI apps.",
5
+ "keywords": [
6
+ "sublime-ui",
7
+ "electron",
8
+ "desktop",
9
+ "ipc",
10
+ "native-bridge",
11
+ "electron-forge",
12
+ "cross-platform",
13
+ "typescript"
14
+ ],
15
+ "homepage": "https://sublime-ui.github.io/sublime-ui/",
16
+ "bugs": "https://github.com/sublime-ui/sublime-ui/issues",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/sublime-ui/sublime-ui.git",
20
+ "directory": "desktop"
21
+ },
22
+ "license": "MIT",
23
+ "author": "Aaron Mkandawire",
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
27
+ "type": "module",
28
+ "sideEffects": false,
29
+ "exports": {
30
+ ".": {
31
+ "types": "./dist/index.d.ts",
32
+ "import": "./dist/index.js"
33
+ },
34
+ "./client": {
35
+ "types": "./dist/client.d.ts",
36
+ "import": "./dist/client.js"
37
+ }
38
+ },
39
+ "files": [
40
+ "dist",
41
+ "src"
42
+ ],
43
+ "scripts": {
44
+ "build": "tsup",
45
+ "typecheck": "tsc --noEmit",
46
+ "test": "vitest run --passWithNoTests",
47
+ "lint": "eslint src"
48
+ },
49
+ "peerDependencies": {
50
+ "electron": ">=30",
51
+ "react": ">=18"
52
+ },
53
+ "peerDependenciesMeta": {
54
+ "electron": {
55
+ "optional": true
56
+ },
57
+ "react": {
58
+ "optional": true
59
+ }
60
+ },
61
+ "devDependencies": {
62
+ "@types/node": "^22",
63
+ "@types/react": "^18.3.12",
64
+ "electron": "^33.0.0",
65
+ "react": "^18.3.1",
66
+ "@testing-library/react": "^16.0.1",
67
+ "jsdom": "^25.0.1"
68
+ }
69
+ }
@@ -10,8 +10,8 @@
10
10
  * promise — gives the proxy a single, structured-clone-safe shape to detect.
11
11
  */
12
12
 
13
- import { resolve } from '../registry';
14
- import { NativeError, serializeError, type SerializedError } from '../errors';
13
+ import { resolve } from '../registry.js';
14
+ import { NativeError, serializeError, type SerializedError } from '../errors.js';
15
15
 
16
16
  /** Envelope returned over IPC when a native call fails. */
17
17
  export interface NativeErrorEnvelope {
@@ -1,4 +1,4 @@
1
- import type { NativeMethods } from '../types';
1
+ import type { NativeMethods } from '../types.js';
2
2
 
3
3
  /**
4
4
  * Build the renderer-side typed proxy for a native service.
package/src/client.ts CHANGED
@@ -17,8 +17,8 @@
17
17
  */
18
18
 
19
19
  // Authoring + contract types (pure — no node/electron).
20
- export { defineNative } from './define-native';
21
- export type { NativeMethods, NativeService } from './types';
20
+ export { defineNative } from './define-native.js';
21
+ export type { NativeMethods, NativeService } from './types.js';
22
22
 
23
23
  // Typed error transport (pure).
24
24
  export {
@@ -26,8 +26,8 @@ export {
26
26
  serializeError,
27
27
  deserializeError,
28
28
  type SerializedError,
29
- } from './errors';
29
+ } from './errors.js';
30
30
 
31
31
  // Renderer hook + proxy (pure — forward over the single IPC channel only).
32
- export { useNative } from './use-native';
33
- export { createProxy } from './bridge/proxy';
32
+ export { useNative } from './use-native.js';
33
+ export { createProxy } from './bridge/proxy.js';
@@ -1,4 +1,4 @@
1
- import type { NativeMethods, NativeService } from './types';
1
+ import type { NativeMethods, NativeService } from './types.js';
2
2
 
3
3
  /**
4
4
  * Author a native service from the main process.
package/src/index.ts CHANGED
@@ -15,9 +15,9 @@
15
15
  */
16
16
 
17
17
  // Core authoring + contract types.
18
- export { defineNative } from './define-native';
19
- export { registerNative } from './registry';
20
- export type { NativeMethods, NativeService } from './types';
18
+ export { defineNative } from './define-native.js';
19
+ export { registerNative } from './registry.js';
20
+ export type { NativeMethods, NativeService } from './types.js';
21
21
 
22
22
  // Typed error transport.
23
23
  export {
@@ -25,24 +25,24 @@ export {
25
25
  serializeError,
26
26
  deserializeError,
27
27
  type SerializedError,
28
- } from './errors';
28
+ } from './errors.js';
29
29
 
30
30
  // Renderer hook + proxy.
31
- export { useNative } from './use-native';
32
- export { createProxy } from './bridge/proxy';
31
+ export { useNative } from './use-native.js';
32
+ export { createProxy } from './bridge/proxy.js';
33
33
 
34
34
  // Main-process router + preload bridge.
35
35
  export {
36
36
  installNativeRouter,
37
37
  type IpcMainLike,
38
38
  type NativeErrorEnvelope,
39
- } from './bridge/main-router';
39
+ } from './bridge/main-router.js';
40
40
  export {
41
41
  exposeNativeBridge,
42
42
  type ContextBridgeLike,
43
43
  type IpcRendererLike,
44
44
  type SublimeNativeBridge,
45
- } from './bridge/preload';
45
+ } from './bridge/preload.js';
46
46
 
47
47
  // Hardened Electron shell.
48
48
  export {
@@ -50,12 +50,12 @@ export {
50
50
  type BrowserWindowLike,
51
51
  type BrowserWindowCtor,
52
52
  type CreateWindowOptions,
53
- } from './shell/create-window';
53
+ } from './shell/create-window.js';
54
54
  export {
55
55
  startDesktop,
56
56
  type AppLike,
57
57
  type StartDesktopOptions,
58
- } from './shell/main';
58
+ } from './shell/main.js';
59
59
 
60
60
  // Built-in services.
61
61
  export {
@@ -65,4 +65,4 @@ export {
65
65
  clipboard,
66
66
  notifications,
67
67
  type NotifyOptions,
68
- } from './services/index';
68
+ } from './services/index.js';
package/src/registry.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  * which the router treats as an unknown-method rejection.
8
8
  */
9
9
 
10
- import type { NativeMethods, NativeService } from './types';
10
+ import type { NativeMethods, NativeService } from './types.js';
11
11
 
12
12
  const services = new Map<string, NativeService>();
13
13
 
@@ -1,5 +1,5 @@
1
- import { defineNative } from '../define-native';
2
- import { getElectron } from './get-electron';
1
+ import { defineNative } from '../define-native.js';
2
+ import { getElectron } from './get-electron.js';
3
3
 
4
4
  /**
5
5
  * Built-in `clipboard` native service.
@@ -1,6 +1,6 @@
1
1
  import type { MessageBoxOptions } from 'electron';
2
- import { defineNative } from '../define-native';
3
- import { getElectron } from './get-electron';
2
+ import { defineNative } from '../define-native.js';
3
+ import { getElectron } from './get-electron.js';
4
4
 
5
5
  /**
6
6
  * Built-in `dialog` native service.
@@ -1,5 +1,5 @@
1
1
  import { readFile, writeFile, readdir, mkdir as mkdirFs, rm, access } from 'node:fs/promises';
2
- import { defineNative } from '../define-native';
2
+ import { defineNative } from '../define-native.js';
3
3
 
4
4
  /**
5
5
  * Built-in `fs` native service.
@@ -6,8 +6,8 @@
6
6
  * `registerNative([...])`, then consume them in the renderer with `useNative`.
7
7
  */
8
8
 
9
- export { fs } from './fs';
10
- export { dialog } from './dialog';
11
- export { shell } from './shell';
12
- export { clipboard } from './clipboard';
13
- export { notifications, type NotifyOptions } from './notifications';
9
+ export { fs } from './fs.js';
10
+ export { dialog } from './dialog.js';
11
+ export { shell } from './shell.js';
12
+ export { clipboard } from './clipboard.js';
13
+ export { notifications, type NotifyOptions } from './notifications.js';
@@ -1,5 +1,5 @@
1
- import { defineNative } from '../define-native';
2
- import { getElectron } from './get-electron';
1
+ import { defineNative } from '../define-native.js';
2
+ import { getElectron } from './get-electron.js';
3
3
 
4
4
  /** Options for {@link notifications}'s `notify` method. */
5
5
  export interface NotifyOptions {
@@ -1,5 +1,5 @@
1
- import { defineNative } from '../define-native';
2
- import { getElectron } from './get-electron';
1
+ import { defineNative } from '../define-native.js';
2
+ import { getElectron } from './get-electron.js';
3
3
 
4
4
  /**
5
5
  * Built-in `shell` native service.
package/src/shell/main.ts CHANGED
@@ -11,8 +11,8 @@
11
11
  * derives from the `entry` shape.
12
12
  */
13
13
 
14
- import { createWindow, type BrowserWindowCtor } from './create-window';
15
- import { installNativeRouter, type IpcMainLike } from '../bridge/main-router';
14
+ import { createWindow, type BrowserWindowCtor } from './create-window.js';
15
+ import { installNativeRouter, type IpcMainLike } from '../bridge/main-router.js';
16
16
 
17
17
  /** Minimal Electron `app` surface needed to bootstrap. Injectable. */
18
18
  export interface AppLike {
package/src/use-native.ts CHANGED
@@ -10,10 +10,10 @@
10
10
  * {@link NativeError} so the caller sees a normal rejected promise.
11
11
  */
12
12
 
13
- import { createProxy } from './bridge/proxy';
14
- import { deserializeError } from './errors';
15
- import type { SerializedError } from './errors';
16
- import type { NativeMethods } from './types';
13
+ import { createProxy } from './bridge/proxy.js';
14
+ import { deserializeError } from './errors.js';
15
+ import type { SerializedError } from './errors.js';
16
+ import type { NativeMethods } from './types.js';
17
17
 
18
18
  /** Shape of the bridge exposed at `window.sublimeNative` by the preload. */
19
19
  interface SublimeNativeWindow {