summaryrefslogtreecommitdiffstats
path: root/node_modules/vm-browserify
diff options
context:
space:
mode:
authorGravatar Piotr Russ <mail@pruss.it> 2020-11-16 00:10:28 +0100
committerGravatar Piotr Russ <mail@pruss.it> 2020-11-16 00:10:28 +0100
commite06ec920f7a5d784e674c4c4b4e6d1da3dc7391d (patch)
tree55713f725f77b44ebfec86e4eec3ce33e71458ca /node_modules/vm-browserify
downloadwebsite_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.tar.gz
website_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.tar.bz2
website_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.zip
api, login, auth
Diffstat (limited to 'node_modules/vm-browserify')
-rw-r--r--node_modules/vm-browserify/.github/FUNDING.yml12
-rw-r--r--node_modules/vm-browserify/.travis.yml8
-rw-r--r--node_modules/vm-browserify/CHANGELOG.md23
-rw-r--r--node_modules/vm-browserify/LICENSE18
-rw-r--r--node_modules/vm-browserify/example/run/bundle.js160
-rw-r--r--node_modules/vm-browserify/example/run/entry.js6
-rw-r--r--node_modules/vm-browserify/example/run/index.html8
-rw-r--r--node_modules/vm-browserify/example/run/server.js6
-rw-r--r--node_modules/vm-browserify/index.js149
-rw-r--r--node_modules/vm-browserify/package.json59
-rw-r--r--node_modules/vm-browserify/readme.markdown66
-rw-r--r--node_modules/vm-browserify/security.md10
-rw-r--r--node_modules/vm-browserify/test/vm.js35
13 files changed, 560 insertions, 0 deletions
diff --git a/node_modules/vm-browserify/.github/FUNDING.yml b/node_modules/vm-browserify/.github/FUNDING.yml
new file mode 100644
index 0000000..9f67277
--- /dev/null
+++ b/node_modules/vm-browserify/.github/FUNDING.yml
@@ -0,0 +1,12 @@
+# These are supported funding model platforms
+
+github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
+patreon: # Replace with a single Patreon username
+open_collective: # Replace with a single Open Collective username
+ko_fi: # Replace with a single Ko-fi username
+tidelift: npm/vm-browserify
+community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
+liberapay: # Replace with a single Liberapay username
+issuehunt: # Replace with a single IssueHunt username
+otechie: # Replace with a single Otechie username
+custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
diff --git a/node_modules/vm-browserify/.travis.yml b/node_modules/vm-browserify/.travis.yml
new file mode 100644
index 0000000..c4b192d
--- /dev/null
+++ b/node_modules/vm-browserify/.travis.yml
@@ -0,0 +1,8 @@
+language: node_js
+dist: xenial
+node_js:
+ - "stable"
+script:
+ - xvfb-run --auto-servernum npm test
+services:
+ - xvfb
diff --git a/node_modules/vm-browserify/CHANGELOG.md b/node_modules/vm-browserify/CHANGELOG.md
new file mode 100644
index 0000000..5fb4425
--- /dev/null
+++ b/node_modules/vm-browserify/CHANGELOG.md
@@ -0,0 +1,23 @@
+# vm-browserify Change Log
+All notable changes to this project will be documented in this file.
+This project adheres to [Semantic Versioning](http://semver.org/).
+
+## 1.1.2 - 2019-11-04
+* Update another jQuery reference in the readme. (https://github.com/browserify/vm-browserify/pull/27)
+* Get rid of jQuery references altogether from samples and readme. (https://github.com/browserify/vm-browserify/commit/d509e8e5afb7b1ead191cbbd49c37a3fb934b2dc)
+
+## 1.1.1 - 2019-11-04
+* Update a reference to jQuery in an example file that was setting off some security software. (https://github.com/browserify/vm-browserify/pull/22)
+
+## 1.1.0 - 2018-06-15
+* Add `vm.isContext(sandbox)`. (https://github.com/browserify/vm-browserify/commit/038c3cb33edcad9eec33aa8a8beae31b15c1a006)
+
+## 1.0.1 - 2018-04-13
+* Remove the `component-indexof` dependency. (https://github.com/browserify/vm-browserify/commit/0d9bd4c99f80db12c5c45e260a23ebfc51ec850d)
+
+## 1.0.0 - 2018-03-23
+
+(This is not a breaking change.)
+
+* Make the `sandbox` argument to `runInNewContext` optional, like in Node. (https://github.com/browserify/vm-browserify/pull/13)
+* Substituting `component-indexof` for deprecated `indexof`. (https://github.com/browserify/vm-browserify/pull/14)
diff --git a/node_modules/vm-browserify/LICENSE b/node_modules/vm-browserify/LICENSE
new file mode 100644
index 0000000..b8f727e
--- /dev/null
+++ b/node_modules/vm-browserify/LICENSE
@@ -0,0 +1,18 @@
+MIT License
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/vm-browserify/example/run/bundle.js b/node_modules/vm-browserify/example/run/bundle.js
new file mode 100644
index 0000000..49a9848
--- /dev/null
+++ b/node_modules/vm-browserify/example/run/bundle.js
@@ -0,0 +1,160 @@
+(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
+var indexOf = function (xs, item) {
+ if (xs.indexOf) return xs.indexOf(item);
+ else for (var i = 0; i < xs.length; i++) {
+ if (xs[i] === item) return i;
+ }
+ return -1;
+};
+var Object_keys = function (obj) {
+ if (Object.keys) return Object.keys(obj)
+ else {
+ var res = [];
+ for (var key in obj) res.push(key)
+ return res;
+ }
+};
+
+var forEach = function (xs, fn) {
+ if (xs.forEach) return xs.forEach(fn)
+ else for (var i = 0; i < xs.length; i++) {
+ fn(xs[i], i, xs);
+ }
+};
+
+var defineProp = (function() {
+ try {
+ Object.defineProperty({}, '_', {});
+ return function(obj, name, value) {
+ Object.defineProperty(obj, name, {
+ writable: true,
+ enumerable: false,
+ configurable: true,
+ value: value
+ })
+ };
+ } catch(e) {
+ return function(obj, name, value) {
+ obj[name] = value;
+ };
+ }
+}());
+
+var globals = ['Array', 'Boolean', 'Date', 'Error', 'EvalError', 'Function',
+'Infinity', 'JSON', 'Math', 'NaN', 'Number', 'Object', 'RangeError',
+'ReferenceError', 'RegExp', 'String', 'SyntaxError', 'TypeError', 'URIError',
+'decodeURI', 'decodeURIComponent', 'encodeURI', 'encodeURIComponent', 'escape',
+'eval', 'isFinite', 'isNaN', 'parseFloat', 'parseInt', 'undefined', 'unescape'];
+
+function Context() {}
+Context.prototype = {};
+
+var Script = exports.Script = function NodeScript (code) {
+ if (!(this instanceof Script)) return new Script(code);
+ this.code = code;
+};
+
+Script.prototype.runInContext = function (context) {
+ if (!(context instanceof Context)) {
+ throw new TypeError("needs a 'context' argument.");
+ }
+
+ var iframe = document.createElement('iframe');
+ if (!iframe.style) iframe.style = {};
+ iframe.style.display = 'none';
+
+ document.body.appendChild(iframe);
+
+ var win = iframe.contentWindow;
+ var wEval = win.eval, wExecScript = win.execScript;
+
+ if (!wEval && wExecScript) {
+ // win.eval() magically appears when this is called in IE:
+ wExecScript.call(win, 'null');
+ wEval = win.eval;
+ }
+
+ forEach(Object_keys(context), function (key) {
+ win[key] = context[key];
+ });
+ forEach(globals, function (key) {
+ if (context[key]) {
+ win[key] = context[key];
+ }
+ });
+
+ var winKeys = Object_keys(win);
+
+ var res = wEval.call(win, this.code);
+
+ forEach(Object_keys(win), function (key) {
+ // Avoid copying circular objects like `top` and `window` by only
+ // updating existing context properties or new properties in the `win`
+ // that was only introduced after the eval.
+ if (key in context || indexOf(winKeys, key) === -1) {
+ context[key] = win[key];
+ }
+ });
+
+ forEach(globals, function (key) {
+ if (!(key in context)) {
+ defineProp(context, key, win[key]);
+ }
+ });
+
+ document.body.removeChild(iframe);
+
+ return res;
+};
+
+Script.prototype.runInThisContext = function () {
+ return eval(this.code); // maybe...
+};
+
+Script.prototype.runInNewContext = function (context) {
+ var ctx = Script.createContext(context);
+ var res = this.runInContext(ctx);
+
+ if (context) {
+ forEach(Object_keys(ctx), function (key) {
+ context[key] = ctx[key];
+ });
+ }
+
+ return res;
+};
+
+forEach(Object_keys(Script.prototype), function (name) {
+ exports[name] = Script[name] = function (code) {
+ var s = Script(code);
+ return s[name].apply(s, [].slice.call(arguments, 1));
+ };
+});
+
+exports.isContext = function (context) {
+ return context instanceof Context;
+};
+
+exports.createScript = function (code) {
+ return exports.Script(code);
+};
+
+exports.createContext = Script.createContext = function (context) {
+ var copy = new Context();
+ if(typeof context === 'object') {
+ forEach(Object_keys(context), function (key) {
+ copy[key] = context[key];
+ });
+ }
+ return copy;
+};
+
+},{}],2:[function(require,module,exports){
+var vm = require('vm');
+
+window.addEventListener('load', function () {
+ var res = vm.runInNewContext('a + 5', { a : 100 });
+ document.querySelector('#res').textContent = res;
+});
+
+},{"vm":1}]},{},[2]);
diff --git a/node_modules/vm-browserify/example/run/entry.js b/node_modules/vm-browserify/example/run/entry.js
new file mode 100644
index 0000000..def1376
--- /dev/null
+++ b/node_modules/vm-browserify/example/run/entry.js
@@ -0,0 +1,6 @@
+var vm = require('vm');
+
+window.addEventListener('load', function () {
+ var res = vm.runInNewContext('a + 5', { a : 100 });
+ document.querySelector('#res').textContent = res;
+});
diff --git a/node_modules/vm-browserify/example/run/index.html b/node_modules/vm-browserify/example/run/index.html
new file mode 100644
index 0000000..9b681f1
--- /dev/null
+++ b/node_modules/vm-browserify/example/run/index.html
@@ -0,0 +1,8 @@
+<html>
+ <head>
+ <script src="/bundle.js"></script>
+ </head>
+ <body>
+ result = <span id="res"></span>
+ </body>
+</html>
diff --git a/node_modules/vm-browserify/example/run/server.js b/node_modules/vm-browserify/example/run/server.js
new file mode 100644
index 0000000..339d3ee
--- /dev/null
+++ b/node_modules/vm-browserify/example/run/server.js
@@ -0,0 +1,6 @@
+var ecstatic = require('ecstatic')(__dirname);
+var http = require('http');
+http.createServer(ecstatic).listen(8000);
+
+console.log('listening on :8000');
+console.log('# remember to run browserify entry.js -o bundle.js');
diff --git a/node_modules/vm-browserify/index.js b/node_modules/vm-browserify/index.js
new file mode 100644
index 0000000..4292de7
--- /dev/null
+++ b/node_modules/vm-browserify/index.js
@@ -0,0 +1,149 @@
+var indexOf = function (xs, item) {
+ if (xs.indexOf) return xs.indexOf(item);
+ else for (var i = 0; i < xs.length; i++) {
+ if (xs[i] === item) return i;
+ }
+ return -1;
+};
+var Object_keys = function (obj) {
+ if (Object.keys) return Object.keys(obj)
+ else {
+ var res = [];
+ for (var key in obj) res.push(key)
+ return res;
+ }
+};
+
+var forEach = function (xs, fn) {
+ if (xs.forEach) return xs.forEach(fn)
+ else for (var i = 0; i < xs.length; i++) {
+ fn(xs[i], i, xs);
+ }
+};
+
+var defineProp = (function() {
+ try {
+ Object.defineProperty({}, '_', {});
+ return function(obj, name, value) {
+ Object.defineProperty(obj, name, {
+ writable: true,
+ enumerable: false,
+ configurable: true,
+ value: value
+ })
+ };
+ } catch(e) {
+ return function(obj, name, value) {
+ obj[name] = value;
+ };
+ }
+}());
+
+var globals = ['Array', 'Boolean', 'Date', 'Error', 'EvalError', 'Function',
+'Infinity', 'JSON', 'Math', 'NaN', 'Number', 'Object', 'RangeError',
+'ReferenceError', 'RegExp', 'String', 'SyntaxError', 'TypeError', 'URIError',
+'decodeURI', 'decodeURIComponent', 'encodeURI', 'encodeURIComponent', 'escape',
+'eval', 'isFinite', 'isNaN', 'parseFloat', 'parseInt', 'undefined', 'unescape'];
+
+function Context() {}
+Context.prototype = {};
+
+var Script = exports.Script = function NodeScript (code) {
+ if (!(this instanceof Script)) return new Script(code);
+ this.code = code;
+};
+
+Script.prototype.runInContext = function (context) {
+ if (!(context instanceof Context)) {
+ throw new TypeError("needs a 'context' argument.");
+ }
+
+ var iframe = document.createElement('iframe');
+ if (!iframe.style) iframe.style = {};
+ iframe.style.display = 'none';
+
+ document.body.appendChild(iframe);
+
+ var win = iframe.contentWindow;
+ var wEval = win.eval, wExecScript = win.execScript;
+
+ if (!wEval && wExecScript) {
+ // win.eval() magically appears when this is called in IE:
+ wExecScript.call(win, 'null');
+ wEval = win.eval;
+ }
+
+ forEach(Object_keys(context), function (key) {
+ win[key] = context[key];
+ });
+ forEach(globals, function (key) {
+ if (context[key]) {
+ win[key] = context[key];
+ }
+ });
+
+ var winKeys = Object_keys(win);
+
+ var res = wEval.call(win, this.code);
+
+ forEach(Object_keys(win), function (key) {
+ // Avoid copying circular objects like `top` and `window` by only
+ // updating existing context properties or new properties in the `win`
+ // that was only introduced after the eval.
+ if (key in context || indexOf(winKeys, key) === -1) {
+ context[key] = win[key];
+ }
+ });
+
+ forEach(globals, function (key) {
+ if (!(key in context)) {
+ defineProp(context, key, win[key]);
+ }
+ });
+
+ document.body.removeChild(iframe);
+
+ return res;
+};
+
+Script.prototype.runInThisContext = function () {
+ return eval(this.code); // maybe...
+};
+
+Script.prototype.runInNewContext = function (context) {
+ var ctx = Script.createContext(context);
+ var res = this.runInContext(ctx);
+
+ if (context) {
+ forEach(Object_keys(ctx), function (key) {
+ context[key] = ctx[key];
+ });
+ }
+
+ return res;
+};
+
+forEach(Object_keys(Script.prototype), function (name) {
+ exports[name] = Script[name] = function (code) {
+ var s = Script(code);
+ return s[name].apply(s, [].slice.call(arguments, 1));
+ };
+});
+
+exports.isContext = function (context) {
+ return context instanceof Context;
+};
+
+exports.createScript = function (code) {
+ return exports.Script(code);
+};
+
+exports.createContext = Script.createContext = function (context) {
+ var copy = new Context();
+ if(typeof context === 'object') {
+ forEach(Object_keys(context), function (key) {
+ copy[key] = context[key];
+ });
+ }
+ return copy;
+};
diff --git a/node_modules/vm-browserify/package.json b/node_modules/vm-browserify/package.json
new file mode 100644
index 0000000..c3e7197
--- /dev/null
+++ b/node_modules/vm-browserify/package.json
@@ -0,0 +1,59 @@
+{
+ "_from": "vm-browserify@^1.0.1",
+ "_id": "vm-browserify@1.1.2",
+ "_inBundle": false,
+ "_integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==",
+ "_location": "/vm-browserify",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "vm-browserify@^1.0.1",
+ "name": "vm-browserify",
+ "escapedName": "vm-browserify",
+ "rawSpec": "^1.0.1",
+ "saveSpec": null,
+ "fetchSpec": "^1.0.1"
+ },
+ "_requiredBy": [
+ "/node-libs-browser"
+ ],
+ "_resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz",
+ "_shasum": "78641c488b8e6ca91a75f511e7a3b32a86e5dda0",
+ "_spec": "vm-browserify@^1.0.1",
+ "_where": "/home/pruss/Dev/3-minute-website/node_modules/node-libs-browser",
+ "author": {
+ "name": "James Halliday",
+ "email": "mail@substack.net",
+ "url": "http://substack.net"
+ },
+ "bugs": {
+ "url": "https://github.com/substack/vm-browserify/issues"
+ },
+ "bundleDependencies": false,
+ "dependencies": {},
+ "deprecated": false,
+ "description": "vm module for the browser",
+ "devDependencies": {
+ "browserify": "^16.1.1",
+ "tape": "^4.11.0",
+ "tape-run": "^6.0.1"
+ },
+ "homepage": "https://github.com/substack/vm-browserify#readme",
+ "keywords": [
+ "vm",
+ "browser",
+ "eval"
+ ],
+ "license": "MIT",
+ "main": "index.js",
+ "name": "vm-browserify",
+ "repository": {
+ "type": "git",
+ "url": "git+ssh://git@github.com/substack/vm-browserify.git"
+ },
+ "scripts": {
+ "test": "browserify test/vm.js | tape-run"
+ },
+ "version": "1.1.2"
+}
diff --git a/node_modules/vm-browserify/readme.markdown b/node_modules/vm-browserify/readme.markdown
new file mode 100644
index 0000000..bc0bfe2
--- /dev/null
+++ b/node_modules/vm-browserify/readme.markdown
@@ -0,0 +1,66 @@
+# vm-browserify
+
+emulate node's vm module for the browser
+
+[![Build Status](https://travis-ci.org/browserify/vm-browserify.svg?branch=master)](https://travis-ci.org/browserify/vm-browserify)
+
+# example
+
+Just write some client-side javascript:
+
+``` js
+var vm = require('vm');
+
+window.addEventListener('load', function () {
+ var res = vm.runInNewContext('a + 5', { a : 100 });
+ document.querySelector('#res').textContent = res;
+});
+```
+
+compile it with [browserify](http://github.com/substack/node-browserify):
+
+```
+browserify entry.js -o bundle.js
+```
+
+then whip up some html:
+
+``` html
+<html>
+ <head>
+ <script src="/bundle.js"></script>
+ </head>
+ <body>
+ result = <span id="res"></span>
+ </body>
+</html>
+```
+
+and when you load the page you should see:
+
+```
+result = 105
+```
+
+# methods
+
+## vm.runInNewContext(code, context={})
+
+Evaluate some `code` in a new iframe with a `context`.
+
+Contexts are like wrapping your code in a `with()` except slightly less terrible
+because the code is sandboxed into a new iframe.
+
+# install
+
+This module is depended upon by browserify, so you should just be able to
+`require('vm')` and it will just work. However if you want to use this module
+directly you can install it with [npm](http://npmjs.org):
+
+```
+npm install vm-browserify
+```
+
+# license
+
+MIT
diff --git a/node_modules/vm-browserify/security.md b/node_modules/vm-browserify/security.md
new file mode 100644
index 0000000..a14ace6
--- /dev/null
+++ b/node_modules/vm-browserify/security.md
@@ -0,0 +1,10 @@
+# Security Policy
+
+## Supported Versions
+Only the latest major version is supported at any given time.
+
+## Reporting a Vulnerability
+
+To report a security vulnerability, please use the
+[Tidelift security contact](https://tidelift.com/security).
+Tidelift will coordinate the fix and disclosure.
diff --git a/node_modules/vm-browserify/test/vm.js b/node_modules/vm-browserify/test/vm.js
new file mode 100644
index 0000000..ea8cd31
--- /dev/null
+++ b/node_modules/vm-browserify/test/vm.js
@@ -0,0 +1,35 @@
+var test = require('tape');
+var vm = require('../');
+
+test('vmRunInNewContext', function (t) {
+ t.plan(6);
+
+ t.equal(vm.runInNewContext('a + 5', { a : 100 }), 105);
+
+ (function () {
+ var vars = { x : 10 };
+ t.equal(vm.runInNewContext('x++', vars), 10);
+ t.equal(vars.x, 11);
+ })();
+
+ (function () {
+ var vars = { x : 10 };
+ t.equal(vm.runInNewContext('var y = 3; y + x++', vars), 13);
+ t.equal(vars.x, 11);
+ t.equal(vars.y, 3);
+ })();
+
+ t.end();
+});
+
+test('vmRunInContext', function (t) {
+ t.plan(2);
+
+ var context = vm.createContext({ foo: 1 });
+
+ vm.runInContext('var x = 1', context);
+ t.deepEqual(context, { foo: 1, x: 1 });
+
+ vm.runInContext('var y = 1', context);
+ t.deepEqual(context, { foo: 1, x: 1, y: 1 });
+});