@alwatr/exit-hook 5.5.29 → 6.0.1

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/dist/main.js ADDED
@@ -0,0 +1,5 @@
1
+ /* 📦 @alwatr/exit-hook v6.0.1 */
2
+ var q=null,y=!1;function D(f){if(q===null)B(),q=[];q.push(f)}function u(f){if(console.log("onExit({signal: %s})",f),y===!0||q===null)return;y=!0;for(let z of q)try{z()}catch(A){console.error("Error in exit hook callback:",A)}if(f==="SIGINT"||f==="SIGTERM")setTimeout(()=>{process.exit(0)})}function B(){process.once("exit",u),process.once("SIGTERM",u),process.once("SIGINT",u)}export{D as exitHook};
3
+
4
+ //# debugId=C9D237A3AAC2118164756E2164756E21
5
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/main.ts"],
4
+ "sourcesContent": [
5
+ "/**\n * Array of callback functions to be called when the process is exiting.\n */\nlet callbacks: (() => void)[] | null = null;\n\n/**\n * True whether the process is exiting to prevent calling the callbacks more than once.\n */\nlet exiting = false;\n\n/**\n * Add a callback function to be called when the process is exiting.\n *\n * @param callback The callback function to be called when the process is exiting.\n *\n * @example\n * ```typescript\n * const saveAllData = () => {\n * // save all data\n * };\n *\n * existHook(saveAllData);\n * ```\n */\nexport function exitHook(callback: () => void): void {\n if (callbacks === null) {\n registerExitEvents();\n callbacks = [];\n }\n callbacks.push(callback);\n}\n\n/**\n * A once callback to be called on process exit event.\n */\nfunction onExit_(signal: number | 'SIGINT' | 'SIGTERM') {\n console.log('onExit({signal: %s})', signal);\n if (exiting === true || callbacks === null) return;\n\n exiting = true;\n\n for (const callback of callbacks) {\n try {\n callback();\n }\n catch (error) {\n console.error('Error in exit hook callback:', error);\n }\n }\n\n if (signal === 'SIGINT' || signal === 'SIGTERM') {\n setTimeout(() => {\n process.exit(0);\n });\n }\n}\n\n/**\n * Register process exit events.\n */\nfunction registerExitEvents(): void {\n /**\n * This event emitted when Node.js empties its event loop and has no additional work to schedule.\n * Normally, the Node.js process will exit when there is no work scheduled,\n * but a listener registered on the 'beforeExit' event can make **asynchronous calls**, and thereby cause the Node.js process to continue.\n *\n * @see https://nodejs.org/api/process.html#event-beforeexit\n */\n // process.once('beforeExit', onExit_);\n\n /**\n * This event is emitted when the Node.js process is about to exit as a result of either:\n * 1- The `process.exit()` method being called explicitly.\n * 2- The Node.js event loop no longer having any additional work to perform.\n *\n * @see https://nodejs.org/api/process.html#event-exit\n */\n process.once('exit', onExit_);\n\n /**\n * This event is emitted in terminal mode before exiting with code 128 + signal number.\n *\n * @see https://nodejs.org/api/process.html#signal-events\n */\n process.once('SIGTERM', onExit_);\n\n /**\n * This event is emitted when `Ctrl+C` is pressed.\n *\n * @see https://nodejs.org/api/process.html#signal-events\n */\n process.once('SIGINT', onExit_);\n}\n"
6
+ ],
7
+ "mappings": ";AAGA,IAAI,EAAmC,KAKnC,EAAU,GAgBP,SAAS,CAAQ,CAAC,EAA4B,CACnD,GAAI,IAAc,KAChB,EAAmB,EACnB,EAAY,CAAC,EAEf,EAAU,KAAK,CAAQ,EAMzB,SAAS,CAAO,CAAC,EAAuC,CAEtD,GADA,QAAQ,IAAI,uBAAwB,CAAM,EACtC,IAAY,IAAQ,IAAc,KAAM,OAE5C,EAAU,GAEV,QAAW,KAAY,EACrB,GAAI,CACF,EAAS,EAEX,MAAO,EAAO,CACZ,QAAQ,MAAM,+BAAgC,CAAK,EAIvD,GAAI,IAAW,UAAY,IAAW,UACpC,WAAW,IAAM,CACf,QAAQ,KAAK,CAAC,EACf,EAOL,SAAS,CAAkB,EAAS,CAiBlC,QAAQ,KAAK,OAAQ,CAAO,EAO5B,QAAQ,KAAK,UAAW,CAAO,EAO/B,QAAQ,KAAK,SAAU,CAAO",
8
+ "debugId": "C9D237A3AAC2118164756E2164756E21",
9
+ "names": []
10
+ }
package/package.json CHANGED
@@ -1,30 +1,55 @@
1
1
  {
2
2
  "name": "@alwatr/exit-hook",
3
+ "version": "6.0.1",
3
4
  "description": "A utility for registering exit handlers in Node.js.",
4
- "version": "5.5.29",
5
+ "license": "MPL-2.0",
5
6
  "author": "S. Ali Mihandoost <ali.mihandoost@gmail.com>",
6
- "bugs": "https://github.com/Alwatr/nanolib/issues",
7
- "devDependencies": {
8
- "@alwatr/nano-build": "6.4.2",
9
- "@alwatr/prettier-config": "6.0.2",
10
- "@alwatr/tsconfig-base": "6.0.4",
11
- "@types/node": "^24.12.0",
12
- "typescript": "^5.9.3"
7
+ "type": "module",
8
+ "repository": {
9
+ "directory": "packages/exit-hook",
10
+ "type": "git",
11
+ "url": "https://github.com/Alwatr/nanolib"
13
12
  },
13
+ "homepage": "https://github.com/Alwatr/nanolib/tree/next/packages/exit-hook#readme",
14
+ "bugs": "https://github.com/Alwatr/nanolib/issues",
14
15
  "exports": {
15
16
  ".": {
16
17
  "types": "./dist/main.d.ts",
17
- "import": "./dist/main.mjs",
18
- "require": "./dist/main.cjs"
18
+ "default": "./dist/main.js"
19
19
  }
20
20
  },
21
+ "sideEffects": false,
22
+ "devDependencies": {
23
+ "@alwatr/nano-build": "7.0.1",
24
+ "@alwatr/prettier-config": "7.0.1",
25
+ "@alwatr/tsconfig-base": "8.0.0",
26
+ "@types/node": "^24.12.0",
27
+ "typescript": "^5.9.3"
28
+ },
29
+ "scripts": {
30
+ "b": "bun run build",
31
+ "build": "bun run build:ts && bun run build:es",
32
+ "build:es": "nano-build --preset=module src/main.ts",
33
+ "build:ts": "tsc --build",
34
+ "c": "bun run clean",
35
+ "cb": "bun run clean && bun run build",
36
+ "clean": "rm -rfv dist *.tsbuildinfo",
37
+ "d": "bun run build:es && bun",
38
+ "w": "bun run watch",
39
+ "watch": "bun run watch:ts & bun run watch:es",
40
+ "watch:es": "bun run build:es --watch",
41
+ "watch:ts": "bun run build:ts --watch --preserveWatchOutput"
42
+ },
21
43
  "files": [
22
- "**/*.{js,mjs,cjs,map,d.ts,html,md,LEGAL.txt}",
44
+ "**/*.{js,mjs,cjs,ts,map,d.ts,html,LEGAL.txt}",
45
+ "README.md",
23
46
  "LICENSE",
24
47
  "!demo/**/*",
25
48
  "!**/*.test.js"
26
49
  ],
27
- "homepage": "https://github.com/Alwatr/nanolib/tree/next/packages/exit-hook#readme",
50
+ "publishConfig": {
51
+ "access": "public"
52
+ },
28
53
  "keywords": [
29
54
  "alwatr",
30
55
  "cross-platform",
@@ -43,34 +68,6 @@
43
68
  "utility",
44
69
  "utils"
45
70
  ],
46
- "license": "MPL-2.0",
47
- "main": "./dist/main.cjs",
48
- "module": "./dist/main.mjs",
49
71
  "prettier": "@alwatr/prettier-config",
50
- "publishConfig": {
51
- "access": "public"
52
- },
53
- "repository": {
54
- "type": "git",
55
- "url": "https://github.com/Alwatr/nanolib",
56
- "directory": "packages/exit-hook"
57
- },
58
- "scripts": {
59
- "b": "bun run build",
60
- "build": "bun run build:ts && bun run build:es",
61
- "build:es": "nano-build --preset=module",
62
- "build:ts": "tsc --build",
63
- "c": "bun run clean",
64
- "cb": "bun run clean && bun run build",
65
- "clean": "rm -rfv dist *.tsbuildinfo",
66
- "d": "bun run build:es && bun --enable-source-maps --trace-warnings",
67
- "w": "bun run watch",
68
- "watch": "bun run watch:ts & bun run watch:es",
69
- "watch:es": "bun run build:es --watch",
70
- "watch:ts": "bun run build:ts --watch --preserveWatchOutput"
71
- },
72
- "sideEffects": false,
73
- "type": "module",
74
- "types": "./dist/main.d.ts",
75
- "gitHead": "c3889e3756b0a0f9b935a1b702a1373ac52cb379"
72
+ "gitHead": "f843742e94d6ebed3921d57b624d9deb35c2c102"
76
73
  }
package/src/main.ts ADDED
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Array of callback functions to be called when the process is exiting.
3
+ */
4
+ let callbacks: (() => void)[] | null = null;
5
+
6
+ /**
7
+ * True whether the process is exiting to prevent calling the callbacks more than once.
8
+ */
9
+ let exiting = false;
10
+
11
+ /**
12
+ * Add a callback function to be called when the process is exiting.
13
+ *
14
+ * @param callback The callback function to be called when the process is exiting.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const saveAllData = () => {
19
+ * // save all data
20
+ * };
21
+ *
22
+ * existHook(saveAllData);
23
+ * ```
24
+ */
25
+ export function exitHook(callback: () => void): void {
26
+ if (callbacks === null) {
27
+ registerExitEvents();
28
+ callbacks = [];
29
+ }
30
+ callbacks.push(callback);
31
+ }
32
+
33
+ /**
34
+ * A once callback to be called on process exit event.
35
+ */
36
+ function onExit_(signal: number | 'SIGINT' | 'SIGTERM') {
37
+ console.log('onExit({signal: %s})', signal);
38
+ if (exiting === true || callbacks === null) return;
39
+
40
+ exiting = true;
41
+
42
+ for (const callback of callbacks) {
43
+ try {
44
+ callback();
45
+ }
46
+ catch (error) {
47
+ console.error('Error in exit hook callback:', error);
48
+ }
49
+ }
50
+
51
+ if (signal === 'SIGINT' || signal === 'SIGTERM') {
52
+ setTimeout(() => {
53
+ process.exit(0);
54
+ });
55
+ }
56
+ }
57
+
58
+ /**
59
+ * Register process exit events.
60
+ */
61
+ function registerExitEvents(): void {
62
+ /**
63
+ * This event emitted when Node.js empties its event loop and has no additional work to schedule.
64
+ * Normally, the Node.js process will exit when there is no work scheduled,
65
+ * but a listener registered on the 'beforeExit' event can make **asynchronous calls**, and thereby cause the Node.js process to continue.
66
+ *
67
+ * @see https://nodejs.org/api/process.html#event-beforeexit
68
+ */
69
+ // process.once('beforeExit', onExit_);
70
+
71
+ /**
72
+ * This event is emitted when the Node.js process is about to exit as a result of either:
73
+ * 1- The `process.exit()` method being called explicitly.
74
+ * 2- The Node.js event loop no longer having any additional work to perform.
75
+ *
76
+ * @see https://nodejs.org/api/process.html#event-exit
77
+ */
78
+ process.once('exit', onExit_);
79
+
80
+ /**
81
+ * This event is emitted in terminal mode before exiting with code 128 + signal number.
82
+ *
83
+ * @see https://nodejs.org/api/process.html#signal-events
84
+ */
85
+ process.once('SIGTERM', onExit_);
86
+
87
+ /**
88
+ * This event is emitted when `Ctrl+C` is pressed.
89
+ *
90
+ * @see https://nodejs.org/api/process.html#signal-events
91
+ */
92
+ process.once('SIGINT', onExit_);
93
+ }
package/CHANGELOG.md DELETED
@@ -1,453 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## [5.5.29](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@5.5.28...@alwatr/exit-hook@5.5.29) (2026-03-16)
7
-
8
- ### 🔨 Code Refactoring
9
-
10
- * migrate build scripts from yarn to bun across multiple packages ([d90e962](https://github.com/Alwatr/nanolib/commit/d90e962f15e5c951e191d5f02341279b6472abc3))
11
-
12
- ### 🔗 Dependencies update
13
-
14
- * bump the npm-dependencies group with 10 updates ([c48d9ba](https://github.com/Alwatr/nanolib/commit/c48d9baa1cd7c2dc144b3e01e0fda60bf87c074c))
15
-
16
- ## [5.5.28](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@5.5.27...@alwatr/exit-hook@5.5.28) (2026-02-18)
17
-
18
- ### 🔗 Dependencies update
19
-
20
- * update @types/node to version 24.10.13 across multiple packages ([4c6d2a3](https://github.com/Alwatr/nanolib/commit/4c6d2a37ab26b1c86812b2aa38b2eca4ee097cb6))
21
-
22
- ## [5.5.27](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@5.5.26...@alwatr/exit-hook@5.5.27) (2025-12-23)
23
-
24
- ### 🔗 Dependencies update
25
-
26
- * upgrade @types/node to version 24.10.4 and update related dependencies ([acf04df](https://github.com/Alwatr/nanolib/commit/acf04df71647f5a401ef5e6bbfffcc478e4326d2))
27
-
28
- ## [5.5.26](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@5.5.25...@alwatr/exit-hook@5.5.26) (2025-12-13)
29
-
30
- ### 🔗 Dependencies update
31
-
32
- * update `@types/node` and `[@lerna-lite](https://github.com/lerna-lite)` dependencies. ([8daa8fd](https://github.com/Alwatr/nanolib/commit/8daa8fd023d5414c9f95feb4319353c6ea34be31))
33
-
34
- ## [5.5.25](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@5.5.24...@alwatr/exit-hook@5.5.25) (2025-12-10)
35
-
36
- ### 🔗 Dependencies update
37
-
38
- * Upgrade lerna-lite, prettier, types/node, and yarn dependencies. ([42a7fca](https://github.com/Alwatr/nanolib/commit/42a7fca15430aca2ac1eaa19496c2a2ebfc8c470))
39
-
40
- ## [5.5.24](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@5.5.23...@alwatr/exit-hook@5.5.24) (2025-11-18)
41
-
42
- ### 🔨 Code Refactoring
43
-
44
- * remove unnecessary type declarations from tsconfig.json files ([89bcc7d](https://github.com/Alwatr/nanolib/commit/89bcc7db839807110b80f8ba34414ea9734d9c75))
45
-
46
- ## [5.5.23](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@5.5.22...@alwatr/exit-hook@5.5.23) (2025-11-15)
47
-
48
- ### 🔗 Dependencies update
49
-
50
- * bump the npm-dependencies group with 2 updates ([a80b84d](https://github.com/Alwatr/nanolib/commit/a80b84dada6c09b5e5621e7487c8ec13fff3c23a))
51
-
52
- ## [5.5.22](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@5.5.21...@alwatr/exit-hook@5.5.22) (2025-11-15)
53
-
54
- **Note:** Version bump only for package @alwatr/exit-hook
55
-
56
- ## [5.5.21](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@5.5.20...@alwatr/exit-hook@5.5.21) (2025-11-04)
57
-
58
- ### 🔗 Dependencies update
59
-
60
- * bump the npm-dependencies group across 1 directory with 9 updates ([fdf29d5](https://github.com/Alwatr/nanolib/commit/fdf29d5aa89983cb06f79d42650a364521f5c4b9))
61
- * update @types/node from ^22.18.12 to ^24.10.0 across multiple packages ([1169a86](https://github.com/Alwatr/nanolib/commit/1169a86001da2abfbe99a7da33c8e92183f553f6))
62
-
63
- ## [5.5.20](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@5.5.19...@alwatr/exit-hook@5.5.20) (2025-10-06)
64
-
65
- ### 🔗 Dependencies update
66
-
67
- * bump the npm-dependencies group with 4 updates ([9825815](https://github.com/Alwatr/nanolib/commit/982581552bbb4b97dca52af5e93a80937f0c3109))
68
-
69
- ## [5.5.19](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@5.5.18...@alwatr/exit-hook@5.5.19) (2025-09-27)
70
-
71
- ### 🧹 Miscellaneous Chores
72
-
73
- * exclude test files from package distribution ([86f4f2f](https://github.com/Alwatr/nanolib/commit/86f4f2f5985845c5cf3a3a9398de7b2f98ce53e7))
74
-
75
- ## [5.5.18](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@5.5.17...@alwatr/exit-hook@5.5.18) (2025-09-22)
76
-
77
- **Note:** Version bump only for package @alwatr/exit-hook
78
-
79
- ## [5.5.17](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@5.5.16...@alwatr/exit-hook@5.5.17) (2025-09-22)
80
-
81
- **Note:** Version bump only for package @alwatr/exit-hook
82
-
83
- ## [5.5.16](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@5.5.15...@alwatr/exit-hook@5.5.16) (2025-09-21)
84
-
85
- **Note:** Version bump only for package @alwatr/exit-hook
86
-
87
- ## [5.5.15](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@5.5.14...@alwatr/exit-hook@5.5.15) (2025-09-20)
88
-
89
- ### 🐛 Bug Fixes
90
-
91
- * add sideEffects property to package.json files for better tree-shaking ([c7b9e74](https://github.com/Alwatr/nanolib/commit/c7b9e74e1920c8e35b438742de61883ca62da58c))
92
- * add sideEffects property to package.json files for better tree-shaking ([e8402c4](https://github.com/Alwatr/nanolib/commit/e8402c481a14a1f807a37aaa862a936713d26176))
93
-
94
- ### 🧹 Miscellaneous Chores
95
-
96
- * remove duplicate sideEffects property from multiple package.json files ([b123f86](https://github.com/Alwatr/nanolib/commit/b123f86be81481de2314aae9bb2eeb629743d24c))
97
-
98
- ## [5.5.14](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@5.5.13...@alwatr/exit-hook@5.5.14) (2025-09-19)
99
-
100
- **Note:** Version bump only for package @alwatr/exit-hook
101
-
102
- ## [5.5.13](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@5.5.12...@alwatr/exit-hook@5.5.13) (2025-09-15)
103
-
104
- **Note:** Version bump only for package @alwatr/exit-hook
105
-
106
- ## [5.5.12](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@5.5.11...@alwatr/exit-hook@5.5.12) (2025-09-13)
107
-
108
- ### 🔗 Dependencies update
109
-
110
- * update @types/node version to ^22.18.3 in multiple package.json files ([13db6fc](https://github.com/Alwatr/nanolib/commit/13db6fc176bc6cdcefedc50d77ac550bd5052c9a))
111
-
112
- ## [5.5.11](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@5.5.10...@alwatr/exit-hook@5.5.11) (2025-09-13)
113
-
114
- ### 🧹 Miscellaneous Chores
115
-
116
- * remove package-tracer dependency and related code from fetch package ([96fe4e9](https://github.com/Alwatr/nanolib/commit/96fe4e9552a205f218ceed187c55e4e904a07089))
117
-
118
- ## [5.5.10](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@5.5.9...@alwatr/exit-hook@5.5.10) (2025-09-09)
119
-
120
- ### 🧹 Miscellaneous Chores
121
-
122
- * remove trailing newlines from contributing sections in README files ([e8ab1bc](https://github.com/Alwatr/nanolib/commit/e8ab1bc43e0addea5ccd4c897c2cec597cb9e15f))
123
-
124
- ## [5.5.9](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@5.5.8...@alwatr/exit-hook@5.5.9) (2025-09-06)
125
-
126
- **Note:** Version bump only for package @alwatr/exit-hook
127
-
128
- ## [5.5.8](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@5.5.7...@alwatr/exit-hook@5.5.8) (2025-09-05)
129
-
130
- ### 🔗 Dependencies update
131
-
132
- * update jest to version 30.1.3 and @types/node to version 22.18.1 ([754212b](https://github.com/Alwatr/nanolib/commit/754212b1523cfc4cfe26c9e9f6d634aa8311e0b7))
133
-
134
- ## [5.5.7](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@5.5.6...@alwatr/exit-hook@5.5.7) (2025-09-01)
135
-
136
- ### 🔗 Dependencies update
137
-
138
- * update lerna-lite dependencies to version 4.7.3 and jest to 30.1.2 ([95d7870](https://github.com/Alwatr/nanolib/commit/95d7870ec7ad1e6ed2688bafddcabf46857f6981))
139
-
140
- ## [5.5.6](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@5.5.5...@alwatr/exit-hook@5.5.6) (2025-08-23)
141
-
142
- **Note:** Version bump only for package @alwatr/exit-hook
143
-
144
- ## [5.5.5](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@5.5.3...@alwatr/exit-hook@5.5.5) (2025-08-23)
145
-
146
- ### 🐛 Bug Fixes
147
-
148
- * update license from AGPL-3.0-only to MPL-2.0 ([d20968e](https://github.com/Alwatr/nanolib/commit/d20968e60cc89b1dcdf9b96507178da6ed562f55))
149
- * update package versions in multiple package.json files ([7638b1c](https://github.com/Alwatr/nanolib/commit/7638b1cafee2b4e0f97db7a89ac9fba6384b9b10))
150
-
151
- ### 🔨 Code Refactoring
152
-
153
- * Updated all package.json files in the project to change dependency version specifiers from "workspace:^" to "workspace:*" for consistency and to allow for more flexible version resolution. ([db6a4f7](https://github.com/Alwatr/nanolib/commit/db6a4f76deec2d1d8039978144e4bc51b6f1a0e3))
154
-
155
- ### 🧹 Miscellaneous Chores
156
-
157
- * reformat all package.json files ([ceda45d](https://github.com/Alwatr/nanolib/commit/ceda45de186667790474f729cb4b161a5148ce19))
158
-
159
- ### 🔗 Dependencies update
160
-
161
- * revert @types/node version to ^22.17.2 (LTS) ([49f8101](https://github.com/Alwatr/nanolib/commit/49f8101eac5c41aa7684112f4308254dbfab9787))
162
- * update TypeScript and Jest versions across all packages to improve compatibility and performance ([31baf36](https://github.com/Alwatr/nanolib/commit/31baf366101e92e27db66a21c849fb101f19be47))
163
-
164
- ## [5.5.4](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@5.5.3...@alwatr/exit-hook@5.5.4) (2025-08-23)
165
-
166
- ### Code Refactoring
167
-
168
- * Updated all package.json files in the project to change dependency version specifiers from "workspace:^" to "workspace:*" for consistency and to allow for more flexible version resolution. ([db6a4f7](https://github.com/Alwatr/nanolib/commit/db6a4f76deec2d1d8039978144e4bc51b6f1a0e3)) by @alimd
169
-
170
- ## <small>5.5.3 (2025-04-15)</small>
171
-
172
- **Note:** Version bump only for package @alwatr/exit-hook
173
-
174
- ## [5.5.2](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@5.5.1...@alwatr/exit-hook@5.5.2) (2025-04-01)
175
-
176
- ### Dependencies update
177
-
178
- * bump the development-dependencies group across 1 directory with 2 updates ([c1320b4](https://github.com/Alwatr/nanolib/commit/c1320b447a492c5e720e25ad71e9df81eeea3670)) by @dependabot[bot]
179
-
180
- ## [5.5.1](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@5.5.0...@alwatr/exit-hook@5.5.1) (2025-03-18)
181
-
182
- ### Dependencies update
183
-
184
- * bump the development-dependencies group with 9 updates ([7290aa3](https://github.com/Alwatr/nanolib/commit/7290aa3b52ce66ca237d2a12d28a7687b113f83d)) by @dependabot[bot]
185
-
186
- ## [5.5.0](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@5.4.0...@alwatr/exit-hook@5.5.0) (2025-03-06)
187
-
188
- ### Miscellaneous Chores
189
-
190
- * update username casing in changelog entries ([9722ac9](https://github.com/Alwatr/nanolib/commit/9722ac9a078438a4e8ebfa5826ea70e0e3a52ca6)) by @
191
-
192
- ### Dependencies update
193
-
194
- * bump the development-dependencies group across 1 directory with 11 updates ([720c395](https://github.com/Alwatr/nanolib/commit/720c3954da55c929fe8fb16957121f4c51fb7f0c)) by @dependabot[bot]
195
-
196
- ## [5.4.0](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@1.1.8...@alwatr/exit-hook@5.4.0) (2025-02-18)
197
-
198
- ### Dependencies update
199
-
200
- * bump @types/node from ^22.13.0 to ^22.13.4 and prettier from 3.4.2 to 3.5.1; update eslint-import-resolver-typescript to 3.8.2 ([b9a8399](https://github.com/Alwatr/nanolib/commit/b9a8399add39509e90bfdc589fb5e2321718029d)) by @
201
-
202
- ## 5.3.0 (2025-02-03)
203
-
204
- ### Miscellaneous Chores
205
-
206
- * edit README ([3860b3d](https://github.com/Alwatr/nanolib/commit/3860b3df48ab82dc479d5236c2e8579df614aabf)) by @
207
-
208
- ### Dependencies update
209
-
210
- * bump the development-dependencies group across 1 directory with 11 updates ([cb79d07](https://github.com/Alwatr/nanolib/commit/cb79d072a57c79e1c01abff1a293d6757bb65350)) by @
211
- * update typescript and @types/node to version 5.7.3 and 22.13.0 respectively across multiple packages ([ddab05b](https://github.com/Alwatr/nanolib/commit/ddab05b5d767c30191f36a065e4bc88744e8e3fe)) by @
212
-
213
- ## 5.0.0 (2024-11-02)
214
-
215
- ### ⚠ BREAKING CHANGES
216
-
217
- * To simplify version management and ensure consistency, all nanolib packages now use the same version as @alwatr/nanolib. This may require updates to your project's dependencies.
218
-
219
- ### Code Refactoring
220
-
221
- * use the same version as @alwatr/nanolib ([60eb860](https://github.com/Alwatr/nanolib/commit/60eb860a0e33dfffe2d1d95e63ce54c60876be06)) by @
222
-
223
- ## [5.3.0](https://github.com/Alwatr/nanolib/compare/v5.2.1...v5.3.0) (2025-02-03)
224
-
225
- ### Miscellaneous Chores
226
-
227
- * edit README ([3860b3d](https://github.com/Alwatr/nanolib/commit/3860b3df48ab82dc479d5236c2e8579df614aabf)) by @ArmanAsadian
228
-
229
- ### Dependencies update
230
-
231
- * bump the development-dependencies group across 1 directory with 11 updates ([cb79d07](https://github.com/Alwatr/nanolib/commit/cb79d072a57c79e1c01abff1a293d6757bb65350)) by @dependabot[bot]
232
- * update typescript and @types/node to version 5.7.3 and 22.13.0 respectively across multiple packages ([ddab05b](https://github.com/Alwatr/nanolib/commit/ddab05b5d767c30191f36a065e4bc88744e8e3fe)) by @alimd
233
-
234
- ## 5.0.0 (2024-11-02)
235
-
236
- ### ⚠ BREAKING CHANGES
237
-
238
- * To simplify version management and ensure consistency, all nanolib packages now use the same version as @alwatr/nanolib. This may require updates to your project's dependencies.
239
-
240
- ### Features
241
-
242
- * **exit-hook:** new package ([a41b3a0](https://github.com/Alwatr/nanolib/commit/a41b3a01a4e6af595521e506326678eb96491a11)) by @
243
- * use `package-tracer` ([cc3c5f9](https://github.com/Alwatr/nanolib/commit/cc3c5f9c1a3d03f0d81b46835665f16a0426fd0d)) by @
244
-
245
- ### Bug Fixes
246
-
247
- * all dependeny topology ([1c17f34](https://github.com/Alwatr/nanolib/commit/1c17f349adf3e98e2a80ab2da4f0f81028dc9c5f)) by @
248
- * **exit-hook:** define package using @alwatr/dedupe to prevent duplicates ([e16638c](https://github.com/Alwatr/nanolib/commit/e16638cb69639f1c7c1316d72db8032fef617d00)) by @
249
- * **exit-hook:** disable beforeExit event and get exit signal from process.exitCode ([2dbed18](https://github.com/Alwatr/nanolib/commit/2dbed18455ab252f686c7af58b9c5bf39f818f0d)) by @
250
- * **exit-hook:** exit after listener called ([70c9f62](https://github.com/Alwatr/nanolib/commit/70c9f624899f87bb417f189792144aa05fca99ba)) by @
251
- * **exit-hook:** Refactor exitHook function to prevent automatically register process exit events ([32d7e29](https://github.com/Alwatr/nanolib/commit/32d7e29dcd89dd4b7dc1a57da391ba8e70f5021d)) by @
252
- * **exit-hook:** show error properly and safe exit on SIGTERM ([b0a27b8](https://github.com/Alwatr/nanolib/commit/b0a27b8c89945069c98637269f976b5e9f3618c0)) by @
253
- * **exit-hook:** typo function name ([e8df52a](https://github.com/Alwatr/nanolib/commit/e8df52a8f527e653025abe6a8bc54719498db83e)) by @
254
-
255
- ### Code Refactoring
256
-
257
- * **exit-hook:** dosen't use `dedupe` anymore ([e6c3ce9](https://github.com/Alwatr/nanolib/commit/e6c3ce91be0a42d5d1f857eca824a200eacc911c)) by @
258
- * **exit-hook:** use new dedupe api ([185aced](https://github.com/Alwatr/nanolib/commit/185aced6566ba986062fbc0d936fb8090430f681)) by @
259
- * prevent side-effects ([01e00e1](https://github.com/Alwatr/nanolib/commit/01e00e191385cc92b28677df0c01a085916ae677)) by @
260
- * use the same version as @alwatr/nanolib ([60eb860](https://github.com/Alwatr/nanolib/commit/60eb860a0e33dfffe2d1d95e63ce54c60876be06)) by @
261
-
262
- ### Miscellaneous Chores
263
-
264
- * **deps-dev:** bump the development-dependencies group with 3 updates ([0e0ec0f](https://github.com/Alwatr/nanolib/commit/0e0ec0f7c66c849727563cabe0e88606aee49035)) by @
265
- * **deps:** upd ([b6dd6dd](https://github.com/Alwatr/nanolib/commit/b6dd6dd8173d9788c179d57091402e693fa2024a)) by @
266
- * **deps:** update ([1a45030](https://github.com/Alwatr/nanolib/commit/1a450305440b710a300787d4ca24b1ed8c6a39d7)) by @
267
- * **deps:** update ([8e70dff](https://github.com/Alwatr/nanolib/commit/8e70dffb1e751496ef2e72d6cffd685f1fea44e3)) by @
268
- * **deps:** update ([f0b60d2](https://github.com/Alwatr/nanolib/commit/f0b60d24c9fae6190940baf95167a1175360d4b3)) by @
269
- * **exit-hook:** change the license to AGPL-3.0 ([74e89a1](https://github.com/Alwatr/nanolib/commit/74e89a18044831c225649494734d284bb95d4629)) by @
270
- * include LICENSE and LEGAL files to publish ([09f366f](https://github.com/Alwatr/nanolib/commit/09f366f680bfa9fb26acb2cd1ccbc68c5a9e9ad8)) by @
271
- * rename logger env ([38443ad](https://github.com/Alwatr/nanolib/commit/38443ade4677e857b5ebd4be417f5f2eb1818c87)) by @
272
- * Update build and lint scripts ([392d0b7](https://github.com/Alwatr/nanolib/commit/392d0b71f446bce336b0256119a80f07aff794ba)) by @
273
- * Update debug command in package.json ([be8403d](https://github.com/Alwatr/nanolib/commit/be8403dec754f2117259bb915b110ea386596401)) by @
274
- * Update package.json exports for [@alwatr](https://github.com/alwatr) packages ([dacb362](https://github.com/Alwatr/nanolib/commit/dacb362b145e3c51b4aba00ff643687a3fac11d2)) by @
275
-
276
- ### Dependencies update
277
-
278
- * bump @types/node ([3d80fed](https://github.com/Alwatr/nanolib/commit/3d80fedaf720af792feb060c2f81c737ebb84e11)) by @
279
- * bump the development-dependencies group across 1 directory with 10 updates ([9ed98ff](https://github.com/Alwatr/nanolib/commit/9ed98ffd0668d5a36e255c82edab3af53bffda8f)) by @
280
- * bump the development-dependencies group across 1 directory with 2 updates ([2dfda9e](https://github.com/Alwatr/nanolib/commit/2dfda9ec38a595f1fd961490d1a2fbf060f20a66)) by @
281
- * bump the development-dependencies group with 10 updates ([fa4aaf0](https://github.com/Alwatr/nanolib/commit/fa4aaf04c907ecae06aa14000ce35216170c15ad)) by @
282
- * bump the development-dependencies group with 2 updates ([be5d6c2](https://github.com/Alwatr/nanolib/commit/be5d6c2d86b937f32cebc6848aaff85af07055dd)) by @
283
- * bump the development-dependencies group with 8 updates ([16847ac](https://github.com/Alwatr/nanolib/commit/16847acba91da027c422e3910d0f2dcc1f084e93)) by @
284
- * upd ([451d025](https://github.com/Alwatr/nanolib/commit/451d0255ba96ed55f897a6f44f62cf4e6d2b12be)) by @
285
- * update ([4434ba6](https://github.com/Alwatr/nanolib/commit/4434ba67c3f576bb1a0c307fbdb263c43cd9733a)) by @
286
- * update ([c36ed50](https://github.com/Alwatr/nanolib/commit/c36ed50f68da2f5608ccd96119963a16cfacb4ce)) by @
287
- * update all ([53342f6](https://github.com/Alwatr/nanolib/commit/53342f67a8a013127f073540bc11929f1813c05c)) by @
288
- * update all dependencies ([1e0c30e](https://github.com/Alwatr/nanolib/commit/1e0c30e6a3a8e19deb5185814e24ab6c08dca573)) by @
289
- * update all dependencies ([0e908b4](https://github.com/Alwatr/nanolib/commit/0e908b476a6b976ec2447f864c8cafcbb8a0f099)) by @
290
- * upgrade ([6dbd300](https://github.com/Alwatr/nanolib/commit/6dbd300642c9bcc9e7d0b281e244bf1b06eb1c38)) by @
291
-
292
- ## [1.1.8](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@1.1.7...@alwatr/exit-hook@1.1.8) (2024-11-02)
293
-
294
- ### Dependencies update
295
-
296
- * update ([4434ba6](https://github.com/Alwatr/nanolib/commit/4434ba67c3f576bb1a0c307fbdb263c43cd9733a)) by @alimd
297
-
298
- ## [1.1.7](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@1.1.6...@alwatr/exit-hook@1.1.7) (2024-10-25)
299
-
300
- ### Dependencies update
301
-
302
- * bump the development-dependencies group across 1 directory with 2 updates ([2dfda9e](https://github.com/Alwatr/nanolib/commit/2dfda9ec38a595f1fd961490d1a2fbf060f20a66)) by @dependabot[bot]
303
- * bump the development-dependencies group with 8 updates ([16847ac](https://github.com/Alwatr/nanolib/commit/16847acba91da027c422e3910d0f2dcc1f084e93)) by @dependabot[bot]
304
-
305
- ## [1.1.6](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@1.1.5...@alwatr/exit-hook@1.1.6) (2024-10-12)
306
-
307
- **Note:** Version bump only for package @alwatr/exit-hook
308
-
309
- ## [1.1.5](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@1.1.4...@alwatr/exit-hook@1.1.5) (2024-10-11)
310
-
311
- ### Code Refactoring
312
-
313
- - **exit-hook:** dosen't use `dedupe` anymore ([e6c3ce9](https://github.com/Alwatr/nanolib/commit/e6c3ce91be0a42d5d1f857eca824a200eacc911c)) by @mohammadhonarvar
314
- - prevent side-effects ([01e00e1](https://github.com/Alwatr/nanolib/commit/01e00e191385cc92b28677df0c01a085916ae677)) by @mohammadhonarvar
315
-
316
- ## [1.1.4](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@1.1.3...@alwatr/exit-hook@1.1.4) (2024-10-11)
317
-
318
- ### Miscellaneous Chores
319
-
320
- - include LICENSE and LEGAL files to publish ([09f366f](https://github.com/Alwatr/nanolib/commit/09f366f680bfa9fb26acb2cd1ccbc68c5a9e9ad8)) by @alimd
321
-
322
- ## [1.1.3](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@1.1.2...@alwatr/exit-hook@1.1.3) (2024-10-11)
323
-
324
- ### Bug Fixes
325
-
326
- - **exit-hook:** Refactor exitHook function to prevent automatically register process exit events ([32d7e29](https://github.com/Alwatr/nanolib/commit/32d7e29dcd89dd4b7dc1a57da391ba8e70f5021d)) by @alimd
327
-
328
- ## [1.1.2](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@1.1.1...@alwatr/exit-hook@1.1.2) (2024-10-10)
329
-
330
- ### Dependencies update
331
-
332
- - bump the development-dependencies group with 10 updates ([fa4aaf0](https://github.com/Alwatr/nanolib/commit/fa4aaf04c907ecae06aa14000ce35216170c15ad)) by @dependabot[bot]
333
-
334
- ## [1.1.1](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@1.1.0...@alwatr/exit-hook@1.1.1) (2024-10-08)
335
-
336
- **Note:** Version bump only for package @alwatr/exit-hook
337
-
338
- ## [1.1.0](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@1.0.16...@alwatr/exit-hook@1.1.0) (2024-09-29)
339
-
340
- ### Features
341
-
342
- - use `package-tracer` ([cc3c5f9](https://github.com/Alwatr/nanolib/commit/cc3c5f9c1a3d03f0d81b46835665f16a0426fd0d)) by @mohammadhonarvar
343
-
344
- ### Bug Fixes
345
-
346
- - all dependeny topology ([1c17f34](https://github.com/Alwatr/nanolib/commit/1c17f349adf3e98e2a80ab2da4f0f81028dc9c5f)) by @mohammadhonarvar
347
-
348
- ### Code Refactoring
349
-
350
- - **exit-hook:** use new dedupe api ([185aced](https://github.com/Alwatr/nanolib/commit/185aced6566ba986062fbc0d936fb8090430f681)) by @alimd
351
-
352
- ### Miscellaneous Chores
353
-
354
- - **exit-hook:** change the license to AGPL-3.0 ([74e89a1](https://github.com/Alwatr/nanolib/commit/74e89a18044831c225649494734d284bb95d4629)) by @ArmanAsadian
355
- - Update build and lint scripts ([392d0b7](https://github.com/Alwatr/nanolib/commit/392d0b71f446bce336b0256119a80f07aff794ba)) by @alimd
356
-
357
- ### Dependencies update
358
-
359
- - bump @types/node ([3d80fed](https://github.com/Alwatr/nanolib/commit/3d80fedaf720af792feb060c2f81c737ebb84e11)) by @dependabot[bot]
360
-
361
- ## [1.0.16](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@1.0.15...@alwatr/exit-hook@1.0.16) (2024-09-21)
362
-
363
- **Note:** Version bump only for package @alwatr/exit-hook
364
-
365
- ## [1.0.15](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@1.0.14...@alwatr/exit-hook@1.0.15) (2024-09-15)
366
-
367
- ### Dependencies update
368
-
369
- - bump the development-dependencies group across 1 directory with 10 updates ([9ed98ff](https://github.com/Alwatr/nanolib/commit/9ed98ffd0668d5a36e255c82edab3af53bffda8f)) by @dependabot[bot]
370
- - update ([c36ed50](https://github.com/Alwatr/nanolib/commit/c36ed50f68da2f5608ccd96119963a16cfacb4ce)) by @alimd
371
-
372
- ## [1.0.14](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@1.0.13...@alwatr/exit-hook@1.0.14) (2024-08-31)
373
-
374
- ### Miscellaneous Chores
375
-
376
- - Update package.json exports for [@alwatr](https://github.com/alwatr) packages ([dacb362](https://github.com/Alwatr/nanolib/commit/dacb362b145e3c51b4aba00ff643687a3fac11d2)) by @
377
-
378
- ## [1.0.13](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@1.0.12...@alwatr/exit-hook@1.0.13) (2024-08-31)
379
-
380
- ### Bug Fixes
381
-
382
- - **exit-hook:** define package using @alwatr/dedupe to prevent duplicates ([e16638c](https://github.com/Alwatr/nanolib/commit/e16638cb69639f1c7c1316d72db8032fef617d00)) by @alimd
383
-
384
- ## [1.0.12](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@1.0.11...@alwatr/exit-hook@1.0.12) (2024-08-31)
385
-
386
- ### Dependencies update
387
-
388
- - update all dependencies ([1e0c30e](https://github.com/Alwatr/nanolib/commit/1e0c30e6a3a8e19deb5185814e24ab6c08dca573)) by @alimd
389
-
390
- ## [1.0.11](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@1.0.10...@alwatr/exit-hook@1.0.11) (2024-07-04)
391
-
392
- ### Dependencies update
393
-
394
- - update all dependencies ([0e908b4](https://github.com/Alwatr/nanolib/commit/0e908b476a6b976ec2447f864c8cafcbb8a0f099)) by @
395
-
396
- ## [1.0.10](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@1.0.9...@alwatr/exit-hook@1.0.10) (2024-05-12)
397
-
398
- ### Bug Fixes
399
-
400
- - **exit-hook:** show error properly and safe exit on SIGTERM ([b0a27b8](https://github.com/Alwatr/nanolib/commit/b0a27b8c89945069c98637269f976b5e9f3618c0)) by @alimd
401
-
402
- ### Dependencies update
403
-
404
- - upgrade ([6dbd300](https://github.com/Alwatr/nanolib/commit/6dbd300642c9bcc9e7d0b281e244bf1b06eb1c38)) by @alimd
405
-
406
- ## [1.0.9](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@1.0.8...@alwatr/exit-hook@1.0.9) (2024-04-25)
407
-
408
- ### Bug Fixes
409
-
410
- - **exit-hook:** disable beforeExit event and get exit signal from process.exitCode ([2dbed18](https://github.com/Alwatr/nanolib/commit/2dbed18455ab252f686c7af58b9c5bf39f818f0d)) by @njfamirm
411
- - **exit-hook:** exit after listener called ([70c9f62](https://github.com/Alwatr/nanolib/commit/70c9f624899f87bb417f189792144aa05fca99ba)) by @njfamirm
412
-
413
- ## [1.0.8](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@1.0.7...@alwatr/exit-hook@1.0.8) (2024-03-28)
414
-
415
- **Note:** Version bump only for package @alwatr/exit-hook
416
-
417
- ## [1.0.7](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@1.0.6...@alwatr/exit-hook@1.0.7) (2024-01-31)
418
-
419
- ### Miscellaneous Chores
420
-
421
- - **deps:** update ([1a45030](https://github.com/Alwatr/nanolib/commit/1a450305440b710a300787d4ca24b1ed8c6a39d7)) by @alimd
422
-
423
- ## [1.0.6](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@1.0.5...@alwatr/exit-hook@1.0.6) (2024-01-24)
424
-
425
- **Note:** Version bump only for package @alwatr/exit-hook
426
-
427
- ## [1.0.5](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@1.0.4...@alwatr/exit-hook@1.0.5) (2024-01-20)
428
-
429
- **Note:** Version bump only for package @alwatr/exit-hook
430
-
431
- ## [1.0.4](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@1.0.3...@alwatr/exit-hook@1.0.4) (2024-01-16)
432
-
433
- **Note:** Version bump only for package @alwatr/exit-hook
434
-
435
- ## [1.0.3](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@1.0.2...@alwatr/exit-hook@1.0.3) (2024-01-08)
436
-
437
- **Note:** Version bump only for package @alwatr/exit-hook
438
-
439
- ## [1.0.2](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@1.0.1...@alwatr/exit-hook@1.0.2) (2024-01-03)
440
-
441
- **Note:** Version bump only for package @alwatr/exit-hook
442
-
443
- ## [1.0.1](https://github.com/Alwatr/nanolib/compare/@alwatr/exit-hook@1.0.0...@alwatr/exit-hook@1.0.1) (2024-01-03)
444
-
445
- ### Bug Fixes
446
-
447
- - **exit-hook:** typo function name ([e8df52a](https://github.com/Alwatr/nanolib/commit/e8df52a8f527e653025abe6a8bc54719498db83e)) by @njfamirm
448
-
449
- # 1.0.0 (2024-01-03)
450
-
451
- ### Features
452
-
453
- - **exit-hook:** new package ([a41b3a0](https://github.com/Alwatr/nanolib/commit/a41b3a01a4e6af595521e506326678eb96491a11)) by @njfamirm
package/dist/main.cjs DELETED
@@ -1,3 +0,0 @@
1
- /** 📦 @alwatr/exit-hook v5.5.29 */
2
- "use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:true})};var __copyProps=(to,from,except,desc)=>{if(from&&typeof from==="object"||typeof from==="function"){for(let key of __getOwnPropNames(from))if(!__hasOwnProp.call(to,key)&&key!==except)__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable})}return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:true}),mod);var main_exports={};__export(main_exports,{exitHook:()=>exitHook});module.exports=__toCommonJS(main_exports);var callbacks=null;var exiting=false;function exitHook(callback){if(callbacks===null){registerExitEvents();callbacks=[]}callbacks.push(callback)}function onExit_(signal){console.log("onExit({signal: %s})",signal);if(exiting===true||callbacks===null)return;exiting=true;for(const callback of callbacks){try{callback()}catch(error){console.error("Error in exit hook callback:",error)}}if(signal==="SIGINT"||signal==="SIGTERM"){setTimeout(()=>{process.exit(0)})}}function registerExitEvents(){process.once("exit",onExit_);process.once("SIGTERM",onExit_);process.once("SIGINT",onExit_)}0&&(module.exports={exitHook});
3
- //# sourceMappingURL=main.cjs.map
package/dist/main.cjs.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/main.ts"],
4
- "sourcesContent": ["/**\n * Array of callback functions to be called when the process is exiting.\n */\nlet callbacks: (() => void)[] | null = null;\n\n/**\n * True whether the process is exiting to prevent calling the callbacks more than once.\n */\nlet exiting = false;\n\n/**\n * Add a callback function to be called when the process is exiting.\n *\n * @param callback The callback function to be called when the process is exiting.\n *\n * @example\n * ```typescript\n * const saveAllData = () => {\n * // save all data\n * };\n *\n * existHook(saveAllData);\n * ```\n */\nexport function exitHook(callback: () => void): void {\n if (callbacks === null) {\n registerExitEvents();\n callbacks = [];\n }\n callbacks.push(callback);\n}\n\n/**\n * A once callback to be called on process exit event.\n */\nfunction onExit_(signal: number | 'SIGINT' | 'SIGTERM') {\n console.log('onExit({signal: %s})', signal);\n if (exiting === true || callbacks === null) return;\n\n exiting = true;\n\n for (const callback of callbacks) {\n try {\n callback();\n }\n catch (error) {\n console.error('Error in exit hook callback:', error);\n }\n }\n\n if (signal === 'SIGINT' || signal === 'SIGTERM') {\n setTimeout(() => {\n process.exit(0);\n });\n }\n}\n\n/**\n * Register process exit events.\n */\nfunction registerExitEvents(): void {\n /**\n * This event emitted when Node.js empties its event loop and has no additional work to schedule.\n * Normally, the Node.js process will exit when there is no work scheduled,\n * but a listener registered on the 'beforeExit' event can make **asynchronous calls**, and thereby cause the Node.js process to continue.\n *\n * @see https://nodejs.org/api/process.html#event-beforeexit\n */\n // process.once('beforeExit', onExit_);\n\n /**\n * This event is emitted when the Node.js process is about to exit as a result of either:\n * 1- The `process.exit()` method being called explicitly.\n * 2- The Node.js event loop no longer having any additional work to perform.\n *\n * @see https://nodejs.org/api/process.html#event-exit\n */\n process.once('exit', onExit_);\n\n /**\n * This event is emitted in terminal mode before exiting with code 128 + signal number.\n *\n * @see https://nodejs.org/api/process.html#signal-events\n */\n process.once('SIGTERM', onExit_);\n\n /**\n * This event is emitted when `Ctrl+C` is pressed.\n *\n * @see https://nodejs.org/api/process.html#signal-events\n */\n process.once('SIGINT', onExit_);\n}\n"],
5
- "mappings": ";qqBAAA,6GAGA,IAAI,UAAmC,KAKvC,IAAI,QAAU,MAgBP,SAAS,SAAS,SAA4B,CACnD,GAAI,YAAc,KAAM,CACtB,mBAAmB,EACnB,UAAY,CAAC,CACf,CACA,UAAU,KAAK,QAAQ,CACzB,CAKA,SAAS,QAAQ,OAAuC,CACtD,QAAQ,IAAI,uBAAwB,MAAM,EAC1C,GAAI,UAAY,MAAQ,YAAc,KAAM,OAE5C,QAAU,KAEV,UAAW,YAAY,UAAW,CAChC,GAAI,CACF,SAAS,CACX,OACO,MAAO,CACZ,QAAQ,MAAM,+BAAgC,KAAK,CACrD,CACF,CAEA,GAAI,SAAW,UAAY,SAAW,UAAW,CAC/C,WAAW,IAAM,CACf,QAAQ,KAAK,CAAC,CAChB,CAAC,CACH,CACF,CAKA,SAAS,oBAA2B,CAiBlC,QAAQ,KAAK,OAAQ,OAAO,EAO5B,QAAQ,KAAK,UAAW,OAAO,EAO/B,QAAQ,KAAK,SAAU,OAAO,CAChC",
6
- "names": []
7
- }
package/dist/main.mjs DELETED
@@ -1,3 +0,0 @@
1
- /** 📦 @alwatr/exit-hook v5.5.29 */
2
- var callbacks=null;var exiting=false;function exitHook(callback){if(callbacks===null){registerExitEvents();callbacks=[]}callbacks.push(callback)}function onExit_(signal){console.log("onExit({signal: %s})",signal);if(exiting===true||callbacks===null)return;exiting=true;for(const callback of callbacks){try{callback()}catch(error){console.error("Error in exit hook callback:",error)}}if(signal==="SIGINT"||signal==="SIGTERM"){setTimeout(()=>{process.exit(0)})}}function registerExitEvents(){process.once("exit",onExit_);process.once("SIGTERM",onExit_);process.once("SIGINT",onExit_)}export{exitHook};
3
- //# sourceMappingURL=main.mjs.map
package/dist/main.mjs.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/main.ts"],
4
- "sourcesContent": ["/**\n * Array of callback functions to be called when the process is exiting.\n */\nlet callbacks: (() => void)[] | null = null;\n\n/**\n * True whether the process is exiting to prevent calling the callbacks more than once.\n */\nlet exiting = false;\n\n/**\n * Add a callback function to be called when the process is exiting.\n *\n * @param callback The callback function to be called when the process is exiting.\n *\n * @example\n * ```typescript\n * const saveAllData = () => {\n * // save all data\n * };\n *\n * existHook(saveAllData);\n * ```\n */\nexport function exitHook(callback: () => void): void {\n if (callbacks === null) {\n registerExitEvents();\n callbacks = [];\n }\n callbacks.push(callback);\n}\n\n/**\n * A once callback to be called on process exit event.\n */\nfunction onExit_(signal: number | 'SIGINT' | 'SIGTERM') {\n console.log('onExit({signal: %s})', signal);\n if (exiting === true || callbacks === null) return;\n\n exiting = true;\n\n for (const callback of callbacks) {\n try {\n callback();\n }\n catch (error) {\n console.error('Error in exit hook callback:', error);\n }\n }\n\n if (signal === 'SIGINT' || signal === 'SIGTERM') {\n setTimeout(() => {\n process.exit(0);\n });\n }\n}\n\n/**\n * Register process exit events.\n */\nfunction registerExitEvents(): void {\n /**\n * This event emitted when Node.js empties its event loop and has no additional work to schedule.\n * Normally, the Node.js process will exit when there is no work scheduled,\n * but a listener registered on the 'beforeExit' event can make **asynchronous calls**, and thereby cause the Node.js process to continue.\n *\n * @see https://nodejs.org/api/process.html#event-beforeexit\n */\n // process.once('beforeExit', onExit_);\n\n /**\n * This event is emitted when the Node.js process is about to exit as a result of either:\n * 1- The `process.exit()` method being called explicitly.\n * 2- The Node.js event loop no longer having any additional work to perform.\n *\n * @see https://nodejs.org/api/process.html#event-exit\n */\n process.once('exit', onExit_);\n\n /**\n * This event is emitted in terminal mode before exiting with code 128 + signal number.\n *\n * @see https://nodejs.org/api/process.html#signal-events\n */\n process.once('SIGTERM', onExit_);\n\n /**\n * This event is emitted when `Ctrl+C` is pressed.\n *\n * @see https://nodejs.org/api/process.html#signal-events\n */\n process.once('SIGINT', onExit_);\n}\n"],
5
- "mappings": ";AAGA,IAAI,UAAmC,KAKvC,IAAI,QAAU,MAgBP,SAAS,SAAS,SAA4B,CACnD,GAAI,YAAc,KAAM,CACtB,mBAAmB,EACnB,UAAY,CAAC,CACf,CACA,UAAU,KAAK,QAAQ,CACzB,CAKA,SAAS,QAAQ,OAAuC,CACtD,QAAQ,IAAI,uBAAwB,MAAM,EAC1C,GAAI,UAAY,MAAQ,YAAc,KAAM,OAE5C,QAAU,KAEV,UAAW,YAAY,UAAW,CAChC,GAAI,CACF,SAAS,CACX,OACO,MAAO,CACZ,QAAQ,MAAM,+BAAgC,KAAK,CACrD,CACF,CAEA,GAAI,SAAW,UAAY,SAAW,UAAW,CAC/C,WAAW,IAAM,CACf,QAAQ,KAAK,CAAC,CAChB,CAAC,CACH,CACF,CAKA,SAAS,oBAA2B,CAiBlC,QAAQ,KAAK,OAAQ,OAAO,EAO5B,QAAQ,KAAK,UAAW,OAAO,EAO/B,QAAQ,KAAK,SAAU,OAAO,CAChC",
6
- "names": []
7
- }