Lazy-load mac-screen-share C++ addon

This commit is contained in:
Fedor Indutny
2025-04-07 14:51:04 -07:00
committed by GitHub
parent 1901a6cf66
commit 5ae1417667
11 changed files with 37 additions and 413 deletions

View File

@@ -1,46 +0,0 @@
diff --git a/index.d.ts b/index.d.ts
index 8d493d5..fc522af 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -1,7 +1,7 @@
/// <reference lib="dom"/>
/// <reference types="electron"/>
/// <reference types="node"/>
-import {AllElectron, Remote, BrowserWindow, Size, Rectangle, Session, MenuItemConstructorOptions, MenuItem} from 'electron';
+import { BrowserWindow, Size, Rectangle, Session, MenuItemConstructorOptions, MenuItem} from 'electron';
import {Options as NewGithubIssueUrlOptions} from 'new-github-issue-url';
import {RequireAtLeastOne} from 'type-fest';
@@ -14,7 +14,7 @@ Access the Electron APIs in both the main and renderer process without having to
api.app.quit(); // The `app` API is usually only available in the main process.
```
*/
-export const api: AllElectron | Remote;
+export const api: never;
/**
Check for various things.
diff --git a/source/is.js b/source/is.js
index 9a7622f..9530a9c 100644
--- a/source/is.js
+++ b/source/is.js
@@ -1,5 +1,4 @@
'use strict';
-const isDev = require('electron-is-dev');
const isUsingAsar = require('./is-using-asar');
module.exports = {
@@ -9,7 +8,12 @@ module.exports = {
main: process.type === 'browser',
renderer: process.type === 'renderer',
usingAsar: isUsingAsar,
- development: isDev,
macAppStore: process.mas === true,
windowsStore: process.windowsStore === true
};
+
+Object.defineProperty(module.exports, 'isDev', {
+ get() {
+ throw new Error('Not supported in electron 15');
+ }
+});

View File

@@ -1,40 +0,0 @@
diff --git a/binding.gyp b/binding.gyp
index f3030f89e418275f10eeff4cb97269cdb248144d..330e120cab4b2c8873a31135e06136733f052340 100644
--- a/binding.gyp
+++ b/binding.gyp
@@ -1,14 +1,23 @@
{
- "targets": [
- {
- "target_name": "screencapturepermissions",
- "sources": [
- "screen-capture-permissions.m"
- ],
- "xcode_settings": {
- "MACOSX_DEPLOYMENT_TARGET": "10.14",
- "OTHER_LDFLAGS": ["-framework CoreGraphics"]
- }
- }
- ]
+ "conditions": [
+ ["OS=='mac'", {
+ "targets": [
+ {
+ "target_name": "screencapturepermissions",
+ "sources": [
+ "screen-capture-permissions.m"
+ ],
+ "xcode_settings": {
+ "MACOSX_DEPLOYMENT_TARGET": "10.14",
+ "OTHER_LDFLAGS": ["-framework CoreGraphics"]
+ }
+ }
+ ]
+ }, {
+ "targets": [{
+ "target_name": "noop",
+ "type": "none",
+ }],
+ }],
+ ],
}