You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

ink

Package Overview
Dependencies
Maintainers
2
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ink - npm Package Compare versions

Comparing version

to
6.0.0

10

build/components/Box.js

@@ -7,2 +7,6 @@ import React, { forwardRef } from 'react';

return (React.createElement("ink-box", { ref: ref, style: {
flexWrap: 'nowrap',
flexDirection: 'row',
flexGrow: 0,
flexShrink: 1,
...style,

@@ -14,9 +18,3 @@ overflowX: style.overflowX ?? style.overflow ?? 'visible',

Box.displayName = 'Box';
Box.defaultProps = {
flexWrap: 'nowrap',
flexDirection: 'row',
flexGrow: 0,
flexShrink: 1,
};
export default Box;
//# sourceMappingURL=Box.js.map

1

build/devtools-window-polyfill.js

@@ -6,2 +6,3 @@ // Ignoring missing types error to avoid adding another dependency for this hack to work

// These things must exist before importing `react-devtools-core`
// eslint-disable-next-line n/no-unsupported-features/node-builtins
customGlobal.WebSocket ||= ws;

@@ -8,0 +9,0 @@ customGlobal.window ||= global;

@@ -17,2 +17,3 @@ import { type ReactNode } from 'react';

private lastOutput;
private lastOutputHeight;
private readonly container;

@@ -19,0 +20,0 @@ private readonly rootNode;

@@ -9,2 +9,3 @@ import process from 'node:process';

import patchConsole from 'patch-console';
import { LegacyRoot } from 'react-reconciler/constants.js';
import Yoga from 'yoga-layout';

@@ -25,2 +26,3 @@ import reconciler from './reconciler.js';

lastOutput;
lastOutputHeight;
container;

@@ -57,2 +59,3 @@ rootNode;

this.lastOutput = '';
this.lastOutputHeight = 0;
// This variable is used only in debug mode to store full static output

@@ -62,5 +65,6 @@ // so that it's rerendered every time, not just new static parts, like in non-debug mode

// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
this.container = reconciler.createContainer(this.rootNode,
// Legacy mode
0, null, false, null, 'id', () => { }, null);
this.container = reconciler.createContainer(this.rootNode, LegacyRoot, null, false, null, 'id', () => { }, () => { },
// @ts-expect-error the types for `react-reconciler` are not up to date with the library.
// See https://github.com/facebook/react/blob/c0464aedb16b1c970d717651bba8d1c66c578729/packages/react-reconciler/src/ReactFiberReconciler.js#L236-L259
() => { }, () => { }, null);
// Unmount when process exits

@@ -120,2 +124,3 @@ this.unsubscribeExit = signalExit(this.unmount, { alwaysLast: false });

this.lastOutput = output;
this.lastOutputHeight = outputHeight;
return;

@@ -126,5 +131,7 @@ }

}
if (outputHeight >= this.options.stdout.rows) {
this.options.stdout.write(ansiEscapes.clearTerminal + this.fullStaticOutput + output);
if (this.lastOutputHeight >= this.options.stdout.rows) {
this.options.stdout.write(ansiEscapes.clearTerminal + this.fullStaticOutput + output + '\n');
this.lastOutput = output;
this.lastOutputHeight = outputHeight;
this.log.sync(output);
return;

@@ -142,6 +149,12 @@ }

this.lastOutput = output;
this.lastOutputHeight = outputHeight;
};
render(node) {
const tree = (React.createElement(App, { stdin: this.options.stdin, stdout: this.options.stdout, stderr: this.options.stderr, writeToStdout: this.writeToStdout, writeToStderr: this.writeToStderr, exitOnCtrlC: this.options.exitOnCtrlC, onExit: this.unmount }, node));
reconciler.updateContainer(tree, this.container, null, noop);
// @ts-expect-error the types for `react-reconciler` are not up to date with the library.
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
reconciler.updateContainerSync(tree, this.container, null, noop);
// @ts-expect-error the types for `react-reconciler` are not up to date with the library.
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
reconciler.flushSyncWork();
}

@@ -204,3 +217,8 @@ writeToStdout(data) {

this.isUnmounted = true;
reconciler.updateContainer(null, this.container, null, noop);
// @ts-expect-error the types for `react-reconciler` are not up to date with the library.
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
reconciler.updateContainerSync(null, this.container, null, noop);
// @ts-expect-error the types for `react-reconciler` are not up to date with the library.
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
reconciler.flushSyncWork();
instances.delete(this.options.stdout);

@@ -207,0 +225,0 @@ if (error instanceof Error) {

@@ -5,2 +5,3 @@ import { type Writable } from 'node:stream';

done: () => void;
sync: (str: string) => void;
(str: string): void;

@@ -7,0 +8,0 @@ };

@@ -33,2 +33,7 @@ import ansiEscapes from 'ansi-escapes';

};
render.sync = (str) => {
const output = str + '\n';
previousOutput = output;
previousLineCount = output.split('\n').length;
};
return render;

@@ -35,0 +40,0 @@ };

import createReconciler from 'react-reconciler';
import { type TextNode, type DOMElement } from './dom.js';
declare const _default: createReconciler.Reconciler<DOMElement, DOMElement, TextNode, DOMElement, unknown>;
declare const _default: createReconciler.Reconciler<DOMElement, DOMElement, TextNode, DOMElement, unknown, unknown>;
export default _default;
import process from 'node:process';
import createReconciler from 'react-reconciler';
import { DefaultEventPriority } from 'react-reconciler/constants.js';
import { DefaultEventPriority, NoEventPriority, } from 'react-reconciler/constants.js';
import Yoga from 'yoga-layout';
import { createContext } from 'react';
import { createTextNode, appendChildNode, insertBeforeNode, removeChildNode, setStyle, setTextNodeValue, createNode, setAttribute, } from './dom.js';

@@ -61,2 +62,3 @@ import applyStyles from './styles.js';

};
let currentUpdatePriority = NoEventPriority;
export default createReconciler({

@@ -96,3 +98,3 @@ getRootHostContext: () => ({

shouldSetTextContent: () => false,
createInstance(originalType, newProps, _root, hostContext) {
createInstance(originalType, newProps, rootNode, hostContext) {
if (hostContext.isInsideText && originalType === 'ink-box') {

@@ -122,2 +124,6 @@ throw new Error(`<Box> can’t be nested inside <Text> component`);

node.internal_static = true;
rootNode.isStaticDirty = true;
// Save reference to <Static> node to skip traversal of entire
// node tree to find it
rootNode.staticNode = node;
continue;

@@ -152,9 +158,3 @@ }

insertBefore: insertBeforeNode,
finalizeInitialChildren(node, _type, _props, rootNode) {
if (node.internal_static) {
rootNode.isStaticDirty = true;
// Save reference to <Static> node to skip traversal of entire
// node tree to find it
rootNode.staticNode = node;
}
finalizeInitialChildren() {
return false;

@@ -169,3 +169,2 @@ },

noTimeout: -1,
getCurrentEventPriority: () => DefaultEventPriority,
beforeActiveInstanceBlur() { },

@@ -183,14 +182,8 @@ afterActiveInstanceBlur() { },

},
prepareUpdate(node, _type, oldProps, newProps, rootNode) {
if (node.internal_static) {
rootNode.isStaticDirty = true;
}
commitUpdate(node, _type, oldProps, newProps, _root) {
const props = diff(oldProps, newProps);
const style = diff(oldProps['style'], newProps['style']);
if (!props && !style) {
return null;
return;
}
return { props, style };
},
commitUpdate(node, { props, style }) {
if (props) {

@@ -224,3 +217,40 @@ for (const [key, value] of Object.entries(props)) {

},
setCurrentUpdatePriority(newPriority) {
currentUpdatePriority = newPriority;
},
getCurrentUpdatePriority: () => currentUpdatePriority,
resolveUpdatePriority() {
if (currentUpdatePriority !== NoEventPriority) {
return currentUpdatePriority;
}
return DefaultEventPriority;
},
maySuspendCommit() {
return false;
},
// eslint-disable-next-line @typescript-eslint/naming-convention
NotPendingTransition: undefined,
// eslint-disable-next-line @typescript-eslint/naming-convention
HostTransitionContext: createContext(null),
resetFormInstance() { },
requestPostPaintCallback() { },
shouldAttemptEagerTransition() {
return false;
},
trackSchedulerEvent() { },
resolveEventType() {
return null;
},
resolveEventTimeStamp() {
return -1.1;
},
preloadInstance() {
return true;
},
startSuspendingCommit() { },
suspendInstance() { },
waitForCommitToBeReady() {
return null;
},
});
//# sourceMappingURL=reconciler.js.map
{
"name": "ink",
"version": "5.2.1",
"version": "6.0.0",
"description": "React for CLI",

@@ -18,3 +18,3 @@ "license": "MIT",

"engines": {
"node": ">=18"
"node": ">=20"
},

@@ -60,3 +60,3 @@ "scripts": {

"patch-console": "^2.0.0",
"react-reconciler": "^0.29.0",
"react-reconciler": "^0.32.0",
"scheduler": "^0.23.0",

@@ -74,9 +74,9 @@ "signal-exit": "^3.0.7",

"devDependencies": {
"@faker-js/faker": "^9.2.0",
"@sindresorhus/tsconfig": "^6.0.0",
"@faker-js/faker": "^9.8.0",
"@sindresorhus/tsconfig": "^7.0.0",
"@types/benchmark": "^2.1.2",
"@types/ms": "^0.7.31",
"@types/node": "^22.9.0",
"@types/react": "^18.3.12",
"@types/react-reconciler": "^0.28.2",
"@types/ms": "^2.1.0",
"@types/node": "^22.15.24",
"@types/react": "^19.1.5",
"@types/react-reconciler": "^0.32.0",
"@types/scheduler": "^0.23.0",

@@ -86,3 +86,3 @@ "@types/signal-exit": "^3.0.0",

"@types/stack-utils": "^2.0.2",
"@types/ws": "^8.5.13",
"@types/ws": "^8.18.1",
"@vdemedes/prettier-config": "^2.0.1",

@@ -93,3 +93,3 @@ "ava": "^5.1.1",

"eslint-config-xo-react": "0.27.0",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^5.0.0",

@@ -100,13 +100,13 @@ "ms": "^2.1.3",

"prettier": "^3.3.3",
"react": "^18.0.0",
"react-devtools-core": "^5.0.0",
"sinon": "^19.0.2",
"react": "^19.1.0",
"react-devtools-core": "^6.1.2",
"sinon": "^20.0.0",
"strip-ansi": "^7.1.0",
"ts-node": "^10.9.2",
"typescript": "^5.6.3",
"typescript": "^5.8.3",
"xo": "^0.59.3"
},
"peerDependencies": {
"@types/react": ">=18.0.0",
"react": ">=18.0.0",
"@types/react": ">=19.0.0",
"react": ">=19.0.0",
"react-devtools-core": "^4.19.1"

@@ -113,0 +113,0 @@ },

@@ -27,4 +27,2 @@ [![](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)

**Note:** This is documentation for Ink 4 and 5. If you're looking for docs on Ink 3, check out [this release](https://github.com/vadimdemedes/ink/tree/v3.2.0).
---

@@ -31,0 +29,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet