Skip to content

chore: Bump terser #4791

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@
"sade": "^1.8.1",
"sinon": "^19.0.2",
"sinon-chai": "^4.0.0",
"terser": "5.16.0",
"terser": "^5.41.0",
"typescript": "5.1.6",
"undici": "^4.12.0",
"vite": "^6.2.0",
Expand Down
3 changes: 1 addition & 2 deletions src/clone-element.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { assign, slice } from './util';
import { createVNode } from './create-element';
import { NULL } from './constants';

/**
* Clones the given VNode, optionally adding attributes/props and replacing its
Expand Down Expand Up @@ -33,6 +32,6 @@ export function cloneElement(vnode, props, children) {
normalizedProps,
key || vnode.key,
ref || vnode.ref,
NULL
null
);
}
24 changes: 12 additions & 12 deletions src/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { assign } from './util';
import { diff, commitRoot } from './diff/index';
import options from './options';
import { Fragment } from './create-element';
import { MODE_HYDRATE, NULL } from './constants';
import { MODE_HYDRATE } from './constants';

/**
* Base Component class. Provides `setState()` and `forceUpdate()`, which
Expand All @@ -28,7 +28,7 @@ export function BaseComponent(props, context) {
BaseComponent.prototype.setState = function (update, callback) {
// only clone state when copying to nextState the first time.
let s;
if (this._nextState != NULL && this._nextState != this.state) {
if (this._nextState != null && this._nextState != this.state) {
s = this._nextState;
} else {
s = this._nextState = assign({}, this.state);
Expand All @@ -45,7 +45,7 @@ BaseComponent.prototype.setState = function (update, callback) {
}

// Skip update if updater function returned null
if (update == NULL) return;
if (update == null) return;

if (this._vnode) {
if (callback) {
Expand Down Expand Up @@ -89,18 +89,18 @@ BaseComponent.prototype.render = Fragment;
* @param {number | null} [childIndex]
*/
export function getDomSibling(vnode, childIndex) {
if (childIndex == NULL) {
if (childIndex == null) {
// Use childIndex==null as a signal to resume the search from the vnode's sibling
return vnode._parent
? getDomSibling(vnode._parent, vnode._index + 1)
: NULL;
: null;
}

let sibling;
for (; childIndex < vnode._children.length; childIndex++) {
sibling = vnode._children[childIndex];

if (sibling != NULL && sibling._dom != NULL) {
if (sibling != null && sibling._dom != null) {
// Since updateParentDomPointers keeps _dom pointer correct,
// we can rely on _dom to tell us if this subtree contains a
// rendered DOM node, and what the first rendered DOM node is
Expand All @@ -113,7 +113,7 @@ export function getDomSibling(vnode, childIndex) {
// Only climb up and search the parent if we aren't searching through a DOM
// VNode (meaning we reached the DOM parent of the original vnode that began
// the search)
return typeof vnode.type == 'function' ? getDomSibling(vnode) : NULL;
return typeof vnode.type == 'function' ? getDomSibling(vnode) : null;
}

/**
Expand All @@ -137,9 +137,9 @@ function renderComponent(component) {
oldVNode,
component._globalContext,
component._parentDom.namespaceURI,
oldVNode._flags & MODE_HYDRATE ? [oldDom] : NULL,
oldVNode._flags & MODE_HYDRATE ? [oldDom] : null,
commitQueue,
oldDom == NULL ? getDomSibling(oldVNode) : oldDom,
oldDom == null ? getDomSibling(oldVNode) : oldDom,
!!(oldVNode._flags & MODE_HYDRATE),
refQueue
);
Expand All @@ -158,11 +158,11 @@ function renderComponent(component) {
* @param {import('./internal').VNode} vnode
*/
function updateParentDomPointers(vnode) {
if ((vnode = vnode._parent) != NULL && vnode._component != NULL) {
vnode._dom = NULL;
if ((vnode = vnode._parent) != null && vnode._component != null) {
vnode._dom = null;
for (let i = 0; i < vnode._children.length; i++) {
let child = vnode._children[i];
if (child != NULL && child._dom != NULL) {
if (child != null && child._dom != null) {
vnode._dom = child._dom;
break;
}
Expand Down
6 changes: 0 additions & 6 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,5 @@ export const SKIP_CHILDREN = 1 << 3;
/** Reset all mode flags */
export const RESET_MODE = ~(MODE_HYDRATE | MODE_SUSPENDED);

export const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
export const XHTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
export const MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';

export const NULL = null;
export const UNDEFINED = undefined;
export const EMPTY_OBJ = /** @type {any} */ ({});
export const EMPTY_ARR = [];
3 changes: 1 addition & 2 deletions src/create-context.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { enqueueRender } from './component';
import { NULL } from './constants';

export let i = 0;

Expand All @@ -14,7 +13,7 @@ export function createContext(defaultValue) {
this.getChildContext = () => ctx;

this.componentWillUnmount = () => {
subs = NULL;
subs = null;
};

this.shouldComponentUpdate = function (_props) {
Expand Down
21 changes: 10 additions & 11 deletions src/create-element.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { slice } from './util';
import options from './options';
import { NULL, UNDEFINED } from './constants';

let vnodeId = 0;

Expand Down Expand Up @@ -29,7 +28,7 @@ export function createElement(type, props, children) {
arguments.length > 3 ? slice.call(arguments, 2) : children;
}

return createVNode(type, normalizedProps, key, ref, NULL);
return createVNode(type, normalizedProps, key, ref, null);
}

/**
Expand All @@ -53,25 +52,25 @@ export function createVNode(type, props, key, ref, original) {
props,
key,
ref,
_children: NULL,
_parent: NULL,
_children: null,
_parent: null,
_depth: 0,
_dom: NULL,
_component: NULL,
constructor: UNDEFINED,
_original: original == NULL ? ++vnodeId : original,
_dom: null,
_component: null,
constructor: void 0,
_original: original == null ? ++vnodeId : original,
_index: -1,
_flags: 0
};

// Only invoke the vnode hook if this was *not* a direct copy:
if (original == NULL && options.vnode != NULL) options.vnode(vnode);
if (original == null && options.vnode != null) options.vnode(vnode);

return vnode;
}

export function createRef() {
return { current: NULL };
return { current: null };
}

export function Fragment(props) {
Expand All @@ -84,4 +83,4 @@ export function Fragment(props) {
* @returns {vnode is VNode}
*/
export const isValidElement = vnode =>
vnode != NULL && vnode.constructor == UNDEFINED;
vnode != null && vnode.constructor == void 0;
6 changes: 2 additions & 4 deletions src/diff/catch-error.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { NULL } from '../constants';

/**
* Find the closest error boundary to a thrown error and call it
* @param {object} error The thrown value
Expand All @@ -22,12 +20,12 @@ export function _catchError(error, vnode, oldVNode, errorInfo) {
try {
ctor = component.constructor;

if (ctor && ctor.getDerivedStateFromError != NULL) {
if (ctor && ctor.getDerivedStateFromError != null) {
component.setState(ctor.getDerivedStateFromError(error));
handled = component._dirty;
}

if (component.componentDidCatch != NULL) {
if (component.componentDidCatch != null) {
component.componentDidCatch(error, errorInfo || {});
handled = component._dirty;
}
Expand Down
Loading
Loading