Skip to content

Commit 4690328

Browse files
committed
feature: deepword: drop support of node < 22
1 parent 3750407 commit 4690328

19 files changed

Lines changed: 57 additions & 63 deletions

.eslintrc.json

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/workflows/nodejs.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ jobs:
1010
strategy:
1111
matrix:
1212
node-version:
13-
- 18.x
14-
- 20.x
15-
- 21.x
13+
- 22.x
14+
- 24.x
15+
- 25.x
1616
steps:
17-
- uses: actions/checkout@v4
18-
- uses: oven-sh/setup-bun@v1
17+
- uses: actions/checkout@v5
18+
- uses: oven-sh/setup-bun@v2
1919
with:
2020
bun-version: latest
2121
- name: Use Node.js ${{ matrix.node-version }}
22-
uses: actions/setup-node@v4
22+
uses: actions/setup-node@v6
2323
with:
2424
node-version: ${{ matrix.node-version }}
2525
- name: Install Redrun
File renamed without changes.

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ webpack.config.js
1313

1414

1515
coverage
16+
*.config.*

.putout.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"match": {
3-
"client/index.js": {
4-
"remove-console": "off"
3+
"client": {
4+
"remove-console": "off",
5+
"nodejs/declare": "off"
56
}
67
}
78
}

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ For this purpuse API could be used.
7171
Middleware of `deepword`. Options could be omitted.
7272

7373
```js
74-
import deepword from 'deepword';
74+
import {deepword} from 'deepword';
7575
import express from 'express';
7676

7777
const app = express();
@@ -93,6 +93,7 @@ Could be used with [socket.io](http://socket.io "Socket.io") to handle editor ev
9393

9494
```js
9595
import {Server} from 'socket.io';
96+
9697
const socket = new Server(server);
9798

9899
deepword.listen(socket, {

bin/deepword.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ else
2727
});
2828

2929
function getPath(name) {
30-
const reg = /^(~|\/)/;
30+
const reg = /^[~/]/;
3131

3232
if (!reg.test(name))
3333
name = process.cwd() + '/' + name;
@@ -38,7 +38,7 @@ function getPath(name) {
3838
async function main(name) {
3939
const filename = getPath(name);
4040
const DIR = `${__dirname}/../html/`;
41-
const {default: deepword} = await import('../server/index.js');
41+
const {deepword} = await import('../server/index.js');
4242
const {default: express} = await import('express');
4343
const {Server} = await import('socket.io');
4444

@@ -90,9 +90,7 @@ function version() {
9090
console.log(`v${info().version}`);
9191
}
9292

93-
function info() {
94-
return require('../package');
95-
}
93+
const info = () => require('../package');
9694

9795
function usage() {
9896
console.log(`Usage: ${info().name} [filename]`);

client/api/evaluate.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {alert} from 'smalltalk';
2-
import tryCatch from 'try-catch';
2+
import {tryCatch} from 'try-catch';
33

44
const getErrorMsg = (isJS, value) => {
55
if (!isJS)
@@ -11,7 +11,7 @@ const getErrorMsg = (isJS, value) => {
1111
};
1212

1313
export default function evaluate() {
14-
const isJS = /\.js$/.test(this._filename);
14+
const isJS = this._filename.endsWith('.js');
1515

1616
const getValue = this.getValue.bind(this);
1717
const focus = this.focus.bind(this);

client/api/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function Deepword(element, options, eddy) {
3636

3737
Emitify.call(this);
3838

39-
const {monaco} = window;
39+
const {monaco} = globalThis;
4040

4141
this._monaco = monaco;
4242
this._TITLE = 'Deepword';

client/api/show-message/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ export default function showMessage(text) {
55
let {_elementMsg} = this;
66

77
if (!_elementMsg) {
8-
this._elementMsg = _elementMsg = createMsg();
8+
this._elementMsg = createMsg();
9+
({_elementMsg} = this);
910
this._element.appendChild(this._elementMsg);
1011
}
1112

0 commit comments

Comments
 (0)