Comparing version 3.20.6 to 3.21.0
@@ -0,1 +1,7 @@ | ||
## 3.21.0 2020-05-19 | ||
* Starting port to TypeScript, see lib/plugin.ts | ||
* Well-defined plugin load lifecycle, see lib/plugin.ts use of https://github.com/rjrodger/ordu | ||
## 3.20.6 2020-05-14 | ||
@@ -2,0 +8,0 @@ |
@@ -6,2 +6,4 @@ /* Copyright © 2019 Richard Rodger and other contributors, MIT License. */ | ||
// TODO: convert to latest ordu | ||
exports.api_add = function () { | ||
@@ -8,0 +10,0 @@ var self = this |
@@ -10,3 +10,3 @@ /* Copyright © 2010-2018 Richard Rodger and other contributors, MIT License. */ | ||
var Common = require('./common') | ||
var Plugins = require('./plugins') | ||
//var Plugins = require('./plugins') | ||
@@ -405,49 +405,2 @@ var errlog = Common.make_standard_err_log_entry | ||
// use('pluginname') - built-in, or provide calling code 'require' as seneca opt | ||
// use(require('pluginname')) - plugin object, init will be called | ||
// if first arg has property senecaplugin | ||
exports.use = function (arg0, arg1, arg2) { | ||
var self = this | ||
// DEPRECATED: Remove when Seneca >= 4.x | ||
// Allow chaining with seneca.use('options', {...}) | ||
// see https://github.com/rjrodger/seneca/issues/80 | ||
if (arg0 === 'options') { | ||
self.options(arg1) | ||
return self | ||
} | ||
try { | ||
// Plugin definition function is under property `define`. | ||
// `init` is deprecated from 4.x | ||
// TODO: use-plugin expects `init` - update use-plugin to make this customizable | ||
if (null != arg0 && 'object' === typeof arg0) { | ||
arg0.init = arg0.define || arg0.init | ||
} | ||
// TODO: use-plugin needs better error message for malformed plugin desc | ||
var desc = self.private$.use.build_plugin_desc(arg0, arg1, arg2) | ||
if (this.private$.ignore_plugins[desc.full]) { | ||
this.log.info({ | ||
kind: 'plugin', | ||
case: 'ignore', | ||
plugin_full: desc.full, | ||
plugin_name: desc.name, | ||
plugin_tag: desc.tag, | ||
}) | ||
return self | ||
} | ||
var plugin = self.private$.use.use_plugin_desc(desc) | ||
self.register(plugin) | ||
} catch (e) { | ||
self.die(self.private$.error(e, 'plugin_' + e.code)) | ||
} | ||
return self | ||
} | ||
exports.ping = function () { | ||
@@ -698,8 +651,21 @@ var now = Date.now() | ||
var sd = Plugins.make_delegate(self, { | ||
// TODO: make this unique with a counter | ||
name: 'seneca_internal_client', | ||
tag: void 0, | ||
//var sd = Plugins.make_delegate(self, { | ||
// TODO: review - this feels like a hack | ||
// perhaps we should instantiate a virtual plugin to represent the client? | ||
// ... but is this necessary at all? | ||
var task_res = self.order.plugin.task.delegate.exec({ | ||
ctx: { | ||
seneca: self, | ||
}, | ||
data: { | ||
plugin: { | ||
// TODO: make this unique with a counter | ||
name: 'seneca_internal_client', | ||
tag: void 0, | ||
}, | ||
}, | ||
}) | ||
var sd = task_res.out.delegate | ||
var sendclient | ||
@@ -706,0 +672,0 @@ |
@@ -148,2 +148,5 @@ /* Copyright © 2010-2018 Richard Rodger and other contributors, MIT License. */ | ||
use_no_args: | ||
'The seneca.use method needs at least one argument to define a plugin.', | ||
// Legacy error message codes | ||
@@ -150,0 +153,0 @@ |
@@ -10,2 +10,4 @@ /* Copyright © 2010-2020 Richard Rodger and other contributors, MIT License. */ | ||
// TODO: convert to latest ordu | ||
module.exports = { | ||
@@ -12,0 +14,0 @@ msg_modify: inward_msg_modify, |
@@ -5,2 +5,3 @@ /* Copyright © 2014-2020 Richard Rodger and other contributors, MIT License. */ | ||
var Fs = require('fs') | ||
var Path = require('path') | ||
var Error = require('eraro') | ||
@@ -228,3 +229,7 @@ var Jsonic = require('jsonic') | ||
var from = origfrom.match(/^\//) ? origfrom : process.cwd() + '/' + origfrom | ||
//var from = origfrom.match(/^\//) ? origfrom : process.cwd() + '/' + origfrom | ||
var from = | ||
Path.basename(origfrom) !== origfrom | ||
? origfrom | ||
: Path.join(process.cwd(), origfrom) | ||
@@ -231,0 +236,0 @@ if (from.match(/\.json$/i)) { |
@@ -12,2 +12,4 @@ /* Copyright © 2014-2018 Richard Rodger and other contributors, MIT License. */ | ||
// TODO: convert to latest ordu | ||
module.exports = { | ||
@@ -14,0 +16,0 @@ test$: { intern: intern }, |
{ | ||
"name": "seneca", | ||
"description": "A Microservices Framework for Node.js", | ||
"version": "3.20.6", | ||
"version": "3.21.0", | ||
"license": "MIT", | ||
@@ -68,7 +68,9 @@ "homepage": "http://senecajs.org", | ||
"engines": { | ||
"node": ">=8.0.0" | ||
"node": ">=10" | ||
}, | ||
"main": "seneca.js", | ||
"scripts": { | ||
"test": "lab -v -P test -L -t 90", | ||
"watch": "tsc -w -d", | ||
"build": "tsc -d", | ||
"test": "lab -v -P test -L -t 90 --sourcemaps --transform node_modules/lab-transform-typescript -r console -o stdout -r html -o test/coverage.html", | ||
"coveralls": "lab -s -P test -r lcov | coveralls", | ||
@@ -79,5 +81,5 @@ "coverage": "lab -v -P test -L -t 90 -r html > docs/coverage.html", | ||
"clean": "rm -rf node_modules package-lock.json yarn.lock", | ||
"reset": "npm run clean && npm i && npm test", | ||
"reset": "npm run clean && npm i && npm run build && npm test", | ||
"repo-tag": "REPO_VERSION=`node -e \"console.log(require('./package').version)\"` && echo TAG: v$REPO_VERSION && git commit -a -m v$REPO_VERSION && git push && git tag v$REPO_VERSION && git push --tags;", | ||
"repo-publish": "REPO_VERSION=`node -e \"console.log(require('./package').version)\"` && npm run clean && npm i --registry http://registry.npmjs.org && npm run prettier && npm test && npm run repo-tag --registry http://registry.npmjs.org && npm publish --registry http://registry.npmjs.org && npm dist-tag add seneca@$REPO_VERSION next --registry http://registry.npmjs.org && npm dist-tag add seneca@$REPO_VERSION plugin --registry http://registry.npmjs.org" | ||
"repo-publish": "REPO_VERSION=`node -e \"console.log(require('./package').version)\"` && npm run clean && npm i --registry http://registry.npmjs.org && npm run prettier && npm run build && npm test && npm run repo-tag --registry http://registry.npmjs.org && npm publish --registry http://registry.npmjs.org && npm dist-tag add seneca@$REPO_VERSION next --registry http://registry.npmjs.org && npm dist-tag add seneca@$REPO_VERSION plugin --registry http://registry.npmjs.org" | ||
}, | ||
@@ -99,3 +101,3 @@ "dependencies": { | ||
"optioner": "^5.0.1", | ||
"ordu": "^1.3.0", | ||
"ordu": "^1.7.1", | ||
"patrun": "^3.0.0", | ||
@@ -105,3 +107,3 @@ "qs": "^6.9.4", | ||
"seneca-transport": "^6.0.0", | ||
"use-plugin": "^7.0.0" | ||
"use-plugin": "^8.0.0" | ||
}, | ||
@@ -117,2 +119,3 @@ "devDependencies": { | ||
"handlebars": "^4.7.6", | ||
"lab-transform-typescript": "^3.0.1", | ||
"lolex": "^6.0.0", | ||
@@ -123,4 +126,6 @@ "prettier": "^2.0.5", | ||
"seneca-joi": "^7.0.2", | ||
"seneca-promisify": "^1.3.0" | ||
"seneca-promisify": "^1.3.0", | ||
"typescript": "^3.9.2", | ||
"@types/node": "^14.0.1" | ||
} | ||
} |
@@ -15,3 +15,3 @@ /* Copyright © 2010-2020 Richard Rodger and other contributors, MIT License. */ | ||
const Stats = require('rolling-stats') | ||
const LegacyOrdu = require('ordu').LegacyOrdu | ||
const { LegacyOrdu } = require('ordu') | ||
const Eraro = require('eraro') | ||
@@ -29,2 +29,3 @@ const Optioner = require('optioner') | ||
const Act = require('./lib/act') | ||
const Plugin = require('./lib/plugin') | ||
const Inward = require('./lib/inward') | ||
@@ -35,3 +36,3 @@ const Outward = require('./lib/outward') | ||
const Package = require('./package.json') | ||
const Plugins = require('./lib/plugins') | ||
//const Plugins = require('./lib/plugins') | ||
const Print = require('./lib/print') | ||
@@ -468,2 +469,8 @@ const Actions = require('./lib/actions') | ||
root$.order = {} | ||
// TODO: rename back to plugins | ||
const api_use = Plugin.api_use(callpoint, { debug: !!start_opts.debug.ordu }) | ||
root$.order.plugin = api_use.ordu | ||
// Seneca methods. Official API. | ||
@@ -487,3 +494,3 @@ root$.toString = API.toString | ||
root$.ping = API.ping // Generate ping response. | ||
root$.use = API.use // Define and load a plugin. | ||
root$.use = api_use.use // Define and load a plugin. | ||
root$.test = API.test // Set test mode. | ||
@@ -512,4 +519,12 @@ root$.quiet = API.quiet // Convenience method to set logging level to `warn+`. | ||
root$.internal = function () { | ||
return { | ||
ordu: { | ||
use: api_use.ordu, | ||
}, | ||
} | ||
} | ||
// Non-API methods. | ||
root$.register = Plugins.register(callpoint) | ||
// root$.register = Plugins.register(callpoint) | ||
@@ -516,0 +531,0 @@ // DEPRECATE IN 4.x |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
250792
24
5984
17
+ Addeduse-plugin@8.2.0(transitive)
- Removednid@0.3.2(transitive)
- Removeduse-plugin@7.0.0(transitive)
Updatedordu@^1.7.1
Updateduse-plugin@^8.0.0