plasmo icon indicating copy to clipboard operation
plasmo copied to clipboard

[RFC] Officially Support Safari target

Open louisgv opened this issue 2 years ago • 11 comments

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.

louisgv avatar Sep 25 '22 07:09 louisgv

https://developer.apple.com/documentation/safariservices/safari_web_extensions/developing_a_safari_web_extension

louisgv avatar Nov 21 '22 06:11 louisgv

@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?

louisgv avatar Nov 21 '22 06:11 louisgv

really looking forward to this wonderful feature!

tyn1998 avatar Nov 23 '22 13:11 tyn1998

really looking forward to this wonderful feature! +1🤖

wangrongding avatar Nov 24 '22 07:11 wangrongding

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 avatar Dec 14 '22 06:12 process1024

@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

louisgv avatar Dec 15 '22 17:12 louisgv

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.

g-sam avatar Sep 01 '23 10:09 g-sam

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)

spookyuser avatar Feb 16 '24 10:02 spookyuser

url importurl:/xxxx still have issues for content scripts in safari target

morganwu277 avatar Apr 02 '24 08:04 morganwu277

url importurl:/xxxx still have issues for content scripts in safari target

is there any workaround available for safari?

tnagss avatar Aug 01 '24 12:08 tnagss

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.

naan avatar Aug 01 '24 12:08 naan