add jsdom to KissConfig
This commit is contained in:
@@ -15,6 +15,7 @@ import sys.FileSystem;
|
||||
import ktxt2.KTxt2;
|
||||
import re_flex.R;
|
||||
import kiss_tools.KeyShortcutHandler;
|
||||
import JSDomExterns;
|
||||
|
||||
using haxe.io.Path;
|
||||
using StringTools;
|
||||
|
@@ -249,4 +249,10 @@
|
||||
(#unless test
|
||||
(var :Array<KTxt2Conversion> conversions [])
|
||||
|
||||
(function registerConversion [:KTxt2Conversion conversion] (conversions.push conversion)))
|
||||
(function registerConversion [:KTxt2Conversion conversion] (conversions.push conversion)))
|
||||
|
||||
|
||||
(function quickWebview []
|
||||
(let [dom (new JSDOM "<!DOCTYPE html><p>Hello world</p>")
|
||||
document dom.window.document]
|
||||
document))
|
11
projects/kiss-vscode/src/JSDomExterns.hx
Normal file
11
projects/kiss-vscode/src/JSDomExterns.hx
Normal file
@@ -0,0 +1,11 @@
|
||||
import js.html.Document;
|
||||
|
||||
typedef JSDOMWindow = {
|
||||
document:Document
|
||||
};
|
||||
|
||||
@:jsRequire("jsdom")
|
||||
extern class JSDOM {
|
||||
function new(html:String);
|
||||
var window:JSDOMWindow;
|
||||
}
|
@@ -100,6 +100,8 @@
|
||||
// install all of the user's Node dependencies:
|
||||
(when (FileSystem.exists (joinPath activeConfigDir "package.json"))
|
||||
(npmSafeTrySpawnSync ["npm" "install"] handleConfigFailure))
|
||||
// install built-in node dependencies:
|
||||
(npmSafeTrySpawnSync ["npm" "install" "jsdom"] handleConfigFailure)
|
||||
// Run the haxe compiler:
|
||||
(trySpawnSync "haxe" ["build.hxml"] (object cwd activeConfigDir) handleConfigFailure)
|
||||
|
||||
|
@@ -114,6 +114,7 @@
|
||||
(openFile dirOrFile)))))))
|
||||
|
||||
// This has to be a macro so it can return from tryLoadConfig
|
||||
// TODO this macro should use gensyms
|
||||
(defMacro trySpawnSync [command args options onError]
|
||||
`(let [command ,command
|
||||
args ,args
|
||||
|
Reference in New Issue
Block a user