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

jpex

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jpex - npm Package Compare versions

Comparing version 3.1.0 to 3.2.0

plugin/raw.js

7

CHANGELOG.md
Change Log
==========
## 3.2.0
- add `jpex.raw` function for extracting a factory function
- add publicPath babel config option
- add support for react-jpex's `useResolve` method
## 3.1.0
- global types like `Window` and `Document` and now be used to register dependencies
- global types like `Window` and `Document` can now be used to register dependencies

@@ -6,0 +11,0 @@ ## 3.0.1

@@ -21,2 +21,3 @@ import { JpexInstance as IJpex, AnyFunction, Factory, SetupConfig } from './types';

resolveWith(name: any, namedParameters?: any): any;
raw(name?: any): any;
encase<F extends AnyFunction, G extends AnyFunction<F>>(_deps: any, _fn?: any): any;

@@ -23,0 +24,0 @@ clearCache(names?: any): any;

@@ -391,2 +391,6 @@ 'use strict';

var getFactory = function getFactory(jpex, name, optional) {
if (typeof name !== 'string') {
throw new JpexError("Name must be a string, but recevied " + typeof name);
}
var factory = jpex.$$resolved[name];

@@ -662,2 +666,6 @@

_proto.raw = function raw(name) {
return getFactory(this, name, false).fn;
};
_proto.encase = function encase(_deps, _fn) {

@@ -722,3 +730,3 @@ var _ref3 = function () {

var resolve$1 = (function (jpex) {
var registerResolveFactory = (function (jpex) {
jpex.factory('$resolve', ['$namedParameters'], function ($namedParameters) {

@@ -744,5 +752,5 @@ var _this = this;

var jpex = new Jpex();
resolve$1(jpex);
registerResolveFactory(jpex);
exports.default = jpex;
exports.jpex = jpex;
import { JpexInstance, Definition, Dependency } from '../types';
export { getFactory } from './utils';
export declare const resolve: (jpex: JpexInstance, name: Dependency, namedParameters?: {

@@ -3,0 +4,0 @@ [key: string]: any;

@@ -21,2 +21,3 @@ import { JpexInstance as IJpex, AnyFunction, Factory, SetupConfig } from './types';

resolveWith(name: any, namedParameters?: any): any;
raw(name?: any): any;
encase<F extends AnyFunction, G extends AnyFunction<F>>(_deps: any, _fn?: any): any;

@@ -23,0 +24,0 @@ clearCache(names?: any): any;

@@ -389,2 +389,6 @@ function _defineProperty(obj, key, value) {

var getFactory = function getFactory(jpex, name, optional) {
if (typeof name !== 'string') {
throw new JpexError("Name must be a string, but recevied " + typeof name);
}
var factory = jpex.$$resolved[name];

@@ -660,2 +664,6 @@

_proto.raw = function raw(name) {
return getFactory(this, name, false).fn;
};
_proto.encase = function encase(_deps, _fn) {

@@ -720,3 +728,3 @@ var _ref3 = function () {

var resolve$1 = (function (jpex) {
var registerResolveFactory = (function (jpex) {
jpex.factory('$resolve', ['$namedParameters'], function ($namedParameters) {

@@ -742,5 +750,5 @@ var _this = this;

var jpex = new Jpex();
resolve$1(jpex);
registerResolveFactory(jpex);
export default jpex;
export { Lifecycle, jpex };
import { JpexInstance, Definition, Dependency } from '../types';
export { getFactory } from './utils';
export declare const resolve: (jpex: JpexInstance, name: Dependency, namedParameters?: {

@@ -3,0 +4,0 @@ [key: string]: any;

@@ -30,2 +30,4 @@ import { Lifecycle } from '../constants';

};
raw<T = any>(name: Dependency): AnyFunction<T>;
raw<T>(): AnyFunction<T>;
clearCache(): void;

@@ -32,0 +34,0 @@ clearCache(name: string): void;

2

package.json
{
"name": "jpex",
"version": "3.1.0",
"version": "3.2.0",
"description": "Javascript Prototype Extension",

@@ -5,0 +5,0 @@ "main": "dist/cjs/jpex.js",

@@ -8,2 +8,4 @@ const { declare } = require('@babel/helper-plugin-utils');

const handleInferCall = require('./infer');
const handleRawCall = require('./raw');
const handleUseResolve = require('./useResolve');

@@ -16,5 +18,6 @@ const mainVisitor = {

identifier = 'jpex',
publicPath,
} = {},
} = state;
const filename = this
const filename = publicPath || this
.filename

@@ -32,2 +35,4 @@ .split('.')

handleInferCall(programPath, path, identifier, filename);
handleRawCall(programPath, path, identifier, filename);
handleUseResolve(programPath, path, identifier, filename);
},

@@ -34,0 +39,0 @@ };

@@ -121,5 +121,16 @@

```
By default it only checks for an object named `jpex`. If you decide to rename it to anything else, or have multiple containers, you can pass an identifier option in:
By default it only checks for an object named `jpex`. If you decide to rename it to anything else, or have multiple containers, you can pass an identifier option in.
By default the types are converted to strings based on the path where they originate from i.e. `type:/src/types/index/MyType`. You can optionally pass in a `publicPath` which will override this behaviour, instead returning `type:myPublicPath/MyType`. This is useful if you want to expose factories via an npm package, for example.
```js
plugins: [ [ 'jpex/babel-plugin', { identifier: [ 'jpex', 'ioc' ] } ] ]
plugins: [
[
'jpex/babel-plugin',
{
identifier: [ 'jpex', 'ioc' ],
publicPath: 'my-library'
}
]
]
```

@@ -264,1 +275,12 @@

```
#### jpex.raw
```ts
jpex.raw<T>(): (...args: any[]) => T
```
returns the raw factory function
```ts
const factory = jpex.raw<IFactory>;
const result = factory(dep1, dep2)('my-thing');
```
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