Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Commit

Permalink
build
Browse files Browse the repository at this point in the history
  • Loading branch information
thealjey committed Apr 21, 2017
1 parent 2e7d0ba commit 9b85f4b
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 29 deletions.
6 changes: 4 additions & 2 deletions docs/highlight.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@ <h1 class="page-title">highlight.js</h1>
if (isNode) {
global.window = jsdom().defaultView;
global.navigator = window.navigator;
window.document.createRange = constant({
global.document = window.document;

/* @flowignore */
document.createRange = constant({
setEnd: noop,
setStart: noop,
getBoundingClientRect: constant({}),
getClientRects: constant([])
});
global.document = window.document;
}

// we have to use normal requires because of the import hoisting
Expand Down
6 changes: 3 additions & 3 deletions docs/module-highlight.html
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ <h4 class="name" id=".highlightArray"><span class="type-signature">(static) </sp

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="highlight.js.html">highlight.js</a>, <a href="highlight.js.html#line83">line 83</a>
<a href="highlight.js.html">highlight.js</a>, <a href="highlight.js.html#line85">line 85</a>
</li></ul></dd>


Expand Down Expand Up @@ -349,7 +349,7 @@ <h4 class="name" id=".highlightHTML"><span class="type-signature">(static) </spa

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="highlight.js.html">highlight.js</a>, <a href="highlight.js.html#line58">line 58</a>
<a href="highlight.js.html">highlight.js</a>, <a href="highlight.js.html#line60">line 60</a>
</li></ul></dd>


Expand Down Expand Up @@ -535,7 +535,7 @@ <h4 class="name" id=".highlightJSX"><span class="type-signature">(static) </span

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="highlight.js.html">highlight.js</a>, <a href="highlight.js.html#line109">line 109</a>
<a href="highlight.js.html">highlight.js</a>, <a href="highlight.js.html#line111">line 111</a>
</li></ul></dd>


Expand Down
2 changes: 1 addition & 1 deletion docs/util.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ <h1 class="page-title">util.js</h1>
* // or - var isNode = require('webcompiler').isNode;
* // or - var isNode = require('webcompiler/lib/util').isNode;
*/
export const isNode = 'undefined' !== typeof process &amp;&amp; 'node' === process.release.name;
export const isNode = 'undefined' !== typeof process &amp;&amp; process.release &amp;&amp; 'node' === process.release.name;

/**
* `true` if the `NODE_ENV` environment variable is set to `"production"`
Expand Down
6 changes: 4 additions & 2 deletions lib/highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
if (_util.isNode) {
global.window = (0, _jsdom.jsdom)().defaultView;
global.navigator = window.navigator;
window.document.createRange = (0, _constant2.default)({
global.document = window.document;

/* ignore */
document.createRange = (0, _constant2.default)({
setEnd: _noop2.default,
setStart: _noop2.default,
getBoundingClientRect: (0, _constant2.default)({}),
getClientRects: (0, _constant2.default)([])
});
global.document = window.document;
}

// we have to use normal requires because of the import hoisting
Expand Down
2 changes: 1 addition & 1 deletion lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ exports.__esModule = true;
* // or - var isNode = require('webcompiler').isNode;
* // or - var isNode = require('webcompiler/lib/util').isNode;
*/
const isNode = exports.isNode = 'undefined' !== typeof process && 'node' === process.release.name;
const isNode = exports.isNode = 'undefined' !== typeof process && process.release && 'node' === process.release.name;

/**
* `true` if the `NODE_ENV` environment variable is set to `"production"`
Expand Down
36 changes: 18 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,34 +64,34 @@
"homepage": "https://thealjey.github.io/webcompiler",
"dependencies": {
"autoprefixer": "^6.7.7",
"babel-cli": "^6.24.0",
"babel-core": "^6.24.0",
"babel-eslint": "^7.2.1",
"babel-cli": "^6.24.1",
"babel-core": "^6.24.1",
"babel-eslint": "^7.2.2",
"babel-loader": "^6.4.1",
"babel-plugin-transform-es2015-modules-commonjs": "^6.24.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.24.1",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-polyfill": "^6.23.0",
"babel-preset-es2015": "^6.24.0",
"babel-preset-es2016": "^6.22.0",
"babel-preset-es2017": "^6.22.0",
"babel-preset-react": "^6.23.0",
"babel-preset-stage-2": "^6.22.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-es2016": "^6.24.1",
"babel-preset-es2017": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"babel-runtime": "^6.23.0",
"cheerio": "^0.22.0",
"clean-stack": "^1.1.1",
"codemirror": "^5.25.0",
"codemirror": "^5.25.2",
"cross-spawn": "^5.1.0",
"docdash": "^0.4.0",
"error-stack-parser": "^2.0.0",
"eslint": "^3.19.0",
"eslint-plugin-babel": "^4.1.1",
"eslint-plugin-flowtype": "^2.30.4",
"eslint-plugin-flowtype": "^2.32.1",
"eslint-plugin-jsx-a11y": "^4.0.0",
"eslint-plugin-lodash": "^2.4.0",
"eslint-plugin-react": "^6.10.3",
"fb-watchman": "^2.0.0",
"flow-bin": "^0.43.0",
"js-yaml": "^3.8.2",
"flow-bin": "^0.44.2",
"js-yaml": "^3.8.3",
"jsdoc": "^3.4.3",
"jsdom": "^9.12.0",
"json-loader": "^0.5.4",
Expand All @@ -101,17 +101,17 @@
"node-sass": "^4.5.2",
"node-sass-import-once": "^1.2.0",
"null-loader": "^0.1.1",
"postcss": "^5.2.16",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"postcss": "^5.2.17",
"react": "^15.5.4",
"react-dom": "^15.5.4",
"react-hot-loader": "^1.3.1",
"remarkable": "^1.7.1",
"serve-static": "^1.12.1",
"stylelint": "^7.10.1",
"stylelint-config-standard": "^16.0.0",
"stylelint-scss": "^1.4.3",
"stylelint-scss": "^1.4.4",
"tiny-lr": "^1.0.3",
"webpack": "^1.14.0",
"webpack": "^1.15.0",
"webpack-dev-server": "^1.16.3"
},
"devDependencies": {
Expand Down
6 changes: 4 additions & 2 deletions src/highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ import {isNode} from './util';
if (isNode) {
global.window = jsdom().defaultView;
global.navigator = window.navigator;
window.document.createRange = constant({
global.document = window.document;

/* @flowignore */
document.createRange = constant({
setEnd: noop,
setStart: noop,
getBoundingClientRect: constant({}),
getClientRects: constant([])
});
global.document = window.document;
}

// we have to use normal requires because of the import hoisting
Expand Down

0 comments on commit 9b85f4b

Please sign in to comment.