UNPKG

1.57 kBJavaScriptView Raw
1"use strict";
2
3// the following development and legacy apis should not be included
4// when bundling the server with a tool like webpack
5
6if (!process.env.BUNDLE) {
7 if (process.env.MARKO_HOT_RELOAD) {
8 require("./hot-reload").enable();
9 }
10
11 // If process was launched with browser refresh then automatically
12 // enable browser-refresh
13 require("./browser-refresh").enable();
14
15 // Adds the template.getDependencies() method needed by older versions of lasso-marko
16 require("./runtime/components/legacy/dependencies/html");
17}
18
19function fixFlush() {
20 try {
21 var OutgoingMessage = require("http").OutgoingMessage;
22 if (OutgoingMessage.prototype.flush && OutgoingMessage.prototype.flush.toString().indexOf("deprecated") !== -1) {
23 // Yes, we are monkey-patching http. This method should never have been added and it was introduced on
24 // the iojs fork. It was quickly deprecated and I'm 99% sure no one is actually using it.
25 // See:
26 // - https://github.com/marko-js/async-writer/issues/3
27 // - https://github.com/nodejs/node/issues/2920
28 //
29 // This method causes problems since marko looks for the flush method and calls it found.
30 // The `res.flush()` method is introduced by the [compression](https://www.npmjs.com/package/compression)
31 // middleware, but, otherwise, it should typically not exist.
32 delete require("http").OutgoingMessage.prototype.flush;
33 }
34 } catch (e) {
35 /* ignore error */
36 }
37}
38
39fixFlush();
40
41exports.createOut = require("./runtime/createOut");
42exports.load = require("./loader");
\No newline at end of file