Skip to content

Commit 5086bc0

Browse files
committed
using webpack for previewing results
1 parent 9a4dd7b commit 5086bc0

14 files changed

Lines changed: 13345 additions & 18 deletions

File tree

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Place your settings in this file to overwrite default and user settings.
22
{
33
"files.exclude": {
4-
"out": true, // set this to true to hide the "out" folder with the compiled JS files
4+
"out": false, // set this to true to hide the "out" folder with the compiled JS files
55
"**/*.pyc": true,
66
"**/__pycache__": true
77
},

package.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@
701701
}
702702
},
703703
"scripts": {
704-
"vscode:prepublish": "node ./node_modules/vscode/bin/compile",
704+
"vscode:prepublish": "node ./node_modules/vscode/bin/compile && webpack",
705705
"compile": "node ./node_modules/vscode/bin/compile -watch -p ./ && installServerIntoExtension ./out ./src/server/package.json ./src/server/tsconfig.json",
706706
"postinstall": "node ./node_modules/vscode/bin/install",
707707
"test": "node ./node_modules/vscode/bin/test"
@@ -720,6 +720,7 @@
720720
"prepend-file": "^1.3.0",
721721
"spawnteract": "^2.2.0",
722722
"tmp": "0.0.28",
723+
"transformime": "^3.1.2",
723724
"tree-kill": "^1.0.0",
724725
"uint64be": "^1.0.1",
725726
"uuid": "^2.0.2",
@@ -731,8 +732,14 @@
731732
"xml2js": "^0.4.17"
732733
},
733734
"devDependencies": {
735+
"babel-core": "^6.14.0",
736+
"babel-loader": "^6.2.5",
737+
"babel-preset-es2015": "^6.14.0",
738+
"ignore-loader": "^0.1.1",
734739
"retyped-diff-match-patch-tsd-ambient": "^1.0.0-0",
740+
"ts-loader": "^0.8.2",
735741
"typescript": "^1.8.5",
736-
"vscode": "^0.11.0"
742+
"vscode": "^0.11.0",
743+
"webpack": "^1.13.2"
737744
}
738745
}

src/client/jupyter/browser/main.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/// <reference path="typings/index.d.ts" />
2+
3+
import {Test} from './test.ts';
4+
const transformime = require('transformime');
5+
const MarkdownTransform = require('transformime-marked');
6+
const transform = transformime.createTransform([MarkdownTransform]) as Function;
7+
8+
(window as any).initializeResults = () => {
9+
const data = (window as any).JUPYTER_DATA as any[];
10+
data.forEach(data => {
11+
if (typeof data['text/html'] === 'string') {
12+
data['text/html'] = data['text/html'].replace(/<\/scripts>/g, '</script>');
13+
}
14+
transform(data).then(result => {
15+
// If dealing with images add them inside a div with white background
16+
if (Object.keys(data).some(key => key.startsWith('image/'))) {
17+
const div = document.createElement('div');
18+
div.style.backgroundColor = 'white';
19+
div.style.display = 'inline-block';
20+
div.appendChild(result.el);
21+
document.body.appendChild(div);
22+
}
23+
else {
24+
document.body.appendChild(result.el);
25+
}
26+
});
27+
});
28+
};

src/client/jupyter/browser/test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export class Test {
2+
public doSometihng() {
3+
return 1 + 2;
4+
}
5+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference path="lib.dom.d.ts" />

0 commit comments

Comments
 (0)