@atom-js-org/electron 0.2.0-alpha.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/LICENSE +31 -0
- package/README.md +18 -0
- package/index.cjs +85 -0
- package/index.d.ts +6 -0
- package/index.mjs +49 -0
- package/package.json +62 -0
- package/renderer.cjs +11 -0
- package/renderer.d.ts +5 -0
- package/renderer.mjs +9 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
AtomJS Attribution License 1.0
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AtomJS contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to use,
|
|
7
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
8
|
+
Software, and to permit persons to whom the Software is furnished to do so,
|
|
9
|
+
subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
1. Framework redistributions, forks, and modified framework distributions must
|
|
12
|
+
retain this license, the NOTICE file, and a reasonably visible attribution
|
|
13
|
+
that includes both the name "AtomJS" and the project link:
|
|
14
|
+
https://github.com/Atom-js-org/atom
|
|
15
|
+
|
|
16
|
+
2. The attribution requirement applies to distributions of the AtomJS
|
|
17
|
+
framework itself or a derivative framework. It does not require applications
|
|
18
|
+
created with AtomJS to display AtomJS branding, notices, splash screens, or
|
|
19
|
+
user-interface credit.
|
|
20
|
+
|
|
21
|
+
3. The names and logos of AtomJS may not be used to imply endorsement of a
|
|
22
|
+
modified distribution without prior permission. Forks may accurately state
|
|
23
|
+
that they are based on AtomJS.
|
|
24
|
+
|
|
25
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
26
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
27
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
28
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
29
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
30
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# @atom-js-org/electron
|
|
2
|
+
|
|
3
|
+
Electron-compatible imports for AtomJS. This package does **not** contain the Electron runtime and does not bundle Chromium.
|
|
4
|
+
|
|
5
|
+
Install it under the local package name `electron`:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install electron@npm:@atom-js-org/electron@alpha
|
|
9
|
+
npm install --save-dev @atom-js-org/cli@alpha
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Existing code can continue to use:
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
const { app, BrowserWindow } = require('electron');
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Project: https://github.com/Atom-js-org/atom
|
package/index.cjs
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const atom = require('@atom-js-org/runtime');
|
|
4
|
+
|
|
5
|
+
installElectronProcessMarkers();
|
|
6
|
+
|
|
7
|
+
function rendererOnlyApi(name) {
|
|
8
|
+
const fail = () => {
|
|
9
|
+
throw new Error(`${name} is a renderer-process Electron API. Use it from an AtomJS preload script.`);
|
|
10
|
+
};
|
|
11
|
+
return new Proxy({}, {
|
|
12
|
+
get(_target, property) {
|
|
13
|
+
if (property === Symbol.toStringTag) return name;
|
|
14
|
+
if (property === 'then') return undefined;
|
|
15
|
+
return fail;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function installElectronProcessMarkers() {
|
|
21
|
+
defineIfMissing(process.versions, 'atomjs', atom.app && atom.app.getVersion ? atom.app.getVersion() : '0.2.0');
|
|
22
|
+
// Presence of process.versions.electron is used by many Electron-oriented
|
|
23
|
+
// packages as a runtime capability check. This is an AtomJS compatibility
|
|
24
|
+
// version, not the version of the real Electron runtime.
|
|
25
|
+
defineIfMissing(process.versions, 'electron', '0.2.0-atomjs.0');
|
|
26
|
+
defineIfMissing(process, 'type', 'browser');
|
|
27
|
+
defineIfMissing(process, 'defaultApp', true);
|
|
28
|
+
defineIfMissing(process, 'resourcesPath', process.cwd());
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function defineIfMissing(target, key, value) {
|
|
32
|
+
if (target[key] !== undefined) return;
|
|
33
|
+
try {
|
|
34
|
+
Object.defineProperty(target, key, {
|
|
35
|
+
configurable: true,
|
|
36
|
+
enumerable: true,
|
|
37
|
+
writable: false,
|
|
38
|
+
value
|
|
39
|
+
});
|
|
40
|
+
} catch {}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
exports.app = atom.app;
|
|
44
|
+
exports.BaseWindow = atom.BaseWindow;
|
|
45
|
+
exports.BrowserWindow = atom.BrowserWindow;
|
|
46
|
+
exports.BrowserView = atom.BrowserView;
|
|
47
|
+
exports.WebContentsView = atom.WebContentsView;
|
|
48
|
+
exports.View = atom.View;
|
|
49
|
+
exports.ImageView = atom.ImageView;
|
|
50
|
+
exports.Menu = atom.Menu;
|
|
51
|
+
exports.MenuItem = atom.MenuItem;
|
|
52
|
+
exports.Tray = atom.Tray;
|
|
53
|
+
exports.Notification = atom.Notification;
|
|
54
|
+
exports.TouchBar = atom.TouchBar;
|
|
55
|
+
exports.MessageChannelMain = atom.MessageChannelMain;
|
|
56
|
+
exports.MessagePortMain = atom.MessagePortMain;
|
|
57
|
+
exports.ipcMain = atom.ipcMain;
|
|
58
|
+
exports.ipcRenderer = rendererOnlyApi('ipcRenderer');
|
|
59
|
+
exports.contextBridge = rendererOnlyApi('contextBridge');
|
|
60
|
+
exports.webFrame = rendererOnlyApi('webFrame');
|
|
61
|
+
exports.dialog = atom.dialog;
|
|
62
|
+
exports.shell = atom.shell;
|
|
63
|
+
exports.clipboard = atom.clipboard;
|
|
64
|
+
exports.nativeTheme = atom.nativeTheme;
|
|
65
|
+
exports.nativeImage = atom.nativeImage;
|
|
66
|
+
exports.session = atom.session;
|
|
67
|
+
exports.protocol = atom.protocol;
|
|
68
|
+
exports.net = atom.net;
|
|
69
|
+
exports.screen = atom.screen;
|
|
70
|
+
exports.webContents = atom.webContents;
|
|
71
|
+
exports.globalShortcut = atom.globalShortcut;
|
|
72
|
+
exports.powerSaveBlocker = atom.powerSaveBlocker;
|
|
73
|
+
exports.powerMonitor = atom.powerMonitor;
|
|
74
|
+
exports.systemPreferences = atom.systemPreferences;
|
|
75
|
+
exports.safeStorage = atom.safeStorage;
|
|
76
|
+
exports.desktopCapturer = atom.desktopCapturer;
|
|
77
|
+
exports.crashReporter = atom.crashReporter;
|
|
78
|
+
exports.autoUpdater = atom.autoUpdater;
|
|
79
|
+
exports.contentTracing = atom.contentTracing;
|
|
80
|
+
exports.netLog = atom.netLog;
|
|
81
|
+
exports.utilityProcess = atom.utilityProcess;
|
|
82
|
+
exports.pushNotifications = atom.pushNotifications;
|
|
83
|
+
exports.inAppPurchase = atom.inAppPurchase;
|
|
84
|
+
exports.parentPort = atom.parentPort;
|
|
85
|
+
exports.default = exports;
|
package/index.d.ts
ADDED
package/index.mjs
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
|
|
3
|
+
const require = createRequire(import.meta.url);
|
|
4
|
+
const electron = require('./index.cjs');
|
|
5
|
+
|
|
6
|
+
export const app = electron.app;
|
|
7
|
+
export const BaseWindow = electron.BaseWindow;
|
|
8
|
+
export const BrowserWindow = electron.BrowserWindow;
|
|
9
|
+
export const BrowserView = electron.BrowserView;
|
|
10
|
+
export const WebContentsView = electron.WebContentsView;
|
|
11
|
+
export const View = electron.View;
|
|
12
|
+
export const ImageView = electron.ImageView;
|
|
13
|
+
export const Menu = electron.Menu;
|
|
14
|
+
export const MenuItem = electron.MenuItem;
|
|
15
|
+
export const Tray = electron.Tray;
|
|
16
|
+
export const Notification = electron.Notification;
|
|
17
|
+
export const TouchBar = electron.TouchBar;
|
|
18
|
+
export const MessageChannelMain = electron.MessageChannelMain;
|
|
19
|
+
export const MessagePortMain = electron.MessagePortMain;
|
|
20
|
+
export const ipcMain = electron.ipcMain;
|
|
21
|
+
export const ipcRenderer = electron.ipcRenderer;
|
|
22
|
+
export const contextBridge = electron.contextBridge;
|
|
23
|
+
export const webFrame = electron.webFrame;
|
|
24
|
+
export const dialog = electron.dialog;
|
|
25
|
+
export const shell = electron.shell;
|
|
26
|
+
export const clipboard = electron.clipboard;
|
|
27
|
+
export const nativeTheme = electron.nativeTheme;
|
|
28
|
+
export const nativeImage = electron.nativeImage;
|
|
29
|
+
export const session = electron.session;
|
|
30
|
+
export const protocol = electron.protocol;
|
|
31
|
+
export const net = electron.net;
|
|
32
|
+
export const screen = electron.screen;
|
|
33
|
+
export const webContents = electron.webContents;
|
|
34
|
+
export const globalShortcut = electron.globalShortcut;
|
|
35
|
+
export const powerSaveBlocker = electron.powerSaveBlocker;
|
|
36
|
+
export const powerMonitor = electron.powerMonitor;
|
|
37
|
+
export const systemPreferences = electron.systemPreferences;
|
|
38
|
+
export const safeStorage = electron.safeStorage;
|
|
39
|
+
export const desktopCapturer = electron.desktopCapturer;
|
|
40
|
+
export const crashReporter = electron.crashReporter;
|
|
41
|
+
export const autoUpdater = electron.autoUpdater;
|
|
42
|
+
export const contentTracing = electron.contentTracing;
|
|
43
|
+
export const netLog = electron.netLog;
|
|
44
|
+
export const utilityProcess = electron.utilityProcess;
|
|
45
|
+
export const pushNotifications = electron.pushNotifications;
|
|
46
|
+
export const inAppPurchase = electron.inAppPurchase;
|
|
47
|
+
export const parentPort = electron.parentPort;
|
|
48
|
+
|
|
49
|
+
export default electron;
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atom-js-org/electron",
|
|
3
|
+
"version": "0.2.0-alpha.0",
|
|
4
|
+
"description": "Electron-compatible API facade powered by AtomJS without bundling Electron or a private Chromium runtime.",
|
|
5
|
+
"main": "index.cjs",
|
|
6
|
+
"module": "index.mjs",
|
|
7
|
+
"types": "index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./index.d.ts",
|
|
11
|
+
"import": "./index.mjs",
|
|
12
|
+
"require": "./index.cjs"
|
|
13
|
+
},
|
|
14
|
+
"./main": {
|
|
15
|
+
"types": "./index.d.ts",
|
|
16
|
+
"import": "./index.mjs",
|
|
17
|
+
"require": "./index.cjs"
|
|
18
|
+
},
|
|
19
|
+
"./renderer": {
|
|
20
|
+
"types": "./renderer.d.ts",
|
|
21
|
+
"import": "./renderer.mjs",
|
|
22
|
+
"require": "./renderer.cjs"
|
|
23
|
+
},
|
|
24
|
+
"./common": {
|
|
25
|
+
"types": "./index.d.ts",
|
|
26
|
+
"import": "./index.mjs",
|
|
27
|
+
"require": "./index.cjs"
|
|
28
|
+
},
|
|
29
|
+
"./package.json": "./package.json"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"index.cjs",
|
|
33
|
+
"index.mjs",
|
|
34
|
+
"index.d.ts",
|
|
35
|
+
"renderer.cjs",
|
|
36
|
+
"renderer.mjs",
|
|
37
|
+
"renderer.d.ts",
|
|
38
|
+
"README.md",
|
|
39
|
+
"LICENSE"
|
|
40
|
+
],
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=20.12"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@atom-js-org/runtime": "0.2.0-alpha.0"
|
|
46
|
+
},
|
|
47
|
+
"repository": {
|
|
48
|
+
"type": "git",
|
|
49
|
+
"url": "git+https://github.com/Atom-js-org/atom.git",
|
|
50
|
+
"directory": "packages/electron-compat"
|
|
51
|
+
},
|
|
52
|
+
"homepage": "https://github.com/Atom-js-org/atom#readme",
|
|
53
|
+
"bugs": {
|
|
54
|
+
"url": "https://github.com/Atom-js-org/atom/issues"
|
|
55
|
+
},
|
|
56
|
+
"publishConfig": {
|
|
57
|
+
"access": "public",
|
|
58
|
+
"tag": "alpha"
|
|
59
|
+
},
|
|
60
|
+
"license": "LicenseRef-AtomJS-1.0",
|
|
61
|
+
"atomjsElectronCompatibility": true
|
|
62
|
+
}
|
package/renderer.cjs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const bridge = globalThis.__ATOMJS_INTERNAL__;
|
|
4
|
+
if (!bridge) {
|
|
5
|
+
throw new Error("electron/renderer is only available inside an AtomJS WebView preload context.");
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
exports.ipcRenderer = bridge.ipcRenderer;
|
|
9
|
+
exports.contextBridge = bridge.contextBridge;
|
|
10
|
+
exports.webFrame = bridge.webFrame || {};
|
|
11
|
+
exports.default = exports;
|
package/renderer.d.ts
ADDED
package/renderer.mjs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const bridge = globalThis.__ATOMJS_INTERNAL__;
|
|
2
|
+
if (!bridge) {
|
|
3
|
+
throw new Error('electron/renderer is only available inside an AtomJS WebView preload context.');
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export const ipcRenderer = bridge.ipcRenderer;
|
|
7
|
+
export const contextBridge = bridge.contextBridge;
|
|
8
|
+
export const webFrame = bridge.webFrame || {};
|
|
9
|
+
export default { ipcRenderer, contextBridge, webFrame };
|