@peter.naydenov/notice 2.4.1 → 2.4.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.
Files changed (43) hide show
  1. package/.claude/settings.local.json +9 -0
  2. package/Changelog.md +12 -0
  3. package/coverage/lcov-report/block-navigation.js +1 -1
  4. package/coverage/lcov-report/index.html +20 -20
  5. package/coverage/lcov-report/main.js.html +171 -168
  6. package/coverage/lcov-report/sorter.js +21 -7
  7. package/coverage/lcov.info +136 -218
  8. package/graphify-out/.graphify_ast.json +1003 -0
  9. package/graphify-out/.graphify_detect.json +1 -0
  10. package/graphify-out/.graphify_python +1 -0
  11. package/graphify-out/.graphify_uncached.txt +15 -0
  12. package/graphify-out/GRAPH_REPORT.md +143 -0
  13. package/graphify-out/cache/0851b0e27934e7cb51d3d94f9e4d981e83b80e7047ebea01d717486978255d66.json +1 -0
  14. package/graphify-out/cache/313b49fbec137bd0ec64660ace8991e0ed210d1782fec8e86ca1a131901ff58d.json +1 -0
  15. package/graphify-out/cache/324c4626d3d3315ed33b0eec6c2158c55fcc53bb501ffe6a852f6e17e8164667.json +1 -0
  16. package/graphify-out/cache/3335588971cea52118dc77fccba5c33701442c573224f845a638cabe71c34240.json +1 -0
  17. package/graphify-out/cache/362bc8f53fda674a6b0ef29bda4b1be41833ddda276e0a3262ac101a5b5bba83.json +1 -0
  18. package/graphify-out/cache/3cd7d97905369ba8190edae73532006c760e252754e064ea6d9fffa261b552e6.json +1 -0
  19. package/graphify-out/cache/5d53ce3027d393c8fe8b1763ed54a0262ba10e18988e26cf273bcb179522bf4d.json +1 -0
  20. package/graphify-out/cache/68e13aab864f52d3708a714958556b7e25ff8233ab8173893de892b323e26d1a.json +1 -0
  21. package/graphify-out/cache/6f0048e5fcf58195aa0c14d4bcbcb2193f818dfe56904f151fd5cc8c406e2ffa.json +1 -0
  22. package/graphify-out/cache/8218f61ff570b6f101de672ba486677b4fb579677ce88ef537f21b9a40f9728d.json +1 -0
  23. package/graphify-out/cache/a65de5e681850c06dc779842b61d7468c9816b72a92417e3c6a8c7eaa005ecb6.json +1 -0
  24. package/graphify-out/cache/a97f881a55f97de2392f6fa86d8dd11ff9e0e0d40ec302ab9d240ec175bce333.json +1 -0
  25. package/graphify-out/cache/ab5f5634b51fc23275d76e77db87f37c1fec389b14b0228b0c8dbe70d0683c84.json +1 -0
  26. package/graphify-out/cache/ast/v0.8.39/234d10784603a5cf5a6f44fe83948a6c3a014590660e4ea32e3ef72f7b485a4b.json +1 -0
  27. package/graphify-out/cache/ast/v0.8.39/74c9623e575baefe69331b1ab4d1ad96ac2bc0f6552f04e59ff556f95a6dd2a7.json +1 -0
  28. package/graphify-out/cache/c7df89e129098aa0a6723787757bd7c58c92f7a50d365f16f92b44391a6a3256.json +1 -0
  29. package/graphify-out/cache/eda9833c7da551691f85741b4b2ac73e9eca5578b842c62002cd120c7bc70eb2.json +1 -0
  30. package/graphify-out/cache/stat-index.json +1 -0
  31. package/graphify-out/cost.json +12 -0
  32. package/graphify-out/graph.html +266 -0
  33. package/graphify-out/graph.json +2470 -0
  34. package/graphify-out/manifest.json +17 -0
  35. package/package.json +14 -25
  36. package/src/main.js +9 -8
  37. package/tsconfig.json +1 -0
  38. package/types/main.d.ts.map +1 -1
  39. package/types/src/main.d.ts +12 -0
  40. package/types/src/main.d.ts.map +1 -0
  41. package/vitest.config.js +12 -0
  42. package/coverage/tmp/coverage-25757-1746173432726-0.json +0 -1
  43. package/coverage/tmp/coverage-25758-1746173432668-0.json +0 -1
@@ -0,0 +1,17 @@
1
+ {
2
+ "rollup.config.js": 1707045102.6095035,
3
+ "types/main.d.ts": 1775124398.1611881,
4
+ "types/src/main.d.ts": 1775124370.093825,
5
+ "test/01-notice.js": 1760816734.0085897,
6
+ "coverage/lcov-report/block-navigation.js": 1760816753.1686575,
7
+ "coverage/lcov-report/prettify.js": 1760816753.170141,
8
+ "coverage/lcov-report/sorter.js": 1760816753.1693764,
9
+ "src/main.js": 1760821018.106246,
10
+ "CODE_OF_CONDUCT.md": 1702927582.1023386,
11
+ "Changelog.md": 1775124762.301444,
12
+ "README.md": 1710493604.3297157,
13
+ "SECURITY.md": 1702927582.1027253,
14
+ "notice-desk.png": 1702927582.103096,
15
+ "coverage/lcov-report/favicon.png": 1760816753.168918,
16
+ "coverage/lcov-report/sort-arrow-sprite.png": 1760816753.1690521
17
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@peter.naydenov/notice",
3
3
  "description": "Event emmiter - NOTICE",
4
- "version": "2.4.1",
4
+ "version": "2.4.3",
5
5
  "license": "MIT",
6
6
  "author": "Peter Naydenov",
7
7
  "main": "./src/main.js",
@@ -18,8 +18,8 @@
18
18
  "./src/*": "./src/*"
19
19
  },
20
20
  "scripts": {
21
- "test": "mocha test",
22
- "cover": "c8 mocha",
21
+ "test": "vitest run",
22
+ "cover": "vitest run --coverage",
23
23
  "build": "rollup -c",
24
24
  "postbuild": "tsc -p tsconfig.json"
25
25
  },
@@ -28,27 +28,13 @@
28
28
  "url": "git+https://github.com/PeterNaydenov/notice"
29
29
  },
30
30
  "devDependencies": {
31
- "@rollup/plugin-commonjs": "^28.0.3",
32
- "@rollup/plugin-node-resolve": "^16.0.1",
33
- "@rollup/plugin-terser": "^0.4.4",
34
- "c8": "^10.1.3",
35
- "chai": "5.2.0",
36
- "mocha": "11.2.2",
37
- "rollup": "^4.40.1",
38
- "typescript": "^5.8.3"
39
- },
40
- "c8": {
41
- "include": [
42
- "src/**/*.js"
43
- ],
44
- "exclude": [
45
- "node_modules",
46
- "test"
47
- ],
48
- "reporter": [
49
- "lcov",
50
- "text-summary"
51
- ]
31
+ "@rollup/plugin-commonjs": "^29.0.3",
32
+ "@rollup/plugin-node-resolve": "^16.0.3",
33
+ "@rollup/plugin-terser": "^1.0.0",
34
+ "@vitest/coverage-v8": "^4.1.10",
35
+ "rollup": "^4.62.2",
36
+ "typescript": "^6.0.3",
37
+ "vitest": "^4.1.10"
52
38
  },
53
39
  "keywords": [
54
40
  "events",
@@ -56,5 +42,8 @@
56
42
  "publisher",
57
43
  "subscriber",
58
44
  "pubsub"
59
- ]
45
+ ],
46
+ "allowScripts": {
47
+ "fsevents@2.3.2": true
48
+ }
60
49
  }
package/src/main.js CHANGED
@@ -42,12 +42,13 @@ function notice () {
42
42
  if ( fx ) { // fx is optional
43
43
  if ( scroll[e] ) scroll[e] = scroll[e].filter ( fn => fn !== fx )
44
44
  if ( scrollOnce[e] ) scrollOnce[e] = scrollOnce[e].filter ( fn => fn !== fx )
45
- if ( scroll[e] && scroll[e].length === 0 ) delete scroll[e]
46
- if ( scrollOnce[e] && scrollOnce[e].length === 0 ) delete scroll[e]
45
+ if ( e !== '*' && scroll[e] && scroll[e].length === 0 ) delete scroll[e] // scroll['*'] must always exist - 'emit' relies on it
46
+ if ( scrollOnce[e] && scrollOnce[e].length === 0 ) delete scrollOnce[e]
47
47
  return
48
48
  }
49
49
  if ( scrollOnce[e] ) delete scrollOnce[e]
50
- if ( scroll[e] ) delete scroll[e]
50
+ if ( e === '*' ) scroll['*'] = [] // scroll['*'] must always exist - 'emit' relies on it
51
+ else if ( scroll[e] ) delete scroll[e]
51
52
  } // off func.
52
53
  /**
53
54
  * Resets all event-related data structures.
@@ -80,18 +81,17 @@ function notice () {
80
81
  function emit () {
81
82
  const [ e, ...args ] = arguments
82
83
  if ( debugFlag ) {
83
- console.log ( `${debugHeader} Event "${e}" was triggered.`)
84
+ console.log ( `${debugHeader} Event "${String(e)}" was triggered.`) // String() - event names can be Symbols
84
85
  if ( args.length > 0 ) {
85
86
  console.log ( 'Arguments:')
86
87
  console.log ( ...args )
87
88
  console.log ( '^----' )
88
89
  }
89
-
90
90
  }
91
91
 
92
92
  function exeCallback ( name ) {
93
93
  let stopped = false;
94
- if ( name === '*' ) return
94
+ if ( name === '*' ) return
95
95
  if ( ignore.has(name) ) return
96
96
  scroll[name].every ( fn => {
97
97
  const r = fn ( ...args );
@@ -112,8 +112,9 @@ function notice () {
112
112
  }
113
113
  if ( scrollOnce[e] ) {
114
114
  if ( ignore.has(e) ) return
115
- scrollOnce[e].forEach ( fn => fn(...args) )
116
- delete scrollOnce[e]
115
+ const onceFns = scrollOnce[e]
116
+ delete scrollOnce[e] // Delete before the calls, so handlers can re-register with 'once'
117
+ onceFns.forEach ( fn => fn(...args) )
117
118
  }
118
119
  if ( scroll[e] ) {
119
120
  exeCallback ( e )
package/tsconfig.json CHANGED
@@ -4,6 +4,7 @@
4
4
  "allowJs": true,
5
5
  "declaration": true,
6
6
  "emitDeclarationOnly": true,
7
+ "rootDir": "./src",
7
8
  "outDir": "types",
8
9
  "declarationMap": true
9
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.js"],"names":[],"mappings":";AACA;YAWgC,MAAM,GAAC,MAAM;cAWd,MAAM,GAAC,MAAM;aAcb,MAAM,GAAC,MAAM;;;cAoGb,MAAM,GAAC,MAAM;eAbb,MAAM,GAAC,MAAM;iBA5DZ,OAAO,WACP,MAAM;EAiGrC"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.js"],"names":[],"mappings":";AACA;YAWgC,MAAM,GAAC,MAAM;cAWd,MAAM,GAAC,MAAM;aAcb,MAAM,GAAC,MAAM;;;cAmGb,MAAM,GAAC,MAAM;eAbb,MAAM,GAAC,MAAM;iBA3DZ,OAAO,WACP,MAAM;EAgGrC"}
@@ -0,0 +1,12 @@
1
+ export default notice;
2
+ declare function notice(): {
3
+ on: (e: string | Symbol, fn: Function) => void;
4
+ once: (e: string | Symbol, fn: Function) => void;
5
+ off: (e: string | Symbol, fx?: Function) => void;
6
+ reset: () => void;
7
+ emit: (...args: any[]) => void;
8
+ stop: (e: string | Symbol) => void;
9
+ start: (e: string | Symbol) => void;
10
+ debug: (val: boolean, header?: string) => void;
11
+ };
12
+ //# sourceMappingURL=main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.js"],"names":[],"mappings":";AACA;YAWgC,MAAM,GAAC,MAAM;cAWd,MAAM,GAAC,MAAM;aAcb,MAAM,GAAC,MAAM;;;cAmGb,MAAM,GAAC,MAAM;eAbb,MAAM,GAAC,MAAM;iBA3DZ,OAAO,WACP,MAAM;EAgGrC"}
@@ -0,0 +1,12 @@
1
+ import { defineConfig } from 'vitest/config'
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ coverage: {
6
+ provider: 'v8',
7
+ include: ['src/**/*.js'],
8
+ exclude: ['node_modules', 'test', 'coverage'],
9
+ reporter: ['lcov', 'text-summary'],
10
+ },
11
+ },
12
+ })