@autometa/bind-decorator
Advanced tools
| {"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 @@ |
@@ -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 |
+5
-4
@@ -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 |
+12
-17
| { | ||
| "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 @@ }, |
+3
-1
| 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 | ||
| [34mCLI[39m Building entry: index.ts | ||
| [34mCLI[39m Using tsconfig: tsconfig.json | ||
| [34mCLI[39m tsup v6.7.0 | ||
| [34mCLI[39m Using tsup config: /home/runner/work/autometa/autometa/libraries/bind-decorator/tsup.config.ts | ||
| [34mCLI[39m Target: es2020 | ||
| [34mCLI[39m Cleaning output folder | ||
| [34mCJS[39m Build start | ||
| [34mESM[39m Build start | ||
| [33mCJS[39m [33mYou have emitDecoratorMetadata enabled but @swc/core was not installed, skipping swc plugin[39m | ||
| [33mESM[39m [33mYou have emitDecoratorMetadata enabled but @swc/core was not installed, skipping swc plugin[39m | ||
| [32mCJS[39m [1mdist/index.js [22m[32m2.32 KB[39m | ||
| [32mCJS[39m ⚡️ Build success in 27ms | ||
| [32mESM[39m [1mdist/esm/index.js [22m[32m1.30 KB[39m | ||
| [32mESM[39m ⚡️ 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 | ||
| [34mCLI[39m Building entry: {"index":"out/index.d.ts"} | ||
| [34mCLI[39m Using tsconfig: tsconfig.json | ||
| [34mCLI[39m tsup v6.7.0 | ||
| [34mCLI[39m Using tsup config: /home/runner/work/autometa/autometa/libraries/bind-decorator/tsup.config.ts | ||
| [34mDTS[39m Build start | ||
| [32mDTS[39m ⚡️ Build success in 154ms | ||
| [32mDTS[39m [1mdist/index.d.ts [22m[32m340.00 B[39m |
| > @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 | ||
| [7m[1m[36m RUN [39m[22m[27m [36mv0.28.5[39m [90m/home/runner/work/autometa/autometa/libraries/bind-decorator[39m | ||
| [2minclude: [22m[33m**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}[39m | ||
| [2mexclude: [22m[33m**/node_modules/**[2m, [22m**/dist/**[2m, [22m**/cypress/**[2m, [22m**/.{idea,git,cache,output,temp}/**[2m, [22m**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*[39m | ||
| [2mwatch exclude: [22m[33m**/node_modules/**[2m, [22m**/dist/**[39m | ||
| No test files found, exiting with code 0 | ||
-62
| // 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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
0
-100%0
-100%14174
-86.31%13
-23.53%153
-27.83%- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed