@dmail/uneval
Advanced tools
Comparing version 5.4.0 to 5.6.0
@@ -5,15 +5,2 @@ 'use strict'; | ||
// https://mathiasbynens.be/notes/globalthis | ||
// eslint-disable-next-line no-extend-native | ||
Object.defineProperty(Object.prototype, "__global__", { | ||
get: function get() { | ||
return this; | ||
}, | ||
configurable: true | ||
}); // eslint-disable-next-line no-undef | ||
var globalThis = __global__; | ||
delete Object.prototype.__global__; | ||
globalThis.globalThis = globalThis; | ||
function _typeof(obj) { | ||
@@ -53,2 +40,24 @@ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { | ||
// eslint-disable-next-line no-undef | ||
if ((typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) !== "object") { | ||
var globalObject; | ||
if (undefined) { | ||
globalObject = undefined; | ||
} else { | ||
// eslint-disable-next-line no-extend-native | ||
Object.defineProperty(Object.prototype, "__global__", { | ||
get: function get() { | ||
return this; | ||
}, | ||
configurable: true | ||
}); // eslint-disable-next-line no-undef | ||
globalObject = __global__; | ||
delete Object.prototype.__global__; | ||
} | ||
globalObject.globalThis = globalObject; | ||
} | ||
// https://developer.mozilla.org/en-US/docs/Glossary/Primitive | ||
@@ -97,3 +106,3 @@ var isComposite = function isComposite(value) { | ||
var propertyValue = descriptor.value; | ||
visitValue(propertyValue, _toConsumableArray(path).concat([property])); | ||
visitValue(propertyValue, [].concat(_toConsumableArray(path), [property])); | ||
} | ||
@@ -164,3 +173,3 @@ }; | ||
var propertyDescriptor = Object.getOwnPropertyDescriptor(value, propertyName); | ||
var propertyNameIdentifier = valueToIdentifier(propertyName, _toConsumableArray(path).concat([propertyName])); | ||
var propertyNameIdentifier = valueToIdentifier(propertyName, [].concat(_toConsumableArray(path), [propertyName])); | ||
var propertyDescription = computePropertyDescription(propertyDescriptor, propertyName, path); | ||
@@ -175,3 +184,3 @@ propertyDescriptionArray.push({ | ||
var propertyDescriptor = Object.getOwnPropertyDescriptor(value, symbol); | ||
var symbolIdentifier = valueToIdentifier(symbol, _toConsumableArray(path).concat(["[".concat(symbol.toString(), "]")])); | ||
var symbolIdentifier = valueToIdentifier(symbol, [].concat(_toConsumableArray(path), ["[".concat(symbol.toString(), "]")])); | ||
var propertyDescription = computePropertyDescription(propertyDescriptor, symbol, path); | ||
@@ -207,5 +216,5 @@ symbolDescriptionArray.push({ | ||
enumerable: propertyDescriptor.enumerable, | ||
getIdentifier: "get" in propertyDescriptor ? valueToIdentifier(propertyDescriptor.get, _toConsumableArray(path).concat([String(propertyNameOrSymbol), "[[descriptor:get]]"])) : undefined, | ||
setIdentifier: "set" in propertyDescriptor ? valueToIdentifier(propertyDescriptor.set, _toConsumableArray(path).concat([String(propertyNameOrSymbol), "[[descriptor:set]]"])) : undefined, | ||
valueIdentifier: "value" in propertyDescriptor ? valueToIdentifier(propertyDescriptor.value, _toConsumableArray(path).concat([String(propertyNameOrSymbol), "[[descriptor:value]]"])) : undefined | ||
getIdentifier: "get" in propertyDescriptor ? valueToIdentifier(propertyDescriptor.get, [].concat(_toConsumableArray(path), [String(propertyNameOrSymbol), "[[descriptor:get]]"])) : undefined, | ||
setIdentifier: "set" in propertyDescriptor ? valueToIdentifier(propertyDescriptor.set, [].concat(_toConsumableArray(path), [String(propertyNameOrSymbol), "[[descriptor:set]]"])) : undefined, | ||
valueIdentifier: "value" in propertyDescriptor ? valueToIdentifier(propertyDescriptor.value, [].concat(_toConsumableArray(path), [String(propertyNameOrSymbol), "[[descriptor:value]]"])) : undefined | ||
}; | ||
@@ -220,3 +229,3 @@ }; | ||
value.forEach(function (entryValue, index) { | ||
var entryValueIdentifier = valueToIdentifier(entryValue, _toConsumableArray(path).concat(["[[SetEntryValue]]", index])); | ||
var entryValueIdentifier = valueToIdentifier(entryValue, [].concat(_toConsumableArray(path), ["[[SetEntryValue]]", index])); | ||
callArray.push([entryValueIdentifier]); | ||
@@ -233,4 +242,4 @@ }); | ||
value.forEach(function (entryValue, entryKey) { | ||
var entryKeyIdentifier = valueToIdentifier(entryKey, _toConsumableArray(path).concat(["[[MapEntryKey]]", entryKey])); | ||
var entryValueIdentifier = valueToIdentifier(entryValue, _toConsumableArray(path).concat(["[[MapEntryValue]]", entryValue])); | ||
var entryKeyIdentifier = valueToIdentifier(entryKey, [].concat(_toConsumableArray(path), ["[[MapEntryKey]]", entryKey])); | ||
var entryValueIdentifier = valueToIdentifier(entryValue, [].concat(_toConsumableArray(path), ["[[MapEntryValue]]", entryValue])); | ||
@@ -304,7 +313,7 @@ _callArray.push([entryKeyIdentifier, entryValueIdentifier]); | ||
var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; | ||
if (value instanceof Array) return valueToIdentifier(value.length, _toConsumableArray(path).concat(["length"])); | ||
if (value instanceof Array) return valueToIdentifier(value.length, [].concat(_toConsumableArray(path), ["length"])); | ||
if ("valueOf" in value === false) return undefined; | ||
if (typeof value.valueOf !== "function") return undefined; | ||
var valueOfReturnValue = value.valueOf(); | ||
if (!isComposite(valueOfReturnValue)) return valueToIdentifier(valueOfReturnValue, _toConsumableArray(path).concat(["valueOf()"])); | ||
if (!isComposite(valueOfReturnValue)) return valueToIdentifier(valueOfReturnValue, [].concat(_toConsumableArray(path), ["valueOf()"])); | ||
if (valueOfReturnValue === value) return undefined; | ||
@@ -452,4 +461,5 @@ throw new Error(createUnexpectedValueOfReturnValueMessage()); | ||
var createUnknownPrototypeMessage = function createUnknownPrototypeMessage() { | ||
return "prototype must be global, like Object.prototype, or somewhere in the value."; | ||
var createUnknownPrototypeMessage = function createUnknownPrototypeMessage(_ref10) { | ||
var prototypeValue = _ref10.prototypeValue; | ||
return "prototype must be global, like Object.prototype, or somewhere in the value.\nprototype constructor name: ".concat(prototypeValue.constructor.name); | ||
}; | ||
@@ -606,3 +616,3 @@ | ||
var recipeVariableName = identifierToVariableName(recipeArray.indexOf(recipe)); | ||
source += "var ".concat(recipeVariableName, " = ").concat(recipeToSetupSource(recipe, recipeVariableName), "\n"); | ||
source += "var ".concat(recipeVariableName, " = ").concat(recipeToSetupSource(recipe), "\n"); | ||
}); | ||
@@ -609,0 +619,0 @@ |
var __dmail_uneval__ = function (exports) { | ||
'use strict'; // https://mathiasbynens.be/notes/globalthis | ||
// eslint-disable-next-line no-extend-native | ||
'use strict'; | ||
Object.defineProperty(Object.prototype, "__global__", { | ||
get: function get() { | ||
return this; | ||
}, | ||
configurable: true | ||
}); // eslint-disable-next-line no-undef | ||
var globalThis = __global__; | ||
delete Object.prototype.__global__; | ||
globalThis.globalThis = globalThis; | ||
function _typeof(obj) { | ||
@@ -48,2 +36,24 @@ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance"); | ||
} // eslint-disable-next-line no-undef | ||
if ((typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) !== "object") { | ||
var globalObject; | ||
if (undefined) { | ||
globalObject = undefined; | ||
} else { | ||
// eslint-disable-next-line no-extend-native | ||
Object.defineProperty(Object.prototype, "__global__", { | ||
get: function get() { | ||
return this; | ||
}, | ||
configurable: true | ||
}); // eslint-disable-next-line no-undef | ||
globalObject = __global__; | ||
delete Object.prototype.__global__; | ||
} | ||
globalObject.globalThis = globalObject; | ||
} // https://developer.mozilla.org/en-US/docs/Glossary/Primitive | ||
@@ -96,3 +106,3 @@ | ||
var propertyValue = descriptor.value; | ||
visitValue(propertyValue, _toConsumableArray(path).concat([property])); | ||
visitValue(propertyValue, [].concat(_toConsumableArray(path), [property])); | ||
} | ||
@@ -163,3 +173,3 @@ }; | ||
var propertyDescriptor = Object.getOwnPropertyDescriptor(value, propertyName); | ||
var propertyNameIdentifier = valueToIdentifier(propertyName, _toConsumableArray(path).concat([propertyName])); | ||
var propertyNameIdentifier = valueToIdentifier(propertyName, [].concat(_toConsumableArray(path), [propertyName])); | ||
var propertyDescription = computePropertyDescription(propertyDescriptor, propertyName, path); | ||
@@ -174,3 +184,3 @@ propertyDescriptionArray.push({ | ||
var propertyDescriptor = Object.getOwnPropertyDescriptor(value, symbol); | ||
var symbolIdentifier = valueToIdentifier(symbol, _toConsumableArray(path).concat(["[".concat(symbol.toString(), "]")])); | ||
var symbolIdentifier = valueToIdentifier(symbol, [].concat(_toConsumableArray(path), ["[".concat(symbol.toString(), "]")])); | ||
var propertyDescription = computePropertyDescription(propertyDescriptor, symbol, path); | ||
@@ -206,5 +216,5 @@ symbolDescriptionArray.push({ | ||
enumerable: propertyDescriptor.enumerable, | ||
getIdentifier: "get" in propertyDescriptor ? valueToIdentifier(propertyDescriptor.get, _toConsumableArray(path).concat([String(propertyNameOrSymbol), "[[descriptor:get]]"])) : undefined, | ||
setIdentifier: "set" in propertyDescriptor ? valueToIdentifier(propertyDescriptor.set, _toConsumableArray(path).concat([String(propertyNameOrSymbol), "[[descriptor:set]]"])) : undefined, | ||
valueIdentifier: "value" in propertyDescriptor ? valueToIdentifier(propertyDescriptor.value, _toConsumableArray(path).concat([String(propertyNameOrSymbol), "[[descriptor:value]]"])) : undefined | ||
getIdentifier: "get" in propertyDescriptor ? valueToIdentifier(propertyDescriptor.get, [].concat(_toConsumableArray(path), [String(propertyNameOrSymbol), "[[descriptor:get]]"])) : undefined, | ||
setIdentifier: "set" in propertyDescriptor ? valueToIdentifier(propertyDescriptor.set, [].concat(_toConsumableArray(path), [String(propertyNameOrSymbol), "[[descriptor:set]]"])) : undefined, | ||
valueIdentifier: "value" in propertyDescriptor ? valueToIdentifier(propertyDescriptor.value, [].concat(_toConsumableArray(path), [String(propertyNameOrSymbol), "[[descriptor:value]]"])) : undefined | ||
}; | ||
@@ -219,3 +229,3 @@ }; | ||
value.forEach(function (entryValue, index) { | ||
var entryValueIdentifier = valueToIdentifier(entryValue, _toConsumableArray(path).concat(["[[SetEntryValue]]", index])); | ||
var entryValueIdentifier = valueToIdentifier(entryValue, [].concat(_toConsumableArray(path), ["[[SetEntryValue]]", index])); | ||
callArray.push([entryValueIdentifier]); | ||
@@ -232,4 +242,4 @@ }); | ||
value.forEach(function (entryValue, entryKey) { | ||
var entryKeyIdentifier = valueToIdentifier(entryKey, _toConsumableArray(path).concat(["[[MapEntryKey]]", entryKey])); | ||
var entryValueIdentifier = valueToIdentifier(entryValue, _toConsumableArray(path).concat(["[[MapEntryValue]]", entryValue])); | ||
var entryKeyIdentifier = valueToIdentifier(entryKey, [].concat(_toConsumableArray(path), ["[[MapEntryKey]]", entryKey])); | ||
var entryValueIdentifier = valueToIdentifier(entryValue, [].concat(_toConsumableArray(path), ["[[MapEntryValue]]", entryValue])); | ||
@@ -303,7 +313,7 @@ _callArray.push([entryKeyIdentifier, entryValueIdentifier]); | ||
var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; | ||
if (value instanceof Array) return valueToIdentifier(value.length, _toConsumableArray(path).concat(["length"])); | ||
if (value instanceof Array) return valueToIdentifier(value.length, [].concat(_toConsumableArray(path), ["length"])); | ||
if ("valueOf" in value === false) return undefined; | ||
if (typeof value.valueOf !== "function") return undefined; | ||
var valueOfReturnValue = value.valueOf(); | ||
if (!isComposite(valueOfReturnValue)) return valueToIdentifier(valueOfReturnValue, _toConsumableArray(path).concat(["valueOf()"])); | ||
if (!isComposite(valueOfReturnValue)) return valueToIdentifier(valueOfReturnValue, [].concat(_toConsumableArray(path), ["valueOf()"])); | ||
if (valueOfReturnValue === value) return undefined; | ||
@@ -451,4 +461,5 @@ throw new Error(createUnexpectedValueOfReturnValueMessage()); | ||
var createUnknownPrototypeMessage = function createUnknownPrototypeMessage() { | ||
return "prototype must be global, like Object.prototype, or somewhere in the value."; | ||
var createUnknownPrototypeMessage = function createUnknownPrototypeMessage(_ref10) { | ||
var prototypeValue = _ref10.prototypeValue; | ||
return "prototype must be global, like Object.prototype, or somewhere in the value.\nprototype constructor name: ".concat(prototypeValue.constructor.name); | ||
}; // be carefull because this function is mutating recipe objects inside the recipeArray. | ||
@@ -605,3 +616,3 @@ // this is not an issue because each recipe object is not accessible from the outside | ||
var recipeVariableName = identifierToVariableName(recipeArray.indexOf(recipe)); | ||
source += "var ".concat(recipeVariableName, " = ").concat(recipeToSetupSource(recipe, recipeVariableName), "\n"); | ||
source += "var ".concat(recipeVariableName, " = ").concat(recipeToSetupSource(recipe), "\n"); | ||
}); | ||
@@ -608,0 +619,0 @@ |
104
package.json
{ | ||
"name": "@dmail/uneval", | ||
"version": "5.4.0", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/dmail/uneval" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"module": "index.js", | ||
"browser": "dist/global/main.js", | ||
"main": "dist/commonjs/main.js", | ||
"files": [ | ||
"/index.js", | ||
"/src/", | ||
"/dist/" | ||
], | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@jsenv/core": "5.51.0", | ||
"@jsenv/eslint-config": "8.0.0", | ||
"@jsenv/eslint-import-resolver": "4.6.0", | ||
"@jsenv/prettier-config": "1.0.0", | ||
"@jsenv/prettier-check-project": "2.3.0", | ||
"@jsenv/codecov-upload": "1.6.0", | ||
"@jsenv/node-module-import-map": "1.5.0", | ||
"@dmail/assert": "3.7.0", | ||
"babel-eslint": "11.0.0-beta.0", | ||
"prettier": "1.16.3", | ||
"eslint": "5.1.0", | ||
"eslint-plugin-import": "2.6.0", | ||
"rimraf": "2.6.2" | ||
}, | ||
"scripts": { | ||
"generate-import-map": "node ./script/generate-import-map/generate-import-map.js", | ||
"start-browsing-server": "node ./script/start-browsing-server/start-browsing-server.js", | ||
"test": "node ./script/test/test.js", | ||
"eslint-check-project": "eslint .", | ||
"prettier-check-project": "node ./script/prettier-check-project/prettier-check-project.js", | ||
"generate-coverage": "node ./script/generate-coverage/generate-coverage.js", | ||
"upload-coverage": "node ./script/upload-coverage/upload-coverage.js", | ||
"dist": "npm run clean && npm run generate-global-bundle && npm run generate-commonjs-bundle", | ||
"generate-global-bundle": "node ./script/generate-global-bundle/generate-global-bundle.js", | ||
"generate-commonjs-bundle": "node ./script/generate-commonjs-bundle/generate-commonjs-bundle.js", | ||
"clean": "rimraf dist && rimraf coverage", | ||
"reinstall": "npm run clean && rimraf node_modules && npm install", | ||
"prepublishOnly": "npm run dist" | ||
} | ||
} | ||
"name": "@dmail/uneval", | ||
"version": "5.6.0", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/dmail/uneval" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"module": "index.js", | ||
"browser": "dist/global/main.js", | ||
"main": "dist/commonjs/main.js", | ||
"files": [ | ||
"/dist/", | ||
"/src/", | ||
"/index.js" | ||
], | ||
"scripts": { | ||
"start-exploring-server": "node ./script/start-exploring-server/start-exploring-server.js", | ||
"test": "node ./script/test/test.js", | ||
"eslint-check": "eslint .", | ||
"prettier-check": "node ./script/prettier-check/prettier-check.js", | ||
"generate-coverage": "node ./script/generate-coverage/generate-coverage.js", | ||
"upload-coverage": "node ./script/upload-coverage/upload-coverage.js", | ||
"generate-global-bundle": "node ./script/generate-global-bundle/generate-global-bundle.js", | ||
"generate-commonjs-bundle": "node ./script/generate-commonjs-bundle/generate-commonjs-bundle.js", | ||
"generate-import-map": "node ./script/generate-import-map/generate-import-map.js", | ||
"dist": "npm run clean && npm run generate-global-bundle && npm run generate-commonjs-bundle", | ||
"clean": "rimraf dist && rimraf coverage", | ||
"reinstall": "npm run clean && rimraf node_modules && npm install", | ||
"prepublishOnly": "node ./script/transform-package/remove-postinstall.js && npm run dist", | ||
"postpublish": "node ./script/transform-package/restore-postinstall.js" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@jsenv/exploring-server": "2.14.0", | ||
"@jsenv/execution": "1.1.0", | ||
"@jsenv/bundling": "1.15.0", | ||
"@jsenv/testing": "1.27.0", | ||
"@jsenv/node-launcher": "1.17.0", | ||
"@jsenv/chromium-launcher": "2.3.0", | ||
"@jsenv/eslint-config": "9.8.0", | ||
"@jsenv/prettier-config": "1.0.0", | ||
"@jsenv/prettier-check-project": "3.2.0", | ||
"@jsenv/codecov-upload": "1.7.0", | ||
"@jsenv/node-module-import-map": "3.2.0", | ||
"@dmail/assert": "3.14.0", | ||
"babel-eslint": "11.0.0-beta.0", | ||
"prettier": "1.18.2", | ||
"eslint": "6.2.1", | ||
"rimraf": "3.0.0" | ||
} | ||
} |
@@ -358,3 +358,4 @@ /** | ||
const createUnknownPrototypeMessage = () => | ||
`prototype must be global, like Object.prototype, or somewhere in the value.` | ||
const createUnknownPrototypeMessage = ({ prototypeValue }) => | ||
`prototype must be global, like Object.prototype, or somewhere in the value. | ||
prototype constructor name: ${prototypeValue.constructor.name}` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
274686
1716
16