plasmo
plasmo copied to clipboard
[RFC] Officially Support Safari target
How do you envision this feature/change to look/work like?
When specifying --target=safari-mv3, it should spit out an actual XCode project suitable to be used on Safari
What is the purpose of this change/feature? Why?
Without freedom of choice there is no creativity
(OPTIONAL) Example implementations
No response
(OPTIONAL) Contact Details
No response
Verify canary release
- [X] I verified that the issue exists in
plasmo
canary release
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
- [X] I checked the current issues for duplicate problems.
https://developer.apple.com/documentation/safariservices/safari_web_extensions/developing_a_safari_web_extension
@ColdSauce according to their sample example - there's a layer of native messaging with the host browser which is interesting. Tho, for the shake of brevity, I wonder how much can we reduce from their example to have the popup
sample extension working in Safari?
really looking forward to this wonderful feature!
really looking forward to this wonderful feature! +1🤖
I have successfully converted plasmo extension to safari, change the egines config of parcel to "IE 11", build mv2 and then use safari-web-extension-converter, then it works, see this pr337
@process1024 AFAIK, the safari converter uses the old MV2 format which is largely deprecated. The latest Safari webkit version support MV3. We should head there eventually imo, but the stop-gaps solution should help extension to move to safari with the provided converter
Having gone through the Safarification process, I don't think Plasmo should include generation of the xcode project in it's build. There are various reasons developers might want control over the xcode project (e.g. altering the native app to display a different message) and it's faster if the project is already there. For an MVP all Plasmo needs to do I think is trigger a custom command after repacking in dev to compile and install the xcode project. It would probably help people to document the required xcode commands as they are poorly documented by apple.
Plasmo could perhaps take care of the one-off generation of the xcode project and modify the default output in some useful ways. Main modifications I found useful: (a) create separate xcode targets for Dev and prod and mv2 and mv3, (b) replace the bundle resources build step with a run script which copies the files from the relevant plasmo build directory, which avoids the need to manually manage resources in the xcode project.
Now if Plasmo could work out a way to update the resources in the installed app package on the fly from the dev server, that would be amazing - no need to recompile/install if the native parts haven't changed.
Another issue i just noticed is that web workers in safari don't work with plasmo, well parcel.
Parcel seems to do this thing where it throws an error to find the bundle url:
https://github.com/parcel-bundler/parcel/blob/2215d360dc531ec46c112223763404650b0a8be1/packages/runtimes/js/src/helpers/bundle-url.js#L15
Which in safari just results in webkit-masked-url://hidden/
(https://bugs.webkit.org/show_bug.cgi?id=246010)
url importurl:/xxxx
still have issues for content scripts in safari target
url import
url:/xxxx
still have issues for content scripts in safari target
is there any workaround available for safari?
url importurl:/xxxx still have issues for content scripts in safari target
is there any workaround available for safari?
I have the same problem, and I used data-text
or data-base64
for loading stylesheets and images.