Skip to content

Commit

Permalink
fix(host): expose all global variables except for REMOVED_GLOBALS (fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed Feb 18, 2020
1 parent 534faff commit de94245
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 17 deletions.
2 changes: 0 additions & 2 deletions packages/neovim/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"typings": "./lib/index",
"dependencies": {
"@msgpack/msgpack": "^1.9.3",
"lodash.defaults": "^4.2.0",
"lodash.omit": "^4.5.0",
"semver": "^7.1.1",
"winston": "3.2.1"
Expand All @@ -53,7 +52,6 @@
"@babel/preset-env": "^7.3.4",
"@babel/preset-typescript": "^7.3.3",
"@types/jest": "^24.0.24",
"@types/lodash.defaults": "^4.2.6",
"@types/lodash.omit": "^4.5.6",
"@types/node": "10.17.x",
"@types/which": "^1.3.2",
Expand Down
8 changes: 6 additions & 2 deletions packages/neovim/src/host/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as path from 'path';
import * as util from 'util';
import * as vm from 'vm';

import defaults from 'lodash.defaults';
import omit from 'lodash.omit';

import { Neovim } from '../api/Neovim';
Expand Down Expand Up @@ -110,7 +109,12 @@ function createSandbox(filename: string): Sandbox {
console: {},
}) as Sandbox;

defaults(sandbox, global);
// Use getOwnPropertyNames to iterate all global variables (#141)
Object.getOwnPropertyNames(global)
.filter(p => !sandbox.hasOwnProperty(p))
.forEach(prop => {
sandbox[prop] = global[prop];
});

// Redirect console calls into logger
Object.keys(console).forEach((k: keyof Console) => {
Expand Down
13 changes: 0 additions & 13 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1804,13 +1804,6 @@
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.4.tgz#38fd73ddfd9b55abb1e1b2ed578cb55bd7b7d339"
integrity sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA==

"@types/lodash.defaults@^4.2.6":
version "4.2.6"
resolved "https://registry.yarnpkg.com/@types/lodash.defaults/-/lodash.defaults-4.2.6.tgz#4ac29d3dd80a42803397076600f5b129f4aef911"
integrity sha512-JsUJheQIG2Yf/n/QRUMGXT76/7x4tLU5i0kxIPeoOcTIh9yNzdEzCHWbwD8mTf+VncGwYZiho+F2u1pEBsGswA==
dependencies:
"@types/lodash" "*"

"@types/lodash.omit@^4.5.6":
version "4.5.6"
resolved "https://registry.yarnpkg.com/@types/lodash.omit/-/lodash.omit-4.5.6.tgz#f2a9518259e481a48ff7ec423420fa8fd58933e2"
Expand Down Expand Up @@ -5885,11 +5878,6 @@ lodash.clonedeep@^4.5.0:
resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef"
integrity sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=

lodash.defaults@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c"
integrity sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw=

lodash.get@^4.4.2:
version "4.4.2"
resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99"
Expand Down Expand Up @@ -6381,7 +6369,6 @@ neo-async@^2.6.0:
version "4.8.0"
dependencies:
"@msgpack/msgpack" "^1.9.3"
lodash.defaults "^4.2.0"
lodash.omit "^4.5.0"
semver "^7.1.1"
winston "3.2.1"
Expand Down

0 comments on commit de94245

Please sign in to comment.