Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
@produck/crank
Advanced tools
The framework is to generate program execution engine. You should provide executors
, program
and extern
that is customized. By providing as mentioned above, you can customize the functions of engine. And then you will get the result of execution. The execution of program support async function and common functon.
$ npm install @produck/crank
import * as Crank from '@produck/crank';
const CustomEngine = Crank.defineEngine({}, {
a: async (process) => {
return 'pass';
},
});
const extern = new CustomEngine.Extern();
const vm = new CustomEngine();
const ret = vm.execute({
*foo() {
return yield this._a();
},
*main() {
return yield this.foo();
},
}, extern).then(value => {
console.log(value); // 'pass'
});
As esModule,
import {
defineEngine, define,
Extern,
isToken
} from '@produck/crank';
// Or
import * as Crank from '@produck/crank';
As CommonJS,
const {
defineEngine, define,
Extern,
isToken
} = require('@produck/crank');
// Or
const Crank = require('@produck/crank');
import * as Crank from '@produck/crank';
const Engine = Crank.define();
You can customize Engine features by custom options.
options.name
: The name of Engine class.
options.call
: Customized the calling of functions.
options.Extern
: Customized Extern, should be subclass of Crank.Extern
.
options.abort
: Customize when to abort the running program.
import * as Crank from '@produck/crank';
const Engine = Crank.define({
name: 'CustomEngine',
call: async (process, nextFrame, next) => await next(),
Extern,
abort: (lastInstruction) => false;
});
You can customize Engine functions by custom executors.
The item of executors should be async function or common functon.
import * as Crank from '@produck/crank';
const Engine = Crank.define({}, {
async b() {
return Promise.resolve(1);
},
a() {
return 1;
}
});
You can execute program and get returned value.
The function of program should be GeneratorFunction
or AsyncGeneratorFunction
.
The main
function is required.
The executors should be calling by this._[executorName]
.
The function of program should be calling by this.[functionName]
.
The extern should be the instance of Engine.Extern
.
import * as Crank from '@produck/crank';
const Engine = Crank.define({}, {
a() {
return 1;
}
});
const vm = new Engine();
const program = {
*main() {
return yield this._a();
}
};
const extern = new Engine.Extern();
vm.execute(program, extern).then(val => {
console.log(val); // 1
});
FAQs
executor framework
The npm package @produck/crank receives a total of 14 weekly downloads. As such, @produck/crank popularity was classified as not popular.
We found that @produck/crank demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.