mirror of https://github.com/grafana/grafana.git
50 lines
42 KiB
JavaScript
50 lines
42 KiB
JavaScript
|
|
/* eslint-disable */
|
||
|
|
//prettier-ignore
|
||
|
|
module.exports = {
|
||
|
|
name: "@yarnpkg/plugin-licenses",
|
||
|
|
factory: function (require) {
|
||
|
|
"use strict";var plugin=(()=>{var ct=Object.create;var re=Object.defineProperty;var lt=Object.getOwnPropertyDescriptor;var ht=Object.getOwnPropertyNames;var dt=Object.getPrototypeOf,ft=Object.prototype.hasOwnProperty;var $=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+i+'" is not supported')});var te=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),oe=(i,e)=>{for(var t in e)re(i,t,{get:e[t],enumerable:!0})},Ee=(i,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ht(e))!ft.call(i,n)&&n!==t&&re(i,n,{get:()=>e[n],enumerable:!(s=lt(e,n))||s.enumerable});return i};var pt=(i,e,t)=>(t=i!=null?ct(dt(i)):{},Ee(e||!i||!i.__esModule?re(t,"default",{value:i,enumerable:!0}):t,i)),ut=i=>Ee(re({},"__esModule",{value:!0}),i);var Ie=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)};var C=(i,e,t)=>(Ie(i,e,"read from private field"),t?t.call(i):e.get(i)),ae=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)};var x=(i,e,t)=>(Ie(i,e,"access private method"),t);var je=te((Yt,We)=>{var ie=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,mt=typeof AbortController=="function",ce=mt?AbortController:class{constructor(){this.signal=new Ce}abort(e=new Error("This operation was aborted")){this.signal.reason=this.signal.reason||e,this.signal.aborted=!0,this.signal.dispatchEvent({type:"abort",target:this.signal})}},gt=typeof AbortSignal=="function",wt=typeof ce.AbortSignal=="function",Ce=gt?AbortSignal:wt?ce.AbortController:class{constructor(){this.reason=void 0,this.aborted=!1,this._listeners=[]}dispatchEvent(e){e.type==="abort"&&(this.aborted=!0,this.onabort(e),this._listeners.forEach(t=>t(e),this))}onabort(){}addEventListener(e,t){e==="abort"&&this._listeners.push(t)}removeEventListener(e,t){e==="abort"&&(this._listeners=this._listeners.filter(s=>s!==t))}},ke=new Set,ye=(i,e)=>{let t=`LRU_CACHE_OPTION_${i}`;le(t)&&ve(t,`${i} option`,`options.${e}`,z)},be=(i,e)=>{let t=`LRU_CACHE_METHOD_${i}`;if(le(t)){let{prototype:s}=z,{get:n}=Object.getOwnPropertyDescriptor(s,i);ve(t,`${i} method`,`cache.${e}()`,n)}},yt=(i,e)=>{let t=`LRU_CACHE_PROPERTY_${i}`;if(le(t)){let{prototype:s}=z,{get:n}=Object.getOwnPropertyDescriptor(s,i);ve(t,`${i} property`,`cache.${e}`,n)}},Me=(...i)=>{typeof process=="object"&&process&&typeof process.emitWarning=="function"?process.emitWarning(...i):console.error(...i)},le=i=>!ke.has(i),ve=(i,e,t,s)=>{ke.add(i);let n=`The ${e} is deprecated. Please use ${t} instead.`;Me(n,"DeprecationWarning",i,s)},M=i=>i&&i===Math.floor(i)&&i>0&&isFinite(i),Ue=i=>M(i)?i<=Math.pow(2,8)?Uint8Array:i<=Math.pow(2,16)?Uint16Array:i<=Math.pow(2,32)?Uint32Array:i<=Number.MAX_SAFE_INTEGER?V:null:null,V=class extends Array{constructor(e){super(e),this.fill(0)}},$e=class{constructor(e){if(e===0)return[];let t=Ue(e);this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},z=class{constructor(e={}){let{max:t=0,ttl:s,ttlResolution:n=1,ttlAutopurge:r,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:f,dispose:c,disposeAfter:l,noDisposeOnSet:g,noUpdateTTL:h,maxSize:p=0,maxEntrySize:y=0,sizeCalculation:d,fetchMethod:u,fetchContext:P,noDeleteOnFetchRejection:F,noDeleteOnStaleGet:k,allowStaleOnFetchRejection:b,allowStaleOnFetchAbort:D,ignoreFetchAbort:E}=e,{length:I,maxAge:R,stale:ee}=e instanceof z?{}:e;if(t!==0&&!M(t))throw new TypeError("max option must be a nonnegative integer");let ge=t?Ue(t):Array;if(!ge)throw new Error("invalid max value: "+t);if(this.max=t,this.maxSize=p,this.maxEntrySize=y||this.maxSize,this.sizeCalculation=d||I,this.sizeCalculation){if(!this.maxSize&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(this.fetc
|
||
|
|
|
||
|
|
NOTICE
|
||
|
|
|
||
|
|
${u}`:y,F=o.get(P);F?F.set(l.name,l):o.set(P,new Map([[l.name,l]]))}let a=`THE FOLLOWING SETS FORTH ATTRIBUTION NOTICES FOR THIRD PARTY SOFTWARE THAT MAY BE CONTAINED IN PORTIONS OF THE ${String(i.topLevelWorkspace.manifest.raw.name).toUpperCase().replace(/-/g," ")} PRODUCT.
|
||
|
|
|
||
|
|
`;for(let[f,c]of o.entries()){a+=`-----
|
||
|
|
|
||
|
|
`;let l=[],g=[];for(let{name:p,repository:y}of c.values()){l.push(p);let d=st(y);d&&g.push(c.size===1?d:`${d} (${p})`)}let h=[];h.push(`The following software may be included in this product: ${l.join(", ")}.`),g.length>0&&h.push(`A copy of the source code may be downloaded from ${g.join(", ")}.`),h.push("This software contains the following license and notice below:"),a+=`${h.join(" ")}
|
||
|
|
|
||
|
|
`,a+=`${f.trim()}
|
||
|
|
|
||
|
|
`}return a};var J=class extends O.Command{constructor(){super(...arguments);this.recursive=O.Option.Boolean("-R,--recursive",!1,{description:"Include transitive dependencies (dependencies of direct dependencies)"});this.production=O.Option.Boolean("--production",!1,{description:"Exclude development dependencies"});this.json=O.Option.Boolean("--json",!1,{description:"Format output as JSON"});this.excludeMetadata=O.Option.Boolean("--exclude-metadata",!1,{description:"Exclude dependency metadata from output"});this.focus=O.Option.Array("--focus",[],{description:"Focus on one or more workspaces"})}async execute(){let t=await K.Configuration.find(this.context.cwd,this.context.plugins),{project:s,workspace:n}=await K.Project.find(t,this.context.cwd);if(!n)throw new rt.WorkspaceRequiredError(s.cwd,this.context.cwd);await s.restoreInstallState(),await G(s,this.focus,this.recursive,this.production);let r=await ue(s,this.json,this.recursive,this.production,this.excludeMetadata);K.treeUtils.emitTree(r,{configuration:t,stdout:this.context.stdout,json:this.json,separators:1})}};J.paths=[["licenses","list"]],J.usage=O.Command.Usage({description:"display the licenses for all packages in the project",details:`
|
||
|
|
This command prints the license information for packages in the project. By default, only direct dependencies are listed.
|
||
|
|
|
||
|
|
If \`-R,--recursive\` is set, the listing will include transitive dependencies (dependencies of direct dependencies).
|
||
|
|
|
||
|
|
If \`--production\` is set, the listing will exclude development dependencies.
|
||
|
|
|
||
|
|
If \`--focus\` is passed, the listing will only include dependencies of the specified workspaces.
|
||
|
|
`,examples:[["List all licenses of direct dependencies","$0 licenses list"],["List all licenses of direct and transitive dependencies","$0 licenses list --recursive"],["List all licenses of production dependencies only","$0 licenses list --production"],["List all licenses for specified workspaces only","$0 licenses list --focus <workspace-a> --focus <workspace-b>"]]});var ot=$("@yarnpkg/cli"),me=$("@yarnpkg/core"),B=$("clipanion");var X=class extends B.Command{constructor(){super(...arguments);this.recursive=B.Option.Boolean("-R,--recursive",!1,{description:"Include transitive dependencies (dependencies of direct dependencies)"});this.production=B.Option.Boolean("--production",!1,{description:"Exclude development dependencies"});this.focus=B.Option.Array("--focus",[],{description:"Focus on one or more workspaces"})}async execute(){let t=await me.Configuration.find(this.context.cwd,this.context.plugins),{project:s,workspace:n}=await me.Project.find(t,this.context.cwd);if(!n)throw new ot.WorkspaceRequiredError(s.cwd,this.context.cwd);await s.restoreInstallState(),await G(s,this.focus,this.recursive,this.production);let r=await nt(s,this.recursive,this.production);this.context.stdout.write(r)}};X.paths=[["licenses","generate-disclaimer"]],X.usage=B.Command.Usage({description:"display the license disclaimer including all packages in the project",details:`
|
||
|
|
This command prints the license disclaimer for packages in the project. By default, only direct dependencies are listed.
|
||
|
|
|
||
|
|
If \`-R,--recursive\` is set, the disclaimer will include transitive dependencies (dependencies of direct dependencies).
|
||
|
|
|
||
|
|
If \`--production\` is set, the disclaimer will exclude development dependencies.
|
||
|
|
|
||
|
|
If \`--focus\` is passed, the disclaimer will only include dependencies of the specified workspaces.
|
||
|
|
`,examples:[["Include licenses of direct dependencies","$0 licenses generate-disclaimer"],["Include licenses of direct and transitive dependencies","$0 licenses generate-disclaimer --recursive"],["Include licenses of production dependencies only","$0 licenses generate-disclaimer --production"],["Include licenses for specified workspaces only","$0 licenses generate-disclaimer --focus <workspace-a> --focus <workspace-b>"]]});var at=$("@yarnpkg/cli"),Z=$("@yarnpkg/core"),A=$("clipanion");var Q=class extends A.Command{constructor(){super(...arguments);this.recursive=A.Option.Boolean("-R,--recursive",!1,{description:"Include transitive dependencies (dependencies of direct dependencies)"});this.production=A.Option.Boolean("--production",!1,{description:"Exclude development dependencies"});this.json=A.Option.Boolean("--json",!1,{description:"Format output as JSON"});this.excludeMetadata=A.Option.Boolean("--exclude-metadata",!1,{description:"Exclude dependency metadata from output"});this.focus=A.Option.Array("--focus",[],{description:"Focus on one or more workspaces"});this.allowedLicenses=A.Option.Array("--allowed",[],{description:"List of allowed licenses"});this.blockedLicenses=A.Option.Array("--blocked",[],{description:"List of blocked licenses"})}async execute(){if(this.allowedLicenses.length===0==(this.blockedLicenses.length===0))throw new A.UsageError("You must provide at least one of --allowed or --blocked, but not both");let t=await Z.Configuration.find(this.context.cwd,this.context.plugins),{project:s,workspace:n}=await Z.Project.find(t,this.context.cwd);if(!n)throw new at.WorkspaceRequiredError(s.cwd,this.context.cwd);await s.restoreInstallState(),await G(s,this.focus,this.recursive,this.production);let r=await ue(s,this.json,this.recursive,this.production,this.excludeMetadata),o=[];for(let[a,f]of Object.entries(r.children)){if(!f)continue;let c=this.allowedLicenses.length===0||this.allowedLicenses.includes(a),l=this.blockedLicenses.length!==0&&this.blockedLicenses.includes(a);(!c||l)&&o.push(f)}return Z.treeUtils.emitTree({children:o},{configuration:t,stdout:this.context.stdout,json:this.json,separators:1}),o.length>0?1:0}};Q.paths=[["licenses","audit"]],Q.usage=A.Command.Usage({description:"audits the licenses for all packages in the project",details:`
|
||
|
|
This command audits and prints the license information for packages in the project that violate the rules set. By default, only direct dependencies are audited.
|
||
|
|
|
||
|
|
If \`-R,--recursive\` is set, the auditing will include transitive dependencies (dependencies of direct dependencies).
|
||
|
|
|
||
|
|
If \`--production\` is set, the auditing will exclude development dependencies.
|
||
|
|
|
||
|
|
If \`--focus\` is passed, the auditing will only include dependencies of the specified workspaces.
|
||
|
|
|
||
|
|
If \`--allowed\` is passed, the auditing will accept dependencies with the specified allowed licenses.
|
||
|
|
|
||
|
|
If \`--blocked\` is passed, the auditing will reject dependencies with the specified blocked licenses.
|
||
|
|
`,examples:[["Audit all licenses of direct dependencies","$0 licenses audit --blocked GPL-3.0"],["Audit all licenses of direct and transitive dependencies","$0 licenses audit --blocked GPL-3.0 --recursive"],["Audit all licenses of production dependencies only","$0 licenses audit --blocked GPL-3.0 --production"],["Audit all licenses for specified workspaces only","$0 licenses audit --blocked GPL-3.0 --focus <workspace-a> --focus <workspace-b>"]]});var Dt={commands:[J,X,Q]},Rt=Dt;return ut(Nt);})();
|
||
|
|
return plugin;
|
||
|
|
}
|
||
|
|
};
|