From 71a96808ac8a7c1ba8cb9c78b649d7f6e6530a95 Mon Sep 17 00:00:00 2001 From: eric thul Date: Mon, 24 Apr 2017 21:04:49 -0400 Subject: Add options for ide commands --- README.md | 4 +++- src/ide.js | 8 ++++---- src/index.js | 5 ++++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1105687..034dac0 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,9 @@ const loaderConfig = { pscBundle: null, // purs bundle pscBundleArgs: {}, pscIde: false, // instant rebuilds using psc-ide-server (experimental) - pscIdeArgs: {}, // for example, to use different psc-ide-server port: {port: 4088} + pscIdeClient: null, // purs ide client + pscIdeClientArgs: {}, // for example, to use different port {port: 4088} + pscIdeServer: null, // purs ide server pscIdeServerArgs: {}, // for example, to change the port { port: 4088 } pscIdeColors: false, // defaults to true if psc === 'psa' pscPackage: false, diff --git a/src/ide.js b/src/ide.js index e6a45c2..00de55b 100644 --- a/src/ide.js +++ b/src/ide.js @@ -36,9 +36,9 @@ UnknownModuleError.prototype.constructor = UnknownModuleError; module.exports.UnknownModuleError = UnknownModuleError; function spawnIdeClient(body, options) { - const ideClientCommand = 'purs'; + const ideClientCommand = options.pscIdeClient || 'purs'; - const ideClientArgs = ['ide', 'client'].concat(dargs(options.pscIdeArgs)); + const ideClientArgs = (options.pscIdeClient ? [] : ['ide', 'client']).concat(dargs(options.pscIdeClientArgs)); const stderr = []; @@ -144,9 +144,9 @@ function formatIdeResult(result, options, index, length) { module.exports.connect = function connect(psModule) { const options = psModule.options - const serverCommand = 'purs'; + const serverCommand = options.pscIdeServer || 'purs'; - const serverArgs = ['ide', 'server'].concat(dargs(Object.assign({ + const serverArgs = (options.pscIdeServer ? [] : ['ide', 'server']).concat(dargs(Object.assign({ outputDirectory: options.output, '_': options.src }, options.pscIdeServerArgs))); diff --git a/src/index.js b/src/index.js index 11b06eb..4c5abd2 100644 --- a/src/index.js +++ b/src/index.js @@ -108,9 +108,12 @@ module.exports = function purescriptLoader(source, map) { pscArgs: {}, pscBundle: null, pscBundleArgs: {}, + pscIdeClient: null, + pscIdeClientArgs: {}, + pscIdeServer: null, + pscIdeServerArgs: {}, pscIde: false, pscIdeColors: loaderOptions.psc === 'psa', - pscIdeArgs: {}, pscPackage: false, bundleOutput: 'output/bundle.js', bundleNamespace: 'PS', -- cgit v1.2.3