UNPKG

great-tariff

Version:

A satirical NPM package that lets you apply fake tariffs to imported modules in your JavaScript project.

6 lines 2.49 kB
"use strict";var s=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var n=(e,o)=>s(e,"name",{value:o,configurable:!0});var P=(e,o)=>{for(var t in o)s(e,t,{get:o[t],enumerable:!0})},x=(e,o,t,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of h(o))!C.call(e,i)&&i!==t&&s(e,i,{get:()=>o[i],enumerable:!(r=$(o,i))||r.enumerable});return e};var w=e=>x(s({},"__esModule",{value:!0}),e);var A={};P(A,{default:()=>v,imposeTariff:()=>p,setConfig:()=>c});module.exports=w(A);function d({pkg:e,action:o,rate:t}){let r=[`The way "${e}" treats us is horrible. Just horrible.`,`"${e}"? Disaster. Sad. We're gonna fix it.`,`"${e}" has been taking advantage of us for years. Not anymore.`],i=[`"${e}"? Total joke. We're gonna delay it until it's great again.`,"It's not a delay. It's a negotiation tactic. Very strong."],a=[`We're putting a big, beautiful tariff on "${e}" \u2013 maybe the biggest ever. People are talking.`,`Nobody knows "${e}" better than me. And it needs a tariff. Believe me.`,`Tremendous tariff on "${e}". It's going to be so fair, you won't believe it.`,`We used to import "${e}" for free. Can you believe that! Not anymore!`,`I talked to many smart people \u2014 they all agree "${e}" needs a tariff.`],f=o==="block"?r:o==="delay"?i:a,b=["\u{1F6A8} Tariff Alert!","\u{1F4E2} Presidential Import Tax in Effect:","\u{1F1FA}\u{1F1F8} Making Imports Great Again...",`\u{1F9F1} Building a firewall against "${e}"...`,`\u{1F575}\uFE0F Evaluating "${e}" for national import security...`],T=t?`This will be a ${t}% tariff. Historic.`:"No free rides here, folks.",g=n(u=>u[Math.floor(Math.random()*u.length)],"random");return`${g(b)} \u{1F5E3}\uFE0F ${g(f)} \u{1F4CA} ${T}`}n(d,"getQuote");var l={policies:{},mode:"MakeImportsGreatAgain"},m=l;function c(e){m={...l,...e,policies:{...l.policies,...e.policies}}}n(c,"setConfig");function y(){return m}n(y,"getConfig");var I=n(e=>new Promise(o=>setTimeout(o,e)),"delay");async function p(e){let t=y().policies?.[e];if(!t)return require(e);let{action:r,tariffRate:i=10}=t,a=d({pkg:e,action:r,rate:i});if(r==="block")throw new Error(`\u{1F6D1} Import Blocked: "${e}" ${a}`);if(r==="delay"){let f=i*10;console.log(`${a} \u23F3 Holding import for ${f}ms...`),await I(f)}return r==="log"&&console.warn(a),require(e)}n(p,"imposeTariff");var v={imposeTariff:p,setConfig:c};0&&(module.exports={imposeTariff,setConfig}); //# sourceMappingURL=index.cjs.map