Fixed #1 - Fixed the whatsnew-** script for loading release notes into builds

Added test to ensure that release notes are parsed properly
Updated to latest dependencies to fix security vulnerability
Updated GH Actions Workflow to run test before updating tag
Updated README.md to reflect proper whatsnew documentation.
This commit is contained in:
Drew Heavner
2020-01-30 11:14:51 -05:00
parent b6496ac4e3
commit bdde081050
2660 changed files with 251487 additions and 213182 deletions

View File

@@ -5,70 +5,32 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = void 0;
function _includes() {
const data = _interopRequireDefault(require("lodash/includes"));
var _includes = _interopRequireDefault(require("lodash/includes"));
_includes = function () {
return data;
};
return data;
}
function _repeat() {
const data = _interopRequireDefault(require("lodash/repeat"));
_repeat = function () {
return data;
};
return data;
}
var _repeat = _interopRequireDefault(require("lodash/repeat"));
var _renamer = _interopRequireDefault(require("./lib/renamer"));
var _index = _interopRequireDefault(require("../index"));
function _defaults() {
const data = _interopRequireDefault(require("lodash/defaults"));
_defaults = function () {
return data;
};
return data;
}
var _defaults = _interopRequireDefault(require("lodash/defaults"));
var _binding = _interopRequireDefault(require("./binding"));
function _globals() {
const data = _interopRequireDefault(require("globals"));
var _globals = _interopRequireDefault(require("globals"));
_globals = function () {
return data;
};
return data;
}
function t() {
const data = _interopRequireWildcard(require("@babel/types"));
t = function () {
return data;
};
return data;
}
var t = _interopRequireWildcard(require("@babel/types"));
var _cache = require("../cache");
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function gatherNodeParts(node, parts) {
if (t().isModuleDeclaration(node)) {
if (t.isModuleDeclaration(node)) {
if (node.source) {
gatherNodeParts(node.source, parts);
} else if (node.specifiers && node.specifiers.length) {
@@ -78,33 +40,33 @@ function gatherNodeParts(node, parts) {
} else if (node.declaration) {
gatherNodeParts(node.declaration, parts);
}
} else if (t().isModuleSpecifier(node)) {
} else if (t.isModuleSpecifier(node)) {
gatherNodeParts(node.local, parts);
} else if (t().isMemberExpression(node)) {
} else if (t.isMemberExpression(node)) {
gatherNodeParts(node.object, parts);
gatherNodeParts(node.property, parts);
} else if (t().isIdentifier(node)) {
} else if (t.isIdentifier(node)) {
parts.push(node.name);
} else if (t().isLiteral(node)) {
} else if (t.isLiteral(node)) {
parts.push(node.value);
} else if (t().isCallExpression(node)) {
} else if (t.isCallExpression(node)) {
gatherNodeParts(node.callee, parts);
} else if (t().isObjectExpression(node) || t().isObjectPattern(node)) {
} else if (t.isObjectExpression(node) || t.isObjectPattern(node)) {
for (const prop of node.properties) {
gatherNodeParts(prop.key || prop.argument, parts);
}
} else if (t().isPrivateName(node)) {
} else if (t.isPrivateName(node)) {
gatherNodeParts(node.id, parts);
} else if (t().isThisExpression(node)) {
} else if (t.isThisExpression(node)) {
parts.push("this");
} else if (t().isSuper(node)) {
} else if (t.isSuper(node)) {
parts.push("super");
}
}
const collectorVisitor = {
For(path) {
for (const key of t().FOR_INIT_KEYS) {
for (const key of t.FOR_INIT_KEYS) {
const declar = path.get(key);
if (declar.isVar()) {
@@ -145,14 +107,14 @@ const collectorVisitor = {
} = path;
const declar = node.declaration;
if (t().isClassDeclaration(declar) || t().isFunctionDeclaration(declar)) {
if (t.isClassDeclaration(declar) || t.isFunctionDeclaration(declar)) {
const id = declar.id;
if (!id) return;
const binding = scope.getBinding(id.name);
if (binding) binding.reference(path);
} else if (t().isVariableDeclaration(declar)) {
} else if (t.isVariableDeclaration(declar)) {
for (const decl of declar.declarations) {
for (const name of Object.keys(t().getBindingIdentifiers(decl))) {
for (const name of Object.keys(t.getBindingIdentifiers(decl))) {
const binding = scope.getBinding(name);
if (binding) binding.reference(path);
}
@@ -184,14 +146,14 @@ const collectorVisitor = {
BlockScoped(path) {
let scope = path.scope;
if (scope.path === path) scope = scope.parent;
scope.getBlockParent().registerDeclaration(path);
},
const parent = scope.getBlockParent();
parent.registerDeclaration(path);
ClassDeclaration(path) {
const id = path.node.id;
if (!id) return;
const name = id.name;
path.scope.bindings[name] = path.scope.getBinding(name);
if (path.isClassDeclaration() && path.node.id) {
const id = path.node.id;
const name = id.name;
path.scope.bindings[name] = path.scope.parent.getBinding(name);
}
},
Block(path) {
@@ -249,15 +211,15 @@ class Scope {
this.push({
id
});
return t().cloneNode(id);
return t.cloneNode(id);
}
generateUidIdentifier(name) {
return t().identifier(this.generateUid(name));
return t.identifier(this.generateUid(name));
}
generateUid(name = "temp") {
name = t().toIdentifier(name).replace(/^_+/, "").replace(/[0-9]+$/g, "");
name = t.toIdentifier(name).replace(/^_+/, "").replace(/[0-9]+$/g, "");
let uid;
let i = 0;
@@ -281,11 +243,11 @@ class Scope {
generateUidBasedOnNode(parent, defaultName) {
let node = parent;
if (t().isAssignmentExpression(parent)) {
if (t.isAssignmentExpression(parent)) {
node = parent.left;
} else if (t().isVariableDeclarator(parent)) {
} else if (t.isVariableDeclarator(parent)) {
node = parent.id;
} else if (t().isObjectProperty(node) || t().isObjectMethod(node)) {
} else if (t.isObjectProperty(node) || t.isObjectMethod(node)) {
node = node.key;
}
@@ -297,15 +259,15 @@ class Scope {
}
generateUidIdentifierBasedOnNode(parent, defaultName) {
return t().identifier(this.generateUidBasedOnNode(parent, defaultName));
return t.identifier(this.generateUidBasedOnNode(parent, defaultName));
}
isStatic(node) {
if (t().isThisExpression(node) || t().isSuper(node)) {
if (t.isThisExpression(node) || t.isSuper(node)) {
return true;
}
if (t().isIdentifier(node)) {
if (t.isIdentifier(node)) {
const binding = this.getBinding(node.name);
if (binding) {
@@ -328,7 +290,7 @@ class Scope {
this.push({
id
});
return t().cloneNode(id);
return t.cloneNode(id);
}
return id;
@@ -362,7 +324,7 @@ class Scope {
}
dump() {
const sep = (0, _repeat().default)("-", 60);
const sep = (0, _repeat.default)("-", 60);
console.log(sep);
let scope = this;
@@ -384,7 +346,7 @@ class Scope {
}
toArray(node, i) {
if (t().isIdentifier(node)) {
if (t.isIdentifier(node)) {
const binding = this.getBinding(node.name);
if (binding && binding.constant && binding.path.isGenericType("Array")) {
@@ -392,14 +354,14 @@ class Scope {
}
}
if (t().isArrayExpression(node)) {
if (t.isArrayExpression(node)) {
return node;
}
if (t().isIdentifier(node, {
if (t.isIdentifier(node, {
name: "arguments"
})) {
return t().callExpression(t().memberExpression(t().memberExpression(t().memberExpression(t().identifier("Array"), t().identifier("prototype")), t().identifier("slice")), t().identifier("call")), [node]);
return t.callExpression(t.memberExpression(t.memberExpression(t.memberExpression(t.identifier("Array"), t.identifier("prototype")), t.identifier("slice")), t.identifier("call")), [node]);
}
let helperName;
@@ -408,13 +370,13 @@ class Scope {
if (i === true) {
helperName = "toConsumableArray";
} else if (i) {
args.push(t().numericLiteral(i));
args.push(t.numericLiteral(i));
helperName = "slicedToArray";
} else {
helperName = "toArray";
}
return t().callExpression(this.hub.addHelper(helperName), args);
return t.callExpression(this.hub.addHelper(helperName), args);
}
hasLabel(name) {
@@ -460,11 +422,7 @@ class Scope {
}
buildUndefinedNode() {
if (this.hasBinding("undefined")) {
return t().unaryExpression("void", t().numericLiteral(0), true);
} else {
return t().identifier("undefined");
}
return t.unaryExpression("void", t.numericLiteral(0), true);
}
registerConstantViolation(path) {
@@ -552,56 +510,56 @@ class Scope {
}
isPure(node, constantsOnly) {
if (t().isIdentifier(node)) {
if (t.isIdentifier(node)) {
const binding = this.getBinding(node.name);
if (!binding) return false;
if (constantsOnly) return binding.constant;
return true;
} else if (t().isClass(node)) {
} else if (t.isClass(node)) {
if (node.superClass && !this.isPure(node.superClass, constantsOnly)) {
return false;
}
return this.isPure(node.body, constantsOnly);
} else if (t().isClassBody(node)) {
} else if (t.isClassBody(node)) {
for (const method of node.body) {
if (!this.isPure(method, constantsOnly)) return false;
}
return true;
} else if (t().isBinary(node)) {
} else if (t.isBinary(node)) {
return this.isPure(node.left, constantsOnly) && this.isPure(node.right, constantsOnly);
} else if (t().isArrayExpression(node)) {
} else if (t.isArrayExpression(node)) {
for (const elem of node.elements) {
if (!this.isPure(elem, constantsOnly)) return false;
}
return true;
} else if (t().isObjectExpression(node)) {
} else if (t.isObjectExpression(node)) {
for (const prop of node.properties) {
if (!this.isPure(prop, constantsOnly)) return false;
}
return true;
} else if (t().isClassMethod(node)) {
} else if (t.isClassMethod(node)) {
if (node.computed && !this.isPure(node.key, constantsOnly)) return false;
if (node.kind === "get" || node.kind === "set") return false;
return true;
} else if (t().isProperty(node)) {
} else if (t.isProperty(node)) {
if (node.computed && !this.isPure(node.key, constantsOnly)) return false;
return this.isPure(node.value, constantsOnly);
} else if (t().isUnaryExpression(node)) {
} else if (t.isUnaryExpression(node)) {
return this.isPure(node.argument, constantsOnly);
} else if (t().isTaggedTemplateExpression(node)) {
return t().matchesPattern(node.tag, "String.raw") && !this.hasBinding("String", true) && this.isPure(node.quasi, constantsOnly);
} else if (t().isTemplateLiteral(node)) {
} else if (t.isTaggedTemplateExpression(node)) {
return t.matchesPattern(node.tag, "String.raw") && !this.hasBinding("String", true) && this.isPure(node.quasi, constantsOnly);
} else if (t.isTemplateLiteral(node)) {
for (const expression of node.expressions) {
if (!this.isPure(expression, constantsOnly)) return false;
}
return true;
} else {
return t().isPureish(node);
return t.isPureish(node);
}
}
@@ -640,20 +598,20 @@ class Scope {
this.data = Object.create(null);
if (path.isLoop()) {
for (const key of t().FOR_INIT_KEYS) {
for (const key of t.FOR_INIT_KEYS) {
const node = path.get(key);
if (node.isBlockScoped()) this.registerBinding(node.node.kind, node);
}
}
if (path.isFunctionExpression() && path.has("id")) {
if (!path.get("id").node[t().NOT_LOCAL_BINDING]) {
if (!path.get("id").node[t.NOT_LOCAL_BINDING]) {
this.registerBinding("local", path.get("id"), path);
}
}
if (path.isClassExpression() && path.has("id")) {
if (!path.get("id").node[t().NOT_LOCAL_BINDING]) {
if (!path.get("id").node[t.NOT_LOCAL_BINDING]) {
this.registerBinding("local", path);
}
}
@@ -732,13 +690,13 @@ class Scope {
let declarPath = !unique && path.getData(dataKey);
if (!declarPath) {
const declar = t().variableDeclaration(kind, []);
const declar = t.variableDeclaration(kind, []);
declar._blockHoist = blockHoist;
[declarPath] = path.unshiftContainer("body", [declar]);
if (!unique) path.setData(dataKey, declarPath);
}
const declarator = t().variableDeclarator(opts.id, opts.init);
const declarator = t.variableDeclarator(opts.id, opts.init);
declarPath.node.declarations.push(declarator);
this.registerBinding(kind, declarPath.get("declarations").pop());
}
@@ -784,7 +742,7 @@ class Scope {
let scope = this;
do {
(0, _defaults().default)(ids, scope.bindings);
(0, _defaults.default)(ids, scope.bindings);
scope = scope.parent;
} while (scope);
@@ -816,10 +774,18 @@ class Scope {
getBinding(name) {
let scope = this;
let previousPath;
do {
const binding = scope.getOwnBinding(name);
if (binding) return binding;
if (binding) {
if (previousPath && previousPath.isPattern() && previousPath.parentPath.isFunction() && binding.kind !== "param") {} else {
return binding;
}
}
previousPath = scope.path;
} while (scope = scope.parent);
}
@@ -846,8 +812,8 @@ class Scope {
if (this.hasOwnBinding(name)) return true;
if (this.parentHasBinding(name, noGlobals)) return true;
if (this.hasUid(name)) return true;
if (!noGlobals && (0, _includes().default)(Scope.globals, name)) return true;
if (!noGlobals && (0, _includes().default)(Scope.contextVariables, name)) return true;
if (!noGlobals && (0, _includes.default)(Scope.globals, name)) return true;
if (!noGlobals && (0, _includes.default)(Scope.contextVariables, name)) return true;
return false;
}
@@ -888,5 +854,5 @@ class Scope {
}
exports.default = Scope;
Scope.globals = Object.keys(_globals().default.builtin);
Scope.globals = Object.keys(_globals.default.builtin);
Scope.contextVariables = ["arguments", "undefined", "Infinity", "NaN"];

View File

@@ -7,27 +7,13 @@ exports.default = void 0;
var _binding = _interopRequireDefault(require("../binding"));
function _helperSplitExportDeclaration() {
const data = _interopRequireDefault(require("@babel/helper-split-export-declaration"));
var _helperSplitExportDeclaration = _interopRequireDefault(require("@babel/helper-split-export-declaration"));
_helperSplitExportDeclaration = function () {
return data;
};
var t = _interopRequireWildcard(require("@babel/types"));
return data;
}
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function t() {
const data = _interopRequireWildcard(require("@babel/types"));
t = function () {
return data;
};
return data;
}
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -74,27 +60,27 @@ class Renamer {
return;
}
(0, _helperSplitExportDeclaration().default)(maybeExportDeclar);
(0, _helperSplitExportDeclaration.default)(maybeExportDeclar);
}
maybeConvertFromClassFunctionDeclaration(path) {
return;
if (!path.isFunctionDeclaration() && !path.isClassDeclaration()) return;
if (this.binding.kind !== "hoisted") return;
path.node.id = t().identifier(this.oldName);
path.node.id = t.identifier(this.oldName);
path.node._blockHoist = 3;
path.replaceWith(t().variableDeclaration("let", [t().variableDeclarator(t().identifier(this.newName), t().toExpression(path.node))]));
path.replaceWith(t.variableDeclaration("let", [t.variableDeclarator(t.identifier(this.newName), t.toExpression(path.node))]));
}
maybeConvertFromClassFunctionExpression(path) {
return;
if (!path.isFunctionExpression() && !path.isClassExpression()) return;
if (this.binding.kind !== "local") return;
path.node.id = t().identifier(this.oldName);
path.node.id = t.identifier(this.oldName);
this.binding.scope.parent.push({
id: t().identifier(this.newName)
id: t.identifier(this.newName)
});
path.replaceWith(t().assignmentExpression("=", t().identifier(this.newName), path.node));
path.replaceWith(t.assignmentExpression("=", t.identifier(this.newName), path.node));
}
rename(block) {