Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vite-plugin-banner

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-banner - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

.github/workflows/codeql-analysis.yml

4

dist/vite-plugin-banner.js
/**
* name: vite-plugin-banner
* version: v0.2.0
* version: v0.3.0
* author: chengpeiquan

@@ -213,3 +213,3 @@ */

var viteConfig;
var includeRegexp = new RegExp(/\.(css|js)$/i);
var includeRegexp = new RegExp(/\.(css|[mc]?js)$/i);
var excludeRegexp = new RegExp(/vendor/);

@@ -216,0 +216,0 @@ function main (pluginOptions) {

/**
* name: vite-plugin-banner
* version: v0.2.0
* version: v0.3.0
* author: chengpeiquan

@@ -20,3 +20,3 @@ */

PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function i(t,n,e,r){return new(e||(e=Promise))((function(o,i){function c(t){try{a(r.next(t))}catch(t){i(t)}}function u(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){var n;t.done?o(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(c,u)}a((r=r.apply(t,n||[])).next())}))}function c(t,n){var e,r,o,i,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(e)throw new TypeError("Generator is already executing.");for(;c;)try{if(e=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return c.label++,{value:i[1],done:!1};case 5:c.label++,r=i[1],i=[0];continue;case 7:i=c.ops.pop(),c.trys.pop();continue;default:if(!(o=c.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){c=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){c.label=i[1];break}if(6===i[0]&&c.label<o[1]){c.label=o[1],o=i;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(i);break}o[2]&&c.ops.pop(),c.trys.pop();continue}i=n.call(t,c)}catch(t){i=[6,t],r=0}finally{e=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var u=new RegExp(/\.(css|js)$/i),a=new RegExp(/vendor/);module.exports=function(t){var e=function(t){var n={content:"",outDir:""},e=Object.prototype.toString.call(t);if(!["[object String]","[object Object]"].includes(e))throw new Error("[vite-plugin-banner] The options must be a string or an object.");if("string"==typeof t&&(n.content=t),"object"==typeof t){if(!Object.prototype.hasOwnProperty.call(t,"content"))throw new Error('[vite-plugin-banner] Missing "content" option.');n.content=t.content,Object.prototype.hasOwnProperty.call(t,"outDir")&&"string"==typeof t.outDir&&(n.outDir=t.outDir)}var r,o="string"!=typeof(r=n.content)?"The banner content must be a string.":r?r.includes("/*")&&!r.includes("*/")||!r.includes("/*")&&r.includes("*/")?"If you want to pass in comment symbols, you must pass them in pairs.":"":"The banner content can not be empty.";if(o)throw new Error("[vite-plugin-banner] ".concat(o));return n}(t);return{name:"banner",configResolved:function(t){r=t},writeBundle:function(t,l){return i(this,void 0,void 0,(function(){var t,i,s,f,p,b,y,h;return c(this,(function(c){for(t=0,i=Object.entries(l);t<i.length;t++)if(s=i[t],f=r.root,p=e.outDir||r.build.outDir||"dist",b=s[0].endsWith(".js-lean")?s[0].replace(/\.js-lean/,".lean.js"):s[0],y=n.resolve(f,p,b),u.test(b)&&!a.test(b))try{h=o.default.readFileSync(y,{encoding:"utf8"}),h=e.content.includes("/*")||e.content.includes("*/")?"".concat(e.content,"\n").concat(h):"/*! ".concat(e.content," */\n").concat(h),o.default.writeFileSync(y,h)}catch(t){}return[2]}))}))}}};
***************************************************************************** */function i(t,n,e,r){return new(e||(e=Promise))((function(o,i){function c(t){try{a(r.next(t))}catch(t){i(t)}}function u(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){var n;t.done?o(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(c,u)}a((r=r.apply(t,n||[])).next())}))}function c(t,n){var e,r,o,i,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(e)throw new TypeError("Generator is already executing.");for(;c;)try{if(e=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return c.label++,{value:i[1],done:!1};case 5:c.label++,r=i[1],i=[0];continue;case 7:i=c.ops.pop(),c.trys.pop();continue;default:if(!(o=c.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){c=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){c.label=i[1];break}if(6===i[0]&&c.label<o[1]){c.label=o[1],o=i;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(i);break}o[2]&&c.ops.pop(),c.trys.pop();continue}i=n.call(t,c)}catch(t){i=[6,t],r=0}finally{e=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var u=new RegExp(/\.(css|[mc]?js)$/i),a=new RegExp(/vendor/);module.exports=function(t){var e=function(t){var n={content:"",outDir:""},e=Object.prototype.toString.call(t);if(!["[object String]","[object Object]"].includes(e))throw new Error("[vite-plugin-banner] The options must be a string or an object.");if("string"==typeof t&&(n.content=t),"object"==typeof t){if(!Object.prototype.hasOwnProperty.call(t,"content"))throw new Error('[vite-plugin-banner] Missing "content" option.');n.content=t.content,Object.prototype.hasOwnProperty.call(t,"outDir")&&"string"==typeof t.outDir&&(n.outDir=t.outDir)}var r,o="string"!=typeof(r=n.content)?"The banner content must be a string.":r?r.includes("/*")&&!r.includes("*/")||!r.includes("/*")&&r.includes("*/")?"If you want to pass in comment symbols, you must pass them in pairs.":"":"The banner content can not be empty.";if(o)throw new Error("[vite-plugin-banner] ".concat(o));return n}(t);return{name:"banner",configResolved:function(t){r=t},writeBundle:function(t,l){return i(this,void 0,void 0,(function(){var t,i,s,f,p,b,y,h;return c(this,(function(c){for(t=0,i=Object.entries(l);t<i.length;t++)if(s=i[t],f=r.root,p=e.outDir||r.build.outDir||"dist",b=s[0].endsWith(".js-lean")?s[0].replace(/\.js-lean/,".lean.js"):s[0],y=n.resolve(f,p,b),u.test(b)&&!a.test(b))try{h=o.default.readFileSync(y,{encoding:"utf8"}),h=e.content.includes("/*")||e.content.includes("*/")?"".concat(e.content,"\n").concat(h):"/*! ".concat(e.content," */\n").concat(h),o.default.writeFileSync(y,h)}catch(t){}return[2]}))}))}}};
//# sourceMappingURL=vite-plugin-banner.min.js.map
{
"name": "vite-plugin-banner",
"version": "0.2.0",
"version": "0.3.0",
"description": "A banner plugin for Vite. Adds a banner to the top of each generated chunk.",

@@ -35,2 +35,3 @@ "main": "dist/vite-plugin-banner.min.js",

"@types/jest": "^27.4.0",
"@types/node": "^17.0.35",
"@typescript-eslint/eslint-plugin": "^5.9.0",

@@ -37,0 +38,0 @@ "@typescript-eslint/parser": "^5.9.0",

@@ -19,3 +19,3 @@ <p align='center'>

> ℹ️ **Only support for Vite 2.**
> ℹ️ **Only support for Vite 2.** <br>Since v0.3.0, ESM and CommonJS module files are supported.

@@ -22,0 +22,0 @@ ## Install

@@ -19,3 +19,3 @@ <p align='center'>

> ℹ️ **只支持 Vite 2.**
> ℹ️ **只支持 Vite 2.** <br>从 v0.3.0 开始,支持处理 ESM 和 CommonJS 模块文件。

@@ -22,0 +22,0 @@ ## 安装

@@ -12,3 +12,3 @@ import fs from 'fs'

// File suffix that needs to be matched
const includeRegexp: RegExp = new RegExp(/\.(css|js)$/i)
const includeRegexp: RegExp = new RegExp(/\.(css|[mc]?js)$/i)

@@ -15,0 +15,0 @@ // Filename to exclude

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc