add jsdom to KissConfig
This commit is contained in:
@@ -15,6 +15,7 @@ import sys.FileSystem;
|
|||||||
import ktxt2.KTxt2;
|
import ktxt2.KTxt2;
|
||||||
import re_flex.R;
|
import re_flex.R;
|
||||||
import kiss_tools.KeyShortcutHandler;
|
import kiss_tools.KeyShortcutHandler;
|
||||||
|
import JSDomExterns;
|
||||||
|
|
||||||
using haxe.io.Path;
|
using haxe.io.Path;
|
||||||
using StringTools;
|
using StringTools;
|
||||||
|
@@ -250,3 +250,9 @@
|
|||||||
(var :Array<KTxt2Conversion> conversions [])
|
(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:
|
// install all of the user's Node dependencies:
|
||||||
(when (FileSystem.exists (joinPath activeConfigDir "package.json"))
|
(when (FileSystem.exists (joinPath activeConfigDir "package.json"))
|
||||||
(npmSafeTrySpawnSync ["npm" "install"] handleConfigFailure))
|
(npmSafeTrySpawnSync ["npm" "install"] handleConfigFailure))
|
||||||
|
// install built-in node dependencies:
|
||||||
|
(npmSafeTrySpawnSync ["npm" "install" "jsdom"] handleConfigFailure)
|
||||||
// Run the haxe compiler:
|
// Run the haxe compiler:
|
||||||
(trySpawnSync "haxe" ["build.hxml"] (object cwd activeConfigDir) handleConfigFailure)
|
(trySpawnSync "haxe" ["build.hxml"] (object cwd activeConfigDir) handleConfigFailure)
|
||||||
|
|
||||||
|
@@ -114,6 +114,7 @@
|
|||||||
(openFile dirOrFile)))))))
|
(openFile dirOrFile)))))))
|
||||||
|
|
||||||
// This has to be a macro so it can return from tryLoadConfig
|
// This has to be a macro so it can return from tryLoadConfig
|
||||||
|
// TODO this macro should use gensyms
|
||||||
(defMacro trySpawnSync [command args options onError]
|
(defMacro trySpawnSync [command args options onError]
|
||||||
`(let [command ,command
|
`(let [command ,command
|
||||||
args ,args
|
args ,args
|
||||||
|
Reference in New Issue
Block a user