refactor: Remove dead package make-simple-evaluate
MODIFY
package.json
package.json
"packages/harden",
"packages/make-hardener",
"packages/make-importer",
- "packages/make-simple-evaluate",
"packages/ses",
"packages/ses-ava",
"packages/ses-integration-test",

DELETE
packages/make-simple-evaluate/LICENSE
-Copyright 2018 TC39 Open Source Contributors
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.

DELETE
packages/make-simple-evaluate/README.md
-# Simple Evaluate
-

DELETE
packages/make-simple-evaluate/package.json
-{
- "name": "@agoric/make-simple-evaluate",
- "version": "0.1.0",
- "private": true,
- "description": "A simple secure evaluator without eval and Function",
- "keywords": [],
- "author": "Agoric",
- "license": "Apache-2.0",
- "homepage": "https://github.com/Agoric/SES-shim/tree/master/packages/make-simple-evaluate#readme",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/Agoric/SES-shim.git"
- },
- "bugs": {
- "url": "https://github.com/Agoric/SES-shim/issues"
- },
- "type": "module",
- "main": "./src/main.js",
- "scripts": {
- "lint": "eslint '**/*.js'",
- "lint-fix": "eslint --fix '**/*.js'",
- "OFF-test": "tap --no-esm --no-coverage --reporter spec 'test/**/test-*.js'"
- },
- "dependencies": {},
- "devDependencies": {
- "@agoric/eslint-config": "^0.1.0",
- "tap": "14.10.5"
- },
- "ava": {
- "files": [
- "test/**/test-*.js"
- ],
- "require": []
- },
- "eslintConfig": {
- "extends": [
- "@agoric"
- ]
- },
- "prettier": {
- "trailingComma": "all",
- "singleQuote": true
- },
- "files": [
- "LICENSE*",
- "dist",
- "src"
- ]
-}

DELETE
packages/make-simple-evaluate/src/main.js
-function makeGlobalObject() {
- const globalPropertyNames = [
- // *** 18.2 Function Properties of the Global Object
-
- 'eval',
- 'isFinite',
- 'isNaN',
- 'parseFloat',
- 'parseInt',
-
- 'decodeURI',
- 'decodeURIComponent',
- 'encodeURI',
- 'encodeURIComponent',
-
- // *** 18.3 Constructor Properties of the Global Object
-
- 'Array',
- 'ArrayBuffer',
- 'Boolean',
- 'DataView',
- 'Date',
- 'Error',
- 'EvalError',
- 'Float32Array',
- 'Float64Array',
- 'Function',
- 'Int8Array',
- 'Int16Array',
- 'Int32Array',
- 'Map',
- 'Number',
- 'Object',
- 'Promise',
- 'Proxy',
- 'RangeError',
- 'ReferenceError',
- 'RegExp',
- 'Set',
- 'SharedArrayBuffer',
- 'String',
- 'Symbol',
- 'SyntaxError',
- 'TypeError',
- 'Uint8Array',
- 'Uint8ClampedArray',
- 'Uint16Array',
- 'Uint32Array',
- 'URIError',
- 'WeakMap',
- 'WeakSet',
-
- // *** 18.4 Other Properties of the Global Object
-
- 'Atomics',
- 'JSON',
- 'Math',
- 'Reflect',
-
- // *** Annex B
-
- 'escape',
- 'unescape',
- ];
-
- const blacklist = [
- 'eval',
- 'Function',
- 'Atomics',
- 'SharedArrayBuffer',
- 'Constructor',
- ];
-
- const globalObject = {};
-
- const descs = {
- Infinity: {
- value: Infinity,
- enumerable: false,
- },
- NaN: {
- value: NaN,
- enumerable: false,
- },
- undefined: {
- value: undefined,
- enumerable: false,
- },
- };
-
- for (const name of globalPropertyNames) {
- if (blacklist.contains(name)) {
- // eslint-disable-next-line no-continue
- continue;
- }
- if (name in globalThis) {
- descs[name] = {
- value: globalThis[name],
- configurable: true,
- writable: true,
- enumerable: false,
- };
- }
- }
-
- Object.defineProperties(globalObject, descs);
-
- return globalObject;
-}
-
-function makeEvaluateFactory() {
- // eslint-disable-next-line no-new-func
- return Function(`
- with (arguments[0]) {
- return function() {
- 'use strict';
- return eval(arguments[0]);
- };
- }
- `);
-}
-
-function applyTransforms(transforms, rewriterState) {
- return transforms.reduce(
- (rs, transform) => (transform.rewrite ? transform.rewrite(rs) : rs),
- rewriterState,
- );
-}
-
-export function makeEvaluate(makerOptions = {}) {
- // GLOBAL OBJECT & EVALUATE FACTORY
-
- const globalObject = makeGlobalObject();
- const evaluateFactory = makeEvaluateFactory();
-
- return function evaluate(source, options = {}) {
- // TRANSFORMS & ENDOWMENTS
-
- const allEndowments = {
- ...(options.endowments || {}),
- ...(makerOptions.endowments || {}),
- };
-
- const allTransforms = [
- ...(options.transforms || []),
- ...(makerOptions.transforms || []),
- ];
-
- const { endowments, src } = applyTransforms(allTransforms, {
- endowments: allEndowments,
- src: source,
- });
-
- // PROXY
- const shadow = Object.freeze({});
- const scopeProxy = new Proxy(shadow, {
- get(_shadow, prop) {
- if (typeof prop === 'symbol') {
- return undefined;
- }
- if (prop in endowments) {
- return Reflect.get(endowments, prop, globalObject);
- }
- return Reflect.get(globalObject, prop);
- },
- set(_shadow, prop, value) {
- if (prop in endowments) {
- const desc = Object.getOwnPropertyDescriptor(endowments, prop);
- if ('value' in desc) {
- // Work around a peculiar behavior in the specs, where
- // value properties are defined on the receiver.
- return Reflect.set(endowments, prop, value);
- }
- return Reflect.set(endowments, prop, value, globalObject);
- }
- return Reflect.set(globalObject, prop, value);
- },
- has(_shadow, prop) {
- return prop in endowments || prop in globalObject || prop in globalThis;
- },
- });
-
- return Reflect.apply(evaluateFactory, globalObject, [scopeProxy])(src);
- };
-}

refactor: Remove dead package make-simple-evaluate