-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(@lexical/devtools): Added full Safari support
- Loading branch information
Showing
36 changed files
with
1,335 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,10 @@ | |
"dev": "wxt", | ||
"dev:firefox": "wxt -b firefox", | ||
"dev:edge": "wxt -b edge", | ||
"dev:safari": "xcrun safari-web-extension-converter --macos-only --no-prompt .output/safari-mv2", | ||
"dev:safari": "npm run build:safari -- --mode development && xcodebuild -configuration Debug -scheme Lexical\\ Developer\\ Tools -project ./safari-xcode//Lexical\\ Developer\\ Tools/Lexical\\ Developer\\ Tools.xcodeproj && echo \"Open Safari, allow unsigned extensions in developer settings, enable extension in extensions manager (if needed)\"", | ||
"safari:convert": "xcrun safari-web-extension-converter --app-name 'Lexical Developer Tools' --project-location ./safari-xcode --macos-only --no-prompt --force --no-open .output/safari-mv2", | ||
"safari:archive": "node safari-xcode/versioning.mjs && xcodebuild -destination 'generic/platform=macOS' -configuration Release -scheme Lexical\\ Developer\\ Tools -project ./safari-xcode/Lexical\\ Developer\\ Tools/Lexical\\ Developer\\ Tools.xcodeproj clean build CONFIGURATION_BUILD_DIR=./dist/ && xcrun productbuild --sign=\"3rd Party Mac Developer Installer: EPAM SISTEMZ, IOOO (K36CA7QL4T\" --component=./safari-xcode/Lexical\\ Developer\\ Tools/dist/Lexical\\ Developer\\ Tools.app /Applications ./safari-xcode/Lexical\\ Developer\\ Tools/dist/Lexical\\ Developer\\ Tools.pkg", | ||
"safari:upload": "VERSION=\"$(node safari-xcode/versioning.mjs)\" && xcrun altool --upload-package ./safari-xcode/Lexical\\ Developer\\ Tools/dist/Lexical\\ Developer\\ Tools.pkg --type osx -u [email protected] --password $PASSWORD --bundle-id com.epam.lexical.developerTools --apple-id 6502753400 --bundle-version $VERSION --bundle-short-version-string $VERSION", | ||
"build": "npm-run-all build:chrome build:firefox build:edge build:safari", | ||
"build:chrome": "wxt build -b chrome", | ||
"build:firefox": "wxt build -b firefox", | ||
|
@@ -27,9 +30,9 @@ | |
"@chakra-ui/react": "^2.8.2", | ||
"@emotion/react": "^11.11.4", | ||
"@emotion/styled": "^11.11.5", | ||
"@webext-pegasus/rpc": "^0.0.4", | ||
"@webext-pegasus/store-zustand": "^0.0.4", | ||
"@webext-pegasus/transport": "^0.0.4", | ||
"@webext-pegasus/rpc": "^0.2.0", | ||
"@webext-pegasus/store-zustand": "^0.2.0", | ||
"@webext-pegasus/transport": "^0.2.0", | ||
"framer-motion": "^11.1.5", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
xcuserdata/ | ||
*.xcworkspace | ||
build/ | ||
fastlane/report.xml | ||
fastlane/Preview.html | ||
fastlane/screenshots/**/*.png | ||
fastlane/test_output | ||
Lexical\ Developer\ Tools/VersioningConfig.xcconfig |
15 changes: 15 additions & 0 deletions
15
packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Config.xcconfig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// Config.xcconfig | ||
// Lexical Developer Tools | ||
// | ||
// Created by Vladlen Fedosov on 5/21/24. | ||
// | ||
|
||
// Configuration settings file format documentation can be found at: | ||
// https://help.apple.com/xcode/#/dev745c5c974 | ||
|
||
VERSION=0.0.0 | ||
BUILD_VERSION=0 | ||
|
||
// This file is generated during npm run safari:archive | ||
#include? "VersioningConfig.xcconfig" |
13 changes: 13 additions & 0 deletions
13
...evtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools Extension/Info.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>NSExtension</key> | ||
<dict> | ||
<key>NSExtensionPointIdentifier</key> | ||
<string>com.apple.Safari.web-extension</string> | ||
<key>NSExtensionPrincipalClass</key> | ||
<string>$(PRODUCT_MODULE_NAME).SafariWebExtensionHandler</string> | ||
</dict> | ||
</dict> | ||
</plist> |
10 changes: 10 additions & 0 deletions
10
...er Tools/Lexical Developer Tools Extension/Lexical_Developer_Tools_Extension.entitlements
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>com.apple.security.app-sandbox</key> | ||
<true/> | ||
<key>com.apple.security.files.user-selected.read-only</key> | ||
<true/> | ||
</dict> | ||
</plist> |
38 changes: 38 additions & 0 deletions
38
...Lexical Developer Tools/Lexical Developer Tools Extension/SafariWebExtensionHandler.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// SafariWebExtensionHandler.swift | ||
// Lexical Developer Tools Extension | ||
// | ||
// Created by Vladlen Fedosov on 5/14/24. | ||
// | ||
|
||
import SafariServices | ||
import os.log | ||
|
||
class SafariWebExtensionHandler: NSObject, NSExtensionRequestHandling { | ||
|
||
func beginRequest(with context: NSExtensionContext) { | ||
let request = context.inputItems.first as? NSExtensionItem | ||
|
||
let profile: UUID? | ||
if #available(iOS 17.0, macOS 14.0, *) { | ||
profile = request?.userInfo?[SFExtensionProfileKey] as? UUID | ||
} else { | ||
profile = request?.userInfo?["profile"] as? UUID | ||
} | ||
|
||
let message: Any? | ||
if #available(iOS 17.0, macOS 14.0, *) { | ||
message = request?.userInfo?[SFExtensionMessageKey] | ||
} else { | ||
message = request?.userInfo?["message"] | ||
} | ||
|
||
os_log(.default, "Received message from browser.runtime.sendNativeMessage: %@ (profile: %@)", String(describing: message), profile?.uuidString ?? "none") | ||
|
||
let response = NSExtensionItem() | ||
response.userInfo = [ SFExtensionMessageKey: [ "echo": message ] ] | ||
|
||
context.completeRequest(returningItems: [ response ], completionHandler: nil) | ||
} | ||
|
||
} |
Oops, something went wrong.