Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@eva/inspector-decorator

Package Overview
Dependencies
Maintainers
4
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eva/inspector-decorator - npm Package Compare versions

Comparing version 0.0.6 to 0.1.0-alpha.0

dist/inspector-decorator.d.ts

118

dist/plugin.cjs.js

@@ -5,33 +5,105 @@ 'use strict';

function getIDEPropsPropertyObj(target, propertyKey) {
//@ts-ignore
if (!target.constructor.IDEProps) {
//@ts-ignore
target.constructor.IDEProps = {};
var tslib = require('tslib');
var SymbolKeysNotSupportedError = /** @class */ (function (_super) {
tslib.__extends(SymbolKeysNotSupportedError, _super);
function SymbolKeysNotSupportedError() {
var _newTarget = this.constructor;
var _this = _super.call(this, 'Symbol keys are not supported yet!') || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
return _this;
}
if (!target.constructor.IDEProps[propertyKey]) {
target.constructor.IDEProps[propertyKey] = {};
return SymbolKeysNotSupportedError;
}(Error));
var StaticGetPropertiesIsNotAFunctionError = /** @class */ (function (_super) {
tslib.__extends(StaticGetPropertiesIsNotAFunctionError, _super);
function StaticGetPropertiesIsNotAFunctionError() {
var _newTarget = this.constructor;
var _this = _super.call(this, 'getProperties is not a function!') || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
return _this;
}
var propertyObj = target.constructor.IDEProps[propertyKey];
return propertyObj;
return StaticGetPropertiesIsNotAFunctionError;
}(Error));
var IDE_PROPERTY_METADATA = 'IDE_PROPERTY_METADATA';
function isFunction(val) {
return typeof val === 'function';
}
function type(type) {
return function (target, propertyKey) {
var prop = getIDEPropsPropertyObj(target, propertyKey);
//@ts-ignore
prop.key = propertyKey;
prop.type = type;
function transformBasicType(type) {
if (type === String) {
return 'string';
}
if (type === Number) {
return 'number';
}
if (type === Boolean) {
return 'boolean';
}
return 'unknown';
}
function defineTypes(target, key, options, returnTypeFunction) {
var type = Reflect.getMetadata('design:type', target, key);
var isArray = type === Array;
var str = transformBasicType(type);
if (str !== 'unknown') {
type = str;
}
if (returnTypeFunction) {
var returnType = returnTypeFunction();
if (Array.isArray(returnType)) {
type = returnType[0];
}
else {
type = returnType;
}
}
var properties = Reflect.getMetadata(IDE_PROPERTY_METADATA, target.constructor) || {};
properties[key] = tslib.__assign({ type: type, isArray: isArray }, options);
Reflect.defineMetadata(IDE_PROPERTY_METADATA, properties, target.constructor);
}
function getTypeDecoratorParams(returnTypeFuncOrOptions, maybeOptions) {
if (typeof returnTypeFuncOrOptions === 'function') {
return {
returnTypeFunc: returnTypeFuncOrOptions,
options: maybeOptions || {},
};
}
return {
options: returnTypeFuncOrOptions || {},
};
}
function step(step) {
function Field(returnTypeFunction, maybeOptions) {
return function (target, propertyKey) {
var prop = getIDEPropsPropertyObj(target, propertyKey);
//@ts-ignore
prop.step = step;
if (typeof propertyKey === 'symbol') {
throw new SymbolKeysNotSupportedError();
}
var _a = getTypeDecoratorParams(returnTypeFunction, maybeOptions), options = _a.options, returnTypeFunc = _a.returnTypeFunc;
defineTypes(target, propertyKey, options, returnTypeFunc);
};
}
function getPropertiesOf(target) {
if ('getProperties' in target) {
if (!isFunction(target['getProperties'])) {
throw new StaticGetPropertiesIsNotAFunctionError();
}
return target.getProperties();
}
var properties = Reflect.getMetadata(IDE_PROPERTY_METADATA, target) || {};
Object.keys(properties).forEach(function (propertyKey) {
if (typeof properties[propertyKey].type === 'function') {
var maybeBasicType = transformBasicType(properties[propertyKey].type);
if (maybeBasicType !== 'unknown') {
properties[propertyKey].type = maybeBasicType;
}
else {
properties[propertyKey].type = getPropertiesOf(properties[propertyKey].type);
}
}
});
return properties;
}
exports.step = step;
exports.type = type;
exports.Field = Field;
exports.getPropertiesOf = getPropertiesOf;

2

dist/plugin.cjs.prod.js

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

"use strict";function t(t,r){return t.constructor.IDEProps||(t.constructor.IDEProps={}),t.constructor.IDEProps[r]||(t.constructor.IDEProps[r]={}),t.constructor.IDEProps[r]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.step=function(r){return function(o,e){t(o,e).step=r}},exports.type=function(r){return function(o,e){var n=t(o,e);n.key=e,n.type=r}};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),e=function(e){function r(){var t=this.constructor,r=e.call(this,"Symbol keys are not supported yet!")||this;return Object.setPrototypeOf(r,t.prototype),r}return t.__extends(r,e),r}(Error),r=function(e){function r(){var t=this.constructor,r=e.call(this,"getProperties is not a function!")||this;return Object.setPrototypeOf(r,t.prototype),r}return t.__extends(r,e),r}(Error);function n(t){return t===String?"string":t===Number?"number":t===Boolean?"boolean":"unknown"}exports.Field=function(r,o){return function(i,u){if("symbol"==typeof u)throw new e;var s=function(t,e){return"function"==typeof t?{returnTypeFunc:t,options:e||{}}:{options:t||{}}}(r,o);!function(e,r,o,i){var u=Reflect.getMetadata("design:type",e,r),s=u===Array,c=n(u);if("unknown"!==c&&(u=c),i){var a=i();u=Array.isArray(a)?a[0]:a}var f=Reflect.getMetadata("IDE_PROPERTY_METADATA",e.constructor)||{};f[r]=t.__assign({type:u,isArray:s},o),Reflect.defineMetadata("IDE_PROPERTY_METADATA",f,e.constructor)}(i,u,s.options,s.returnTypeFunc)}},exports.getPropertiesOf=function t(e){if("getProperties"in e){if("function"!=typeof e.getProperties)throw new r;return e.getProperties()}var o=Reflect.getMetadata("IDE_PROPERTY_METADATA",e)||{};return Object.keys(o).forEach((function(e){if("function"==typeof o[e].type){var r=n(o[e].type);o[e].type="unknown"!==r?r:t(o[e].type)}})),o};

@@ -1,31 +0,103 @@

function getIDEPropsPropertyObj(target, propertyKey) {
//@ts-ignore
if (!target.constructor.IDEProps) {
//@ts-ignore
target.constructor.IDEProps = {};
import { __extends, __assign } from 'tslib';
var SymbolKeysNotSupportedError = /** @class */ (function (_super) {
__extends(SymbolKeysNotSupportedError, _super);
function SymbolKeysNotSupportedError() {
var _newTarget = this.constructor;
var _this = _super.call(this, 'Symbol keys are not supported yet!') || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
return _this;
}
if (!target.constructor.IDEProps[propertyKey]) {
target.constructor.IDEProps[propertyKey] = {};
return SymbolKeysNotSupportedError;
}(Error));
var StaticGetPropertiesIsNotAFunctionError = /** @class */ (function (_super) {
__extends(StaticGetPropertiesIsNotAFunctionError, _super);
function StaticGetPropertiesIsNotAFunctionError() {
var _newTarget = this.constructor;
var _this = _super.call(this, 'getProperties is not a function!') || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
return _this;
}
var propertyObj = target.constructor.IDEProps[propertyKey];
return propertyObj;
return StaticGetPropertiesIsNotAFunctionError;
}(Error));
var IDE_PROPERTY_METADATA = 'IDE_PROPERTY_METADATA';
function isFunction(val) {
return typeof val === 'function';
}
function type(type) {
return function (target, propertyKey) {
var prop = getIDEPropsPropertyObj(target, propertyKey);
//@ts-ignore
prop.key = propertyKey;
prop.type = type;
function transformBasicType(type) {
if (type === String) {
return 'string';
}
if (type === Number) {
return 'number';
}
if (type === Boolean) {
return 'boolean';
}
return 'unknown';
}
function defineTypes(target, key, options, returnTypeFunction) {
var type = Reflect.getMetadata('design:type', target, key);
var isArray = type === Array;
var str = transformBasicType(type);
if (str !== 'unknown') {
type = str;
}
if (returnTypeFunction) {
var returnType = returnTypeFunction();
if (Array.isArray(returnType)) {
type = returnType[0];
}
else {
type = returnType;
}
}
var properties = Reflect.getMetadata(IDE_PROPERTY_METADATA, target.constructor) || {};
properties[key] = __assign({ type: type, isArray: isArray }, options);
Reflect.defineMetadata(IDE_PROPERTY_METADATA, properties, target.constructor);
}
function getTypeDecoratorParams(returnTypeFuncOrOptions, maybeOptions) {
if (typeof returnTypeFuncOrOptions === 'function') {
return {
returnTypeFunc: returnTypeFuncOrOptions,
options: maybeOptions || {},
};
}
return {
options: returnTypeFuncOrOptions || {},
};
}
function step(step) {
function Field(returnTypeFunction, maybeOptions) {
return function (target, propertyKey) {
var prop = getIDEPropsPropertyObj(target, propertyKey);
//@ts-ignore
prop.step = step;
if (typeof propertyKey === 'symbol') {
throw new SymbolKeysNotSupportedError();
}
var _a = getTypeDecoratorParams(returnTypeFunction, maybeOptions), options = _a.options, returnTypeFunc = _a.returnTypeFunc;
defineTypes(target, propertyKey, options, returnTypeFunc);
};
}
function getPropertiesOf(target) {
if ('getProperties' in target) {
if (!isFunction(target['getProperties'])) {
throw new StaticGetPropertiesIsNotAFunctionError();
}
return target.getProperties();
}
var properties = Reflect.getMetadata(IDE_PROPERTY_METADATA, target) || {};
Object.keys(properties).forEach(function (propertyKey) {
if (typeof properties[propertyKey].type === 'function') {
var maybeBasicType = transformBasicType(properties[propertyKey].type);
if (maybeBasicType !== 'unknown') {
properties[propertyKey].type = maybeBasicType;
}
else {
properties[propertyKey].type = getPropertiesOf(properties[propertyKey].type);
}
}
});
return properties;
}
export { step, type };
export { Field, getPropertiesOf };
{
"name": "@eva/inspector-decorator",
"version": "0.0.6",
"version": "0.1.0-alpha.0",
"scripts": {
"build": "node ./scripts/build.js",
"buildDev": "npm run build -- -d",
"buildProd": "npm run build -- -r"
"buildProd": "npm run build -- -r",
"test": "jest"
},

@@ -22,3 +23,3 @@ "main": "index.js",

"@rollup/plugin-node-resolve": "^11.2.0",
"@types/jest": "^26.0.24",
"@types/jest": "^27.4.1",
"@types/pixi.js": "^4.8.9",

@@ -37,3 +38,3 @@ "@typescript-eslint/eslint-plugin": "^1.13.0",

"http-server": "^0.11.1",
"jest": "^24.9.0",
"jest": "^27.5.1",
"minimist": "^1.2.5",

@@ -58,5 +59,13 @@ "prettier": "^2.2.1",

"terser": "^4.2.1",
"ts-jest": "^27.1.3",
"typescript": "^3.6.4",
"zlib": "^1.0.5"
},
"dependencies": {
"reflect-metadata": "^0.1.13",
"tslib": "^2.3.1"
},
"jest": {
"preset": "ts-jest"
}
}
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