diff --git a/Makefile b/Makefile index 1e6b8c2..2e1677f 100755 --- a/Makefile +++ b/Makefile @@ -13,6 +13,10 @@ build: rm -rf dist yarn build +copy-build-safari: + rm -rf Safari/Gitako/Gitako\ Extension/Resources/* + cd dist && cp -r . ../Safari/Gitako/Gitako\ Extension/Resources + test: yarn test diff --git a/Safari/.gitignore b/Safari/.gitignore new file mode 100644 index 0000000..074d44a --- /dev/null +++ b/Safari/.gitignore @@ -0,0 +1,28 @@ +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## User settings +xcuserdata/ + +## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) +*.xcscmblueprint +*.xccheckout + +## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) +build/ +DerivedData/ +*.moved-aside +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 + +## Gcc Patch +/*.gcno + +Resources diff --git a/Safari/Gitako/Gitako Extension/Gitako_Extension.entitlements b/Safari/Gitako/Gitako Extension/Gitako_Extension.entitlements new file mode 100644 index 0000000..f2ef3ae --- /dev/null +++ b/Safari/Gitako/Gitako Extension/Gitako_Extension.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + + diff --git a/Safari/Gitako/Gitako Extension/Info.plist b/Safari/Gitako/Gitako Extension/Info.plist new file mode 100644 index 0000000..6b030ef --- /dev/null +++ b/Safari/Gitako/Gitako Extension/Info.plist @@ -0,0 +1,33 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Gitako Extension + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + $(MARKETING_VERSION) + CFBundleVersion + $(MARKETING_VERSION) + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSExtension + + NSExtensionPointIdentifier + com.apple.Safari.web-extension + NSExtensionPrincipalClass + $(PRODUCT_MODULE_NAME).SafariWebExtensionHandler + + + diff --git a/Safari/Gitako/Gitako Extension/SafariWebExtensionHandler.swift b/Safari/Gitako/Gitako Extension/SafariWebExtensionHandler.swift new file mode 100644 index 0000000..a0e14c2 --- /dev/null +++ b/Safari/Gitako/Gitako Extension/SafariWebExtensionHandler.swift @@ -0,0 +1,14 @@ +// +// SafariWebExtensionHandler.swift +// Gitako Extension +// +// Created by Enix on 13/6/2021. +// + +import SafariServices +import os.log + +let SFExtensionMessageKey = "message" + +class SafariWebExtensionHandler: NSObject { +} diff --git a/Safari/Gitako/Gitako.xcodeproj/project.pbxproj b/Safari/Gitako/Gitako.xcodeproj/project.pbxproj new file mode 100644 index 0000000..6ab018f --- /dev/null +++ b/Safari/Gitako/Gitako.xcodeproj/project.pbxproj @@ -0,0 +1,787 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 0EA3131B2675C39B00D5C092 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EA3131A2675C39B00D5C092 /* AppDelegate.swift */; }; + 0EA3131E2675C39B00D5C092 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0EA3131C2675C39B00D5C092 /* Main.storyboard */; }; + 0EA313202675C39B00D5C092 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EA3131F2675C39B00D5C092 /* ViewController.swift */; }; + 0EA313222675C39C00D5C092 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0EA313212675C39C00D5C092 /* Assets.xcassets */; }; + 0EA3132D2675C39D00D5C092 /* GitakoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EA3132C2675C39D00D5C092 /* GitakoTests.swift */; }; + 0EA313382675C39D00D5C092 /* GitakoUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EA313372675C39D00D5C092 /* GitakoUITests.swift */; }; + 0EA3133F2675C39D00D5C092 /* Gitako Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 0EA3133E2675C39D00D5C092 /* Gitako Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + 0EA313442675C39D00D5C092 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0EA313432675C39D00D5C092 /* Cocoa.framework */; }; + 0EA313472675C39D00D5C092 /* SafariWebExtensionHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EA313462675C39D00D5C092 /* SafariWebExtensionHandler.swift */; }; + 0EA3134E2675C39D00D5C092 /* manifest.json in Resources */ = {isa = PBXBuildFile; fileRef = 0EA3134D2675C39D00D5C092 /* manifest.json */; }; + 0EA313502675C39D00D5C092 /* background.js in Resources */ = {isa = PBXBuildFile; fileRef = 0EA3134F2675C39D00D5C092 /* background.js */; }; + 0EA313522675C39D00D5C092 /* content.js in Resources */ = {isa = PBXBuildFile; fileRef = 0EA313512675C39D00D5C092 /* content.js */; }; + 0EA3136A2675C82800D5C092 /* content.js in Resources */ = {isa = PBXBuildFile; fileRef = 0EA313512675C39D00D5C092 /* content.js */; }; + 0EA313722675C9A300D5C092 /* firefox-shim.js in Resources */ = {isa = PBXBuildFile; fileRef = 0EA3136B2675C9A300D5C092 /* firefox-shim.js */; }; + 0EA313732675C9A300D5C092 /* content.css in Resources */ = {isa = PBXBuildFile; fileRef = 0EA3136C2675C9A300D5C092 /* content.css */; }; + 0EA313742675C9A300D5C092 /* browser-polyfill.js in Resources */ = {isa = PBXBuildFile; fileRef = 0EA313702675C9A300D5C092 /* browser-polyfill.js */; }; + 0EA313752675C9A300D5C092 /* icons in Resources */ = {isa = PBXBuildFile; fileRef = 0EA313712675C9A300D5C092 /* icons */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 0EA313292675C39C00D5C092 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0EA3130E2675C39B00D5C092 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 0EA313152675C39B00D5C092; + remoteInfo = Gitako; + }; + 0EA313342675C39D00D5C092 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0EA3130E2675C39B00D5C092 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 0EA313152675C39B00D5C092; + remoteInfo = Gitako; + }; + 0EA313402675C39D00D5C092 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0EA3130E2675C39B00D5C092 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 0EA3133D2675C39D00D5C092; + remoteInfo = "Gitako Extension"; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 0EA313602675C39D00D5C092 /* Embed App Extensions */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 13; + files = ( + 0EA3133F2675C39D00D5C092 /* Gitako Extension.appex in Embed App Extensions */, + ); + name = "Embed App Extensions"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 0EA313162675C39B00D5C092 /* Gitako.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Gitako.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 0EA313192675C39B00D5C092 /* Gitako.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Gitako.entitlements; sourceTree = ""; }; + 0EA3131A2675C39B00D5C092 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 0EA3131D2675C39B00D5C092 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 0EA3131F2675C39B00D5C092 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 0EA313212675C39C00D5C092 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 0EA313232675C39C00D5C092 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 0EA313282675C39C00D5C092 /* GitakoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GitakoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 0EA3132C2675C39D00D5C092 /* GitakoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GitakoTests.swift; sourceTree = ""; }; + 0EA3132E2675C39D00D5C092 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 0EA313332675C39D00D5C092 /* GitakoUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GitakoUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 0EA313372675C39D00D5C092 /* GitakoUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GitakoUITests.swift; sourceTree = ""; }; + 0EA313392675C39D00D5C092 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 0EA3133E2675C39D00D5C092 /* Gitako Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Gitako Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; }; + 0EA313432675C39D00D5C092 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; + 0EA313462675C39D00D5C092 /* SafariWebExtensionHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafariWebExtensionHandler.swift; sourceTree = ""; }; + 0EA3134D2675C39D00D5C092 /* manifest.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = manifest.json; sourceTree = ""; }; + 0EA3134F2675C39D00D5C092 /* background.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = background.js; sourceTree = ""; }; + 0EA313512675C39D00D5C092 /* content.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = content.js; sourceTree = ""; }; + 0EA313592675C39D00D5C092 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 0EA3135A2675C39D00D5C092 /* Gitako_Extension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Gitako_Extension.entitlements; sourceTree = ""; }; + 0EA3136B2675C9A300D5C092 /* firefox-shim.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "firefox-shim.js"; sourceTree = ""; }; + 0EA3136C2675C9A300D5C092 /* content.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = content.css; sourceTree = ""; }; + 0EA3136D2675C9A300D5C092 /* content.js.map */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.module-map"; path = content.js.map; sourceTree = ""; }; + 0EA3136E2675C9A300D5C092 /* content.css.map */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.module-map"; path = content.css.map; sourceTree = ""; }; + 0EA3136F2675C9A300D5C092 /* background.js.map */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.module-map"; path = background.js.map; sourceTree = ""; }; + 0EA313702675C9A300D5C092 /* browser-polyfill.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "browser-polyfill.js"; sourceTree = ""; }; + 0EA313712675C9A300D5C092 /* icons */ = {isa = PBXFileReference; lastKnownFileType = folder; path = icons; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 0EA313132675C39B00D5C092 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 0EA313252675C39C00D5C092 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 0EA313302675C39D00D5C092 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 0EA3133B2675C39D00D5C092 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 0EA313442675C39D00D5C092 /* Cocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 0EA3130D2675C39B00D5C092 = { + isa = PBXGroup; + children = ( + 0EA313182675C39B00D5C092 /* Gitako */, + 0EA3132B2675C39C00D5C092 /* GitakoTests */, + 0EA313362675C39D00D5C092 /* GitakoUITests */, + 0EA313452675C39D00D5C092 /* Gitako Extension */, + 0EA313422675C39D00D5C092 /* Frameworks */, + 0EA313172675C39B00D5C092 /* Products */, + ); + sourceTree = ""; + }; + 0EA313172675C39B00D5C092 /* Products */ = { + isa = PBXGroup; + children = ( + 0EA313162675C39B00D5C092 /* Gitako.app */, + 0EA313282675C39C00D5C092 /* GitakoTests.xctest */, + 0EA313332675C39D00D5C092 /* GitakoUITests.xctest */, + 0EA3133E2675C39D00D5C092 /* Gitako Extension.appex */, + ); + name = Products; + sourceTree = ""; + }; + 0EA313182675C39B00D5C092 /* Gitako */ = { + isa = PBXGroup; + children = ( + 0EA313192675C39B00D5C092 /* Gitako.entitlements */, + 0EA3131A2675C39B00D5C092 /* AppDelegate.swift */, + 0EA3131C2675C39B00D5C092 /* Main.storyboard */, + 0EA3131F2675C39B00D5C092 /* ViewController.swift */, + 0EA313212675C39C00D5C092 /* Assets.xcassets */, + 0EA313232675C39C00D5C092 /* Info.plist */, + ); + path = Gitako; + sourceTree = ""; + }; + 0EA3132B2675C39C00D5C092 /* GitakoTests */ = { + isa = PBXGroup; + children = ( + 0EA3132C2675C39D00D5C092 /* GitakoTests.swift */, + 0EA3132E2675C39D00D5C092 /* Info.plist */, + ); + path = GitakoTests; + sourceTree = ""; + }; + 0EA313362675C39D00D5C092 /* GitakoUITests */ = { + isa = PBXGroup; + children = ( + 0EA313372675C39D00D5C092 /* GitakoUITests.swift */, + 0EA313392675C39D00D5C092 /* Info.plist */, + ); + path = GitakoUITests; + sourceTree = ""; + }; + 0EA313422675C39D00D5C092 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 0EA313432675C39D00D5C092 /* Cocoa.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 0EA313452675C39D00D5C092 /* Gitako Extension */ = { + isa = PBXGroup; + children = ( + 0EA313462675C39D00D5C092 /* SafariWebExtensionHandler.swift */, + 0EA313592675C39D00D5C092 /* Info.plist */, + 0EA3135A2675C39D00D5C092 /* Gitako_Extension.entitlements */, + 0EA313482675C39D00D5C092 /* Resources */, + ); + path = "Gitako Extension"; + sourceTree = ""; + }; + 0EA313482675C39D00D5C092 /* Resources */ = { + isa = PBXGroup; + children = ( + 0EA3136F2675C9A300D5C092 /* background.js.map */, + 0EA313702675C9A300D5C092 /* browser-polyfill.js */, + 0EA3136C2675C9A300D5C092 /* content.css */, + 0EA3136E2675C9A300D5C092 /* content.css.map */, + 0EA3136D2675C9A300D5C092 /* content.js.map */, + 0EA3136B2675C9A300D5C092 /* firefox-shim.js */, + 0EA313712675C9A300D5C092 /* icons */, + 0EA3134D2675C39D00D5C092 /* manifest.json */, + 0EA3134F2675C39D00D5C092 /* background.js */, + 0EA313512675C39D00D5C092 /* content.js */, + ); + path = Resources; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 0EA313152675C39B00D5C092 /* Gitako */ = { + isa = PBXNativeTarget; + buildConfigurationList = 0EA313612675C39D00D5C092 /* Build configuration list for PBXNativeTarget "Gitako" */; + buildPhases = ( + 0EA313122675C39B00D5C092 /* Sources */, + 0EA313132675C39B00D5C092 /* Frameworks */, + 0EA313142675C39B00D5C092 /* Resources */, + 0EA313602675C39D00D5C092 /* Embed App Extensions */, + ); + buildRules = ( + ); + dependencies = ( + 0EA313412675C39D00D5C092 /* PBXTargetDependency */, + ); + name = Gitako; + productName = Gitako; + productReference = 0EA313162675C39B00D5C092 /* Gitako.app */; + productType = "com.apple.product-type.application"; + }; + 0EA313272675C39C00D5C092 /* GitakoTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 0EA313642675C39D00D5C092 /* Build configuration list for PBXNativeTarget "GitakoTests" */; + buildPhases = ( + 0EA313242675C39C00D5C092 /* Sources */, + 0EA313252675C39C00D5C092 /* Frameworks */, + 0EA313262675C39C00D5C092 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 0EA3132A2675C39C00D5C092 /* PBXTargetDependency */, + ); + name = GitakoTests; + productName = GitakoTests; + productReference = 0EA313282675C39C00D5C092 /* GitakoTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 0EA313322675C39D00D5C092 /* GitakoUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 0EA313672675C39D00D5C092 /* Build configuration list for PBXNativeTarget "GitakoUITests" */; + buildPhases = ( + 0EA3132F2675C39D00D5C092 /* Sources */, + 0EA313302675C39D00D5C092 /* Frameworks */, + 0EA313312675C39D00D5C092 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 0EA313352675C39D00D5C092 /* PBXTargetDependency */, + ); + name = GitakoUITests; + productName = GitakoUITests; + productReference = 0EA313332675C39D00D5C092 /* GitakoUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; + 0EA3133D2675C39D00D5C092 /* Gitako Extension */ = { + isa = PBXNativeTarget; + buildConfigurationList = 0EA3135D2675C39D00D5C092 /* Build configuration list for PBXNativeTarget "Gitako Extension" */; + buildPhases = ( + 0EA3133A2675C39D00D5C092 /* Sources */, + 0EA3133B2675C39D00D5C092 /* Frameworks */, + 0EA3133C2675C39D00D5C092 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Gitako Extension"; + productName = "Gitako Extension"; + productReference = 0EA3133E2675C39D00D5C092 /* Gitako Extension.appex */; + productType = "com.apple.product-type.app-extension"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 0EA3130E2675C39B00D5C092 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1250; + LastUpgradeCheck = 1250; + TargetAttributes = { + 0EA313152675C39B00D5C092 = { + CreatedOnToolsVersion = 12.5; + }; + 0EA313272675C39C00D5C092 = { + CreatedOnToolsVersion = 12.5; + TestTargetID = 0EA313152675C39B00D5C092; + }; + 0EA313322675C39D00D5C092 = { + CreatedOnToolsVersion = 12.5; + TestTargetID = 0EA313152675C39B00D5C092; + }; + 0EA3133D2675C39D00D5C092 = { + CreatedOnToolsVersion = 12.5; + }; + }; + }; + buildConfigurationList = 0EA313112675C39B00D5C092 /* Build configuration list for PBXProject "Gitako" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 0EA3130D2675C39B00D5C092; + productRefGroup = 0EA313172675C39B00D5C092 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 0EA313152675C39B00D5C092 /* Gitako */, + 0EA313272675C39C00D5C092 /* GitakoTests */, + 0EA313322675C39D00D5C092 /* GitakoUITests */, + 0EA3133D2675C39D00D5C092 /* Gitako Extension */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 0EA313142675C39B00D5C092 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 0EA3136A2675C82800D5C092 /* content.js in Resources */, + 0EA313222675C39C00D5C092 /* Assets.xcassets in Resources */, + 0EA3131E2675C39B00D5C092 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 0EA313262675C39C00D5C092 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 0EA313312675C39D00D5C092 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 0EA3133C2675C39D00D5C092 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 0EA313502675C39D00D5C092 /* background.js in Resources */, + 0EA3134E2675C39D00D5C092 /* manifest.json in Resources */, + 0EA313522675C39D00D5C092 /* content.js in Resources */, + 0EA313732675C9A300D5C092 /* content.css in Resources */, + 0EA313742675C9A300D5C092 /* browser-polyfill.js in Resources */, + 0EA313752675C9A300D5C092 /* icons in Resources */, + 0EA313722675C9A300D5C092 /* firefox-shim.js in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 0EA313122675C39B00D5C092 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 0EA313202675C39B00D5C092 /* ViewController.swift in Sources */, + 0EA3131B2675C39B00D5C092 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 0EA313242675C39C00D5C092 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 0EA3132D2675C39D00D5C092 /* GitakoTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 0EA3132F2675C39D00D5C092 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 0EA313382675C39D00D5C092 /* GitakoUITests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 0EA3133A2675C39D00D5C092 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 0EA313472675C39D00D5C092 /* SafariWebExtensionHandler.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 0EA3132A2675C39C00D5C092 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 0EA313152675C39B00D5C092 /* Gitako */; + targetProxy = 0EA313292675C39C00D5C092 /* PBXContainerItemProxy */; + }; + 0EA313352675C39D00D5C092 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 0EA313152675C39B00D5C092 /* Gitako */; + targetProxy = 0EA313342675C39D00D5C092 /* PBXContainerItemProxy */; + }; + 0EA313412675C39D00D5C092 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 0EA3133D2675C39D00D5C092 /* Gitako Extension */; + targetProxy = 0EA313402675C39D00D5C092 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 0EA3131C2675C39B00D5C092 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 0EA3131D2675C39B00D5C092 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 0EA3135B2675C39D00D5C092 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 0EA3135C2675C39D00D5C092 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + 0EA3135E2675C39D00D5C092 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_ENTITLEMENTS = "Gitako Extension/Gitako_Extension.entitlements"; + CODE_SIGN_IDENTITY = "-"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + INFOPLIST_FILE = "Gitako Extension/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@executable_path/../../../../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.14; + MARKETING_VERSION = 3.7.0; + PRODUCT_BUNDLE_IDENTIFIER = enixcoda.Gitako.Extension; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 0EA3135F2675C39D00D5C092 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_ENTITLEMENTS = "Gitako Extension/Gitako_Extension.entitlements"; + CODE_SIGN_IDENTITY = "-"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + INFOPLIST_FILE = "Gitako Extension/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@executable_path/../../../../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.14; + MARKETING_VERSION = 3.7.0; + PRODUCT_BUNDLE_IDENTIFIER = enixcoda.Gitako.Extension; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + 0EA313622675C39D00D5C092 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = Gitako/Gitako.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + INFOPLIST_FILE = Gitako/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.14; + MARKETING_VERSION = 3.7.0; + PRODUCT_BUNDLE_IDENTIFIER = enixcoda.Gitako; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 0EA313632675C39D00D5C092 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = Gitako/Gitako.entitlements; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = KVT97368XL; + INFOPLIST_FILE = Gitako/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.14; + MARKETING_VERSION = 3.7.0; + PRODUCT_BUNDLE_IDENTIFIER = enixcoda.Gitako; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + 0EA313652675C39D00D5C092 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = GitakoTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@loader_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.14; + PRODUCT_BUNDLE_IDENTIFIER = enixcoda.GitakoTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Gitako.app/Contents/MacOS/Gitako"; + }; + name = Debug; + }; + 0EA313662675C39D00D5C092 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = GitakoTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@loader_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.14; + PRODUCT_BUNDLE_IDENTIFIER = enixcoda.GitakoTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Gitako.app/Contents/MacOS/Gitako"; + }; + name = Release; + }; + 0EA313682675C39D00D5C092 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = GitakoUITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@loader_path/../Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = enixcoda.GitakoUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_TARGET_NAME = Gitako; + }; + name = Debug; + }; + 0EA313692675C39D00D5C092 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = GitakoUITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@loader_path/../Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = enixcoda.GitakoUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_TARGET_NAME = Gitako; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 0EA313112675C39B00D5C092 /* Build configuration list for PBXProject "Gitako" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 0EA3135B2675C39D00D5C092 /* Debug */, + 0EA3135C2675C39D00D5C092 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 0EA3135D2675C39D00D5C092 /* Build configuration list for PBXNativeTarget "Gitako Extension" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 0EA3135E2675C39D00D5C092 /* Debug */, + 0EA3135F2675C39D00D5C092 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 0EA313612675C39D00D5C092 /* Build configuration list for PBXNativeTarget "Gitako" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 0EA313622675C39D00D5C092 /* Debug */, + 0EA313632675C39D00D5C092 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 0EA313642675C39D00D5C092 /* Build configuration list for PBXNativeTarget "GitakoTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 0EA313652675C39D00D5C092 /* Debug */, + 0EA313662675C39D00D5C092 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 0EA313672675C39D00D5C092 /* Build configuration list for PBXNativeTarget "GitakoUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 0EA313682675C39D00D5C092 /* Debug */, + 0EA313692675C39D00D5C092 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 0EA3130E2675C39B00D5C092 /* Project object */; +} diff --git a/Safari/Gitako/Gitako.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Safari/Gitako/Gitako.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/Safari/Gitako/Gitako.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Safari/Gitako/Gitako.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Safari/Gitako/Gitako.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Safari/Gitako/Gitako.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Safari/Gitako/Gitako/AppDelegate.swift b/Safari/Gitako/Gitako/AppDelegate.swift new file mode 100644 index 0000000..7396502 --- /dev/null +++ b/Safari/Gitako/Gitako/AppDelegate.swift @@ -0,0 +1,25 @@ +// +// AppDelegate.swift +// Gitako +// +// Created by Enix on 13/6/2021. +// + +import Cocoa + +@main +class AppDelegate: NSObject, NSApplicationDelegate { + + func applicationDidFinishLaunching(_ notification: Notification) { + // Insert code here to initialize your application + } + + func applicationWillTerminate(_ notification: Notification) { + // Insert code here to tear down your application + } + + func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { + return true + } + +} diff --git a/Safari/Gitako/Gitako/Assets.xcassets/AccentColor.colorset/Contents.json b/Safari/Gitako/Gitako/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/Safari/Gitako/Gitako/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Safari/Gitako/Gitako/Assets.xcassets/AppIcon.appiconset/Contents.json b/Safari/Gitako/Gitako/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..1fc4d50 --- /dev/null +++ b/Safari/Gitako/Gitako/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,61 @@ +{ + "images" : [ + { + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "filename" : "Gitako-64.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "filename" : "Gitako-128.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "filename" : "Gitako-256.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Safari/Gitako/Gitako/Assets.xcassets/AppIcon.appiconset/Gitako-128.png b/Safari/Gitako/Gitako/Assets.xcassets/AppIcon.appiconset/Gitako-128.png new file mode 100644 index 0000000..60c967f Binary files /dev/null and b/Safari/Gitako/Gitako/Assets.xcassets/AppIcon.appiconset/Gitako-128.png differ diff --git a/Safari/Gitako/Gitako/Assets.xcassets/AppIcon.appiconset/Gitako-256.png b/Safari/Gitako/Gitako/Assets.xcassets/AppIcon.appiconset/Gitako-256.png new file mode 100644 index 0000000..6902e60 Binary files /dev/null and b/Safari/Gitako/Gitako/Assets.xcassets/AppIcon.appiconset/Gitako-256.png differ diff --git a/Safari/Gitako/Gitako/Assets.xcassets/AppIcon.appiconset/Gitako-64.png b/Safari/Gitako/Gitako/Assets.xcassets/AppIcon.appiconset/Gitako-64.png new file mode 100644 index 0000000..e9db0ac Binary files /dev/null and b/Safari/Gitako/Gitako/Assets.xcassets/AppIcon.appiconset/Gitako-64.png differ diff --git a/Safari/Gitako/Gitako/Assets.xcassets/Contents.json b/Safari/Gitako/Gitako/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/Safari/Gitako/Gitako/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Safari/Gitako/Gitako/Base.lproj/Main.storyboard b/Safari/Gitako/Gitako/Base.lproj/Main.storyboard new file mode 100644 index 0000000..c29b1b6 --- /dev/null +++ b/Safari/Gitako/Gitako/Base.lproj/Main.storyboard @@ -0,0 +1,167 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Safari/Gitako/Gitako/Gitako.entitlements b/Safari/Gitako/Gitako/Gitako.entitlements new file mode 100644 index 0000000..f2ef3ae --- /dev/null +++ b/Safari/Gitako/Gitako/Gitako.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + + diff --git a/Safari/Gitako/Gitako/Info.plist b/Safari/Gitako/Gitako/Info.plist new file mode 100644 index 0000000..c748bf6 --- /dev/null +++ b/Safari/Gitako/Gitako/Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + $(MARKETING_VERSION) + CFBundleVersion + $(MARKETING_VERSION) + LSApplicationCategoryType + public.app-category.productivity + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSMainStoryboardFile + Main + NSPrincipalClass + NSApplication + + diff --git a/Safari/Gitako/Gitako/ViewController.swift b/Safari/Gitako/Gitako/ViewController.swift new file mode 100644 index 0000000..d84c4ea --- /dev/null +++ b/Safari/Gitako/Gitako/ViewController.swift @@ -0,0 +1,51 @@ +// +// ViewController.swift +// Gitako +// +// Created by Enix on 13/6/2021. +// + +import Cocoa +import SafariServices.SFSafariApplication +import SafariServices.SFSafariExtensionManager + +let appName = "Gitako" +let extensionBundleIdentifier = "enixcoda.Gitako.Extension" + +class ViewController: NSViewController { + + @IBOutlet var appNameLabel: NSTextField! + + override func viewDidLoad() { + super.viewDidLoad() + self.appNameLabel.stringValue = appName + SFSafariExtensionManager.getStateOfSafariExtension(withIdentifier: extensionBundleIdentifier) { (state, error) in + guard let state = state, error == nil else { + // Insert code to inform the user that something went wrong. + return + } + + DispatchQueue.main.async { + if (state.isEnabled) { + self.appNameLabel.stringValue = "\(appName)'s extension is currently on. You can close this window now." + } else { + self.appNameLabel.stringValue = "\(appName)'s extension is currently off. You can turn it on in Safari Extensions preferences." + } + } + } + } + + @IBAction func openSafariExtensionPreferences(_ sender: AnyObject?) { + SFSafariApplication.showPreferencesForExtension(withIdentifier: extensionBundleIdentifier) { error in + guard error == nil else { + // Insert code to inform the user that something went wrong. + return + } + + DispatchQueue.main.async { + NSApplication.shared.terminate(nil) + } + } + } + +} diff --git a/Safari/Gitako/GitakoTests/GitakoTests.swift b/Safari/Gitako/GitakoTests/GitakoTests.swift new file mode 100644 index 0000000..ab23269 --- /dev/null +++ b/Safari/Gitako/GitakoTests/GitakoTests.swift @@ -0,0 +1,33 @@ +// +// GitakoTests.swift +// GitakoTests +// +// Created by Enix on 13/6/2021. +// + +import XCTest +@testable import Gitako + +class GitakoTests: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testPerformanceExample() throws { + // This is an example of a performance test case. + self.measure { + // Put the code you want to measure the time of here. + } + } + +} diff --git a/Safari/Gitako/GitakoTests/Info.plist b/Safari/Gitako/GitakoTests/Info.plist new file mode 100644 index 0000000..64d65ca --- /dev/null +++ b/Safari/Gitako/GitakoTests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/Safari/Gitako/GitakoUITests/GitakoUITests.swift b/Safari/Gitako/GitakoUITests/GitakoUITests.swift new file mode 100644 index 0000000..3bcaea9 --- /dev/null +++ b/Safari/Gitako/GitakoUITests/GitakoUITests.swift @@ -0,0 +1,42 @@ +// +// GitakoUITests.swift +// GitakoUITests +// +// Created by Enix on 13/6/2021. +// + +import XCTest + +class GitakoUITests: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + continueAfterFailure = false + + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + // UI tests must launch the application that they test. + let app = XCUIApplication() + app.launch() + + // Use recording to get started writing UI tests. + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testLaunchPerformance() throws { + if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) { + // This measures how long it takes to launch your application. + measure(metrics: [XCTApplicationLaunchMetric()]) { + XCUIApplication().launch() + } + } + } +} diff --git a/Safari/Gitako/GitakoUITests/Info.plist b/Safari/Gitako/GitakoUITests/Info.plist new file mode 100644 index 0000000..64d65ca --- /dev/null +++ b/Safari/Gitako/GitakoUITests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/package.json b/package.json index 57c14b2..5b71c77 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "private": true, "homepage": "https://github.com/EnixCoda/Gitako", "scripts": { - "start": "VERSION=dev-v$(node scripts/get-version.js) webpack --watch", + "dev": "VERSION=dev-v$(node scripts/get-version.js) webpack --watch", + "dev-safari": "TARGET=safari yarn run dev", "debug-firefox": "web-ext run -s dist", "analyse-bundle": "ANALYSE= NODE_ENV=production webpack", "postinstall": "rm -rf node_modules/@types/react-native && node scripts/fix-pjax-api", diff --git a/src/components/Highlight.tsx b/src/components/Highlight.tsx index 083630d..820a294 100644 --- a/src/components/Highlight.tsx +++ b/src/components/Highlight.tsx @@ -1,18 +1,23 @@ import * as React from 'react' -export function Highlight(props: { text: string; match?: RegExp }) { +export function Highlight(props: { text: string; match?: RegExp | string }) { const { text, match } = props const $match = React.useMemo(() => { - if (match instanceof RegExp) { - if (match.flags.includes('g')) return match - return new RegExp(match.source, 'g' + match.flags) + if (match) { + if (match instanceof RegExp) { + if (match.flags.includes('g')) return match + return new RegExp(match.source, 'g' + match.flags) + } + return new RegExp(match, 'g') } return null }, [match]) - if (!($match instanceof RegExp) || typeof text !== 'string') return <>{text} + if (!$match) return <>{text} - const matchedPieces = Array.from(text.matchAll($match)).map(([text]) => text) + const matchedPieces = Array.from(text.matchAll($match)).map( + ([text, highlightText = text]) => highlightText, + ) const preservedPieces = text.split($match) const content = [] diff --git a/src/components/HighlightOnIndexes.tsx b/src/components/HighlightOnIndexes.tsx new file mode 100644 index 0000000..189b2ce --- /dev/null +++ b/src/components/HighlightOnIndexes.tsx @@ -0,0 +1,17 @@ +import * as React from 'react'; + +export function HighlightOnIndexes(props: { text: string; indexes?: number[]; }) { + const { text, indexes } = props; + + if (!indexes?.length) + return <>{text}; + + return ( + <> + {text + .split('') + .map((char, i) => indexes.includes(i) ? {char} : {char} + )} + + ); +} diff --git a/src/components/ResizeHandler.tsx b/src/components/ResizeHandler.tsx index 05692f9..4c4442a 100644 --- a/src/components/ResizeHandler.tsx +++ b/src/components/ResizeHandler.tsx @@ -75,7 +75,9 @@ export function useResizeHandler( return () => window.removeEventListener('pointerup', onPointerUp) }, []) - const onPointerDown = React.useCallback(({ clientX, clientY }: React.PointerEvent) => { + const onPointerDown = React.useCallback((e: React.PointerEvent) => { + e.preventDefault() // Prevent unexpected selection when dragging in Safari + const { clientX, clientY } = e pointerDown.current = true initialSizeRef.current = [clientX, clientY] baseSize.current = latestPropSize.current diff --git a/src/components/SelectInput.tsx b/src/components/SelectInput.tsx index 3701e9b..48479a4 100644 --- a/src/components/SelectInput.tsx +++ b/src/components/SelectInput.tsx @@ -11,21 +11,24 @@ export function SelectInput({ } >) { return ( - +
+ + +
) } export type Option = { diff --git a/src/components/SideBar.tsx b/src/components/SideBar.tsx index a351b38..a2cb811 100644 --- a/src/components/SideBar.tsx +++ b/src/components/SideBar.tsx @@ -10,7 +10,7 @@ import { platform } from 'platforms' import * as React from 'react' import { cx } from 'utils/cx' import * as DOMHelper from 'utils/DOMHelper' -import { run } from 'utils/general' +import { detectBrowser, run } from 'utils/general' import { useCatchNetworkError } from 'utils/hooks/useCatchNetworkError' import { useLoadedContext } from 'utils/hooks/useLoadedContext' import { useOnPJAXDone, usePJAX } from 'utils/hooks/usePJAX' @@ -49,6 +49,10 @@ export function SideBar() { } }, [hasMetaData]) + React.useEffect(() => { + if (detectBrowser() === 'Safari') DOMHelper.markGitakoSafariFlag() + }, []) + const sidebarToggleMode = configContext.value.sidebarToggleMode const intelligentToggle = configContext.value.intelligentToggle const $shouldShow = useStateIO(intelligentToggle === null ? false : intelligentToggle) diff --git a/src/components/SideBarBodyWrapper.tsx b/src/components/SideBarBodyWrapper.tsx index 63dd118..e9a6a98 100644 --- a/src/components/SideBarBodyWrapper.tsx +++ b/src/components/SideBarBodyWrapper.tsx @@ -6,6 +6,8 @@ import { defaultConfigs } from 'utils/config/helper' import { cx } from 'utils/cx' import { setCSSVariable } from 'utils/DOMHelper' import * as features from 'utils/features' +import { detectBrowser } from 'utils/general' +import { useConditionalHook } from '../utils/hooks/useConditionalHook' type Size = number export type Size2D = [Size, Size] @@ -36,6 +38,11 @@ export function SideBarBodyWrapper({ const configContext = useConfigs() const blockLeaveRef = React.useRef(false) + const heightForSafari = useConditionalHook( + () => detectBrowser() === 'Safari', + () => useWindowSize().height, + ) + React.useEffect(() => { setSize(baseSize) }, [baseSize]) @@ -95,11 +102,12 @@ export function SideBarBodyWrapper({ [onLeave], ) - const newLocal: [number, number] = React.useMemo(() => [size, size], [size]) + const dummySize: [number, number] = React.useMemo(() => [size, size], [size]) return (
{children}
@@ -113,7 +121,7 @@ export function SideBarBodyWrapper({ onResizeStateChange={state => { blockLeaveRef.current = state === 'resizing' }} - size={newLocal} + size={dummySize} /> )}
diff --git a/src/components/searchModes/fuzzyMode.tsx b/src/components/searchModes/fuzzyMode.tsx index d500e7f..b2e495b 100644 --- a/src/components/searchModes/fuzzyMode.tsx +++ b/src/components/searchModes/fuzzyMode.tsx @@ -2,7 +2,7 @@ import * as React from 'react' import { cx } from 'utils/cx' import { hasUpperCase } from 'utils/general' import { ModeShape } from '.' -import { Highlight } from '../Highlight' +import { HighlightOnIndexes } from '../HighlightOnIndexes' export const fuzzyMode: ModeShape = { getSearchParams(searchKey) { @@ -26,13 +26,13 @@ export const fuzzyMode: ModeShape = { let progress = 0 return chunks.map((chunk, index, chunks) => { const chunkIndexes = indexes.filter(i => i >= progress && i < chunk.length + progress) - const regexp = chunkIndexes.length - ? new RegExp(chunkIndexes.map(i => `(?<=^.{${i - progress}}).`).join('|')) - : undefined - progress += chunk.length + 1 + + const highlightIndexes = chunkIndexes.length ? chunkIndexes.map(i => i - progress) : undefined + + progress += chunk.length + 1 // not neat side effect in map function return ( - + ) }) diff --git a/src/components/searchModes/regexMode.tsx b/src/components/searchModes/regexMode.tsx index 6de1b3b..bfd3b39 100644 --- a/src/components/searchModes/regexMode.tsx +++ b/src/components/searchModes/regexMode.tsx @@ -1,29 +1,22 @@ import * as React from 'react' import { cx } from 'utils/cx' -import { hasUpperCase, isValidRegexpSource, searchKeyToRegexp } from 'utils/general' +import { searchKeyToRegexp } from 'utils/general' import { ModeShape } from '.' import { Highlight } from '../Highlight' export const regexMode: ModeShape = { getSearchParams(searchKey) { - if (!searchKey) return null - const regexp = searchKeyToRegexp(searchKey) if (regexp) { - const matchNode = (node: TreeNode) => regexp.test(node.name) - return { - matchNode, + matchNode: node => regexp.test(node.name), } } return null }, renderNodeLabelText(node, searchKey) { - const regex = - searchKey && isValidRegexpSource(searchKey) - ? new RegExp(searchKey, 'g' + (hasUpperCase(searchKey) ? '' : 'i')) - : undefined + const regex = searchKeyToRegexp(searchKey) || undefined const { name } = node return name.includes('/') ? ( name.split('/').map((chunk, index, chunks) => ( diff --git a/src/styles/index.scss b/src/styles/index.scss index a3b5681..5d9cfa7 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -86,6 +86,19 @@ $minimal-z-index: max( } } +@mixin pseudo-primer-icon($icon-name) { + content: ''; + display: block; + cursor: pointer; + user-select: none; + -webkit-mask-image: url('~@primer/octicons/build/svg/' + $icon-name + '.svg?inline'); + mask-image: url('~@primer/octicons/build/svg/' + $icon-name + '.svg?inline'); + -webkit-mask-size: contain; + mask-size: contain; + -webkit-mask-position: center; + mask-position: center; +} + .#{$name}-ready { // github // code folding start @@ -116,19 +129,10 @@ $minimal-z-index: max( align-items: center; &::before { - content: ''; - display: block; width: 10px; height: 20px; - cursor: pointer; - user-select: none; transition: 0.25s ease; - -webkit-mask-image: url('~@primer/octicons/build/svg/chevron-down.svg?inline'); - mask-image: url('~@primer/octicons/build/svg/chevron-down.svg?inline'); - -webkit-mask-size: contain; - mask-size: contain; - -webkit-mask-position: center; - mask-position: center; + @include pseudo-primer-icon('chevron-down'); } @include interactive-background-on-before( @@ -894,16 +898,38 @@ $minimal-z-index: max( cursor: not-allowed; } } - select { - width: 100%; - -moz-appearance: menulist-button; - // make it look like text inputs - height: 36px; - border-radius: 6px; - border: 1px solid var(--gitako-border-default); - background: var(--gitako-canvas-default); - color: var(--gitako-fg-default); - box-shadow: var(--gitako-primer-shadow-inset); + .select-wrapper { + position: relative; + + select { + width: 100%; + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + // make it look like text inputs + height: 36px; + padding: 0 6px; + border-radius: 6px; + border: 1px solid var(--gitako-border-default); + background: var(--gitako-canvas-default); + color: var(--gitako-fg-default); + box-shadow: var(--gitako-primer-shadow-inset); + } + + .chevron { + position: absolute; + right: 6px; + top: 8px; + width: 10px; + height: 20px; + + &::before { + width: 10px; + height: 20px; + background-color: var(--gitako-fg-subtle); + @include pseudo-primer-icon('chevron-down'); + } + } } &.field-checkbox { padding-left: 20px; diff --git a/src/utils/DOMHelper.ts b/src/utils/DOMHelper.ts index 94ddee9..b369b46 100644 --- a/src/utils/DOMHelper.ts +++ b/src/utils/DOMHelper.ts @@ -2,15 +2,24 @@ * this helper helps manipulating DOM */ +export function setGitakoBodyClass(className: string, enable: boolean) { + const classList = document.body.classList + if (enable) classList.add(className) + else classList.remove(className) +} + /** * when gitako is ready, make page's header narrower * or cancel it */ export function markGitakoReadyState(ready: boolean) { const readyClassName = 'gitako-ready' - const classList = document.body.classList - if (ready) classList.add(readyClassName) - else classList.remove(readyClassName) + return setGitakoBodyClass(readyClassName, ready) +} + +export function markGitakoSafariFlag(enable = true) { + const className = 'gitako-safari' + return setGitakoBodyClass(className, enable) } /** diff --git a/src/utils/general.ts b/src/utils/general.ts index af14a56..619b889 100644 --- a/src/utils/general.ts +++ b/src/utils/general.ts @@ -34,6 +34,16 @@ function detectOS(): OperatingSystems { export const os = detectOS() +export const detectBrowser = () => { + const ua = navigator.userAgent.toLowerCase() + if (ua.includes('safari')) { + if (ua.includes('chrome')) return 'Chrome' + return 'Safari' + } + + return 'Other' +} + export function friendlyFormatShortcut(shortcut?: string) { if (!shortcut) return '' if (os === OperatingSystems.Windows) { @@ -133,13 +143,7 @@ export async function JSONRequest(url: string, data: any, extra: RequestInit = { export function searchKeyToRegexp(searchKey: string) { if (!searchKey) return null - try { - const flags = hasUpperCase(searchKey) ? '' : 'i' - // case-sensitive when searchKey contains uppercase char - return new RegExp(searchKey, flags) - } catch (err) { - return null // matching nothing if failed transforming regexp - } + return safeRegexp(searchKey, hasUpperCase(searchKey) ? 'g' : 'gi') } export function hasUpperCase(input: string) { @@ -155,15 +159,18 @@ export async function renderReact(element: ReactElement) { }) } -export function isValidRegexpSource(source: string) { +export function safeRegexp(pattern: string | RegExp, flags?: string | undefined) { try { - new RegExp(source) - return true + return new RegExp(pattern, flags) } catch (err) { - return false + return null } } +export function isValidRegexpSource(source: string) { + return Boolean(safeRegexp(source)) +} + export function withEffect any>( method: Method, effect: (payload: ReturnType) => void, diff --git a/src/utils/hooks/useConditionalHook.ts b/src/utils/hooks/useConditionalHook.ts new file mode 100644 index 0000000..613269d --- /dev/null +++ b/src/utils/hooks/useConditionalHook.ts @@ -0,0 +1,6 @@ +import * as React from "react"; + +export function useConditionalHook(condition: () => boolean, hook: () => T) { + const [use] = React.useState(condition) + if (use) return hook() +} diff --git a/webpack.config.js b/webpack.config.js index b28b018..c34aae7 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -9,6 +9,18 @@ const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPl const srcPath = path.resolve(__dirname, 'src') const packagesPath = path.resolve(__dirname, 'packages') +function resolvePathInput(input) { + return path.isAbsolute(input) ? input : path.resolve(process.cwd(), input) +} + +const buildTarget = process.env.TARGET +const buildTargetOutputMap = { + safari: 'Safari/Gitako/Gitako Extension/Resources', +} +const envOutputDir = process.env.OUTPUT_DIR || buildTargetOutputMap[buildTarget] +const outputPath = envOutputDir ? resolvePathInput(envOutputDir) : path.resolve(__dirname, 'dist') + +const IN_PRODUCTION_MODE = process.env.NODE_ENV === 'production' const plugins = [ new CopyWebpackPlugin([ { @@ -17,9 +29,25 @@ const plugins = [ transform(content) { const { version, description, author, homepage: homepage_url } = require('./package.json') const manifest = JSON.parse(content) - return JSON.stringify( - Object.assign(manifest, { version, description, author, homepage_url }), - ) + Object.assign(manifest, { + version, + description, + author, + homepage_url, + }) + + // Disable custom domains for Safari + if (buildTarget === 'safari') { + Reflect.deleteProperty(manifest, 'optional_permissions') + Reflect.deleteProperty(manifest, 'background') + } + + if (!IN_PRODUCTION_MODE) { + Object.assign(manifest, { + web_accessible_resources: manifest.web_accessible_resources.concat('*.map'), // enable source mapping while developing + }) + } + return JSON.stringify(manifest) }, }, { @@ -50,7 +78,6 @@ if (analyse) { console.log(`BundleAnalyzerPlugin added`) } -const IN_PRODUCTION_MODE = process.env.NODE_ENV === 'production' plugins.push( new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV), @@ -66,7 +93,7 @@ module.exports = { devtool: IN_PRODUCTION_MODE ? 'source-map' : 'inline-source-map', mode: IN_PRODUCTION_MODE ? 'production' : 'development', output: { - path: path.resolve(__dirname, 'dist'), + path: outputPath, filename: '[name].js', }, resolve: {