vite-express
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -0,5 +1,8 @@ | ||
import e from "express"; | ||
import core from "express-serve-static-core"; | ||
declare function serveStatic(): (_: e.Request, __: e.Response, next: e.NextFunction) => void; | ||
declare function serve(app: core.Express): Promise<void>; | ||
declare function listen(app: core.Express, port?: number, callback?: () => void): Promise<void>; | ||
declare function listen(app: core.Express, port: number, callback: () => void): Promise<void>; | ||
declare const _default: { | ||
static: typeof serveStatic; | ||
serve: typeof serve; | ||
@@ -6,0 +9,0 @@ listen: typeof listen; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=t(require("express"),require("path"),require("vite"),require("node-fetch")):"function"==typeof define&&define.amd?define(["express","path","vite","node-fetch"],t):(e="undefined"!=typeof globalThis?globalThis:e||self)&&(module.exports=t(e.express,e.path,e.vite,e.nodeFetch))}(this,(function(e,t,n,r){"use strict";function u(e,t,n,r,u,i,o){try{var c=e[i](o),a=c.value}catch(e){return void n(e)}c.done?t(a):Promise.resolve(a).then(r,u)}function i(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function c(e){u(o,r,i,c,a,"next",e)}function a(e){u(o,r,i,c,a,"throw",e)}c(void 0)}))}}function o(e){return e&&e.__esModule?e:{default:e}}e=o(e),t=o(t),r=o(r);var c=function(e,t){var n,r,u,i,o={label:0,sent:function(){if(1&u[0])throw u[1];return u[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(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(u=2&i[0]?r.return:i[0]?r.throw||((u=r.return)&&u.call(r),0):r.next)&&!(u=u.call(r,i[1])).done)return u;switch(r=0,u&&(i=[2&i[0],u.value]),i[0]){case 0:case 1:u=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,r=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(u=o.trys,(u=u.length>0&&u[u.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!u||i[1]>u[0]&&i[1]<u[3])){o.label=i[1];break}if(6===i[0]&&o.label<u[1]){o.label=u[1],u=i;break}if(u&&o.label<u[2]){o.label=u[2],o.ops.push(i);break}u[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],r=0}finally{n=u=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}};function a(e){return s.apply(this,arguments)}function s(){return(s=i((function(r){var u;return c(this,(function(i){switch(i.label){case 0:return[4,(0,n.build)()];case 1:return i.sent(),[4,(0,n.resolveConfig)({},"build")];case 2:return u=i.sent(),r.use(e.default.static(t.default.resolve(__dirname,u.build.outDir))),[2]}}))}))).apply(this,arguments)}function l(e){return f.apply(this,arguments)}function f(){return f=i((function(e){var t,u,o,a,s;return c(this,(function(l){switch(l.label){case 0:return[4,(0,n.createServer)({clearScreen:!1})];case 1:return t=l.sent(),u=t.config,a=null!==(o=u.server.port)&&void 0!==o?o:5173,s="http://127.0.0.1:".concat(a),e.use((function(e,t,n){if(e.path.match(/(\.\w+$)|(@react-refresh|@vite)/))return t.redirect("".concat(s).concat(e.path));n()})),e.get("/*",(f=i((function(e,t){var n;return c(this,(function(e){switch(e.label){case 0:return[4,(0,r.default)(s).then((function(e){return e.text()}))];case 1:return n=e.sent(),t.header("Content-Type","text/html").send(n),[2]}}))})),function(e,t){return f.apply(this,arguments)})),[4,t.listen()];case 2:return l.sent(),[2]}var f}))})),f.apply(this,arguments)}function p(e){return h.apply(this,arguments)}function h(){return(h=i((function(e){var t;return c(this,(function(n){switch(n.label){case 0:return"production"!==(null!==(t=process.env.NODE_ENV)&&void 0!==t?t:"development")?[3,2]:[4,a(e)];case 1:return n.sent(),[3,4];case 2:return[4,l(e)];case 3:n.sent(),n.label=4;case 4:return[2]}}))}))).apply(this,arguments)}function d(){return d=i((function(e){var t,n,r=arguments;return c(this,(function(u){switch(u.label){case 0:return t=r.length>1&&void 0!==r[1]?r[1]:3e3,n=r.length>2&&void 0!==r[2]?r[2]:function(){return console.log("Server is listening on port ".concat(t,"..."))},[4,p(e)];case 1:return u.sent(),e.listen(t,n),[2]}}))})),d.apply(this,arguments)}return{serve:p,listen:function(e){return d.apply(this,arguments)}}})); | ||
!function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=t(require("express"),require("path"),require("vite"),require("node-fetch")):"function"==typeof define&&define.amd?define(["express","path","vite","node-fetch"],t):(e="undefined"!=typeof globalThis?globalThis:e||self)&&(module.exports=t(e.express,e.path,e.vite,e.nodeFetch))}(this,(function(e,t,n,r){"use strict";function u(e,t,n,r,u,o,i){try{var c=e[o](i),a=c.value}catch(e){return void n(e)}c.done?t(a):Promise.resolve(a).then(r,u)}function o(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function c(e){u(i,r,o,c,a,"next",e)}function a(e){u(i,r,o,c,a,"throw",e)}c(void 0)}))}}function i(e){return e&&e.__esModule?e:{default:e}}e=i(e),t=i(t),r=i(r);var c=function(e,t){var n,r,u,o,i={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(u=2&o[0]?r.return:o[0]?r.throw||((u=r.return)&&u.call(r),0):r.next)&&!(u=u.call(r,o[1])).done)return u;switch(r=0,u&&(o=[2&o[0],u.value]),o[0]){case 0:case 1:u=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(u=i.trys,(u=u.length>0&&u[u.length-1])||6!==o[0]&&2!==o[0])){i=0;continue}if(3===o[0]&&(!u||o[1]>u[0]&&o[1]<u[3])){i.label=o[1];break}if(6===o[0]&&i.label<u[1]){i.label=u[1],u=o;break}if(u&&i.label<u[2]){i.label=u[2],i.ops.push(o);break}u[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=u=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}},a=process.env.NODE_ENV,s="production"===a?a:"development",l=5173,f="http://127.0.0.1:".concat(l);function p(){return"production"===s?function(e,t,n){return n()}:function(e,t,n){if(e.path.match(/(\.\w+$)|(@react-refresh|@vite)/))return t.redirect("".concat(f).concat(e.path));n()}}function h(e){return d.apply(this,arguments)}function d(){return(d=o((function(r){var u;return c(this,(function(o){switch(o.label){case 0:return[4,(0,n.build)()];case 1:return o.sent(),[4,(0,n.resolveConfig)({},"build")];case 2:return u=o.sent(),console.log(t.default.resolve(__dirname,u.root,u.build.outDir)),r.use(e.default.static(t.default.resolve(__dirname,u.root,u.build.outDir))),[2]}}))}))).apply(this,arguments)}function v(e){return b.apply(this,arguments)}function b(){return b=o((function(e){var t;return c(this,(function(u){switch(u.label){case 0:return[4,(0,n.createServer)({clearScreen:!1,server:{port:l}})];case 1:return t=u.sent(),e.use(p()),e.get("/*",(i=o((function(e,t){var n;return c(this,(function(e){switch(e.label){case 0:return[4,(0,r.default)(f).then((function(e){return e.text()}))];case 1:return n=e.sent(),t.header("Content-Type","text/html").send(n),[2]}}))})),function(e,t){return i.apply(this,arguments)})),[4,t.listen()];case 2:return u.sent(),[2]}var i}))})),b.apply(this,arguments)}function y(e){return w.apply(this,arguments)}function w(){return(w=o((function(e){return c(this,(function(t){switch(t.label){case 0:return"production"!==s?[3,2]:[4,h(e)];case 1:return t.sent(),[3,4];case 2:return[4,v(e)];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))).apply(this,arguments)}function m(){return(m=o((function(e,t,n){return c(this,(function(r){switch(r.label){case 0:return[4,y(e)];case 1:return r.sent(),e.listen(t,n),[2]}}))}))).apply(this,arguments)}return{static:p,serve:y,listen:function(e,t,n){return m.apply(this,arguments)}}})); |
{ | ||
"name": "vite-express", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"main": "dist/main.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/main.d.ts", |
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
4785
11
0