🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@autometa/bind-decorator

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@autometa/bind-decorator - npm Package Compare versions

Comparing version
0.4.1
to
0.5.0
+1
dist/esm/index.js.map
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-types\nexport function Bind<T extends Function>(\n _target: object,\n propertyKey: string,\n descriptor: TypedPropertyDescriptor<T>\n ): TypedPropertyDescriptor<T> | void {\n if (!descriptor || typeof descriptor.value !== \"function\") {\n throw new TypeError(\n `Only methods can be decorated with @bind. <${propertyKey}> is not a method!`\n );\n }\n \n return {\n configurable: true,\n get(this: T): T {\n const bound: T = descriptor.value?.bind(this);\n Object.defineProperty(this, propertyKey, {\n value: bound,\n configurable: true,\n writable: true,\n });\n return bound;\n },\n // eslint-disable-next-line @typescript-eslint/ban-types\n set(this: T, value: Function): T {\n const bound: T = value.bind(this);\n Object.defineProperty(this, propertyKey, {\n value: bound,\n configurable: true,\n writable: true,\n });\n return bound;\n },\n };\n }\n \n // eslint-disable-next-line @typescript-eslint/ban-types\n export function Freeze<T extends Function>(\n _target: object,\n propertyKey: string,\n descriptor: TypedPropertyDescriptor<T>\n ): TypedPropertyDescriptor<T> | void {\n if (!descriptor || typeof descriptor.value !== \"function\") {\n throw new TypeError(\n `Only methods can be decorated with @bind. <${propertyKey}> is not a method!`\n );\n }\n \n return {\n configurable: false,\n writable: false,\n get(this: T): T {\n const bound: T = descriptor.value?.bind(this);\n Object.defineProperty(this, propertyKey, {\n value: bound,\n configurable: true,\n writable: true,\n });\n return bound;\n },\n };\n }\n "],"mappings":";AACO,SAAS,KACZ,SACA,aACA,YACmC;AACnC,MAAI,CAAC,cAAc,OAAO,WAAW,UAAU,YAAY;AACzD,UAAM,IAAI;AAAA,MACR,8CAA8C,WAAW;AAAA,IAC3D;AAAA,EACF;AAEA,SAAO;AAAA,IACL,cAAc;AAAA,IACd,MAAgB;AACd,YAAM,QAAW,WAAW,OAAO,KAAK,IAAI;AAC5C,aAAO,eAAe,MAAM,aAAa;AAAA,QACvC,OAAO;AAAA,QACP,cAAc;AAAA,QACd,UAAU;AAAA,MACZ,CAAC;AACD,aAAO;AAAA,IACT;AAAA;AAAA,IAEA,IAAa,OAAoB;AAC/B,YAAM,QAAW,MAAM,KAAK,IAAI;AAChC,aAAO,eAAe,MAAM,aAAa;AAAA,QACvC,OAAO;AAAA,QACP,cAAc;AAAA,QACd,UAAU;AAAA,MACZ,CAAC;AACD,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAGO,SAAS,OACd,SACA,aACA,YACmC;AACnC,MAAI,CAAC,cAAc,OAAO,WAAW,UAAU,YAAY;AACzD,UAAM,IAAI;AAAA,MACR,8CAA8C,WAAW;AAAA,IAC3D;AAAA,EACF;AAEA,SAAO;AAAA,IACL,cAAc;AAAA,IACd,UAAU;AAAA,IACV,MAAgB;AACd,YAAM,QAAW,WAAW,OAAO,KAAK,IAAI;AAC5C,aAAO,eAAe,MAAM,aAAa;AAAA,QACvC,OAAO;AAAA,QACP,cAAc;AAAA,QACd,UAAU;AAAA,MACZ,CAAC;AACD,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
declare function Bind<T extends Function>(_target: object, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T> | void;
declare function Freeze<T extends Function>(_target: object, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T> | void;
export { Bind, Freeze };
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-types\nexport function Bind<T extends Function>(\n _target: object,\n propertyKey: string,\n descriptor: TypedPropertyDescriptor<T>\n ): TypedPropertyDescriptor<T> | void {\n if (!descriptor || typeof descriptor.value !== \"function\") {\n throw new TypeError(\n `Only methods can be decorated with @bind. <${propertyKey}> is not a method!`\n );\n }\n \n return {\n configurable: true,\n get(this: T): T {\n const bound: T = descriptor.value?.bind(this);\n Object.defineProperty(this, propertyKey, {\n value: bound,\n configurable: true,\n writable: true,\n });\n return bound;\n },\n // eslint-disable-next-line @typescript-eslint/ban-types\n set(this: T, value: Function): T {\n const bound: T = value.bind(this);\n Object.defineProperty(this, propertyKey, {\n value: bound,\n configurable: true,\n writable: true,\n });\n return bound;\n },\n };\n }\n \n // eslint-disable-next-line @typescript-eslint/ban-types\n export function Freeze<T extends Function>(\n _target: object,\n propertyKey: string,\n descriptor: TypedPropertyDescriptor<T>\n ): TypedPropertyDescriptor<T> | void {\n if (!descriptor || typeof descriptor.value !== \"function\") {\n throw new TypeError(\n `Only methods can be decorated with @bind. <${propertyKey}> is not a method!`\n );\n }\n \n return {\n configurable: false,\n writable: false,\n get(this: T): T {\n const bound: T = descriptor.value?.bind(this);\n Object.defineProperty(this, propertyKey, {\n value: bound,\n configurable: true,\n writable: true,\n });\n return bound;\n },\n };\n }\n "],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACO,SAAS,KACZ,SACA,aACA,YACmC;AACnC,MAAI,CAAC,cAAc,OAAO,WAAW,UAAU,YAAY;AACzD,UAAM,IAAI;AAAA,MACR,8CAA8C,WAAW;AAAA,IAC3D;AAAA,EACF;AAEA,SAAO;AAAA,IACL,cAAc;AAAA,IACd,MAAgB;AACd,YAAM,QAAW,WAAW,OAAO,KAAK,IAAI;AAC5C,aAAO,eAAe,MAAM,aAAa;AAAA,QACvC,OAAO;AAAA,QACP,cAAc;AAAA,QACd,UAAU;AAAA,MACZ,CAAC;AACD,aAAO;AAAA,IACT;AAAA;AAAA,IAEA,IAAa,OAAoB;AAC/B,YAAM,QAAW,MAAM,KAAK,IAAI;AAChC,aAAO,eAAe,MAAM,aAAa;AAAA,QACvC,OAAO;AAAA,QACP,cAAc;AAAA,QACd,UAAU;AAAA,MACZ,CAAC;AACD,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAGO,SAAS,OACd,SACA,aACA,YACmC;AACnC,MAAI,CAAC,cAAc,OAAO,WAAW,UAAU,YAAY;AACzD,UAAM,IAAI;AAAA,MACR,8CAA8C,WAAW;AAAA,IAC3D;AAAA,EACF;AAEA,SAAO;AAAA,IACL,cAAc;AAAA,IACd,UAAU;AAAA,IACV,MAAgB;AACd,YAAM,QAAW,WAAW,OAAO,KAAK,IAAI;AAC5C,aAAO,eAAe,MAAM,aAAa;AAAA,QACvC,OAAO;AAAA,QACP,cAAc;AAAA,QACd,UAAU;AAAA,MACZ,CAAC;AACD,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
+6
-0
# @autometa/dto-builder
## 0.5.0
### Minor Changes
- 554b77e: Releasing packages
## 0.4.1

@@ -4,0 +10,0 @@

+2
-1

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

// index.ts
// src/index.ts
function Bind(_target, propertyKey, descriptor) {

@@ -55,1 +55,2 @@ if (!descriptor || typeof descriptor.value !== "function") {

};
//# sourceMappingURL=index.js.map

@@ -20,9 +20,9 @@ "use strict";

// index.ts
var bind_decorator_exports = {};
__export(bind_decorator_exports, {
// src/index.ts
var src_exports = {};
__export(src_exports, {
Bind: () => Bind,
Freeze: () => Freeze
});
module.exports = __toCommonJS(bind_decorator_exports);
module.exports = __toCommonJS(src_exports);
function Bind(_target, propertyKey, descriptor) {

@@ -82,1 +82,2 @@ if (!descriptor || typeof descriptor.value !== "function") {

});
//# sourceMappingURL=index.js.map
{
"name": "@autometa/bind-decorator",
"version": "0.4.1",
"version": "0.5.0",
"description": "Binds the this keyword of a method. Respectfully a fork of https://www.npmjs.com/package/bind-decorator",
"type": "module",
"main": "dist/cjs/index.js",
"main": "dist/index.js",
"module": "dist/esm/index.js",
"types": "dist/types/index.d.ts",
"types": "dist/index.d.ts",
"keywords": [

@@ -22,5 +22,5 @@ "bind this keyword",

"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js",
"require": "./dist/index.js",
"default": "./dist/esm/index.js",
"types": "./dist/types/index.d.ts"
"types": "./dist/index.d.ts"
},

@@ -30,4 +30,4 @@ "devDependencies": {

"@typescript-eslint/parser": "^5.54.1",
"eslint": "^7.32.0",
"eslint-config-custom": "0.5.1",
"eslint": "^8.37.0",
"eslint-config-custom": "0.6.0",
"node": "^19.6.0",

@@ -37,10 +37,7 @@ "prettier": "^2.8.3",

"rimraf": "^4.1.2",
"ts-jest": "^29.0.5",
"ts-node": "^10.9.1",
"tsconfig": " *",
"tsup": "^7.2.0",
"typescript": "^4.9.5",
"vitest": "^0.28.5"
"vitest": "0.33.0"
},
"dependencies": {
"tsup": "^6.7.0"
},
"scripts": {

@@ -51,6 +48,4 @@ "test": "vitest run --passWithNoTests",

"lint:fix": "eslint . --fix",
"build:js": "tsup",
"build:dts:tsc": "tsc --build --clean && tsc && tsup --entry.index out/index.d.ts --dtsOnly",
"build:dts": "pnpm build:dts:tsc",
"build": "pnpm build:js && pnpm build:dts ",
"clean": "rimraf dist",
"build": "tsup",
"build:watch": "tsup --watch"

@@ -57,0 +52,0 @@ },

import type { Options } from "tsup";
export const tsup: Options = {
clean: true, // clean up the dist folder
dts: true, // generate .d.ts bundle
sourcemap:true, // generate sourcemaps
format: ["cjs", "esm"], // generate cjs and esm files
skipNodeModulesBundle: true,
entryPoints: ["index.ts"],
entryPoints: ["src/index.ts"],
target: "es2020",

@@ -8,0 +10,0 @@ outDir: "dist",

> @autometa/bind-decorator@0.4.1 build /home/runner/work/autometa/autometa/libraries/bind-decorator
> pnpm build:js && pnpm build:dts
> @autometa/bind-decorator@0.4.1 build:js /home/runner/work/autometa/autometa/libraries/bind-decorator
> tsup
CLI Building entry: index.ts
CLI Using tsconfig: tsconfig.json
CLI tsup v6.7.0
CLI Using tsup config: /home/runner/work/autometa/autometa/libraries/bind-decorator/tsup.config.ts
CLI Target: es2020
CLI Cleaning output folder
CJS Build start
ESM Build start
CJS You have emitDecoratorMetadata enabled but @swc/core was not installed, skipping swc plugin
ESM You have emitDecoratorMetadata enabled but @swc/core was not installed, skipping swc plugin
CJS dist/index.js 2.32 KB
CJS ⚡️ Build success in 27ms
ESM dist/esm/index.js 1.30 KB
ESM ⚡️ Build success in 27ms
> @autometa/bind-decorator@0.4.1 build:dts /home/runner/work/autometa/autometa/libraries/bind-decorator
> pnpm build:dts:tsc
> @autometa/bind-decorator@0.4.1 build:dts:tsc /home/runner/work/autometa/autometa/libraries/bind-decorator
> tsc --build --clean && tsc && tsup --entry.index out/index.d.ts --dtsOnly
CLI Building entry: {"index":"out/index.d.ts"}
CLI Using tsconfig: tsconfig.json
CLI tsup v6.7.0
CLI Using tsup config: /home/runner/work/autometa/autometa/libraries/bind-decorator/tsup.config.ts
DTS Build start
DTS ⚡️ Build success in 154ms
DTS dist/index.d.ts 340.00 B
> @autometa/bind-decorator@0.4.1 lint /home/runner/work/autometa/autometa/libraries/bind-decorator
> eslint . --max-warnings 0
> @autometa/bind-decorator@0.4.1 test /home/runner/work/autometa/autometa/libraries/bind-decorator
> vitest run --passWithNoTests
 RUN  v0.28.5 /home/runner/work/autometa/autometa/libraries/bind-decorator
include: **/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}
exclude: **/node_modules/**, **/dist/**, **/cypress/**, **/.{idea,git,cache,output,temp}/**, **/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*
watch exclude: **/node_modules/**, **/dist/**
No test files found, exiting with code 0
// eslint-disable-next-line @typescript-eslint/ban-types
export function Bind<T extends Function>(
_target: object,
propertyKey: string,
descriptor: TypedPropertyDescriptor<T>
): TypedPropertyDescriptor<T> | void {
if (!descriptor || typeof descriptor.value !== "function") {
throw new TypeError(
`Only methods can be decorated with @bind. <${propertyKey}> is not a method!`
);
}
return {
configurable: true,
get(this: T): T {
const bound: T = descriptor.value?.bind(this);
Object.defineProperty(this, propertyKey, {
value: bound,
configurable: true,
writable: true,
});
return bound;
},
// eslint-disable-next-line @typescript-eslint/ban-types
set(this: T, value: Function): T {
const bound: T = value.bind(this);
Object.defineProperty(this, propertyKey, {
value: bound,
configurable: true,
writable: true,
});
return bound;
},
};
}
// eslint-disable-next-line @typescript-eslint/ban-types
export function Freeze<T extends Function>(
_target: object,
propertyKey: string,
descriptor: TypedPropertyDescriptor<T>
): TypedPropertyDescriptor<T> | void {
if (!descriptor || typeof descriptor.value !== "function") {
throw new TypeError(
`Only methods can be decorated with @bind. <${propertyKey}> is not a method!`
);
}
return {
configurable: false,
writable: false,
get(this: T): T {
const bound: T = descriptor.value?.bind(this);
Object.defineProperty(this, propertyKey, {
value: bound,
configurable: true,
writable: true,
});
return bound;
},
};
}
export declare function Bind<T extends Function>(_target: object, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T> | void;
export declare function Freeze<T extends Function>(_target: object, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T> | void;
//# sourceMappingURL=index.d.ts.map
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,wBAAgB,IAAI,CAAC,CAAC,SAAS,QAAQ,EACrC,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,uBAAuB,CAAC,CAAC,CAAC,GACrC,uBAAuB,CAAC,CAAC,CAAC,GAAG,IAAI,CA6BnC;AAGD,wBAAgB,MAAM,CAAC,CAAC,SAAS,QAAQ,EACvC,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,uBAAuB,CAAC,CAAC,CAAC,GACrC,uBAAuB,CAAC,CAAC,CAAC,GAAG,IAAI,CAoBnC"}

Sorry, the diff of this file is not supported yet