@tsed/hooks 8.10.0-rc.1 → 8.10.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -2,24 +2,21 @@
2
2
  "name": "@tsed/hooks",
3
3
  "description": "Hooks module for Ts.ED Framework",
4
4
  "type": "module",
5
- "version": "8.10.0-rc.1",
5
+ "version": "8.10.0-rc.3",
6
6
  "source": "./src/index.ts",
7
7
  "main": "./lib/esm/index.js",
8
8
  "module": "./lib/esm/index.js",
9
9
  "typings": "./lib/types/index.d.ts",
10
- "browser": "./lib/browser/hooks.umd.cjs",
11
10
  "exports": {
12
11
  ".": {
13
12
  "tsed-source": "./src/index.ts",
14
13
  "types": "./lib/types/index.d.ts",
15
- "browser": "./lib/browser/hooks.umd.cjs",
16
14
  "import": "./lib/esm/index.js",
17
15
  "default": "./lib/esm/index.js"
18
16
  }
19
17
  },
20
18
  "scripts": {
21
- "build": "yarn build:ts && yarn run build:browser",
22
- "build:browser": "vite build",
19
+ "build": "yarn build:ts",
23
20
  "build:ts": "tsc --build tsconfig.esm.json",
24
21
  "test": "vitest run",
25
22
  "test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
@@ -30,8 +27,8 @@
30
27
  },
31
28
  "devDependencies": {
32
29
  "@tsed/monorepo-utils": "2.3.13",
33
- "@tsed/typescript": "8.10.0-rc.1",
34
- "@tsed/vitest": "8.10.0-rc.1",
30
+ "@tsed/typescript": "8.10.0-rc.3",
31
+ "@tsed/vitest": "8.10.0-rc.3",
35
32
  "eslint": "9.12.0",
36
33
  "typescript": "5.4.5",
37
34
  "vite": "6.2.2",
@@ -1 +0,0 @@
1
- (function(i,c){typeof exports=="object"&&typeof module<"u"?c(exports):typeof define=="function"&&define.amd?define(["exports"],c):(i=typeof globalThis<"u"?globalThis:i||self,c(i["@tsed/hooks"]={}))})(this,function(i){"use strict";var y=i=>{throw TypeError(i)};var w=(i,c,r)=>c.has(i)||y("Cannot "+r);var h=(i,c,r)=>(w(i,c,"read from private field"),r?r.call(i):c.get(i)),u=(i,c,r)=>c.has(i)?y("Cannot add the same private member more than once"):c instanceof WeakSet?c.add(i):c.set(i,r);var l;function c(d,s){return!d||!s.ref||d&&s.ref===d}class r{constructor(){u(this,l,new Map)}has(s){var t;return!!((t=h(this,l).get(s))!=null&&t.length)}on(s,t,e){let n=t;e||(e=n,n=void 0);const o=h(this,l).get(s)||[];return o.push({cb:e,ref:n}),h(this,l).set(s,o),this}once(s,t,e){e||(e=t);const n=(...o)=>{e(...o),this.off(s,n)};return this.on(s,t,n),this}off(s,t){const e=(n,o)=>{o.length?h(this,l).set(n,o):h(this,l).delete(n)};if(typeof s=="string"&&t){let n=h(this,l).get(s);n&&e(s,n.filter(o=>o.cb!==t))}else{const n=s;h(this,l).forEach((o,a)=>{e(a,o.filter(E=>E.ref!==n))})}return this}emit(s,t,e){Array.isArray(t)&&(e=t,t=void 0),e||(e=[]);const n=h(this,l).get(s);if(n!=null&&n.length)for(const o of n)c(t,o)&&o.cb.apply(null,e)}async asyncEmit(s,t,e){Array.isArray(t)&&(e=t,t=void 0);const n=h(this,l).get(s);if(n!=null&&n.length){const o=n.filter(a=>c(t,a)).map(a=>a.cb.apply(null,e));await Promise.all(o)}}alter(s,t,e=[],n=null){const o=h(this,l).get(s);if(o!=null&&o.length)for(const{cb:a}of o)t=a.call(n,t,...e);return t}async asyncAlter(s,t,e=[],n=null){const o=h(this,l).get(s);if(o!=null&&o.length)for(const a of o)t=await a.cb.call(n,t,...e);return t}destroy(){h(this,l).clear()}}l=new WeakMap;const f=new r,$=f.on.bind(f),g=f.once.bind(f),m=f.off.bind(f),b=f.emit.bind(f),p=f.asyncEmit.bind(f),A=f.alter.bind(f),k=f.asyncAlter.bind(f);i.$alter=A,i.$asyncAlter=k,i.$asyncEmit=p,i.$emit=b,i.$off=m,i.$on=$,i.$once=g,i.Hooks=r,i.hooks=f,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
package/vite.config.mts DELETED
@@ -1,22 +0,0 @@
1
- import {defineConfig} from "vite";
2
- import {resolve} from "path";
3
-
4
- // https://vitejs.dev/config/
5
- export default defineConfig({
6
- plugins: [
7
- // dts({
8
- // outDir: "lib/browser/types",
9
- // include: ["src"],
10
- // exclude: ["**/*.spec.{ts,tsx}", "**/*.stories.{ts,tsx}"],
11
- // })
12
- ],
13
- build: {
14
- outDir: "lib/browser",
15
- lib: {
16
- entry: resolve(import.meta.dirname, "src/index.ts"),
17
- formats: ["umd"],
18
- name: "@tsed/hooks",
19
- fileName: "hooks",
20
- },
21
- }
22
- });