Add formatWithCursor, check, doc, and util to the standalone build (#4556)

* Add formatWithCursor, check, and doc to the standalone build

* Add util, too
master
Suchipi 2018-05-26 17:25:36 -06:00 committed by GitHub
parent fda7bf59f4
commit 5508546de8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 1 deletions

View File

@ -4,6 +4,9 @@ const version = require("./package.json").version;
const core = require("./src/main/core");
const getSupportInfo = require("./src/main/support").getSupportInfo;
const sharedUtil = require("./src/common/util-shared");
const doc = require("./src/doc");
const internalPlugins = [
require("./src/language-js"),
@ -34,15 +37,28 @@ function withPlugins(fn) {
};
}
const formatWithCursor = withPlugins(core.formatWithCursor);
module.exports = {
formatWithCursor: formatWithCursor,
format(text, opts) {
return withPlugins(core.formatWithCursor)(text, opts).formatted;
return formatWithCursor(text, opts).formatted;
},
check(text, opts) {
const formatted = formatWithCursor(text, opts).formatted;
return formatted === text;
},
doc,
getSupportInfo: withPlugins(getSupportInfo),
version,
util: sharedUtil,
__debug: {
parse: withPlugins(core.parse),
formatAST: withPlugins(core.formatAST),