marko/src/index.js
Michael Rawlings 101c5c6bb8
refactor to better separate compiler/taglib/core-tags/runtime (#1319)
* refactor out taglib loader/finder/lookup

* add comments for taglib apis that we need to deprecate

* move components into runtime/core-tags
2019-04-16 13:34:26 -07:00

46 lines
1.7 KiB
JavaScript

"use strict";
// the following development and legacy apis should not be included
// when bundling the server with a tool like webpack
if (!process.env.BUNDLE) {
if (process.env.MARKO_HOT_RELOAD) {
require("./hot-reload").enable();
}
// If process was launched with browser refresh then automatically
// enable browser-refresh
require("./browser-refresh").enable();
// Adds the template.getDependencies() method needed by older versions of lasso-marko
require("./runtime/components/legacy/dependencies/html");
}
function fixFlush() {
try {
var OutgoingMessage = require("http").OutgoingMessage;
if (
OutgoingMessage.prototype.flush &&
OutgoingMessage.prototype.flush.toString().indexOf("deprecated") !==
-1
) {
// Yes, we are monkey-patching http. This method should never have been added and it was introduced on
// the iojs fork. It was quickly deprecated and I'm 99% sure no one is actually using it.
// See:
// - https://github.com/marko-js/async-writer/issues/3
// - https://github.com/nodejs/node/issues/2920
//
// This method causes problems since marko looks for the flush method and calls it found.
// The `res.flush()` method is introduced by the [compression](https://www.npmjs.com/package/compression)
// middleware, but, otherwise, it should typically not exist.
delete require("http").OutgoingMessage.prototype.flush;
}
} catch (e) {
/* ignore error */
}
}
fixFlush();
exports.createOut = require("./runtime/createOut");
exports.load = require("./loader");