2b01ec14bf
This PR contains the work done to update the live tests to the latest data plus lots of QoL improvements to the library, including: * added test cases to test the ``AmiiboService` locally; * conformed the models to the `Hashable` protocol; * documented the use of caching with the `AmiiboService` service; * updated the reference to the new AmiiboAPI url; * updated the year on the copyrights and header files; * updated the overall documentation of the source code and the package. Reviewed-on: #22 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
10 lines
9.1 KiB
JavaScript
10 lines
9.1 KiB
JavaScript
/*!
|
|
* This source file is part of the Swift.org open source project
|
|
*
|
|
* Copyright (c) 2021 Apple Inc. and the Swift project authors
|
|
* Licensed under Apache License v2.0 with Runtime Library Exception
|
|
*
|
|
* See https://swift.org/LICENSE.txt for license information
|
|
* See https://swift.org/CONTRIBUTORS.txt for Swift project authors
|
|
*/
|
|
"use strict";(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[255],{7735:function(e,n,t){t.r(n),t.d(n,{default:function(){return S}});t(8111),t(1701);function a(e){return e?"string"===typeof e?e:e.source:null}function s(e){return i("(?=",e,")")}function i(...e){const n=e.map(e=>a(e)).join("");return n}function c(e){const n=e[e.length-1];return"object"===typeof n&&n.constructor===Object?(e.splice(e.length-1,1),n):{}}function o(...e){const n=c(e),t="("+(n.capture?"":"?:")+e.map(e=>a(e)).join("|")+")";return t}const r=e=>i(/\b/,e,/\w$/.test(e)?/\b/:/\B/),u=["Protocol","Type"].map(r),l=["init","self"].map(r),d=["Any","Self"],m=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],p=["false","nil","true"],b=["assignment","associativity","higherThan","left","lowerThan","none","right"],F=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],f=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],h=o(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),w=o(h,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),y=i(h,w,"*"),g=o(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),v=o(g,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),E=i(g,v,"*"),A=i(/[A-Z]/,v,"*"),k=["attached","autoclosure",i(/convention\(/,o("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",i(/objc\(/,E,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],C=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function N(e){const n={match:/\s+/,relevance:0},t=e.COMMENT("/\\*","\\*/",{contains:["self"]}),a=[e.C_LINE_COMMENT_MODE,t],c={match:[/\./,o(...u,...l)],className:{2:"keyword"}},h={match:i(/\./,o(...m)),relevance:0},g=m.filter(e=>"string"===typeof e).concat(["_|0"]),N=m.filter(e=>"string"!==typeof e).concat(d).map(r),S={variants:[{className:"keyword",match:o(...N,...l)}]},B={$pattern:o(/\b\w+/,/#\w+/),keyword:g.concat(F),literal:p},_=[c,h,S],D={match:i(/\./,o(...f)),relevance:0},x={className:"built_in",match:i(/\b/,o(...f),/(?=\()/)},M=[D,x],I={match:/->/,relevance:0},$={className:"operator",relevance:0,variants:[{match:y},{match:`\\.(\\.|${w})+`}]},L=[I,$],O="([0-9]_*)+",K="([0-9a-fA-F]_*)+",P={className:"number",relevance:0,variants:[{match:`\\b(${O})(\\.(${O}))?([eE][+-]?(${O}))?\\b`},{match:`\\b0x(${K})(\\.(${K}))?([pP][+-]?(${O}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},T=(e="")=>({className:"subst",variants:[{match:i(/\\/,e,/[0\\tnr"']/)},{match:i(/\\/,e,/u\{[0-9a-fA-F]{1,8}\}/)}]}),j=(e="")=>({className:"subst",match:i(/\\/,e,/[\t ]*(?:[\r\n]|\r\n)/)}),z=(e="")=>({className:"subst",label:"interpol",begin:i(/\\/,e,/\(/),end:/\)/}),q=(e="")=>({begin:i(e,/"""/),end:i(/"""/,e),contains:[T(e),j(e),z(e)]}),U=(e="")=>({begin:i(e,/"/),end:i(/"/,e),contains:[T(e),z(e)]}),W={className:"string",variants:[q(),q("#"),q("##"),q("###"),U(),U("#"),U("##"),U("###")]},Z=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],V={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:Z},G=e=>{const n=i(e,/\//),t=i(/\//,e);return{begin:n,end:t,contains:[...Z,{scope:"comment",begin:`#(?!.*${t})`,end:/$/}]}},H={scope:"regexp",variants:[G("###"),G("##"),G("#"),V]},R={match:i(/`/,E,/`/)},X={className:"variable",match:/\$\d+/},J={className:"variable",match:`\\$${v}+`},Q=[R,X,J],Y={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:C,contains:[...L,P,W]}]}},ee={scope:"keyword",match:i(/@/,o(...k),s(o(/\(/,/\s+/)))},ne={scope:"meta",match:i(/@/,E)},te=[Y,ee,ne],ae={match:s(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:i(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,v,"+")},{className:"type",match:A,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:i(/\s+&\s+/,s(A)),relevance:0}]},se={begin:/</,end:/>/,keywords:B,contains:[...a,..._,...te,I,ae]};ae.contains.push(se);const ie={match:i(E,/\s*:/),keywords:"_|0",relevance:0},ce={begin:/\(/,end:/\)/,relevance:0,keywords:B,contains:["self",ie,...a,H,..._,...M,...L,P,W,...Q,...te,ae]},oe={begin:/</,end:/>/,keywords:"repeat each",contains:[...a,ae]},re={begin:o(s(i(E,/\s*:/)),s(i(E,/\s+/,E,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:E}]},ue={begin:/\(/,end:/\)/,keywords:B,contains:[re,...a,..._,...L,P,W,...te,ae,ce],endsParent:!0,illegal:/["']/},le={match:[/(func|macro)/,/\s+/,o(R.match,E,y)],className:{1:"keyword",3:"title.function"},contains:[oe,ue,n],illegal:[/\[/,/%/]},de={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[oe,ue,n],illegal:/\[|%/},me={match:[/operator/,/\s+/,y],className:{1:"keyword",3:"title"}},pe={begin:[/precedencegroup/,/\s+/,A],className:{1:"keyword",3:"title"},contains:[ae],keywords:[...b,...p],end:/}/},be={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Fe={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},fe={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,E,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:B,contains:[oe,..._,{begin:/:/,end:/\{/,keywords:B,contains:[{scope:"title.class.inherited",match:A},..._],relevance:0}]};for(const s of W.variants){const e=s.contains.find(e=>"interpol"===e.label);e.keywords=B;const n=[..._,...M,...L,P,W,...Q];e.contains=[...n,{begin:/\(/,end:/\)/,contains:["self",...n]}]}return{name:"Swift",keywords:B,contains:[...a,le,de,be,Fe,fe,me,pe,{beginKeywords:"import",end:/$/,contains:[...a],relevance:0},H,..._,...M,...L,P,W,...Q,...te,ae,ce]}}function S(e){const n=N(e),t=({beginKeywords:e=""})=>e.split(" ").includes("class"),a=n.contains.findIndex(t);if(a>=0){const{beginKeywords:e,...t}=n.contains[a];n.contains[a]={...t,begin:/\b(struct|protocol|extension|enum|actor|class\b(?!.*\bfunc))\b/}}const s=e=>{const{className:n,match:t}=e;if("subst"!==n||!t)return!1;const a=t.toString();return a.startsWith("\\")&&a.endsWith("[\\t ]*(?:[\\r\\n]|\\r\\n)")},i=n.contains.findIndex(({className:e})=>"string"===e);return n.contains[i]={...n.contains[i],variants:n.contains[i].variants.map(e=>({...e,contains:e.contains.map(e=>s(e)?{className:"subst",begin:/\\#{0,3}/,end:/[\t ]*(?:[\r\n]|\r\n)/,excludeEnd:!0}:e)}))},n}}}]); |