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.3.3 to 3.4.0

dist/es/types/BuiltIns.d.ts

5

CHANGELOG.md
Change Log
==========
### 3.4.0
- clearCache now supports type inference
- you can now pass `publicPath: true` and it will use the `name` property of your app's `package.json` as the public path
- built in deps `$options` `$namedParameters` and `$resolve` now have corresponding type exports `Options` `NamedParameters` and `Resolve`
### 3.3.3

@@ -4,0 +9,0 @@ - array dependencies were being incorrectly flattened

340

dist/cjs/jpex.js

@@ -5,2 +5,143 @@ 'use strict';

function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _construct(Parent, args, Class) {
if (_isNativeReflectConstruct()) {
_construct = Reflect.construct;
} else {
_construct = function _construct(Parent, args, Class) {
var a = [null];
a.push.apply(a, args);
var Constructor = Function.bind.apply(Parent, a);
var instance = new Constructor();
if (Class) _setPrototypeOf(instance, Class.prototype);
return instance;
};
}
return _construct.apply(null, arguments);
}
function _isNativeFunction(fn) {
return Function.toString.call(fn).indexOf("[native code]") !== -1;
}
function _wrapNativeSuper(Class) {
var _cache = typeof Map === "function" ? new Map() : undefined;
_wrapNativeSuper = function _wrapNativeSuper(Class) {
if (Class === null || !_isNativeFunction(Class)) return Class;
if (typeof Class !== "function") {
throw new TypeError("Super expression must either be null or a function");
}
if (typeof _cache !== "undefined") {
if (_cache.has(Class)) return _cache.get(Class);
_cache.set(Class, Wrapper);
}
function Wrapper() {
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
}
Wrapper.prototype = Object.create(Class.prototype, {
constructor: {
value: Wrapper,
enumerable: false,
writable: true,
configurable: true
}
});
return _setPrototypeOf(Wrapper, Class);
};
return _wrapNativeSuper(Class);
}
var Lifecycle;
(function (Lifecycle) {

@@ -11,3 +152,3 @@ Lifecycle[Lifecycle["APPLICATION"] = 1] = "APPLICATION";

Lifecycle[Lifecycle["NONE"] = 4] = "NONE";
})(exports.Lifecycle || (exports.Lifecycle = {}));
})(Lifecycle || (Lifecycle = {}));

@@ -24,15 +165,15 @@ function constant(jpex, name, obj) {

application: function application() {
factory.lifecycle = exports.Lifecycle.APPLICATION;
factory.lifecycle = Lifecycle.APPLICATION;
return wrapper;
},
class: function _class() {
factory.lifecycle = exports.Lifecycle.CLASS;
factory.lifecycle = Lifecycle.CLASS;
return wrapper;
},
instance: function instance() {
factory.lifecycle = exports.Lifecycle.INSTANCE;
factory.lifecycle = Lifecycle.INSTANCE;
return wrapper;
},
none: function none() {
factory.lifecycle = exports.Lifecycle.NONE;
factory.lifecycle = Lifecycle.NONE;
return wrapper;

@@ -86,3 +227,4 @@ }

try {
_process = eval('process'); // eslint-disable-line no-eval
// eslint-disable-next-line no-new-func
_process = new Function('return process')();
} catch (e) {// No process

@@ -93,6 +235,6 @@ } // eslint-disable-next-line max-len

return typeof _process === 'object' && _process.toString && _process.toString() === '[object process]';
}(); // eslint-disable-next-line @typescript-eslint/no-unused-vars
}();
var unsafeRequire = function unsafeRequire(target) {
return eval('require.main.require(target)'); // eslint-disable-line no-eval
// eslint-disable-next-line no-new-func
return new Function('require', 'target', 'return require.main.require(target)')(require, target);
};

@@ -208,141 +350,2 @@ var REG_COMMENTS = /\/\/(.*?)\n|\/\*([\S\s]*?)\*\//g;

function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _construct(Parent, args, Class) {
if (_isNativeReflectConstruct()) {
_construct = Reflect.construct;
} else {
_construct = function _construct(Parent, args, Class) {
var a = [null];
a.push.apply(a, args);
var Constructor = Function.bind.apply(Parent, a);
var instance = new Constructor();
if (Class) _setPrototypeOf(instance, Class.prototype);
return instance;
};
}
return _construct.apply(null, arguments);
}
function _isNativeFunction(fn) {
return Function.toString.call(fn).indexOf("[native code]") !== -1;
}
function _wrapNativeSuper(Class) {
var _cache = typeof Map === "function" ? new Map() : undefined;
_wrapNativeSuper = function _wrapNativeSuper(Class) {
if (Class === null || !_isNativeFunction(Class)) return Class;
if (typeof Class !== "function") {
throw new TypeError("Super expression must either be null or a function");
}
if (typeof _cache !== "undefined") {
if (_cache.has(Class)) return _cache.get(Class);
_cache.set(Class, Wrapper);
}
function Wrapper() {
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
}
Wrapper.prototype = Object.create(Class.prototype, {
constructor: {
value: Wrapper,
enumerable: false,
writable: true,
configurable: true
}
});
return _setPrototypeOf(Wrapper, Class);
};
return _wrapNativeSuper(Class);
}
var JpexError = /*#__PURE__*/function (_Error) {

@@ -423,3 +426,3 @@ _inheritsLoose(JpexError, _Error);

switch (factory.lifecycle) {
case exports.Lifecycle.APPLICATION:
case Lifecycle.APPLICATION:
factory.resolved = true;

@@ -429,3 +432,3 @@ factory.value = value;

case exports.Lifecycle.CLASS:
case Lifecycle.CLASS:
jpex.$$resolved[name] = {

@@ -437,6 +440,6 @@ resolved: true,

case exports.Lifecycle.NONE:
case Lifecycle.NONE:
break;
case exports.Lifecycle.INSTANCE:
case Lifecycle.INSTANCE:
default:

@@ -476,4 +479,4 @@ namedParameters[name] = value;

if (isObject(name)) {
var key = Object.keys(name)[0];
return resolveOne(jpex, key, name[key], namedParameters, stack);
var _key = Object.keys(name)[0];
return resolveOne(jpex, _key, name[_key], namedParameters, stack);
}

@@ -504,5 +507,7 @@

case '$options':
case "type:jpex/Options":
return localOptions;
case '$namedParameters':
case "type:jpex/NamedParameters":
// @ts-ignore

@@ -630,4 +635,12 @@ return namedParameters;

this.$$factories = {};
this.$$resolved = {};
_defineProperty(this, "decorate", void 0);
_defineProperty(this, "$$defaultLifecycle", void 0);
_defineProperty(this, "$$parent", void 0);
_defineProperty(this, "$$factories", {});
_defineProperty(this, "$$resolved", {});
var _options = options,

@@ -637,3 +650,3 @@ _options$inherit = _options.inherit,

_options$lifecycle = _options.lifecycle,
lifecycle = _options$lifecycle === void 0 ? (_ref = inherit ? parent == null ? void 0 : parent.$$defaultLifecycle : void 0) != null ? _ref : exports.Lifecycle.CLASS : _options$lifecycle;
lifecycle = _options$lifecycle === void 0 ? (_ref = inherit ? parent == null ? void 0 : parent.$$defaultLifecycle : void 0) != null ? _ref : Lifecycle.CLASS : _options$lifecycle;
this.$$parent = parent;

@@ -720,11 +733,11 @@ this.$$defaultLifecycle = lifecycle;

for (var key in this.$$factories) {
if (!names.length || names.indexOf(key) > -1) {
this.$$factories[key].resolved = false;
for (var _key2 in this.$$factories) {
if (!names.length || names.indexOf(_key2) > -1) {
this.$$factories[_key2].resolved = false;
}
}
for (var _key2 in this.$$resolved) {
if (!names.length || names.indexOf(_key2) > -1) {
delete this.$$resolved[_key2];
for (var _key3 in this.$$resolved) {
if (!names.length || names.indexOf(_key3) > -1) {
delete this.$$resolved[_key3];
}

@@ -759,2 +772,3 @@ }

});
jpex.alias("type:jpex/Resolve", '$resolve');
});

@@ -761,0 +775,0 @@

@@ -0,0 +0,0 @@ export declare enum Lifecycle {

import { JpexInstance } from '../types';
declare function alias(jpex: JpexInstance, alias: any, name: any): void;
export default alias;

@@ -0,0 +0,0 @@ import { JpexInstance } from '../types';

@@ -0,0 +0,0 @@ import { JpexInstance } from '../types';

@@ -0,0 +0,0 @@ export { default as constant } from './constant';

@@ -0,0 +0,0 @@ import { JpexInstance } from '../types';

@@ -0,0 +0,0 @@ import { Factory, Dependency } from '../types';

declare class JpexError extends Error {
}
export default JpexError;
export { default as resolve } from './resolve';
import { JpexInstance } from '../types';
declare const _default: (jpex: JpexInstance) => void;
export default _default;

@@ -1,5 +0,6 @@

import { JpexInstance, SetupConfig } from './types';
import type { JpexInstance, SetupConfig, Options, NamedParameters, Resolve } from './types';
import { Lifecycle } from './constants';
declare const jpex: JpexInstance;
export { jpex, JpexInstance, SetupConfig, Lifecycle, };
export { jpex, };
export type { JpexInstance, SetupConfig, Lifecycle, Options, NamedParameters, Resolve, };
export default jpex;

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

@@ -0,1 +1,140 @@

function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _construct(Parent, args, Class) {
if (_isNativeReflectConstruct()) {
_construct = Reflect.construct;
} else {
_construct = function _construct(Parent, args, Class) {
var a = [null];
a.push.apply(a, args);
var Constructor = Function.bind.apply(Parent, a);
var instance = new Constructor();
if (Class) _setPrototypeOf(instance, Class.prototype);
return instance;
};
}
return _construct.apply(null, arguments);
}
function _isNativeFunction(fn) {
return Function.toString.call(fn).indexOf("[native code]") !== -1;
}
function _wrapNativeSuper(Class) {
var _cache = typeof Map === "function" ? new Map() : undefined;
_wrapNativeSuper = function _wrapNativeSuper(Class) {
if (Class === null || !_isNativeFunction(Class)) return Class;
if (typeof Class !== "function") {
throw new TypeError("Super expression must either be null or a function");
}
if (typeof _cache !== "undefined") {
if (_cache.has(Class)) return _cache.get(Class);
_cache.set(Class, Wrapper);
}
function Wrapper() {
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
}
Wrapper.prototype = Object.create(Class.prototype, {
constructor: {
value: Wrapper,
enumerable: false,
writable: true,
configurable: true
}
});
return _setPrototypeOf(Wrapper, Class);
};
return _wrapNativeSuper(Class);
}
var Lifecycle;

@@ -81,3 +220,4 @@

try {
_process = eval('process'); // eslint-disable-line no-eval
// eslint-disable-next-line no-new-func
_process = new Function('return process')();
} catch (e) {// No process

@@ -88,6 +228,6 @@ } // eslint-disable-next-line max-len

return typeof _process === 'object' && _process.toString && _process.toString() === '[object process]';
}(); // eslint-disable-next-line @typescript-eslint/no-unused-vars
}();
var unsafeRequire = function unsafeRequire(target) {
return eval('require.main.require(target)'); // eslint-disable-line no-eval
// eslint-disable-next-line no-new-func
return new Function('require', 'target', 'return require.main.require(target)')(require, target);
};

@@ -203,141 +343,2 @@ var REG_COMMENTS = /\/\/(.*?)\n|\/\*([\S\s]*?)\*\//g;

function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _construct(Parent, args, Class) {
if (_isNativeReflectConstruct()) {
_construct = Reflect.construct;
} else {
_construct = function _construct(Parent, args, Class) {
var a = [null];
a.push.apply(a, args);
var Constructor = Function.bind.apply(Parent, a);
var instance = new Constructor();
if (Class) _setPrototypeOf(instance, Class.prototype);
return instance;
};
}
return _construct.apply(null, arguments);
}
function _isNativeFunction(fn) {
return Function.toString.call(fn).indexOf("[native code]") !== -1;
}
function _wrapNativeSuper(Class) {
var _cache = typeof Map === "function" ? new Map() : undefined;
_wrapNativeSuper = function _wrapNativeSuper(Class) {
if (Class === null || !_isNativeFunction(Class)) return Class;
if (typeof Class !== "function") {
throw new TypeError("Super expression must either be null or a function");
}
if (typeof _cache !== "undefined") {
if (_cache.has(Class)) return _cache.get(Class);
_cache.set(Class, Wrapper);
}
function Wrapper() {
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
}
Wrapper.prototype = Object.create(Class.prototype, {
constructor: {
value: Wrapper,
enumerable: false,
writable: true,
configurable: true
}
});
return _setPrototypeOf(Wrapper, Class);
};
return _wrapNativeSuper(Class);
}
var JpexError = /*#__PURE__*/function (_Error) {

@@ -468,4 +469,4 @@ _inheritsLoose(JpexError, _Error);

if (isObject(name)) {
var key = Object.keys(name)[0];
return resolveOne(jpex, key, name[key], namedParameters, stack);
var _key = Object.keys(name)[0];
return resolveOne(jpex, _key, name[_key], namedParameters, stack);
}

@@ -496,5 +497,7 @@

case '$options':
case "type:jpex/Options":
return localOptions;
case '$namedParameters':
case "type:jpex/NamedParameters":
// @ts-ignore

@@ -622,4 +625,12 @@ return namedParameters;

this.$$factories = {};
this.$$resolved = {};
_defineProperty(this, "decorate", void 0);
_defineProperty(this, "$$defaultLifecycle", void 0);
_defineProperty(this, "$$parent", void 0);
_defineProperty(this, "$$factories", {});
_defineProperty(this, "$$resolved", {});
var _options = options,

@@ -711,11 +722,11 @@ _options$inherit = _options.inherit,

for (var key in this.$$factories) {
if (!names.length || names.indexOf(key) > -1) {
this.$$factories[key].resolved = false;
for (var _key2 in this.$$factories) {
if (!names.length || names.indexOf(_key2) > -1) {
this.$$factories[_key2].resolved = false;
}
}
for (var _key2 in this.$$resolved) {
if (!names.length || names.indexOf(_key2) > -1) {
delete this.$$resolved[_key2];
for (var _key3 in this.$$resolved) {
if (!names.length || names.indexOf(_key3) > -1) {
delete this.$$resolved[_key3];
}

@@ -750,2 +761,3 @@ }

});
jpex.alias("type:jpex/Resolve", '$resolve');
});

@@ -757,2 +769,2 @@

export default jpex;
export { Lifecycle, jpex };
export { jpex };

@@ -0,0 +0,0 @@ import { JpexInstance, Definition, Dependency } from '../types';

@@ -0,0 +0,0 @@ import { JpexInstance, Dependency, Definition } from '../types';

@@ -0,0 +0,0 @@ import { Factory, JpexInstance } from '../types';

@@ -0,0 +0,0 @@ import { AnyFunction } from '../types';

{
"name": "jpex",
"version": "3.3.3",
"version": "3.4.0",
"description": "Javascript Prototype Extension",

@@ -11,6 +11,8 @@ "main": "dist/cjs/jpex.js",

"coverage": "nyc ava",
"lint": "eslint './src/**/*.ts' && tsc",
"build:prepare": "rm -rf dist && rm -rf tmp",
"build:js": "rollup --config ./rollup.config.js && cp -r src/types dist/es",
"build": "yarn build:prepare && yarn build:js",
"lint": "eslint './src/**/*.ts' && tsc --noEmit",
"build:prepare": "rm -rf dist",
"build:js": "rollup --config ./rollup.config.js",
"build:ts": "tsc -d --outDir dist/es --emitDeclarationOnly ./src/index.ts",
"build:post": "node ./postbuild-checks.js",
"build": "yarn build:prepare && yarn build:js && yarn build:ts",
"prepublishOnly": "yarn build"

@@ -73,3 +75,2 @@ },

"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-typescript2": "^0.27.1",
"sinon": "^9.0.2",

@@ -76,0 +77,0 @@ "typescript": "^3.8.2"

@@ -14,3 +14,3 @@ const { types: t } = require('@babel/core');

if (!cache[key]) {
const usePublicPath = state.publicPath && path.parent.source.value[0] === '.';
const usePublicPath = state.publicPath && path.parent.source && path.parent.source.value[0] === '.';
const value = `${usePublicPath ? state.publicPath : state.filename}/${state.typeName}`;

@@ -28,3 +28,3 @@ cache[key] = value;

if (!cache[key]) {
const usePublicPath = state.publicPath && path.parent.source.value[0] === '.';
const usePublicPath = state.publicPath && path.parent.source && path.parent.source.value[0] === '.';
const value = `${usePublicPath ? state.publicPath : state.filename}/${state.typeName}`;

@@ -31,0 +31,0 @@ cache[key] = value;

@@ -0,1 +1,2 @@

const { resolve } = require('path');
const { declare } = require('@babel/helper-plugin-utils');

@@ -10,2 +11,3 @@ const handleFactoryCalls = require('./factories');

const handleUseResolve = require('./useResolve');
const handleClearCache = require('./clearCache');

@@ -28,2 +30,5 @@ const mainVisitor = {

identifier = [].concat(identifier);
if (publicPath === true) {
publicPath = require(resolve('./package.json')).name;
}
const opts = {

@@ -41,2 +46,3 @@ identifier,

handleRawCall(programPath, path, opts);
handleClearCache(programPath, path, opts);
handleUseResolve(programPath, path, opts);

@@ -43,0 +49,0 @@ },

@@ -137,2 +137,4 @@

You can also set this to `true` which will automatically use your library's `name` property from its `package.json` as the public path.
There are a number of caveats to this method, however:

@@ -254,5 +256,8 @@ - The plugin only supports named types so you can't do `jpex.factory<{}>()`

```ts
(name?: string | string[]): void
(): void
<T>(): void
(name: string): void
(name: string[]): void
```
Clears the cache. If you provide a name, it will only clear that factory's cache. If you omit name, it will clear the entire cache.
Clears the cache. If you provide a name or a type, it will only clear that dependency's cache. If you omit name altogether, it will clear the entire cache.

@@ -259,0 +264,0 @@ #### jpex.extend

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