Merge branch 'canary'

This commit is contained in:
Labhansh Agrawal 2022-01-08 01:22:57 +05:30
commit bc50b48f79
27 changed files with 1524 additions and 1857 deletions

View file

@ -1,11 +1,11 @@
name: Comment spectron screenshots on PR name: Comment e2e test screenshots on PR
on: on:
workflow_run: workflow_run:
workflows: ['Node CI'] workflows: ['Node CI']
types: types:
- completed - completed
jobs: jobs:
spectron_comment: e2e_comment:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event.workflow_run.event == 'pull_request' if: github.event.workflow_run.event == 'pull_request'
steps: steps:
@ -14,14 +14,14 @@ jobs:
WORKFLOW_RUN_INFO: ${{ toJSON(github.event.workflow_run) }} WORKFLOW_RUN_INFO: ${{ toJSON(github.event.workflow_run) }}
run: echo "$WORKFLOW_RUN_INFO" run: echo "$WORKFLOW_RUN_INFO"
- name: Download Artifacts - name: Download Artifacts
uses: dawidd6/action-download-artifact@v2.14.1 uses: dawidd6/action-download-artifact@v2.16.0
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: nodejs.yml workflow: nodejs.yml
run_id: ${{ github.event.workflow_run.id }} run_id: ${{ github.event.workflow_run.id }}
name: spectron name: e2e
- name: Get PR number - name: Get PR number
uses: dawidd6/action-download-artifact@v2.14.1 uses: dawidd6/action-download-artifact@v2.16.0
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: nodejs.yml workflow: nodejs.yml
@ -46,11 +46,18 @@ jobs:
IMG_MARKDOWN: ${{ join(fromJSON(steps.upload_screenshots.outputs.markdown_urls), '') }} IMG_MARKDOWN: ${{ join(fromJSON(steps.upload_screenshots.outputs.markdown_urls), '') }}
MESSAGE: | MESSAGE: |
Hi there, Hi there,
Thank you for contributing to Hyper!
You can get the build artifacts from [here](https://nightly.link/{1}/actions/runs/{2}).
Here are screenshots of Hyper built from this pr. Here are screenshots of Hyper built from this pr.
{0} {0}
Thank you for contributing to Hyper!
with: with:
type: create type: create
issue_number: ${{ steps.pr_num_reader.outputs.content }} issue_number: ${{ steps.pr_num_reader.outputs.content }}
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
body: ${{ format(env.MESSAGE, env.IMG_MARKDOWN) }} body: ${{ format(env.MESSAGE, env.IMG_MARKDOWN, github.repository, github.event.workflow_run.id) }}
- name: Hide older comments
uses: kanga333/comment-hider@v0.3.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
leave_visible: 1
issue_number: ${{ steps.pr_num_reader.outputs.content }}

View file

@ -23,7 +23,7 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }} - name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2.4.1 uses: actions/setup-node@v2.5.1
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
cache: yarn cache: yarn
@ -32,7 +32,7 @@ jobs:
app/yarn.lock app/yarn.lock
- name: Install - name: Install
run: yarn install run: yarn install
- name: Test - name: Lint and Run Unit Tests
run: yarn run test run: yarn run test
- name: Getting Build Icon - name: Getting Build Icon
if: github.ref == 'refs/heads/canary' || github.base_ref == 'canary' if: github.ref == 'refs/heads/canary' || github.base_ref == 'canary'
@ -59,14 +59,14 @@ jobs:
dist/*.deb dist/*.deb
dist/*.rpm dist/*.rpm
dist/*.exe dist/*.exe
- name: Test Spectron - name: Run E2E Tests
if: runner.os != 'Linux' if: runner.os != 'Linux'
run: yarn run test:spectron run: yarn run test:e2e
- name: Archive Spectron test screenshot - name: Archive E2E test screenshot
if: runner.os != 'Linux' if: runner.os != 'Linux'
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: spectron name: e2e
path: dist/tmp/*.png path: dist/tmp/*.png
- name: Save the pr number in an artifact - name: Save the pr number in an artifact
if: github.event_name == 'pull_request' if: github.event_name == 'pull_request'

View file

@ -57,17 +57,11 @@ const _watch = () => {
console.error('error watching config', error); console.error('error watching config', error);
}); });
app.on('before-quit', (e) => { app.on('before-quit', () => {
if (Object.keys(_watcher.getWatched()).length > 0) { if (Object.keys(_watcher.getWatched()).length > 0) {
e.preventDefault(); _watcher.close().catch((err) => {
_watcher console.warn(err);
.close() });
.catch((err) => {
console.warn(err);
})
.finally(() => {
app.quit();
});
} }
}); });
}; };

View file

@ -148,7 +148,7 @@ module.exports = {
// Whether to use the WebGL renderer. Set it to false to use canvas-based // Whether to use the WebGL renderer. Set it to false to use canvas-based
// rendering (slower, but supports transparent backgrounds) // rendering (slower, but supports transparent backgrounds)
webGLRenderer: false, webGLRenderer: true,
// keypress required for weblink activation: [ctrl|alt|meta|shift] // keypress required for weblink activation: [ctrl|alt|meta|shift]
// todo: does not pick up config changes automatically, need to restart terminal :/ // todo: does not pick up config changes automatically, need to restart terminal :/
@ -160,6 +160,9 @@ module.exports = {
// set to true to disable auto updates // set to true to disable auto updates
disableAutoUpdates: false, disableAutoUpdates: false,
// set to true to enable screen reading apps (like NVDA) to read the contents of the terminal
screenReaderMode: false,
// for advanced config flags please refer to https://hyper.is/#cfg // for advanced config flags please refer to https://hyper.is/#cfg
}, },

View file

@ -9,6 +9,10 @@ if (['--help', '-v', '--version'].includes(process.argv[1])) {
process.exit(); process.exit();
} }
// Enable remote module
import {initialize as remoteInitialize} from '@electron/remote/main';
remoteInitialize();
// Native // Native
import {resolve} from 'path'; import {resolve} from 'path';

View file

@ -54,7 +54,7 @@ export const createMenu = (
void dialog.showMessageBox({ void dialog.showMessageBox({
title: `About ${appName}`, title: `About ${appName}`,
message: `${appName} ${appVersion} (${updateChannel})`, message: `${appName} ${appVersion} (${updateChannel})`,
detail: `Renderers: ${renderers}\nPlugins: ${pluginList}\n\nCreated by Guillermo Rauch\nCopyright © 2020 Vercel, Inc.`, detail: `Renderers: ${renderers}\nPlugins: ${pluginList}\n\nCreated by Guillermo Rauch\nCopyright © 2021 Vercel, Inc.`,
buttons: [], buttons: [],
icon: icon as any icon: icon as any
}); });

View file

@ -22,7 +22,7 @@ export default (commands: Record<string, string>, showAbout: () => void): MenuIt
If not, please try and fulfil these first. If not, please try and fulfil these first.
--> -->
<!-- 👉 Checked checkbox should look like this: [x] --> <!-- 👉 Checked checkbox should look like this: [x] -->
- [ ] Your Hyper.app version is **${version}**. Please verify your using the [latest](https://github.com/vercel/hyper/releases/latest) Hyper.app version - [ ] Your Hyper.app version is **${version}**. Please verify you're using the [latest](https://github.com/vercel/hyper/releases/latest) Hyper.app version
- [ ] I have searched the [issues](https://github.com/vercel/hyper/issues) of this repo and believe that this is not a duplicate - [ ] I have searched the [issues](https://github.com/vercel/hyper/issues) of this repo and believe that this is not a duplicate
--- ---
- **Any relevant information from devtools?** _(CMD+OPTION+I on macOS, CTRL+SHIFT+I elsewhere)_: - **Any relevant information from devtools?** _(CMD+OPTION+I on macOS, CTRL+SHIFT+I elsewhere)_:

View file

@ -10,9 +10,10 @@
}, },
"repository": "zeit/hyper", "repository": "zeit/hyper",
"dependencies": { "dependencies": {
"@electron/remote": "2.0.1",
"async-retry": "1.3.3", "async-retry": "1.3.3",
"chokidar": "^3.5.2", "chokidar": "^3.5.2",
"color": "4.0.1", "color": "4.1.0",
"default-shell": "1.0.1", "default-shell": "1.0.1",
"electron-fetch": "1.7.4", "electron-fetch": "1.7.4",
"electron-is-dev": "2.0.0", "electron-is-dev": "2.0.0",
@ -34,6 +35,6 @@
"uuid": "8.3.2" "uuid": "8.3.2"
}, },
"optionalDependencies": { "optionalDependencies": {
"native-reg": "0.3.5" "native-reg": "1.0.0"
} }
} }

View file

@ -14,6 +14,7 @@ import contextMenuTemplate from './contextmenu';
import {execCommand} from '../commands'; import {execCommand} from '../commands';
import {setRendererType, unsetRendererType} from '../utils/renderer-utils'; import {setRendererType, unsetRendererType} from '../utils/renderer-utils';
import {decorateSessionOptions, decorateSessionClass} from '../plugins'; import {decorateSessionOptions, decorateSessionClass} from '../plugins';
import {enable as remoteEnable} from '@electron/remote/main';
export function newWindow( export function newWindow(
options_: BrowserWindowConstructorOptions, options_: BrowserWindowConstructorOptions,
@ -38,12 +39,15 @@ export function newWindow(
webPreferences: { webPreferences: {
nodeIntegration: true, nodeIntegration: true,
navigateOnDragDrop: true, navigateOnDragDrop: true,
enableRemoteModule: true,
contextIsolation: false contextIsolation: false
}, },
...options_ ...options_
}; };
const window = new BrowserWindow(app.plugins.getDecoratedBrowserOptions(winOpts)); const window = new BrowserWindow(app.plugins.getDecoratedBrowserOptions(winOpts));
// Enable remote module on this window
remoteEnable(window.webContents);
window.uid = classOpts.uid; window.uid = classOpts.uid;
app.plugins.onWindowClass(window); app.plugins.onWindowClass(window);

View file

@ -2,6 +2,11 @@
# yarn lockfile v1 # yarn lockfile v1
"@electron/remote@2.0.1":
version "2.0.1"
resolved "https://registry.npmjs.org/@electron/remote/-/remote-2.0.1.tgz#810cbc595a21f0f94641eb2d7e8264063a3f84de"
integrity sha512-bGX4/yB2bPZwXm1DsxgoABgH0Cz7oFtXJgkerB8VrStYdTyvhGAULzNLRn9rVmeAuC3VUDXaXpZIlZAZHpsLIA==
"@types/semver@^7.3.8": "@types/semver@^7.3.8":
version "7.3.8" version "7.3.8"
resolved "https://registry.npmjs.org/@types/semver/-/semver-7.3.8.tgz#508a27995498d7586dcecd77c25e289bfaf90c59" resolved "https://registry.npmjs.org/@types/semver/-/semver-7.3.8.tgz#508a27995498d7586dcecd77c25e289bfaf90c59"
@ -14,17 +19,7 @@ ajv-formats@^2.1.1:
dependencies: dependencies:
ajv "^8.0.0" ajv "^8.0.0"
ajv@^8.0.0: ajv@^8.0.0, ajv@^8.6.3:
version "8.1.0"
resolved "https://registry.npmjs.org/ajv/-/ajv-8.1.0.tgz#45d5d3d36c7cdd808930cc3e603cf6200dbeb736"
integrity sha512-B/Sk2Ix7A36fs/ZkuGLIR86EdjbgR6fsAcbx9lOP/QBSXujDNbVmIS/U4Itz5k8fPFDeVZl/zQ/gJW4Jrq6XjQ==
dependencies:
fast-deep-equal "^3.1.1"
json-schema-traverse "^1.0.0"
require-from-string "^2.0.2"
uri-js "^4.2.2"
ajv@^8.6.3:
version "8.6.3" version "8.6.3"
resolved "https://registry.npmjs.org/ajv/-/ajv-8.6.3.tgz#11a66527761dc3e9a3845ea775d2d3c0414e8764" resolved "https://registry.npmjs.org/ajv/-/ajv-8.6.3.tgz#11a66527761dc3e9a3845ea775d2d3c0414e8764"
integrity sha512-SMJOdDP6LqTkD0Uq8qLi+gMwSt0imXLSV080qFVwJCpH9U6Mb+SUGHAXM0KNbcBPguytWyvFxcHgMLe2D2XSpw== integrity sha512-SMJOdDP6LqTkD0Uq8qLi+gMwSt0imXLSV080qFVwJCpH9U6Mb+SUGHAXM0KNbcBPguytWyvFxcHgMLe2D2XSpw==
@ -93,21 +88,21 @@ color-name@^1.0.0, color-name@~1.1.4:
resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
color-string@^1.6.0: color-string@^1.9.0:
version "1.6.0" version "1.9.0"
resolved "https://registry.npmjs.org/color-string/-/color-string-1.6.0.tgz#c3915f61fe267672cb7e1e064c9d692219f6c312" resolved "https://registry.npmjs.org/color-string/-/color-string-1.9.0.tgz#63b6ebd1bec11999d1df3a79a7569451ac2be8aa"
integrity sha512-c/hGS+kRWJutUBEngKKmk4iH3sD59MBkoxVapS/0wgpCz2u7XsNloxknyvBhzwEs1IbV36D9PwqLPJ2DTu3vMA== integrity sha512-9Mrz2AQLefkH1UvASKj6v6hj/7eWgjnT/cVsR8CumieLoT+g900exWeNogqtweI8dxloXN9BDQTYro1oWu/5CQ==
dependencies: dependencies:
color-name "^1.0.0" color-name "^1.0.0"
simple-swizzle "^0.2.2" simple-swizzle "^0.2.2"
color@4.0.1: color@4.1.0:
version "4.0.1" version "4.1.0"
resolved "https://registry.npmjs.org/color/-/color-4.0.1.tgz#21df44cd10245a91b1ccf5ba031609b0e10e7d67" resolved "https://registry.npmjs.org/color/-/color-4.1.0.tgz#9502e6a2dcacb26adf4c60910a27628d010b3de3"
integrity sha512-rpZjOKN5O7naJxkH2Rx1sZzzBgaiWECc6BYXjeCE6kF0kcASJYbUq02u7JqIHwCb/j3NhV+QhRL2683aICeGZA== integrity sha512-o2rkkxyLGgYoeUy1OodXpbPAQNmlNBrirQ8ODO8QutzDiDMNdezSOZLNnusQ6pUpCQJUsaJIo9DZJKqa2HgH7A==
dependencies: dependencies:
color-convert "^2.0.1" color-convert "^2.0.1"
color-string "^1.6.0" color-string "^1.9.0"
conf@^10.0.3: conf@^10.0.3:
version "10.0.3" version "10.0.3"
@ -446,17 +441,17 @@ nan@^2.14.0:
resolved "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz#f5376400695168f4cc694ac9393d0c9585eeea19" resolved "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz#f5376400695168f4cc694ac9393d0c9585eeea19"
integrity sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ== integrity sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==
native-reg@0.3.5: native-reg@1.0.0:
version "0.3.5" version "1.0.0"
resolved "https://registry.npmjs.org/native-reg/-/native-reg-0.3.5.tgz#80f6601028f236be68ef45b5c17493a94abb1145" resolved "https://registry.npmjs.org/native-reg/-/native-reg-1.0.0.tgz#77f9acbf59eda02680c00b0b1b9d1e0078b7820d"
integrity sha512-lwaSAbq02DZ2aFK/ZvHzDpaHQSo7fh0GjIol+juMe6iwmeBO+ZMXFSPLfpOksOhcxgEBhgCU1bVm1G0u9lkdpA== integrity sha512-MxukmqY7jOeiS9+b4TAlfG9cvaQ03oLET35nUGYGHDRcLx0NFk7eeoWqX4wAXaFiMW50ZiFalOA6W8q3fprcsw==
dependencies: dependencies:
node-gyp-build "^4" node-gyp-build "4"
node-gyp-build@^4: node-gyp-build@4:
version "4.2.3" version "4.3.0"
resolved "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz#ce6277f853835f718829efb47db20f3e4d9c4739" resolved "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.3.0.tgz#9f256b03e5826150be39c764bf51e993946d71a3"
integrity sha512-MN6ZpzmfNCRM+3t57PTJHgHyw/h4OWnZ6mR8P5j/uZtqQr46RRuDE/P+g3n0YR/AiYXeWixZZzaip77gdICfRg== integrity sha512-iWjXZvmboq0ja1pUGULQBexmxq8CV4xBhX7VDOTbL7ZR4FOowwY/VOtRxBN/yKxmdGoIp4j5ysNT4u3S2pDQ3Q==
node-pty@0.10.1: node-pty@0.10.1:
version "0.10.1" version "0.10.1"

View file

@ -1,9 +1,5 @@
export default { module.exports = {
files: ['test/*'], files: ['test/*'],
babel: {
compileEnhancements: false,
compileAsTests: ['**/testUtils/**/*']
},
extensions: ['ts'], extensions: ['ts'],
require: ['ts-node/register/transpile-only'], require: ['ts-node/register/transpile-only'],
timeout: '30s' timeout: '30s'

View file

@ -1,9 +1,5 @@
export default { module.exports = {
files: ['test/unit/*'], files: ['test/unit/*'],
babel: {
compileEnhancements: false,
compileAsTests: ['**/testUtils/**/*']
},
extensions: ['ts'], extensions: ['ts'],
require: ['ts-node/register/transpile-only'] require: ['ts-node/register/transpile-only']
}; };

View file

@ -1,9 +1,9 @@
import {remote} from 'electron'; import {require as remoteRequire} from '@electron/remote';
import {HyperDispatch} from './hyper'; import {HyperDispatch} from './hyper';
import {closeSearch} from './actions/sessions'; import {closeSearch} from './actions/sessions';
// TODO: Should be updates to new async API https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31 // TODO: Should be updates to new async API https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31
const {getDecoratedKeymaps} = remote.require('./plugins') as typeof import('../app/plugins'); const {getDecoratedKeymaps} = remoteRequire('./plugins') as typeof import('../app/plugins');
let commands: Record<string, (event: any, dispatch: HyperDispatch) => void> = { let commands: Record<string, (event: any, dispatch: HyperDispatch) => void> = {
'editor:search-close': (e, dispatch) => { 'editor:search-close': (e, dispatch) => {

View file

@ -99,14 +99,14 @@ export default class Notification extends React.PureComponent<NotificationProps,
position: relative; position: relative;
left: 4px; left: 4px;
cursor: pointer; cursor: pointer;
opacity: 0.5; font-weight: 600;
color: currentColor; color: currentColor;
transition: opacity 0.1s ease-in-out; transition: font-weight 0.1s ease-in-out;
} }
.notification_dismissLink:hover, .notification_dismissLink:hover,
.notification_dismissLink:focus { .notification_dismissLink:focus {
opacity: 1; font-weight: 900;
} }
`}</style> `}</style>
</div> </div>

View file

@ -38,10 +38,10 @@ export default class Notifications extends React.PureComponent<NotificationsProp
<Notification <Notification
key="message" key="message"
backgroundColor="#FE354E" backgroundColor="#FE354E"
color="#fff"
text={this.props.messageText} text={this.props.messageText}
onDismiss={this.props.onDismissMessage} onDismiss={this.props.onDismissMessage}
userDismissable={this.props.messageDismissable} userDismissable={this.props.messageDismissable}
userDismissColor="#AA2D3C"
> >
{this.props.messageURL {this.props.messageURL
? [ ? [
@ -58,7 +58,7 @@ export default class Notifications extends React.PureComponent<NotificationsProp
> >
more more
</a>, </a>,
')' ') '
] ]
: null} : null}
</Notification> </Notification>

View file

@ -104,6 +104,7 @@ class TermGroup_ extends React.PureComponent<TermGroupProps> {
webLinksActivationKey: this.props.webLinksActivationKey, webLinksActivationKey: this.props.webLinksActivationKey,
macOptionSelectionMode: this.props.macOptionSelectionMode, macOptionSelectionMode: this.props.macOptionSelectionMode,
disableLigatures: this.props.disableLigatures, disableLigatures: this.props.disableLigatures,
screenReaderMode: this.props.screenReaderMode,
uid uid
}); });

View file

@ -77,7 +77,8 @@ const getTermOptions = (props: TermProps): ITerminalOptions => {
brightMagenta: props.colors.lightMagenta, brightMagenta: props.colors.lightMagenta,
brightCyan: props.colors.lightCyan, brightCyan: props.colors.lightCyan,
brightWhite: props.colors.lightWhite brightWhite: props.colors.lightWhite
} },
screenReaderMode: props.screenReaderMode
}; };
}; };

View file

@ -116,6 +116,7 @@ export default class Terms extends React.Component<TermsProps> {
webLinksActivationKey: this.props.webLinksActivationKey, webLinksActivationKey: this.props.webLinksActivationKey,
macOptionSelectionMode: this.props.macOptionSelectionMode, macOptionSelectionMode: this.props.macOptionSelectionMode,
disableLigatures: this.props.disableLigatures, disableLigatures: this.props.disableLigatures,
screenReaderMode: this.props.screenReaderMode,
parentProps: this.props parentProps: this.props
}); });

1
lib/config.d.ts vendored
View file

@ -51,6 +51,7 @@ export type configOptions = {
}; };
padding: string; padding: string;
quickEdit: boolean; quickEdit: boolean;
screenReaderMode: boolean;
scrollback: number; scrollback: number;
selectionColor: string; selectionColor: string;
shell: string; shell: string;

View file

@ -45,7 +45,8 @@ const mapStateToProps = (state: HyperState) => {
webGLRenderer: state.ui.webGLRenderer, webGLRenderer: state.ui.webGLRenderer,
webLinksActivationKey: state.ui.webLinksActivationKey, webLinksActivationKey: state.ui.webLinksActivationKey,
macOptionSelectionMode: state.ui.macOptionSelectionMode, macOptionSelectionMode: state.ui.macOptionSelectionMode,
disableLigatures: state.ui.disableLigatures disableLigatures: state.ui.disableLigatures,
screenReaderMode: state.ui.screenReaderMode
}; };
}; };

3
lib/hyper.d.ts vendored
View file

@ -79,6 +79,7 @@ export type uiState = Immutable<{
quickEdit: boolean; quickEdit: boolean;
resizeAt: number; resizeAt: number;
rows: number | null; rows: number | null;
screenReaderMode: boolean;
scrollback: number; scrollback: number;
selectionColor: string; selectionColor: string;
showHamburgerMenu: boolean | ''; showHamburgerMenu: boolean | '';
@ -287,6 +288,7 @@ export type TermGroupOwnProps = {
| 'onTitle' | 'onTitle'
| 'padding' | 'padding'
| 'quickEdit' | 'quickEdit'
| 'screenReaderMode'
| 'scrollback' | 'scrollback'
| 'selectionColor' | 'selectionColor'
| 'sessions' | 'sessions'
@ -344,6 +346,7 @@ export type TermProps = {
padding: string; padding: string;
quickEdit: boolean; quickEdit: boolean;
rows: number | null; rows: number | null;
screenReaderMode: boolean;
scrollback: number; scrollback: number;
search: boolean; search: boolean;
searchAddon: SearchAddon | null; searchAddon: SearchAddon | null;

View file

@ -107,7 +107,8 @@ const initial: uiState = Immutable<Mutable<uiState>>({
webGLRenderer: true, webGLRenderer: true,
webLinksActivationKey: '', webLinksActivationKey: '',
macOptionSelectionMode: 'vertical', macOptionSelectionMode: 'vertical',
disableLigatures: false disableLigatures: true,
screenReaderMode: false
}); });
const reducer: IUiReducer = (state = initial, action) => { const reducer: IUiReducer = (state = initial, action) => {
@ -260,10 +261,14 @@ const reducer: IUiReducer = (state = initial, action) => {
ret.macOptionSelectionMode = config.macOptionSelectionMode; ret.macOptionSelectionMode = config.macOptionSelectionMode;
} }
if (config.disableLigatures) { if (config.disableLigatures !== undefined) {
ret.disableLigatures = config.disableLigatures; ret.disableLigatures = config.disableLigatures;
} }
if (config.screenReaderMode !== undefined) {
ret.screenReaderMode = config.screenReaderMode;
}
ret._lastUpdate = now; ret._lastUpdate = now;
return ret; return ret;

View file

@ -1,7 +1,8 @@
import {ipcRenderer, remote} from 'electron'; import {ipcRenderer} from 'electron';
import {require as remoteRequire} from '@electron/remote';
// TODO: Should be updates to new async API https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31 // TODO: Should be updates to new async API https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31
const plugins = remote.require('./plugins') as typeof import('../../app/plugins'); const plugins = remoteRequire('./plugins') as typeof import('../../app/plugins');
export function getConfig() { export function getConfig() {
return plugins.getDecoratedConfig(); return plugins.getDecoratedConfig();

View file

@ -1,6 +1,6 @@
// eslint-disable-next-line eslint-comments/disable-enable-pair // eslint-disable-next-line eslint-comments/disable-enable-pair
/* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable @typescript-eslint/no-unsafe-return */
import {remote} from 'electron'; import {require as remoteRequire} from '@electron/remote';
// TODO: Should be updates to new async API https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31 // TODO: Should be updates to new async API https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31
import {connect as reduxConnect, Options} from 'react-redux'; import {connect as reduxConnect, Options} from 'react-redux';
@ -32,7 +32,7 @@ import IPCChildProcess from './ipc-child-process';
import ChildProcess from 'child_process'; import ChildProcess from 'child_process';
// remote interface to `../plugins` // remote interface to `../plugins`
const plugins = remote.require('./plugins') as typeof import('../../app/plugins'); const plugins = remoteRequire('./plugins') as typeof import('../../app/plugins');
// `require`d modules // `require`d modules
let modules: hyperPlugin[]; let modules: hyperPlugin[];

View file

@ -11,7 +11,7 @@
"test": "yarn run lint && yarn run test:unit", "test": "yarn run lint && yarn run test:unit",
"test:unit": "ava", "test:unit": "ava",
"test:unit:watch": "yarn run test:unit -- --watch", "test:unit:watch": "yarn run test:unit -- --watch",
"test:spectron": "ava --config ava-spectron.config.js", "test:e2e": "ava --config ava-e2e.config.js",
"postinstall": "webpack --config-name hyper-app && electron-builder install-app-deps && yarn run rebuild-node-pty && cpy --cwd=target --parents \"node_modules/**/*\" \"../app/\" && husky install", "postinstall": "webpack --config-name hyper-app && electron-builder install-app-deps && yarn run rebuild-node-pty && cpy --cwd=target --parents \"node_modules/**/*\" \"../app/\" && husky install",
"rebuild-node-pty": "electron-rebuild -f -o node-pty -m target", "rebuild-node-pty": "electron-rebuild -f -o node-pty -m target",
"dist": "yarn run build && cross-env BABEL_ENV=production babel target/renderer/bundle.js --out-file target/renderer/bundle.js --no-comments --minified && electron-builder", "dist": "yarn run build && cross-env BABEL_ENV=production babel target/renderer/bundle.js --out-file target/renderer/bundle.js --no-comments --minified && electron-builder",
@ -23,105 +23,107 @@
"email": "team@zeit.co" "email": "team@zeit.co"
}, },
"dependencies": { "dependencies": {
"@electron/remote": "2.0.1",
"args": "5.0.1", "args": "5.0.1",
"chalk": "4.1.2", "chalk": "4.1.2",
"color": "4.0.1", "color": "4.1.0",
"columnify": "1.5.4", "columnify": "1.5.4",
"css-loader": "6.3.0", "css-loader": "6.5.1",
"got": "11.8.2", "got": "11.8.3",
"json-loader": "0.5.7", "json-loader": "0.5.7",
"mousetrap": "chabou/mousetrap#useCapture", "mousetrap": "chabou/mousetrap#useCapture",
"ms": "2.1.3", "ms": "2.1.3",
"open": "8.2.1", "open": "8.4.0",
"ora": "5.4.1", "ora": "5.4.1",
"parse-url": "5.0.7", "parse-url": "5.0.7",
"php-escape-shell": "1.0.0", "php-escape-shell": "1.0.0",
"react": "17.0.2", "react": "17.0.2",
"react-deep-force-update": "2.1.3", "react-deep-force-update": "2.1.3",
"react-dom": "17.0.2", "react-dom": "17.0.2",
"react-redux": "7.2.5", "react-redux": "7.2.6",
"recast": "0.20.5", "recast": "0.20.5",
"redux": "4.1.1", "redux": "4.1.2",
"redux-thunk": "2.3.0", "redux-thunk": "2.4.1",
"reselect": "4.0.0", "reselect": "4.1.5",
"seamless-immutable": "7.1.4", "seamless-immutable": "7.1.4",
"semver": "7.3.5", "semver": "7.3.5",
"shebang-loader": "0.0.1", "shebang-loader": "0.0.1",
"styled-jsx": "4.0.1", "styled-jsx": "4.0.1",
"stylis": "3.5.4", "stylis": "3.5.4",
"uuid": "8.3.2", "uuid": "8.3.2",
"webpack-cli": "4.8.0", "webpack-cli": "4.9.1",
"xterm": "^4.14.1", "xterm": "^4.16.0",
"xterm-addon-fit": "^0.5.0", "xterm-addon-fit": "^0.5.0",
"xterm-addon-ligatures": "^0.5.1", "xterm-addon-ligatures": "0.6.0-beta.4",
"xterm-addon-search": "^0.8.1", "xterm-addon-search": "^0.8.2",
"xterm-addon-unicode11": "^0.3.0", "xterm-addon-unicode11": "^0.3.0",
"xterm-addon-web-links": "^0.4.0", "xterm-addon-web-links": "^0.5.0",
"xterm-addon-webgl": "^0.11.2" "xterm-addon-webgl": "^0.11.4"
}, },
"devDependencies": { "devDependencies": {
"@ava/babel": "2.0.0", "@ava/babel": "2.0.0",
"@babel/cli": "7.15.7", "@ava/typescript": "^3.0.1",
"@babel/core": "7.15.5", "@babel/cli": "7.16.7",
"@babel/plugin-proposal-class-properties": "^7.14.5", "@babel/core": "7.16.7",
"@babel/plugin-proposal-numeric-separator": "^7.14.5", "@babel/plugin-proposal-class-properties": "^7.16.7",
"@babel/plugin-proposal-object-rest-spread": "^7.15.6", "@babel/plugin-proposal-numeric-separator": "^7.16.7",
"@babel/plugin-proposal-optional-chaining": "7.14.5", "@babel/plugin-proposal-object-rest-spread": "^7.16.7",
"@babel/preset-react": "7.14.5", "@babel/plugin-proposal-optional-chaining": "7.16.7",
"@babel/preset-typescript": "7.15.0", "@babel/preset-react": "7.16.7",
"@babel/preset-typescript": "7.16.7",
"@types/args": "5.0.0", "@types/args": "5.0.0",
"@types/async-retry": "1.4.3", "@types/async-retry": "1.4.3",
"@types/color": "3.0.2", "@types/color": "3.0.2",
"@types/columnify": "^1.5.1", "@types/columnify": "^1.5.1",
"@types/fs-extra": "9.0.13", "@types/fs-extra": "9.0.13",
"@types/lodash": "^4.14.175", "@types/lodash": "^4.14.178",
"@types/mkdirp": "1.0.2", "@types/mkdirp": "1.0.2",
"@types/mousetrap": "1.6.8", "@types/mousetrap": "1.6.9",
"@types/ms": "0.7.31", "@types/ms": "0.7.31",
"@types/node": "^14.17.14", "@types/node": "^14.17.14",
"@types/pify": "5.0.1", "@types/pify": "5.0.1",
"@types/plist": "3.0.2", "@types/plist": "3.0.2",
"@types/react": "^17.0.27", "@types/react": "^17.0.38",
"@types/react-dom": "^17.0.9", "@types/react-dom": "^17.0.11",
"@types/react-redux": "^7.1.18", "@types/react-redux": "^7.1.21",
"@types/seamless-immutable": "7.1.16", "@types/seamless-immutable": "7.1.16",
"@types/styled-jsx": "2.2.9", "@types/styled-jsx": "2.2.9",
"@types/terser-webpack-plugin": "5.2.0", "@types/terser-webpack-plugin": "5.2.0",
"@types/uuid": "8.3.1", "@types/uuid": "8.3.3",
"@typescript-eslint/eslint-plugin": "4.32.0", "@typescript-eslint/eslint-plugin": "4.33.0",
"@typescript-eslint/parser": "4.32.0", "@typescript-eslint/parser": "4.33.0",
"ava": "3.15.0", "ava": "4.0.0",
"babel-loader": "8.2.2", "babel-loader": "8.2.3",
"concurrently": "6.3.0", "concurrently": "7.0.0",
"copy-webpack-plugin": "9.0.1", "copy-webpack-plugin": "10.2.0",
"cpy-cli": "^3.1.1", "cpy-cli": "^3.1.1",
"cross-env": "7.0.3", "cross-env": "7.0.3",
"electron": "^13.2.3", "electron": "^14.2.3",
"electron-builder": "^22.11.7", "electron-builder": "^22.14.5",
"electron-devtools-installer": "3.2.0", "electron-devtools-installer": "3.2.0",
"electron-notarize": "1.1.1", "electron-notarize": "1.1.1",
"electron-rebuild": "3.2.3", "electron-rebuild": "3.2.5",
"electronmon": "^2.0.2", "electronmon": "^2.0.2",
"eslint": "7.32.0", "eslint": "7.32.0",
"eslint-config-prettier": "8.3.0", "eslint-config-prettier": "8.3.0",
"eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-prettier": "4.0.0", "eslint-plugin-prettier": "4.0.0",
"eslint-plugin-react": "7.26.1", "eslint-plugin-react": "7.28.0",
"husky": "7.0.2", "husky": "7.0.4",
"inquirer": "8.1.5", "inquirer": "8.2.0",
"node-addon-api": "4.2.0", "node-addon-api": "4.2.0",
"node-gyp": "8.2.0", "node-gyp": "8.4.1",
"null-loader": "4.0.1", "null-loader": "4.0.1",
"playwright": "1.17.1",
"plist": "3.0.4", "plist": "3.0.4",
"prettier": "2.4.1", "prettier": "2.5.1",
"proxyquire": "2.1.3", "proxyquire": "2.1.3",
"redux-devtools-extension": "2.13.9", "redux-devtools-extension": "2.13.9",
"spectron": "15.0.0", "style-loader": "3.3.1",
"style-loader": "3.3.0", "terser": "5.10.0",
"terser": "5.9.0", "ts-node": "10.4.0",
"ts-node": "10.2.1", "typescript": "4.5.4",
"typescript": "4.4.3", "webpack": "5.65.0"
"webpack": "5.56.1"
}, },
"electronmon": { "electronmon": {
"patterns": [ "patterns": [

View file

@ -1,14 +1,12 @@
/* eslint-disable eslint-comments/disable-enable-pair */
/* eslint-disable @typescript-eslint/await-thenable */
// Native // Native
import path from 'path'; import path from 'path';
import fs from 'fs-extra'; import fs from 'fs-extra';
// Packages // Packages
import test from 'ava'; import test from 'ava';
import {Application} from 'spectron'; import {_electron, ElectronApplication} from 'playwright';
let app: Application; let app: ElectronApplication;
test.before(async () => { test.before(async () => {
let pathToBinary; let pathToBinary;
@ -30,22 +28,31 @@ test.before(async () => {
throw new Error('Path to the built binary needs to be defined for this platform in test/index.js'); throw new Error('Path to the built binary needs to be defined for this platform in test/index.js');
} }
app = new Application({ app = await _electron.launch({
path: pathToBinary executablePath: pathToBinary
}); });
await app.firstWindow();
await app.start(); await new Promise((resolve) => setTimeout(resolve, 5000));
}); });
test.after(async () => { test.after(async () => {
await new Promise((resolve) => setTimeout(resolve, 5000)); await app
await app.browserWindow.capturePage().then(async (imageBuffer) => { .evaluate(async ({BrowserWindow, desktopCapturer, screen}) => {
await fs.writeFile(`dist/tmp/${process.platform}_test.png`, imageBuffer); // eslint-disable-next-line prefer-const
}); let {width, height, ...position} = BrowserWindow.getFocusedWindow()!.getBounds();
await app.stop(); const {scaleFactor} = screen.getDisplayNearestPoint(position);
width *= scaleFactor;
height *= scaleFactor;
const sources = await desktopCapturer.getSources({types: ['window'], thumbnailSize: {width, height}});
return sources[0].thumbnail.toPNG().toString('base64');
})
.then((img) => Buffer.from(img || '', 'base64'))
.then(async (imageBuffer) => {
await fs.writeFile(`dist/tmp/${process.platform}_test.png`, imageBuffer);
});
await app.close();
}); });
test('see if dev tools are open', async (t) => { test('see if dev tools are open', async (t) => {
await app.client.waitUntilWindowLoaded(); t.false(await app.evaluate(({webContents}) => webContents.getFocusedWebContents().isDevToolsOpened()));
t.false(await app.webContents.isDevToolsOpened());
}); });

3064
yarn.lock

File diff suppressed because it is too large Load diff