UNPKG

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