extension 4.0.18 → 4.0.19
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/dist/49.cjs +17 -8
- package/dist/browsers.cjs +661 -14
- package/dist/cli.cjs +1821 -1731
- package/dist/extension/browsers/browsers-lib/banner.d.ts +2 -0
- package/dist/extension/browsers/browsers-lib/messages.d.ts +1 -0
- package/dist/extension/browsers/index.d.ts +4 -0
- package/dist/extension/browsers/run-safari/safari-launch/index.d.ts +14 -1
- package/dist/extension/browsers/run-safari/safari-packager.d.ts +30 -0
- package/package.json +4 -4
package/dist/browsers.cjs
CHANGED
|
@@ -148,7 +148,9 @@ var __webpack_modules__ = {
|
|
|
148
148
|
};
|
|
149
149
|
const updateSuffix = readUpdateSuffixOnce();
|
|
150
150
|
console.log(_messages__rspack_import_5.io());
|
|
151
|
-
console.log(_messages__rspack_import_5.e_(manifest, opts.browser, message, opts.browserVersionLine, updateSuffix || void 0
|
|
151
|
+
console.log(_messages__rspack_import_5.e_(manifest, opts.browser, message, opts.browserVersionLine, updateSuffix || void 0, {
|
|
152
|
+
profilePath: opts.profilePath
|
|
153
|
+
}));
|
|
152
154
|
console.log(_messages__rspack_import_5.io());
|
|
153
155
|
markCardPrinted(k, opts.browser, opts.outPath);
|
|
154
156
|
return true;
|
|
@@ -187,7 +189,8 @@ var __webpack_modules__ = {
|
|
|
187
189
|
console.log(_messages__rspack_import_5.io());
|
|
188
190
|
console.log(_messages__rspack_import_5.e_(manifest, opts.browser, message, browserLabel, updateSuffix || void 0, {
|
|
189
191
|
includeExtensionId: opts.includeExtensionId,
|
|
190
|
-
runLabel
|
|
192
|
+
runLabel,
|
|
193
|
+
profilePath: opts.profilePath
|
|
191
194
|
}));
|
|
192
195
|
console.log(_messages__rspack_import_5.io());
|
|
193
196
|
} else {
|
|
@@ -204,7 +207,8 @@ var __webpack_modules__ = {
|
|
|
204
207
|
console.log(_messages__rspack_import_5.io());
|
|
205
208
|
console.log(_messages__rspack_import_5.e_(manifest, opts.browser, message, browserLabel, updateSuffix || void 0, {
|
|
206
209
|
includeExtensionId: opts.includeExtensionId,
|
|
207
|
-
runLabel
|
|
210
|
+
runLabel,
|
|
211
|
+
profilePath: opts.profilePath
|
|
208
212
|
}));
|
|
209
213
|
console.log(_messages__rspack_import_5.io());
|
|
210
214
|
}
|
|
@@ -219,6 +223,10 @@ var __webpack_modules__ = {
|
|
|
219
223
|
{
|
|
220
224
|
label: 'Output',
|
|
221
225
|
value: opts.outPath
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
label: 'Profile',
|
|
229
|
+
value: opts.profilePath || ''
|
|
222
230
|
}
|
|
223
231
|
]
|
|
224
232
|
}));
|
|
@@ -613,6 +621,92 @@ var __webpack_modules__ = {
|
|
|
613
621
|
function firefoxDryRunConfig(cfg) {
|
|
614
622
|
return `${getLoggingPrefix('info')} Config: ${pintor__rspack_import_8_default().gray(cfg)}.`;
|
|
615
623
|
}
|
|
624
|
+
function safariBuildCalled() {
|
|
625
|
+
return `${getLoggingPrefix('debug')} browser build browser=safari`;
|
|
626
|
+
}
|
|
627
|
+
function prettyPlatform(platform) {
|
|
628
|
+
if ('win32' === platform) return 'Windows';
|
|
629
|
+
if ('linux' === platform) return 'Linux';
|
|
630
|
+
return platform;
|
|
631
|
+
}
|
|
632
|
+
function safariRequiresMacOS(platform) {
|
|
633
|
+
return `${getLoggingPrefix('warn')} Safari extensions can only be built on macOS.\nDetected ${pintor__rspack_import_8_default().gray(prettyPlatform(platform))}.\nTarget another browser via ${pintor__rspack_import_8_default().blue('--browser')} ${pintor__rspack_import_8_default().gray('<chrome|edge|firefox>')}, or run this command on a Mac with Xcode.`;
|
|
634
|
+
}
|
|
635
|
+
function safariPackagingSkippedNonMac(platform) {
|
|
636
|
+
return `${getLoggingPrefix('warn')} Safari packaging needs macOS with Xcode, detected ${pintor__rspack_import_8_default().gray(prettyPlatform(platform))}, so the Xcode packaging step is skipped.\nThe web-extension build in ${pintor__rspack_import_8_default().yellow('dist/safari')} is still complete and can be packaged later on a Mac with ${pintor__rspack_import_8_default().blue('extension build --browser=safari')}.`;
|
|
637
|
+
}
|
|
638
|
+
function safariXcodeRequired(developerDir) {
|
|
639
|
+
const current = developerDir ? `${pintor__rspack_import_8_default().gray('Active toolchain:')} ${pintor__rspack_import_8_default().underline(developerDir)}` : `${pintor__rspack_import_8_default().gray('No active developer directory was found.')}`;
|
|
640
|
+
return `${getLoggingPrefix('error')} Safari packaging needs the full Xcode app (not just the Command Line Tools).\n${pintor__rspack_import_8_default().red('NOT FOUND')} ${pintor__rspack_import_8_default().underline('safari-web-extension-converter')}\n${current}\n\nTo enable Safari builds:\n- Install ${pintor__rspack_import_8_default().yellow('Xcode')} from the Mac App Store, then\n- Point the toolchain at it: ${pintor__rspack_import_8_default().blue('sudo xcode-select --switch')} ${pintor__rspack_import_8_default().gray('/Applications/Xcode.app')}\n- Finish setup once: ${pintor__rspack_import_8_default().blue('xcodebuild -runFirstLaunch')}\n\nPrefer to keep building now?\nTarget another browser via ${pintor__rspack_import_8_default().blue('--browser')} ${pintor__rspack_import_8_default().gray('<chrome|edge|firefox>')}.`;
|
|
641
|
+
}
|
|
642
|
+
function safariToolchainMissing(tool) {
|
|
643
|
+
return `${getLoggingPrefix('error')} Safari packaging tool not found: ${pintor__rspack_import_8_default().underline(tool)}\nYour Xcode install looks incomplete.\nTry ${pintor__rspack_import_8_default().blue('xcodebuild -runFirstLaunch')}, or reinstall Xcode from the Mac App Store.`;
|
|
644
|
+
}
|
|
645
|
+
function safariConverting(extensionDir) {
|
|
646
|
+
return `${getLoggingPrefix('info')} Convert the web extension into a Safari app project from ${pintor__rspack_import_8_default().underline(extensionDir)}.`;
|
|
647
|
+
}
|
|
648
|
+
function safariConverted(projectDir) {
|
|
649
|
+
return `${getLoggingPrefix('success')} Generated the Safari Xcode project at ${pintor__rspack_import_8_default().underline(projectDir)}.`;
|
|
650
|
+
}
|
|
651
|
+
function safariBuilding(scheme) {
|
|
652
|
+
return `${getLoggingPrefix('info')} Build the Safari app with xcodebuild (scheme: ${pintor__rspack_import_8_default().gray(scheme)}).`;
|
|
653
|
+
}
|
|
654
|
+
function safariBuilt(appPath) {
|
|
655
|
+
return `${getLoggingPrefix('success')} Built the Safari app at ${pintor__rspack_import_8_default().underline(appPath)}.`;
|
|
656
|
+
}
|
|
657
|
+
function safariOpening(target) {
|
|
658
|
+
return `${getLoggingPrefix('info')} Open ${pintor__rspack_import_8_default().underline(target)}.`;
|
|
659
|
+
}
|
|
660
|
+
function safariToolFailed(tool, exitCode, outputTail) {
|
|
661
|
+
const code = null === exitCode ? 'no exit code' : `exit ${exitCode}`;
|
|
662
|
+
const tail = outputTail.trim().length ? `\n${pintor__rspack_import_8_default().gray('── last output ──')}\n${outputTail}` : `\n${pintor__rspack_import_8_default().gray('(no output captured)')}`;
|
|
663
|
+
return `${getLoggingPrefix('error')} Safari packaging tool ${pintor__rspack_import_8_default().underline(tool)} failed (${pintor__rspack_import_8_default().red(code)}).${tail}`;
|
|
664
|
+
}
|
|
665
|
+
function safariConverterWarnings(warnings) {
|
|
666
|
+
return `${getLoggingPrefix('warn')} safari-web-extension-converter reported ${pintor__rspack_import_8_default().yellow(String(warnings.length))} warning(s), some manifest keys/APIs may not be supported by Safari:\n` + warnings.map((line)=>` ${pintor__rspack_import_8_default().gray('•')} ${line}`).join('\n');
|
|
667
|
+
}
|
|
668
|
+
function safariDefaultBundleIdNote(bundleId) {
|
|
669
|
+
return `${getLoggingPrefix('info')} Use the generated bundle id ${pintor__rspack_import_8_default().gray(bundleId)}.\nFor an app you plan to distribute, set your own with ${pintor__rspack_import_8_default().blue('--bundle-id')} now.\nChanging it later makes Safari treat the extension as a new identity.`;
|
|
670
|
+
}
|
|
671
|
+
function safariOpenHint(appPath, appName) {
|
|
672
|
+
return `${getLoggingPrefix('info')} Launch it once to register with Safari: ${pintor__rspack_import_8_default().blue('open')} ${pintor__rspack_import_8_default().underline(`"${appPath}"`)}\nThen enable ${pintor__rspack_import_8_default().brightBlue(appName)} via Safari ▸ Develop ▸ ${pintor__rspack_import_8_default().yellow('Allow Unsigned Extensions')} and Safari ▸ Settings ▸ Extensions.`;
|
|
673
|
+
}
|
|
674
|
+
function safariDryRunNotBuilding() {
|
|
675
|
+
return `${getLoggingPrefix('info')} Dry run: skip the Safari app build.`;
|
|
676
|
+
}
|
|
677
|
+
function safariDryRunConverter(cmd) {
|
|
678
|
+
return `${getLoggingPrefix('info')} Converter: ${pintor__rspack_import_8_default().gray(cmd)}.`;
|
|
679
|
+
}
|
|
680
|
+
function safariDryRunXcodebuild(cmd) {
|
|
681
|
+
return `${getLoggingPrefix('info')} xcodebuild: ${pintor__rspack_import_8_default().gray(cmd)}.`;
|
|
682
|
+
}
|
|
683
|
+
function safariNextSteps(appName) {
|
|
684
|
+
return `${getLoggingPrefix('info')} One-time setup to load ${pintor__rspack_import_8_default().brightBlue(appName)} in Safari:\n ${pintor__rspack_import_8_default().gray('1.')} Safari ▸ Settings ▸ Advanced ▸ check ${pintor__rspack_import_8_default().yellow('“Show features for web developers”')}\n ${pintor__rspack_import_8_default().gray('2.')} Safari ▸ Develop ▸ ${pintor__rspack_import_8_default().yellow('Allow Unsigned Extensions')} ${pintor__rspack_import_8_default().gray('(resets each launch)')}\n ${pintor__rspack_import_8_default().gray('3.')} Safari ▸ Settings ▸ Extensions ▸ turn on ${pintor__rspack_import_8_default().yellow(appName)}\n ${pintor__rspack_import_8_default().gray('→')} The app window that just opened can also take you there.`;
|
|
685
|
+
}
|
|
686
|
+
function safariRegistered(appName) {
|
|
687
|
+
return `${getLoggingPrefix('success')} Safari recognizes ${pintor__rspack_import_8_default().brightBlue(appName)}, finish enabling it with the steps above.`;
|
|
688
|
+
}
|
|
689
|
+
function safariNotYetRegistered(appName) {
|
|
690
|
+
return `${getLoggingPrefix('warn')} Safari hasn't picked up ${pintor__rspack_import_8_default().brightBlue(appName)} yet.\nOpen the app once, then check Safari ▸ Settings ▸ Extensions.`;
|
|
691
|
+
}
|
|
692
|
+
function safariRebuilt(appName) {
|
|
693
|
+
return `${getLoggingPrefix('success')} Rebuilt ${pintor__rspack_import_8_default().brightBlue(appName)}, reload the page (or toggle the extension) in Safari to see changes.`;
|
|
694
|
+
}
|
|
695
|
+
function safariProjectStale() {
|
|
696
|
+
return `${getLoggingPrefix('info')} Regenerate the Xcode project, manifest.json or identity options changed since it was generated.`;
|
|
697
|
+
}
|
|
698
|
+
function safariForcedRegeneration() {
|
|
699
|
+
return `${getLoggingPrefix('info')} Regenerate the Xcode project, --force-regenerate is set.`;
|
|
700
|
+
}
|
|
701
|
+
function safariRegenerationDiscards(preservedKeys) {
|
|
702
|
+
return `${getLoggingPrefix('warn')} Regenerating replaces the Xcode project: customizations made in Xcode (entitlements, capabilities, added files/targets) are ${pintor__rspack_import_8_default().red('discarded')}.\nPreserved automatically: ${pintor__rspack_import_8_default().yellow(preservedKeys.join(', '))}.\nIf you customized the project, back it up before continuing.`;
|
|
703
|
+
}
|
|
704
|
+
function safariSettingsPreserved(keys) {
|
|
705
|
+
return `${getLoggingPrefix('info')} Preserved Xcode build settings across regeneration: ${pintor__rspack_import_8_default().yellow(keys.join(', '))}.\nIf any other project-level tweaks were lost, reconfigure them in Xcode.`;
|
|
706
|
+
}
|
|
707
|
+
function safariSkippingConversion() {
|
|
708
|
+
return `${getLoggingPrefix('info')} Skip the conversion, the Xcode project is up to date with manifest.json.`;
|
|
709
|
+
}
|
|
616
710
|
function cdpClientFoundTargets(count) {
|
|
617
711
|
return `${getLoggingPrefix('debug')} cdp targets=${count}`;
|
|
618
712
|
}
|
|
@@ -709,6 +803,10 @@ var __webpack_modules__ = {
|
|
|
709
803
|
label: 'Extension ID',
|
|
710
804
|
value: includeExtensionId ? cleanId : ''
|
|
711
805
|
},
|
|
806
|
+
{
|
|
807
|
+
label: 'Profile',
|
|
808
|
+
value: String(opts?.profilePath || '').trim()
|
|
809
|
+
},
|
|
712
810
|
{
|
|
713
811
|
label: 'Run ID',
|
|
714
812
|
value: opts?.runLabel || ''
|
|
@@ -761,12 +859,16 @@ var __webpack_modules__ = {
|
|
|
761
859
|
return `${getLoggingPrefix('error')} Received an unreadable Firefox remote debugging message.\nThe debugging connection is out of sync with the browser, usually after a crash or an abrupt reload.\nRestart the dev session.\nIf it repeats, report it with your Firefox version.`;
|
|
762
860
|
}
|
|
763
861
|
__webpack_require__.d(__webpack_exports__, {
|
|
862
|
+
$q: ()=>safariDefaultBundleIdNote,
|
|
764
863
|
$w: ()=>bestEffortBannerPrintFailed,
|
|
864
|
+
A: ()=>safariToolFailed,
|
|
765
865
|
A9: ()=>firefoxLaunchCalled,
|
|
766
866
|
AG: ()=>enhancedProcessManagementForceKill,
|
|
867
|
+
Aj: ()=>safariDryRunXcodebuild,
|
|
767
868
|
CN: ()=>unsupportedManifestVersionOnChromium,
|
|
768
869
|
CY: ()=>devChromiumDebugPort,
|
|
769
870
|
Cn: ()=>chromeProcessError,
|
|
871
|
+
Cs: ()=>safariToolchainMissing,
|
|
770
872
|
Dh: ()=>invalidGeckoBinaryPath,
|
|
771
873
|
E8: ()=>chromiumDryRunFlags,
|
|
772
874
|
EE: ()=>geckoAddonLoadRefused,
|
|
@@ -775,11 +877,14 @@ var __webpack_modules__ = {
|
|
|
775
877
|
F4: ()=>enhancedProcessManagementUncaughtException,
|
|
776
878
|
FF: ()=>cdpClientFoundTargets,
|
|
777
879
|
Fm: ()=>connectionClosedError,
|
|
880
|
+
G3: ()=>safariRequiresMacOS,
|
|
778
881
|
GB: ()=>waitingForBrowserDebugger,
|
|
779
882
|
Gq: ()=>locatingBrowser,
|
|
883
|
+
H1: ()=>safariRegenerationDiscards,
|
|
780
884
|
HH: ()=>messageWithoutSenderError,
|
|
781
885
|
Ih: ()=>browserNotInstalledError,
|
|
782
886
|
JB: ()=>devChannelSnapshotInUse,
|
|
887
|
+
KP: ()=>safariBuildCalled,
|
|
783
888
|
L: ()=>chromiumManifestLoadBlockers,
|
|
784
889
|
LD: ()=>firefoxDryRunBinary,
|
|
785
890
|
M3: ()=>cdpClientConnected,
|
|
@@ -791,45 +896,64 @@ var __webpack_modules__ = {
|
|
|
791
896
|
NO: ()=>mv3BackgroundScriptsNotSupportedByChromium,
|
|
792
897
|
Nk: ()=>chromiumDryRunNotLaunching,
|
|
793
898
|
Q0: ()=>chromiumDryRunBinary,
|
|
899
|
+
Rl: ()=>safariBuilt,
|
|
794
900
|
Sp: ()=>invalidChromiumBinaryPath,
|
|
795
901
|
TF: ()=>enhancedProcessManagementCleanupError,
|
|
796
902
|
Te: ()=>cdpClientTargetWebSocketUrlStored,
|
|
797
903
|
Th: ()=>browserInstanceExited,
|
|
904
|
+
Tq: ()=>safariForcedRegeneration,
|
|
905
|
+
UW: ()=>safariPackagingSkippedNonMac,
|
|
798
906
|
Ug: ()=>usingManagedChromiumFamilyFallback,
|
|
799
907
|
Vk: ()=>enhancedProcessManagementCleanup,
|
|
800
908
|
WV: ()=>addonInstallError,
|
|
801
909
|
XH: ()=>enhancedProcessManagementTerminating,
|
|
910
|
+
Xi: ()=>safariXcodeRequired,
|
|
802
911
|
Z5: ()=>cdpClientExtensionInfoFailed,
|
|
803
912
|
_D: ()=>browserLaunchError,
|
|
804
913
|
aI: ()=>devChromeProfilePath,
|
|
914
|
+
aO: ()=>safariOpenHint,
|
|
805
915
|
bv: ()=>cdpUnifiedExtensionLog,
|
|
806
916
|
cD: ()=>targetActorHasActiveRequestError,
|
|
917
|
+
cF: ()=>safariRebuilt,
|
|
807
918
|
dN: ()=>firefoxNoBinaryArgsFound,
|
|
808
919
|
dk: ()=>generalBrowserError,
|
|
809
920
|
dw: ()=>devFirefoxProfilePath,
|
|
810
921
|
e_: ()=>runningInDevelopment,
|
|
922
|
+
fL: ()=>safariDryRunConverter,
|
|
923
|
+
fO: ()=>safariNextSteps,
|
|
811
924
|
fR: ()=>cdpClientConnectionError,
|
|
925
|
+
fd: ()=>safariRegistered,
|
|
926
|
+
fw: ()=>safariOpening,
|
|
812
927
|
hE: ()=>cdpClientConnectionClosed,
|
|
813
928
|
iL: ()=>resolvedBrowserBinary,
|
|
814
929
|
io: ()=>emptyLine,
|
|
815
930
|
iv: ()=>firefoxBinaryArgsExtracted,
|
|
816
931
|
jP: ()=>rdpInvalidRequestPayload,
|
|
932
|
+
jR: ()=>safariBuilding,
|
|
933
|
+
jc: ()=>safariProjectStale,
|
|
817
934
|
jk: ()=>requireGeckoBinaryForGeckoBased,
|
|
818
935
|
k6: ()=>firefoxDryRunConfig,
|
|
819
936
|
kK: ()=>preferringSystemBrowserOverSnapshot,
|
|
820
937
|
l9: ()=>parsingPacketError,
|
|
938
|
+
l_: ()=>safariConverted,
|
|
821
939
|
ne: ()=>requireChromiumBinaryForChromiumBased,
|
|
822
940
|
nn: ()=>chromeProcessExited,
|
|
941
|
+
oB: ()=>safariSettingsPreserved,
|
|
942
|
+
oM: ()=>safariSkippingConversion,
|
|
823
943
|
p8: ()=>cdpClientAttachedToTarget,
|
|
824
944
|
pd: ()=>devFirefoxDebugPort,
|
|
825
945
|
qN: ()=>messagingClientClosedError,
|
|
826
946
|
qR: ()=>chromiumInvalidMatchPatterns,
|
|
947
|
+
qY: ()=>safariNotYetRegistered,
|
|
827
948
|
qn: ()=>firefoxDryRunNotLaunching,
|
|
828
949
|
sP: ()=>mv2NotSupportedByChromium,
|
|
829
950
|
sY: ()=>creatingUserProfile,
|
|
951
|
+
uK: ()=>safariConverting,
|
|
830
952
|
wk: ()=>chromeFailedToSpawn,
|
|
831
953
|
xy: ()=>chromeInitializingEnhancedReload,
|
|
832
|
-
|
|
954
|
+
y1: ()=>safariConverterWarnings,
|
|
955
|
+
y7: ()=>skippingBrowserLaunchDueToCompileErrors,
|
|
956
|
+
yc: ()=>safariDryRunNotBuilding
|
|
833
957
|
});
|
|
834
958
|
},
|
|
835
959
|
"./browsers/browsers-lib/output-binaries-resolver.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
@@ -1584,12 +1708,15 @@ var __webpack_modules__ = {
|
|
|
1584
1708
|
__webpack_require__.r(__webpack_exports__);
|
|
1585
1709
|
var _browsers_lib_browser_family__rspack_import_0 = __webpack_require__("./browsers/browsers-lib/browser-family.ts");
|
|
1586
1710
|
var _browsers_lib_output_binaries_resolver__rspack_import_1 = __webpack_require__("./browsers/browsers-lib/output-binaries-resolver.ts");
|
|
1587
|
-
var
|
|
1588
|
-
var
|
|
1711
|
+
var _browsers_lib_runtime_options__rspack_import_10 = __webpack_require__("./browsers/browsers-lib/runtime-options.ts");
|
|
1712
|
+
var _run_chromium_chromium_context__rspack_import_8 = __webpack_require__("./browsers/run-chromium/chromium-context/index.ts");
|
|
1589
1713
|
var _run_chromium_chromium_launch__rspack_import_2 = __webpack_require__("./browsers/run-chromium/chromium-launch/index.ts");
|
|
1590
|
-
var
|
|
1714
|
+
var _run_firefox_firefox_context__rspack_import_9 = __webpack_require__("./browsers/run-firefox/firefox-context/index.ts");
|
|
1591
1715
|
var _run_firefox_firefox_launch__rspack_import_3 = __webpack_require__("./browsers/run-firefox/firefox-launch/index.ts");
|
|
1592
1716
|
var _run_only__rspack_import_4 = __webpack_require__("./browsers/run-only.ts");
|
|
1717
|
+
var _run_safari_safari_launch__rspack_import_5 = __webpack_require__("./browsers/run-safari/safari-launch/index.ts");
|
|
1718
|
+
var _run_safari_safari_launch_safari_config__rspack_import_6 = __webpack_require__("./browsers/run-safari/safari-launch/safari-config.ts");
|
|
1719
|
+
var _run_safari_safari_packager__rspack_import_7 = __webpack_require__("./browsers/run-safari/safari-packager.ts");
|
|
1593
1720
|
function createCompilationLike(opts) {
|
|
1594
1721
|
return {
|
|
1595
1722
|
options: {
|
|
@@ -1638,7 +1765,7 @@ var __webpack_modules__ = {
|
|
|
1638
1765
|
logTab: opts.logTab,
|
|
1639
1766
|
logSink: opts.logSink
|
|
1640
1767
|
};
|
|
1641
|
-
const ctx = (0,
|
|
1768
|
+
const ctx = (0, _run_chromium_chromium_context__rspack_import_8.g)();
|
|
1642
1769
|
const launcher = new _run_chromium_chromium_launch__rspack_import_2.f(chromiumOpts, ctx);
|
|
1643
1770
|
const enableCdp = 'development' === mode;
|
|
1644
1771
|
await launcher.runOnce(compilationLike, {
|
|
@@ -1712,9 +1839,9 @@ var __webpack_modules__ = {
|
|
|
1712
1839
|
port: opts.port,
|
|
1713
1840
|
dryRun: opts.dryRun
|
|
1714
1841
|
};
|
|
1715
|
-
const ctx = (0,
|
|
1842
|
+
const ctx = (0, _run_firefox_firefox_context__rspack_import_9.D)();
|
|
1716
1843
|
const launcher = new _run_firefox_firefox_launch__rspack_import_3.c(firefoxOpts, ctx);
|
|
1717
|
-
const launchRequest = (0,
|
|
1844
|
+
const launchRequest = (0, _browsers_lib_runtime_options__rspack_import_10.zU)(pluginOptions, mode, {
|
|
1718
1845
|
persistProfile: opts.persistProfile,
|
|
1719
1846
|
geckoBinary: opts.geckoBinary
|
|
1720
1847
|
});
|
|
@@ -1745,8 +1872,17 @@ var __webpack_modules__ = {
|
|
|
1745
1872
|
};
|
|
1746
1873
|
}
|
|
1747
1874
|
__webpack_require__.d(__webpack_exports__, {
|
|
1875
|
+
builtAppPath: ()=>_run_safari_safari_launch_safari_config__rspack_import_6.fd,
|
|
1876
|
+
createSafariPackager: ()=>_run_safari_safari_packager__rspack_import_7.P,
|
|
1877
|
+
isValidBundleId: ()=>_run_safari_safari_launch_safari_config__rspack_import_6.OA,
|
|
1748
1878
|
launchBrowser: ()=>launchBrowser,
|
|
1749
|
-
|
|
1879
|
+
macOsSchemeName: ()=>_run_safari_safari_launch_safari_config__rspack_import_6.aD,
|
|
1880
|
+
packageSafariExtension: ()=>_run_safari_safari_launch__rspack_import_5.Ah,
|
|
1881
|
+
resolveSafariBuildConfig: ()=>_run_safari_safari_launch_safari_config__rspack_import_6.F7,
|
|
1882
|
+
runOnlyPreviewBrowser: ()=>_run_only__rspack_import_4.E,
|
|
1883
|
+
safariBuildPreflight: ()=>_run_safari_safari_launch__rspack_import_5.QW,
|
|
1884
|
+
safariPreflightError: ()=>_run_safari_safari_launch__rspack_import_5.iF,
|
|
1885
|
+
xcodeProjectPath: ()=>_run_safari_safari_launch_safari_config__rspack_import_6.Gi
|
|
1750
1886
|
});
|
|
1751
1887
|
},
|
|
1752
1888
|
"./browsers/run-chromium/cdp/discovery.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
@@ -2507,10 +2643,13 @@ var __webpack_modules__ = {
|
|
|
2507
2643
|
const loadExtensionFlag = args.chromiumConfig.find((flag)=>flag.startsWith('--load-extension='));
|
|
2508
2644
|
const extensionOutputPath = (0, extension_output_path.W)(args.compilation, loadExtensionFlag);
|
|
2509
2645
|
if (!extensionOutputPath) return;
|
|
2646
|
+
const userDataDirFlag = args.chromiumConfig.find((flag)=>flag.startsWith('--user-data-dir='));
|
|
2647
|
+
const profilePath = userDataDirFlag ? userDataDirFlag.replace('--user-data-dir=', '').replace(/^"|"$/g, '') : void 0;
|
|
2510
2648
|
if ('production' === mode) return void await (0, banner.MK)({
|
|
2511
2649
|
browser: args.browser,
|
|
2512
2650
|
outPath: extensionOutputPath,
|
|
2513
|
-
browserVersionLine: args.browserVersionLine
|
|
2651
|
+
browserVersionLine: args.browserVersionLine,
|
|
2652
|
+
profilePath
|
|
2514
2653
|
});
|
|
2515
2654
|
if ('development' !== mode) return;
|
|
2516
2655
|
const ready = await (0, manifest_readiness.fR)(extensionOutputPath, {
|
|
@@ -2523,7 +2662,8 @@ var __webpack_modules__ = {
|
|
|
2523
2662
|
outPath: extensionOutputPath,
|
|
2524
2663
|
hostPort: args.hostPort,
|
|
2525
2664
|
getInfo: async ()=>null,
|
|
2526
|
-
browserVersionLine: args.browserVersionLine
|
|
2665
|
+
browserVersionLine: args.browserVersionLine,
|
|
2666
|
+
profilePath
|
|
2527
2667
|
});
|
|
2528
2668
|
}
|
|
2529
2669
|
class ChromiumLaunchPlugin {
|
|
@@ -5017,6 +5157,495 @@ var __webpack_modules__ = {
|
|
|
5017
5157
|
E: ()=>runOnlyPreviewBrowser
|
|
5018
5158
|
});
|
|
5019
5159
|
},
|
|
5160
|
+
"./browsers/run-safari/safari-launch/index.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
5161
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
5162
|
+
Ah: ()=>packageSafariExtension,
|
|
5163
|
+
QW: ()=>safariBuildPreflight,
|
|
5164
|
+
iF: ()=>safariPreflightError
|
|
5165
|
+
});
|
|
5166
|
+
var external_node_child_process_ = __webpack_require__("node:child_process");
|
|
5167
|
+
var external_node_fs_ = __webpack_require__("node:fs");
|
|
5168
|
+
var messaging = __webpack_require__("./helpers/messaging.ts");
|
|
5169
|
+
var messages = __webpack_require__("./browsers/browsers-lib/messages.ts");
|
|
5170
|
+
function logSafariDryRun(converterCmd, xcodebuildCmd) {
|
|
5171
|
+
if ((0, messaging._o)()) console.log(messages.KP());
|
|
5172
|
+
console.log(messages.yc());
|
|
5173
|
+
console.log(messages.fL(converterCmd));
|
|
5174
|
+
console.log(messages.Aj(xcodebuildCmd));
|
|
5175
|
+
}
|
|
5176
|
+
var safari_config = __webpack_require__("./browsers/run-safari/safari-launch/safari-config.ts");
|
|
5177
|
+
function isMacOS() {
|
|
5178
|
+
return 'darwin' === process.platform;
|
|
5179
|
+
}
|
|
5180
|
+
function activeDeveloperDir() {
|
|
5181
|
+
try {
|
|
5182
|
+
const result = (0, external_node_child_process_.spawnSync)('xcode-select', [
|
|
5183
|
+
'-p'
|
|
5184
|
+
], {
|
|
5185
|
+
encoding: 'utf8',
|
|
5186
|
+
timeout: 15000
|
|
5187
|
+
});
|
|
5188
|
+
if (0 !== result.status) return null;
|
|
5189
|
+
const resolved = String(result.stdout || '').trim();
|
|
5190
|
+
return resolved.length > 0 ? resolved : null;
|
|
5191
|
+
} catch {
|
|
5192
|
+
return null;
|
|
5193
|
+
}
|
|
5194
|
+
}
|
|
5195
|
+
function findWithXcrun(tool) {
|
|
5196
|
+
try {
|
|
5197
|
+
const result = (0, external_node_child_process_.spawnSync)('xcrun', [
|
|
5198
|
+
'--find',
|
|
5199
|
+
tool
|
|
5200
|
+
], {
|
|
5201
|
+
encoding: 'utf8',
|
|
5202
|
+
timeout: 15000
|
|
5203
|
+
});
|
|
5204
|
+
if (0 !== result.status) return null;
|
|
5205
|
+
const resolved = String(result.stdout || '').trim();
|
|
5206
|
+
return resolved.length > 0 ? resolved : null;
|
|
5207
|
+
} catch {
|
|
5208
|
+
return null;
|
|
5209
|
+
}
|
|
5210
|
+
}
|
|
5211
|
+
function detectSafariToolchain() {
|
|
5212
|
+
const platformOk = isMacOS();
|
|
5213
|
+
if (!platformOk) return {
|
|
5214
|
+
platformOk: false,
|
|
5215
|
+
developerDir: null,
|
|
5216
|
+
needsFullXcode: false,
|
|
5217
|
+
converter: null,
|
|
5218
|
+
xcodebuild: null,
|
|
5219
|
+
ok: false
|
|
5220
|
+
};
|
|
5221
|
+
const developerDir = activeDeveloperDir();
|
|
5222
|
+
const needsFullXcode = !developerDir || /CommandLineTools/i.test(developerDir);
|
|
5223
|
+
const converter = findWithXcrun('safari-web-extension-converter');
|
|
5224
|
+
const xcodebuild = findWithXcrun('xcodebuild');
|
|
5225
|
+
return {
|
|
5226
|
+
platformOk,
|
|
5227
|
+
developerDir,
|
|
5228
|
+
needsFullXcode,
|
|
5229
|
+
converter,
|
|
5230
|
+
xcodebuild,
|
|
5231
|
+
ok: Boolean(converter && xcodebuild)
|
|
5232
|
+
};
|
|
5233
|
+
}
|
|
5234
|
+
function fallbackLogger() {
|
|
5235
|
+
return {
|
|
5236
|
+
info: (...a)=>console.log(...a),
|
|
5237
|
+
warn: (...a)=>console.warn(...a),
|
|
5238
|
+
error: (...a)=>console.error(...a),
|
|
5239
|
+
debug: (...a)=>console?.debug?.(...a)
|
|
5240
|
+
};
|
|
5241
|
+
}
|
|
5242
|
+
function isTestEnv() {
|
|
5243
|
+
return Boolean(process.env.VITEST || process.env.VITEST_WORKER_ID);
|
|
5244
|
+
}
|
|
5245
|
+
function delay(ms) {
|
|
5246
|
+
return new Promise((resolve)=>setTimeout(resolve, ms));
|
|
5247
|
+
}
|
|
5248
|
+
const TOOL_TAIL_LINES = 50;
|
|
5249
|
+
const TOOL_TAIL_BYTES = 8192;
|
|
5250
|
+
function toolOutputTail(output) {
|
|
5251
|
+
const lines = output.slice(4 * -TOOL_TAIL_BYTES).split(/\r?\n/).filter((line)=>line.trim().length > 0);
|
|
5252
|
+
const tail = lines.slice(-TOOL_TAIL_LINES).join('\n');
|
|
5253
|
+
return tail.length > TOOL_TAIL_BYTES ? tail.slice(-TOOL_TAIL_BYTES) : tail;
|
|
5254
|
+
}
|
|
5255
|
+
function runTool(bin, args, opts) {
|
|
5256
|
+
const streamOutput = (0, messaging._o)() && !opts?.quiet;
|
|
5257
|
+
return new Promise((resolve)=>{
|
|
5258
|
+
let output = '';
|
|
5259
|
+
const child = (0, external_node_child_process_.spawn)(bin, args, {
|
|
5260
|
+
stdio: [
|
|
5261
|
+
'ignore',
|
|
5262
|
+
'pipe',
|
|
5263
|
+
'pipe'
|
|
5264
|
+
]
|
|
5265
|
+
});
|
|
5266
|
+
const onChunk = (chunk)=>{
|
|
5267
|
+
const text = String(chunk);
|
|
5268
|
+
output += text;
|
|
5269
|
+
if (output.length > 8 * TOOL_TAIL_BYTES) output = output.slice(4 * -TOOL_TAIL_BYTES);
|
|
5270
|
+
if (streamOutput) process.stdout.write(text);
|
|
5271
|
+
};
|
|
5272
|
+
child.stdout?.on('data', onChunk);
|
|
5273
|
+
child.stderr?.on('data', onChunk);
|
|
5274
|
+
child.on('error', (error)=>resolve({
|
|
5275
|
+
ok: false,
|
|
5276
|
+
code: null,
|
|
5277
|
+
output: `${output}${String(error)}`
|
|
5278
|
+
}));
|
|
5279
|
+
child.on('close', (code)=>resolve({
|
|
5280
|
+
ok: 0 === code,
|
|
5281
|
+
code,
|
|
5282
|
+
output
|
|
5283
|
+
}));
|
|
5284
|
+
});
|
|
5285
|
+
}
|
|
5286
|
+
function converterWarnings(output) {
|
|
5287
|
+
return output.split(/\r?\n/).filter((line)=>/warning/i.test(line)).map((line)=>line.trim()).filter((line)=>line.length > 0);
|
|
5288
|
+
}
|
|
5289
|
+
async function confirmRegisteredWithSafari(bundleIdentifier) {
|
|
5290
|
+
const needle = `${bundleIdentifier}.Extension`;
|
|
5291
|
+
for(let attempt = 0; attempt < 6; attempt += 1){
|
|
5292
|
+
const { ok, output } = await runTool('pluginkit', [
|
|
5293
|
+
'-m'
|
|
5294
|
+
], {
|
|
5295
|
+
quiet: true
|
|
5296
|
+
});
|
|
5297
|
+
if (ok && output.includes(needle)) return true;
|
|
5298
|
+
await delay(800);
|
|
5299
|
+
}
|
|
5300
|
+
return false;
|
|
5301
|
+
}
|
|
5302
|
+
function describePackage(config) {
|
|
5303
|
+
return {
|
|
5304
|
+
appName: config.appName,
|
|
5305
|
+
bundleId: config.bundleIdentifier,
|
|
5306
|
+
bundleIdDerived: config.bundleIdDerived,
|
|
5307
|
+
appPath: (0, safari_config.fd)(config),
|
|
5308
|
+
xcodeProjectPath: (0, safari_config.Gi)(config),
|
|
5309
|
+
macOsOnly: config.macOsOnly
|
|
5310
|
+
};
|
|
5311
|
+
}
|
|
5312
|
+
function safariPreflightError() {
|
|
5313
|
+
const tc = detectSafariToolchain();
|
|
5314
|
+
if (!tc.platformOk) return messages.G3(process.platform);
|
|
5315
|
+
if (!tc.ok) {
|
|
5316
|
+
if (tc.needsFullXcode) return messages.Xi(tc.developerDir);
|
|
5317
|
+
return messages.Cs(tc.converter ? 'xcodebuild' : 'safari-web-extension-converter');
|
|
5318
|
+
}
|
|
5319
|
+
return null;
|
|
5320
|
+
}
|
|
5321
|
+
function safariBuildPreflight() {
|
|
5322
|
+
const tc = detectSafariToolchain();
|
|
5323
|
+
if (!tc.platformOk) return {
|
|
5324
|
+
severity: 'skip',
|
|
5325
|
+
message: messages.UW(process.platform)
|
|
5326
|
+
};
|
|
5327
|
+
if (!tc.ok) return {
|
|
5328
|
+
severity: 'fatal',
|
|
5329
|
+
message: tc.needsFullXcode ? messages.Xi(tc.developerDir) : messages.Cs(tc.converter ? 'xcodebuild' : 'safari-web-extension-converter')
|
|
5330
|
+
};
|
|
5331
|
+
return {
|
|
5332
|
+
severity: 'ok'
|
|
5333
|
+
};
|
|
5334
|
+
}
|
|
5335
|
+
async function runSafariPipeline(compilation, host, logger, mode) {
|
|
5336
|
+
const config = (0, safari_config.F7)(compilation, host);
|
|
5337
|
+
const converterArgs = (0, safari_config.w7)(config);
|
|
5338
|
+
const xcodebuildArgs = (0, safari_config.vx)(config);
|
|
5339
|
+
if (host.dryRun || isTestEnv()) {
|
|
5340
|
+
logSafariDryRun(`xcrun ${converterArgs.join(' ')}`, `xcodebuild ${xcodebuildArgs.join(' ')}`);
|
|
5341
|
+
return describePackage(config);
|
|
5342
|
+
}
|
|
5343
|
+
const toolchain = detectSafariToolchain();
|
|
5344
|
+
if (!toolchain.platformOk) {
|
|
5345
|
+
logger.warn?.(messages.G3(process.platform));
|
|
5346
|
+
return describePackage(config);
|
|
5347
|
+
}
|
|
5348
|
+
if (!toolchain.ok) {
|
|
5349
|
+
if (toolchain.needsFullXcode) logger.error?.(messages.Xi(toolchain.developerDir));
|
|
5350
|
+
else {
|
|
5351
|
+
const missing = toolchain.converter ? 'xcodebuild' : 'safari-web-extension-converter';
|
|
5352
|
+
logger.error?.(messages.Cs(missing));
|
|
5353
|
+
}
|
|
5354
|
+
return describePackage(config);
|
|
5355
|
+
}
|
|
5356
|
+
const projectExists = external_node_fs_.existsSync((0, safari_config.Gi)(config));
|
|
5357
|
+
const needsConversion = !projectExists || host.forceRegenerate || (0, safari_config.vk)(config);
|
|
5358
|
+
if (needsConversion) {
|
|
5359
|
+
if (projectExists) {
|
|
5360
|
+
logger.info?.(host.forceRegenerate ? messages.Tq() : messages.jc());
|
|
5361
|
+
logger.warn?.(messages.H1([
|
|
5362
|
+
...safari_config.X9
|
|
5363
|
+
]));
|
|
5364
|
+
}
|
|
5365
|
+
const { saved, restore } = (0, safari_config._D)(config);
|
|
5366
|
+
logger.info?.(messages.uK(config.extensionDir));
|
|
5367
|
+
const converted = await runTool('xcrun', converterArgs);
|
|
5368
|
+
if (!converted.ok) {
|
|
5369
|
+
const tail = toolOutputTail(converted.output);
|
|
5370
|
+
logger.error?.(messages.A('safari-web-extension-converter', converted.code, tail));
|
|
5371
|
+
throw new Error(`safari-web-extension-converter failed (exit ${converted.code})\n${tail}`);
|
|
5372
|
+
}
|
|
5373
|
+
const warnings = converterWarnings(converted.output);
|
|
5374
|
+
if (warnings.length > 0) logger.warn?.(messages.y1(warnings));
|
|
5375
|
+
const projFile = (0, safari_config.vh)(config);
|
|
5376
|
+
if (external_node_fs_.existsSync(projFile)) external_node_fs_.writeFileSync(projFile, (0, safari_config.IA)(external_node_fs_.readFileSync(projFile, 'utf8'), config.bundleIdentifier), 'utf8');
|
|
5377
|
+
restore();
|
|
5378
|
+
const preservedKeys = Object.keys(saved);
|
|
5379
|
+
if (preservedKeys.length > 0) logger.info?.(messages.oB(preservedKeys));
|
|
5380
|
+
(0, safari_config.x7)(config);
|
|
5381
|
+
logger.info?.(messages.l_(config.projectLocation));
|
|
5382
|
+
} else logger.info?.(messages.oM());
|
|
5383
|
+
if ('full' === mode) logger.info?.(messages.jR((0, safari_config.aD)(config)));
|
|
5384
|
+
const built = await runTool('xcodebuild', xcodebuildArgs);
|
|
5385
|
+
if (!built.ok) {
|
|
5386
|
+
const tail = toolOutputTail(built.output);
|
|
5387
|
+
logger.error?.(messages.A('xcodebuild', built.code, tail));
|
|
5388
|
+
throw new Error(`xcodebuild failed (exit ${built.code})\n${tail}`);
|
|
5389
|
+
}
|
|
5390
|
+
const appPath = (0, safari_config.fd)(config);
|
|
5391
|
+
if ('resync' === mode) {
|
|
5392
|
+
logger.info?.(messages.cF(config.appName));
|
|
5393
|
+
return describePackage(config);
|
|
5394
|
+
}
|
|
5395
|
+
logger.info?.(messages.Rl(appPath));
|
|
5396
|
+
if (config.bundleIdDerived) logger.info?.(messages.$q(config.bundleIdentifier));
|
|
5397
|
+
if (!config.open) {
|
|
5398
|
+
logger.info?.(messages.aO(appPath, config.appName));
|
|
5399
|
+
return describePackage(config);
|
|
5400
|
+
}
|
|
5401
|
+
const target = external_node_fs_.existsSync(appPath) ? appPath : (0, safari_config.Gi)(config);
|
|
5402
|
+
logger.info?.(messages.fw(target));
|
|
5403
|
+
await runTool('open', [
|
|
5404
|
+
target
|
|
5405
|
+
]);
|
|
5406
|
+
if (config.safariBinary) await runTool('open', [
|
|
5407
|
+
'-a',
|
|
5408
|
+
config.safariBinary
|
|
5409
|
+
]);
|
|
5410
|
+
logger.info?.(messages.fO(config.appName));
|
|
5411
|
+
if (await confirmRegisteredWithSafari(config.bundleIdentifier)) logger.info?.(messages.fd(config.appName));
|
|
5412
|
+
else logger.warn?.(messages.qY(config.appName));
|
|
5413
|
+
return describePackage(config);
|
|
5414
|
+
}
|
|
5415
|
+
async function packageSafariExtension(host, outputPath, logger, mode = 'full') {
|
|
5416
|
+
const compilation = {
|
|
5417
|
+
options: {
|
|
5418
|
+
output: {
|
|
5419
|
+
path: outputPath
|
|
5420
|
+
}
|
|
5421
|
+
},
|
|
5422
|
+
outputOptions: {
|
|
5423
|
+
path: outputPath
|
|
5424
|
+
}
|
|
5425
|
+
};
|
|
5426
|
+
return await runSafariPipeline(compilation, host, logger || fallbackLogger(), mode);
|
|
5427
|
+
}
|
|
5428
|
+
},
|
|
5429
|
+
"./browsers/run-safari/safari-launch/safari-config.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
5430
|
+
var node_fs__rspack_import_0 = __webpack_require__("node:fs");
|
|
5431
|
+
var node_path__rspack_import_1 = __webpack_require__("node:path");
|
|
5432
|
+
function sanitizeAppName(value) {
|
|
5433
|
+
const cleaned = String(value || '').replace(/[\\/:*?"<>|]+/g, ' ').replace(/\s+/g, ' ').trim();
|
|
5434
|
+
return cleaned.length > 0 ? cleaned : 'Extension';
|
|
5435
|
+
}
|
|
5436
|
+
function bundleSegment(appName) {
|
|
5437
|
+
return String(appName || '').replace(/[^A-Za-z0-9]+/g, '-').replace(/^-+|-+$/g, '') || 'extension';
|
|
5438
|
+
}
|
|
5439
|
+
function deriveBundleId(appName) {
|
|
5440
|
+
return `dev.extensionjs.${bundleSegment(appName)}`;
|
|
5441
|
+
}
|
|
5442
|
+
function isValidBundleId(value) {
|
|
5443
|
+
return /^[A-Za-z][A-Za-z0-9-]*(\.[A-Za-z][A-Za-z0-9-]*)+$/.test(value);
|
|
5444
|
+
}
|
|
5445
|
+
function readManifest(extensionDir) {
|
|
5446
|
+
try {
|
|
5447
|
+
const manifestPath = node_path__rspack_import_1.join(extensionDir, 'manifest.json');
|
|
5448
|
+
if (node_fs__rspack_import_0.existsSync(manifestPath)) return JSON.parse(node_fs__rspack_import_0.readFileSync(manifestPath, 'utf8')) || {};
|
|
5449
|
+
} catch {}
|
|
5450
|
+
return {};
|
|
5451
|
+
}
|
|
5452
|
+
function resolveSafariBuildConfig(compilation, host) {
|
|
5453
|
+
const extensionDir = String(compilation?.options?.output?.path || '');
|
|
5454
|
+
const manifest = readManifest(extensionDir);
|
|
5455
|
+
const appName = sanitizeAppName(String(host.appName || manifest?.name || 'Extension'));
|
|
5456
|
+
const userBundleId = String(host.bundleId || '').trim();
|
|
5457
|
+
const bundleIdDerived = !userBundleId;
|
|
5458
|
+
const bundleIdentifier = bundleIdDerived ? deriveBundleId(appName) : userBundleId;
|
|
5459
|
+
const projectLocation = `${extensionDir.replace(/[\\/]+$/, '')}-xcode`;
|
|
5460
|
+
return {
|
|
5461
|
+
extensionDir,
|
|
5462
|
+
projectLocation,
|
|
5463
|
+
appName,
|
|
5464
|
+
bundleIdentifier,
|
|
5465
|
+
bundleIdDerived,
|
|
5466
|
+
macOsOnly: false !== host.macOsOnly,
|
|
5467
|
+
language: 'swift',
|
|
5468
|
+
open: !host.noOpen,
|
|
5469
|
+
safariBinary: host.safariBinary
|
|
5470
|
+
};
|
|
5471
|
+
}
|
|
5472
|
+
function composeConverterArgs(config) {
|
|
5473
|
+
const args = [
|
|
5474
|
+
'safari-web-extension-converter',
|
|
5475
|
+
config.extensionDir,
|
|
5476
|
+
'--project-location',
|
|
5477
|
+
config.projectLocation,
|
|
5478
|
+
'--app-name',
|
|
5479
|
+
config.appName,
|
|
5480
|
+
'--bundle-identifier',
|
|
5481
|
+
config.bundleIdentifier,
|
|
5482
|
+
'--no-prompt',
|
|
5483
|
+
'--no-open',
|
|
5484
|
+
'--force',
|
|
5485
|
+
'objc' === config.language ? '--objc' : '--swift'
|
|
5486
|
+
];
|
|
5487
|
+
if (config.macOsOnly) args.push('--macos-only');
|
|
5488
|
+
return args;
|
|
5489
|
+
}
|
|
5490
|
+
function macOsSchemeName(config) {
|
|
5491
|
+
return config.macOsOnly ? config.appName : `${config.appName} (macOS)`;
|
|
5492
|
+
}
|
|
5493
|
+
function xcodeProjectPath(config) {
|
|
5494
|
+
return node_path__rspack_import_1.join(config.projectLocation, config.appName, `${config.appName}.xcodeproj`);
|
|
5495
|
+
}
|
|
5496
|
+
function derivedDataPath(config) {
|
|
5497
|
+
return node_path__rspack_import_1.join(config.projectLocation, '.derived');
|
|
5498
|
+
}
|
|
5499
|
+
function builtAppPath(config) {
|
|
5500
|
+
return node_path__rspack_import_1.join(derivedDataPath(config), 'Build', 'Products', 'Release', `${config.appName}.app`);
|
|
5501
|
+
}
|
|
5502
|
+
function composeXcodebuildArgs(config) {
|
|
5503
|
+
return [
|
|
5504
|
+
'-project',
|
|
5505
|
+
xcodeProjectPath(config),
|
|
5506
|
+
'-scheme',
|
|
5507
|
+
macOsSchemeName(config),
|
|
5508
|
+
'-configuration',
|
|
5509
|
+
'Release',
|
|
5510
|
+
'-derivedDataPath',
|
|
5511
|
+
derivedDataPath(config),
|
|
5512
|
+
'CODE_SIGN_IDENTITY=-',
|
|
5513
|
+
'CODE_SIGNING_REQUIRED=NO',
|
|
5514
|
+
'CODE_SIGNING_ALLOWED=YES',
|
|
5515
|
+
'build'
|
|
5516
|
+
];
|
|
5517
|
+
}
|
|
5518
|
+
function manifestFingerprintPath(config) {
|
|
5519
|
+
return node_path__rspack_import_1.join(config.projectLocation, '.manifest-fingerprint');
|
|
5520
|
+
}
|
|
5521
|
+
function stableStringify(obj) {
|
|
5522
|
+
if (null == obj) return JSON.stringify(obj);
|
|
5523
|
+
if ('object' != typeof obj) return JSON.stringify(obj);
|
|
5524
|
+
if (Array.isArray(obj)) return `[${obj.map(stableStringify).join(',')}]`;
|
|
5525
|
+
const keys = Object.keys(obj).sort();
|
|
5526
|
+
return `{${keys.map((k)=>`${JSON.stringify(k)}:${stableStringify(obj[k])}`).join(',')}}`;
|
|
5527
|
+
}
|
|
5528
|
+
function readManifestRaw(extensionDir) {
|
|
5529
|
+
try {
|
|
5530
|
+
return node_fs__rspack_import_0.readFileSync(node_path__rspack_import_1.join(extensionDir, 'manifest.json'), 'utf8');
|
|
5531
|
+
} catch {
|
|
5532
|
+
return '';
|
|
5533
|
+
}
|
|
5534
|
+
}
|
|
5535
|
+
function normalizeManifest(raw) {
|
|
5536
|
+
try {
|
|
5537
|
+
return stableStringify(JSON.parse(raw));
|
|
5538
|
+
} catch {
|
|
5539
|
+
return raw;
|
|
5540
|
+
}
|
|
5541
|
+
}
|
|
5542
|
+
function composeProjectFingerprint(config) {
|
|
5543
|
+
return JSON.stringify({
|
|
5544
|
+
v: 2,
|
|
5545
|
+
identity: {
|
|
5546
|
+
appName: config.appName,
|
|
5547
|
+
bundleId: config.bundleIdentifier,
|
|
5548
|
+
macOsOnly: config.macOsOnly
|
|
5549
|
+
},
|
|
5550
|
+
manifest: normalizeManifest(readManifestRaw(config.extensionDir))
|
|
5551
|
+
});
|
|
5552
|
+
}
|
|
5553
|
+
function saveManifestFingerprint(config) {
|
|
5554
|
+
node_fs__rspack_import_0.mkdirSync(node_path__rspack_import_1.dirname(manifestFingerprintPath(config)), {
|
|
5555
|
+
recursive: true
|
|
5556
|
+
});
|
|
5557
|
+
node_fs__rspack_import_0.writeFileSync(manifestFingerprintPath(config), composeProjectFingerprint(config), 'utf8');
|
|
5558
|
+
}
|
|
5559
|
+
function isProjectStale(config) {
|
|
5560
|
+
const fpPath = manifestFingerprintPath(config);
|
|
5561
|
+
if (!node_fs__rspack_import_0.existsSync(fpPath)) return true;
|
|
5562
|
+
const stored = node_fs__rspack_import_0.readFileSync(fpPath, 'utf8');
|
|
5563
|
+
return stored !== composeProjectFingerprint(config);
|
|
5564
|
+
}
|
|
5565
|
+
function alignBundleIdentifiers(pbxprojContent, bundleId) {
|
|
5566
|
+
return pbxprojContent.replace(/PRODUCT_BUNDLE_IDENTIFIER = ("?)([^;"]+)\1;/g, (_match, _quote, value)=>/\.Extension$/.test(String(value)) ? `PRODUCT_BUNDLE_IDENTIFIER = "${bundleId}.Extension";` : `PRODUCT_BUNDLE_IDENTIFIER = "${bundleId}";`);
|
|
5567
|
+
}
|
|
5568
|
+
const PRESERVED_SETTINGS = [
|
|
5569
|
+
'DEVELOPMENT_TEAM',
|
|
5570
|
+
'CODE_SIGN_STYLE',
|
|
5571
|
+
'PROVISIONING_PROFILE_SPECIFIER'
|
|
5572
|
+
];
|
|
5573
|
+
function pbxprojPath(config) {
|
|
5574
|
+
return node_path__rspack_import_1.join(xcodeProjectPath(config), 'project.pbxproj');
|
|
5575
|
+
}
|
|
5576
|
+
function extractXcodeUserSettings(pbxprojContent) {
|
|
5577
|
+
const found = {};
|
|
5578
|
+
for (const key of PRESERVED_SETTINGS){
|
|
5579
|
+
const m = new RegExp(`\\b${key}\\s*=\\s*([^;]+);`).exec(pbxprojContent);
|
|
5580
|
+
if (m) {
|
|
5581
|
+
const val = m[1].trim();
|
|
5582
|
+
if (val && '""' !== val && "''" !== val) found[key] = val;
|
|
5583
|
+
}
|
|
5584
|
+
}
|
|
5585
|
+
return found;
|
|
5586
|
+
}
|
|
5587
|
+
function applyXcodeUserSettings(pbxprojContent, settings) {
|
|
5588
|
+
let result = pbxprojContent;
|
|
5589
|
+
for (const [key, value] of Object.entries(settings)){
|
|
5590
|
+
const existing = new RegExp(`\\b${key}\\s*=\\s*[^;]+;`, 'g');
|
|
5591
|
+
result = existing.test(result) ? result.replace(existing, `${key} = ${value};`) : result.replace(/buildSettings\s*=\s*\{/g, `buildSettings = {\n\t\t\t\t${key} = ${value};`);
|
|
5592
|
+
}
|
|
5593
|
+
return result;
|
|
5594
|
+
}
|
|
5595
|
+
function backupAndRestoreXcodeSettings(config) {
|
|
5596
|
+
const projFile = pbxprojPath(config);
|
|
5597
|
+
let saved = {};
|
|
5598
|
+
if (node_fs__rspack_import_0.existsSync(projFile)) saved = extractXcodeUserSettings(node_fs__rspack_import_0.readFileSync(projFile, 'utf8'));
|
|
5599
|
+
return {
|
|
5600
|
+
saved,
|
|
5601
|
+
restore () {
|
|
5602
|
+
if (0 === Object.keys(saved).length) return;
|
|
5603
|
+
if (!node_fs__rspack_import_0.existsSync(projFile)) return;
|
|
5604
|
+
const content = node_fs__rspack_import_0.readFileSync(projFile, 'utf8');
|
|
5605
|
+
node_fs__rspack_import_0.writeFileSync(projFile, applyXcodeUserSettings(content, saved), 'utf8');
|
|
5606
|
+
}
|
|
5607
|
+
};
|
|
5608
|
+
}
|
|
5609
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
5610
|
+
F7: ()=>resolveSafariBuildConfig,
|
|
5611
|
+
Gi: ()=>xcodeProjectPath,
|
|
5612
|
+
IA: ()=>alignBundleIdentifiers,
|
|
5613
|
+
OA: ()=>isValidBundleId,
|
|
5614
|
+
_D: ()=>backupAndRestoreXcodeSettings,
|
|
5615
|
+
aD: ()=>macOsSchemeName,
|
|
5616
|
+
fd: ()=>builtAppPath,
|
|
5617
|
+
vh: ()=>pbxprojPath,
|
|
5618
|
+
vk: ()=>isProjectStale,
|
|
5619
|
+
vx: ()=>composeXcodebuildArgs,
|
|
5620
|
+
w7: ()=>composeConverterArgs,
|
|
5621
|
+
x7: ()=>saveManifestFingerprint
|
|
5622
|
+
}, {
|
|
5623
|
+
X9: PRESERVED_SETTINGS
|
|
5624
|
+
});
|
|
5625
|
+
},
|
|
5626
|
+
"./browsers/run-safari/safari-packager.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
5627
|
+
var _safari_launch__rspack_import_0 = __webpack_require__("./browsers/run-safari/safari-launch/index.ts");
|
|
5628
|
+
function withoutUndefined(input) {
|
|
5629
|
+
if (!input) return {};
|
|
5630
|
+
return Object.fromEntries(Object.entries(input).filter(([, value])=>void 0 !== value));
|
|
5631
|
+
}
|
|
5632
|
+
function createSafariPackager(options = {}) {
|
|
5633
|
+
const { browser = 'safari', noOpen = true, dryRun = false, logger, ...identity } = options;
|
|
5634
|
+
return async (distPath, mode = 'full', overrides)=>await (0, _safari_launch__rspack_import_0.Ah)({
|
|
5635
|
+
extension: [
|
|
5636
|
+
distPath
|
|
5637
|
+
],
|
|
5638
|
+
browser,
|
|
5639
|
+
noOpen,
|
|
5640
|
+
dryRun,
|
|
5641
|
+
...withoutUndefined(identity),
|
|
5642
|
+
...withoutUndefined(overrides)
|
|
5643
|
+
}, distPath, logger, mode);
|
|
5644
|
+
}
|
|
5645
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
5646
|
+
P: ()=>createSafariPackager
|
|
5647
|
+
});
|
|
5648
|
+
},
|
|
5020
5649
|
"./helpers/messaging.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
5021
5650
|
var pintor__rspack_import_0 = __webpack_require__("pintor");
|
|
5022
5651
|
var pintor__rspack_import_0_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_0);
|
|
@@ -5201,11 +5830,29 @@ __webpack_require__.m = __webpack_modules__;
|
|
|
5201
5830
|
};
|
|
5202
5831
|
})();
|
|
5203
5832
|
var __webpack_exports__ = __webpack_require__("./browsers/index.ts");
|
|
5833
|
+
exports.builtAppPath = __webpack_exports__.builtAppPath;
|
|
5834
|
+
exports.createSafariPackager = __webpack_exports__.createSafariPackager;
|
|
5835
|
+
exports.isValidBundleId = __webpack_exports__.isValidBundleId;
|
|
5204
5836
|
exports.launchBrowser = __webpack_exports__.launchBrowser;
|
|
5837
|
+
exports.macOsSchemeName = __webpack_exports__.macOsSchemeName;
|
|
5838
|
+
exports.packageSafariExtension = __webpack_exports__.packageSafariExtension;
|
|
5839
|
+
exports.resolveSafariBuildConfig = __webpack_exports__.resolveSafariBuildConfig;
|
|
5205
5840
|
exports.runOnlyPreviewBrowser = __webpack_exports__.runOnlyPreviewBrowser;
|
|
5841
|
+
exports.safariBuildPreflight = __webpack_exports__.safariBuildPreflight;
|
|
5842
|
+
exports.safariPreflightError = __webpack_exports__.safariPreflightError;
|
|
5843
|
+
exports.xcodeProjectPath = __webpack_exports__.xcodeProjectPath;
|
|
5206
5844
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
5845
|
+
"builtAppPath",
|
|
5846
|
+
"createSafariPackager",
|
|
5847
|
+
"isValidBundleId",
|
|
5207
5848
|
"launchBrowser",
|
|
5208
|
-
"
|
|
5849
|
+
"macOsSchemeName",
|
|
5850
|
+
"packageSafariExtension",
|
|
5851
|
+
"resolveSafariBuildConfig",
|
|
5852
|
+
"runOnlyPreviewBrowser",
|
|
5853
|
+
"safariBuildPreflight",
|
|
5854
|
+
"safariPreflightError",
|
|
5855
|
+
"xcodeProjectPath"
|
|
5209
5856
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
5210
5857
|
Object.defineProperty(exports, '__esModule', {
|
|
5211
5858
|
value: true
|