New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bakeryjs

Package Overview
Dependencies
Maintainers
4
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bakeryjs - npm Package Compare versions

Comparing version 0.0.1-beta.8 to 0.0.1-beta.10

30

build/lib/bakeryjs/__tests__/ComponentFactory.test.js

@@ -12,7 +12,8 @@ "use strict";

});
const componentsDir = path_1.resolve(__dirname, '..', '..', '..', 'components') + '/';
const testDataDir = path_1.resolve(__dirname, '..', '..', '..', '..', 'test-data') + '/';
const componentsDir = path_1.resolve(__dirname, '../../../components');
const componentsDirSlash = componentsDir + '/';
const testDataDir = path_1.resolve(__dirname, '../../../../test-data') + '/';
describe('Component Factory', () => {
it('create builtin box', async () => {
const factory = new ComponentFactory_1.ComponentFactory(componentsDir, serviceProvider);
const factory = new ComponentFactory_1.ComponentFactory(componentsDirSlash, serviceProvider);
const tickBox = await factory.create('tick');

@@ -22,3 +23,3 @@ expect(tickBox).not.toBeUndefined();

it('create nonexistent box throws', () => {
const factory = new ComponentFactory_1.ComponentFactory(componentsDir, serviceProvider);
const factory = new ComponentFactory_1.ComponentFactory(componentsDirSlash, serviceProvider);
factory.create('fick').catch((reason) => {

@@ -30,6 +31,21 @@ expect.assertions(2);

});
describe('Component Factory -- path without ending slash', () => {
it('create builtin box', async () => {
const factory = new ComponentFactory_1.ComponentFactory(componentsDir, serviceProvider);
const tickBox = await factory.create('tick');
expect(tickBox).not.toBeUndefined();
});
it('create nonexistent box throws', () => {
const factory = new ComponentFactory_1.ComponentFactory(componentsDir, serviceProvider);
factory.create('fick').catch((reason) => {
expect.assertions(2);
expect(reason).toBeInstanceOf(VError);
expect(reason.name).toBe('BoxNotFound');
});
});
});
describe('double factory', async () => {
it('create a builtin box', async () => {
const multiFactory = new ComponentFactory_1.MultiComponentFactory();
multiFactory.push(new ComponentFactory_1.ComponentFactory(componentsDir, serviceProvider));
multiFactory.push(new ComponentFactory_1.ComponentFactory(componentsDirSlash, serviceProvider));
multiFactory.push(new ComponentFactory_1.ComponentFactory(testDataDir, serviceProvider));

@@ -41,3 +57,3 @@ const tickBox = await multiFactory.create('tick');

const multiFactory = new ComponentFactory_1.MultiComponentFactory();
multiFactory.push(new ComponentFactory_1.ComponentFactory(componentsDir, serviceProvider));
multiFactory.push(new ComponentFactory_1.ComponentFactory(componentsDirSlash, serviceProvider));
multiFactory.push(new ComponentFactory_1.ComponentFactory(testDataDir, serviceProvider));

@@ -48,3 +64,3 @@ const tickBox = await multiFactory.create('helloworld');

it('create nonexistent box throws', () => {
const factory = new ComponentFactory_1.ComponentFactory(componentsDir, serviceProvider);
const factory = new ComponentFactory_1.ComponentFactory(componentsDirSlash, serviceProvider);
factory.create('fick').catch((reason) => {

@@ -51,0 +67,0 @@ expect(reason).toBeInstanceOf(VError);

@@ -11,4 +11,5 @@ "use strict";

const fs = __importStar(require("fs"));
const path_1 = require("path");
const verror_1 = require("verror");
const componentNameParser_1 = require("./componentNameParser");
const verror_1 = require("verror");
const debug = require('debug')('bakeryjs:componentProvider');

@@ -54,16 +55,17 @@ function boxNotFoundError(name, baseURIs) {

const files = fs.readdirSync(componentsPath);
files.forEach((file) => {
if (fs.statSync(`${componentsPath}${file}`).isDirectory()) {
for (const file of files) {
const stat = fs.statSync(path_1.join(componentsPath, file));
if (stat.isDirectory()) {
if (file !== '.' && file !== '..') {
this.findComponents(`${componentsPath}${file}/`, `${parentDir}${file}/`);
this.findComponents(path_1.join(componentsPath, file), path_1.join(parentDir, file));
}
}
else {
const name = componentNameParser_1.parseComponentName(`${parentDir}${file}`);
if (name == null) {
const name = componentNameParser_1.parseComponentName(path_1.join(parentDir, file));
if (!name) {
return;
}
this.availableComponents[name] = `${componentsPath}${file}`;
this.availableComponents[name] = path_1.join(componentsPath, file);
}
});
}
}

@@ -70,0 +72,0 @@ }

@@ -20,3 +20,3 @@ import { PriorityQueueI } from './PriorityQueueI';

constructor(target: string, worker: (j: any, cb: (e: any, v: any) => void) => void, config: Partial<BetterQueue.QueueOptions<any, any>>);
push(message: T | T[], priority?: number): void;
push(message: T | T[], priority?: undefined): void;
readonly length: number;

@@ -23,0 +23,0 @@ source: string | undefined;

@@ -14,3 +14,3 @@ "use strict";

const BetterQueue = require("better-queue");
const DEFAULT_PRIORITY = 5;
const DEFAULT_PRIORITY = undefined;
let AQueue = class AQueue {

@@ -17,0 +17,0 @@ constructor(target, worker, config) {

{
"name": "bakeryjs",
"version": "0.0.1-beta.8",
"version": "0.0.1-beta.10",
"description": "FBP-inspired library",

@@ -24,3 +24,3 @@ "main": "build/index",

"dependencies": {
"ajv": "^6.5.5",
"ajv": "^6.6.2",
"async": "^2.6.1",

@@ -35,8 +35,8 @@ "better-queue": "^3.8.10",

"@types/better-queue": "^3.8.0",
"@types/jest": "^23.3.9",
"@types/node": "^10.12.6",
"@types/jest": "^23.3.10",
"@types/node": "^10.12.15",
"@types/verror": "^1.10.3",
"eslint": "^5.8.0",
"eslint": "^5.10.0",
"eslint-config-prettier": "^3.3.0",
"eslint-plugin-jest": "^22.0.0",
"eslint-plugin-jest": "^22.1.2",
"eslint-plugin-prettier": "^3.0.0",

@@ -46,9 +46,9 @@ "eslint-plugin-typescript": "^0.14.0",

"jest-junit": "^5.2.0",
"nodemon": "^1.18.6",
"prettier": "1.15.2",
"ts-jest": "^23.10.4",
"nodemon": "^1.18.9",
"prettier": "1.15.3",
"ts-jest": "^23.10.5",
"ts-node": "^7.0.1",
"typedoc": "^0.13.0",
"typescript": "^3.1.6",
"typescript-eslint-parser": "^21.0.0"
"typescript": "^3.2.2",
"typescript-eslint-parser": "^21.0.2"
},

@@ -55,0 +55,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc