upgrade to esm from @std/esm
parent
1f45aec2fa
commit
e2e59466be
|
@ -3,3 +3,4 @@
|
||||||
/syncd/
|
/syncd/
|
||||||
*.log
|
*.log
|
||||||
/temp/
|
/temp/
|
||||||
|
*.lock
|
||||||
|
|
22
package.json
22
package.json
|
@ -1,18 +1,18 @@
|
||||||
{
|
{
|
||||||
"name": "@uci/socket",
|
"name": "@uci/socket",
|
||||||
"version": "0.1.1",
|
"version": "0.1.2",
|
||||||
"description": "JSON packet intra(named)/inter(TCP) host communication over socket",
|
"description": "JSON packet intra(named)/inter(TCP) host communication over socket",
|
||||||
"main": "src",
|
"main": "src",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"testw": "mocha -r @std/esm test/*.test.mjs --watch --recurse --watch-extensions mjs",
|
"testw": "mocha -r esm test/*.test.mjs --watch --recurse --watch-extensions mjs",
|
||||||
"test": "mocha -r @std/esm --timeout 10000 test/*.test.mjs",
|
"test": "mocha -r esm --timeout 10000 test/*.test.mjs",
|
||||||
"testlog": "DEBUG=true mocha -r @std/esm --timeout 10000 test/*.test.mjs",
|
"testlog": "DEBUG=true mocha -r esm --timeout 10000 test/*.test.mjs",
|
||||||
"testci": "istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -R spec --recursive && codecov || true",
|
"testci": "istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -R spec --recursive && codecov || true",
|
||||||
"s": "DEBUG=true node -r @std/esm examples/server",
|
"s": "DEBUG=true node -r esm examples/server",
|
||||||
"devs": "SOCKETS_DIR=/opt/sockets DEBUG=true ./node_modules/.bin/nodemon -r @std/esm -e mjs examples/server",
|
"devs": "SOCKETS_DIR=/opt/sockets DEBUG=true ./node_modules/.bin/nodemon -r esm-e mjs examples/server",
|
||||||
"c": "DEBUG=true node -r @std/esm examples/client",
|
"c": "DEBUG=true node -r esm examples/client",
|
||||||
"devc": "SOCKETS_DIR=/opt/sockets DEBUG=true node -r @std/esm examples/client",
|
"devc": "SOCKETS_DIR=/opt/sockets DEBUG=true node -r esm examples/client",
|
||||||
"c2": "node -r @std/esm examples/client2"
|
"c2": "node -r esm examples/client2"
|
||||||
},
|
},
|
||||||
"author": "David Kebler",
|
"author": "David Kebler",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -35,17 +35,17 @@
|
||||||
"url": "https://github.com/uCOMmandIt/message/issues"
|
"url": "https://github.com/uCOMmandIt/message/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/uCOMmandIt/message#readme",
|
"homepage": "https://github.com/uCOMmandIt/message#readme",
|
||||||
"@std/esm": "cjs",
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@std/esm": "^0.22.0",
|
|
||||||
"chai": "^4.1.2",
|
"chai": "^4.1.2",
|
||||||
"chai-as-promised": "^7.1.1",
|
"chai-as-promised": "^7.1.1",
|
||||||
"codecov": "^3.0.0",
|
"codecov": "^3.0.0",
|
||||||
|
"esm": "^3.0.21",
|
||||||
"istanbul": "^0.4.5",
|
"istanbul": "^0.4.5",
|
||||||
"mocha": "^5.0.1",
|
"mocha": "^5.0.1",
|
||||||
"nodemon": "^1.15.1"
|
"nodemon": "^1.15.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@uci/logger": "^0.0.2",
|
||||||
"better-try-catch": "^0.6.2",
|
"better-try-catch": "^0.6.2",
|
||||||
"clone": "^2.1.1",
|
"clone": "^2.1.1",
|
||||||
"death": "^1.1.0",
|
"death": "^1.1.0",
|
||||||
|
|
|
@ -7,14 +7,6 @@ import JsonStream from './json-stream'
|
||||||
import logger from '@uci/logger'
|
import logger from '@uci/logger'
|
||||||
|
|
||||||
let log = {}
|
let log = {}
|
||||||
const LOG_OPTS = {
|
|
||||||
repo:'uci-socket',
|
|
||||||
npm:'@uci/socket',
|
|
||||||
file:'src/consumer.mjs',
|
|
||||||
class:'Consumer',
|
|
||||||
id:this.id,
|
|
||||||
instance_created:new Date().getTime()
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO change default pipe dir for windows and mac os
|
// TODO change default pipe dir for windows and mac os
|
||||||
const DEFAULT_PIPE_DIR = (process.env.SOCKETS_DIR || '/tmp/UCI')
|
const DEFAULT_PIPE_DIR = (process.env.SOCKETS_DIR || '/tmp/UCI')
|
||||||
|
@ -23,7 +15,7 @@ const DEFAULT_SOCKET_NAME = 'uci-sock'
|
||||||
export default class Consumer extends Socket {
|
export default class Consumer extends Socket {
|
||||||
constructor (opts={}) {
|
constructor (opts={}) {
|
||||||
super()
|
super()
|
||||||
log = logger.child(LOG_OPTS)
|
log = logger({file:'src/consumer.js',class:'Consumer',name:'socket',id:this.id})
|
||||||
this.id = opts.id || opts.name || 'socket:'+ new Date().getTime()
|
this.id = opts.id || opts.name || 'socket:'+ new Date().getTime()
|
||||||
if (!opts.path) {
|
if (!opts.path) {
|
||||||
log.warn({opts:opts},'no host supplied using localhost...use named piped instead')
|
log.warn({opts:opts},'no host supplied using localhost...use named piped instead')
|
|
@ -10,14 +10,7 @@ import clone from 'clone'
|
||||||
// import logger from '../../uci-logger/src/logger'
|
// import logger from '../../uci-logger/src/logger'
|
||||||
import logger from '@uci/logger'
|
import logger from '@uci/logger'
|
||||||
let log = {}
|
let log = {}
|
||||||
const LOG_OPTS = {
|
|
||||||
repo:'uci-socket',
|
|
||||||
npm:'@uci/socket',
|
|
||||||
file:'src/socket.mjs',
|
|
||||||
class:'Socket',
|
|
||||||
id:this.id,
|
|
||||||
instance_created:new Date().getTime()
|
|
||||||
}
|
|
||||||
// TODO change default pipe dir for windows and mac os
|
// TODO change default pipe dir for windows and mac os
|
||||||
const DEFAULT_PIPE_DIR = (process.env.SOCKETS_DIR || '/tmp/UCI')
|
const DEFAULT_PIPE_DIR = (process.env.SOCKETS_DIR || '/tmp/UCI')
|
||||||
const DEFAULT_SOCKET_NAME = 'uci-sock'
|
const DEFAULT_SOCKET_NAME = 'uci-sock'
|
||||||
|
@ -37,7 +30,7 @@ export default class Socket extends Server {
|
||||||
//self bindings
|
//self bindings
|
||||||
this._listen = this._listen.bind(this)
|
this._listen = this._listen.bind(this)
|
||||||
this.create = this.create.bind(this)
|
this.create = this.create.bind(this)
|
||||||
log = logger.child(LOG_OPTS) //create instance logger set LOG_OPTS above
|
log = logger({file:'src/socket.js',class:'Socket',name:'socket',id:this.id})
|
||||||
} // end constructor
|
} // end constructor
|
||||||
|
|
||||||
async create () {
|
async create () {
|
Loading…
Reference in New Issue