vite-plugin-banner
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -1,7 +0,6 @@ | ||
/** | ||
/** | ||
* name: vite-plugin-banner | ||
* version: v0.1.1 | ||
* version: v0.1.2 | ||
* author: chengpeiquan | ||
*/ | ||
'use strict'; | ||
*/'use strict'; | ||
@@ -216,3 +215,3 @@ var fs = require('fs'); | ||
else { | ||
data = "/* " + comment + " */\n" + data; | ||
data = "/*! " + comment + " */\n" + data; | ||
} | ||
@@ -219,0 +218,0 @@ fs__default['default'].writeFileSync(filePath, data); |
@@ -1,7 +0,6 @@ | ||
/** | ||
/** | ||
* name: vite-plugin-banner | ||
* version: v0.1.1 | ||
* version: v0.1.2 | ||
* author: chengpeiquan | ||
*/ | ||
"use strict";var e=require("fs"),n=require("path");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=t(e); | ||
*/"use strict";var e=require("fs"),n=require("path");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=t(e); | ||
/*! ***************************************************************************** | ||
@@ -20,3 +19,3 @@ Copyright (c) Microsoft Corporation. | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */function o(e,n,t,r){return new(t||(t=Promise))((function(o,i){function u(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(u,c)}a((r=r.apply(e,n||[])).next())}))}function i(e,n){var t,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;u;)try{if(t=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 u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=n.call(e,u)}catch(e){i=[6,e],r=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}var u,c=new RegExp(/\.(css|js)$/i),a=new RegExp(/vendor/);module.exports=function(e){var t=function(e){return"string"!=typeof e?"The comment must be a string.":e?e.includes("/*")&&!e.includes("*/")||!e.includes("/*")&&e.includes("*/")?"If you want to pass in comment symbols, you must pass them in pairs.":"":"The comment can not be empty."}(e);if(t)throw new Error("[vite-plugin-banner] "+t);return{name:"banner",configResolved:function(e){u=e},writeBundle:function(t,l){return o(this,void 0,void 0,(function(){var t,o,s,f,p,d,h,y;return i(this,(function(i){for(t=0,o=Object.entries(l);t<o.length;t++)if(s=o[t],f=u.root,p=u.build.outDir||"dist",d=s[0],h=n.resolve(f,p,d),c.test(d)&&!a.test(d))try{y=r.default.readFileSync(h,{encoding:"utf8"}),y=e.includes("/*")||e.includes("*/")?e+"\n"+y:"/* "+e+" */\n"+y,r.default.writeFileSync(h,y)}catch(e){console.log(e)}return[2]}))}))}}}; | ||
***************************************************************************** */function o(e,n,t,r){return new(t||(t=Promise))((function(o,i){function u(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(u,c)}a((r=r.apply(e,n||[])).next())}))}function i(e,n){var t,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;u;)try{if(t=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 u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=n.call(e,u)}catch(e){i=[6,e],r=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}var u,c=new RegExp(/\.(css|js)$/i),a=new RegExp(/vendor/);module.exports=function(e){var t=function(e){return"string"!=typeof e?"The comment must be a string.":e?e.includes("/*")&&!e.includes("*/")||!e.includes("/*")&&e.includes("*/")?"If you want to pass in comment symbols, you must pass them in pairs.":"":"The comment can not be empty."}(e);if(t)throw new Error("[vite-plugin-banner] "+t);return{name:"banner",configResolved:function(e){u=e},writeBundle:function(t,l){return o(this,void 0,void 0,(function(){var t,o,s,f,p,d,h,y;return i(this,(function(i){for(t=0,o=Object.entries(l);t<o.length;t++)if(s=o[t],f=u.root,p=u.build.outDir||"dist",d=s[0],h=n.resolve(f,p,d),c.test(d)&&!a.test(d))try{y=r.default.readFileSync(h,{encoding:"utf8"}),y=e.includes("/*")||e.includes("*/")?e+"\n"+y:"/*! "+e+" */\n"+y,r.default.writeFileSync(h,y)}catch(e){console.log(e)}return[2]}))}))}}}; | ||
//# sourceMappingURL=vite-plugin-banner.min.js.map |
{ | ||
"name": "vite-plugin-banner", | ||
"version": "0.1.1", | ||
"description": "A banner plugin for Vite.", | ||
"version": "0.1.2", | ||
"description": "A banner plugin for Vite. Adds a banner to the top of each generated chunk.", | ||
"main": "dist/vite-plugin-banner.min.js", | ||
"types": "vite-plugin-banner.d.ts", | ||
"types": "dist/main.d.ts", | ||
"scripts": { | ||
@@ -8,0 +8,0 @@ "build": "rollup -c rollup.config.ts" |
@@ -89,3 +89,3 @@ <p align='center'> | ||
e.g. in `app.b3a7772e.js`: | ||
e.g. in `app.6936be52.js`: | ||
@@ -92,0 +92,0 @@ ```js |
@@ -89,3 +89,3 @@ <p align='center'> | ||
例如,在生成的 `app.b3a7772e.js` 里: | ||
例如,在生成的 `app.6936be52.js` 里: | ||
@@ -92,0 +92,0 @@ ```js |
@@ -12,8 +12,3 @@ import resolve from '@rollup/plugin-node-resolve' | ||
const ResolveBanner = () => { | ||
return `/** | ||
* name: ${pkg.name} | ||
* version: v${pkg.version} | ||
* author: ${pkg.author} | ||
*/ | ||
`; | ||
return `/**\n * name: ${pkg.name}\n * version: v${pkg.version}\n * author: ${pkg.author}\n */`; | ||
} | ||
@@ -20,0 +15,0 @@ |
@@ -0,0 +0,0 @@ /** |
@@ -54,3 +54,3 @@ import fs from 'fs' | ||
else { | ||
data = `/* ${comment} */\n${data}` | ||
data = `/*! ${comment} */\n${data}` | ||
} | ||
@@ -57,0 +57,0 @@ |
@@ -0,0 +0,0 @@ { |
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
69052
393