reqwise-core 1.0.0 → 1.1.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/package.json CHANGED
@@ -1,25 +1,28 @@
1
- {
2
- "name": "reqwise-core",
3
- "version": "1.0.0",
4
- "main": "dist/index.js",
5
- "module": "dist/index.mjs",
6
- "types": "dist/index.d.ts",
7
- "exports": {
8
- ".": {
9
- "import": "./dist/index.mjs",
10
- "require": "./dist/index.js"
11
- }
12
- },
13
- "peerDependencies": {
14
- "axios": ">=1.0.0"
15
- },
16
- "peerDependenciesMeta": {
17
- "axios": {
18
- "optional": true
19
- }
20
- },
21
- "scripts": {
22
- "build": "tsup",
23
- "type-check": "tsc -p tsconfig.json --noEmit"
24
- }
25
- }
1
+ {
2
+ "name": "reqwise-core",
3
+ "version": "1.1.1",
4
+ "description": "Core vanilla TypeScript HTTP interceptor and floating developer panel for Reqwise ecosystem.",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.ts",
8
+ "keywords": [
9
+ "reqwise",
10
+ "devtools",
11
+ "http-logger",
12
+ "network-inspector",
13
+ "monorepo",
14
+ "axios-interceptor",
15
+ "fetch-logger"
16
+ ],
17
+ "author": "Ali Zadeh <alizadehh04@example.com>",
18
+ "license": "MIT",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com",
22
+ "directory": "packages/core"
23
+ },
24
+ "bugs": {
25
+ "url": "https://github.com"
26
+ },
27
+ "homepage": "https://github.com"
28
+ }
@@ -1,26 +0,0 @@
1
-
2
- > @reqwise/core@0.0.0 build C:\Users\PC\Desktop\Code\reqwise\packages\core
3
- > tsup
4
-
5
- CLI Building entry: src/index.ts
6
- CLI Using tsconfig: tsconfig.json
7
- CLI tsup v8.5.1
8
- CLI Using tsup config: C:\Users\PC\Desktop\Code\reqwise\packages\core\tsup.config.ts
9
- CLI Target: es2020
10
- CLI Cleaning output folder
11
- CJS Build start
12
- ESM Build start
13
- CJS dist\index.js 2.90 MB
14
- CJS dist\index.js.map 2.95 MB
15
- CJS ⚡️ Build success in 137ms
16
- ESM dist\storage-P7DHGOZ3.mjs 314.00 B
17
- ESM dist\chunk-DKID2ES7.mjs 2.00 KB
18
- ESM dist\storage-P7DHGOZ3.mjs.map 71.00 B
19
- ESM dist\chunk-DKID2ES7.mjs.map 4.08 KB
20
- ESM dist\index.mjs 2.90 MB
21
- ESM dist\index.mjs.map 2.95 MB
22
- ESM ⚡️ Build success in 138ms
23
- DTS Build start
24
- DTS ⚡️ Build success in 780ms
25
- DTS dist\index.d.ts 5.34 KB
26
- DTS dist\index.d.mts 5.34 KB
@@ -1,96 +0,0 @@
1
- // src/storage.ts
2
- var STORAGE_KEY = "reqwise_history_v1";
3
- var config = {
4
- maxItems: 200,
5
- persistHistory: true
6
- };
7
- var memory = [];
8
- var subscribers = [];
9
- function canUseLocalStorage() {
10
- try {
11
- return typeof window !== "undefined" && typeof window.localStorage !== "undefined";
12
- } catch (e) {
13
- return false;
14
- }
15
- }
16
- function notify() {
17
- const snapshot = memory.slice();
18
- for (const s of subscribers) s(snapshot);
19
- }
20
- function load() {
21
- if (!config.persistHistory) return;
22
- if (!canUseLocalStorage()) return;
23
- try {
24
- const raw = window.localStorage.getItem(STORAGE_KEY);
25
- if (!raw) return;
26
- const parsed = JSON.parse(raw);
27
- memory = Array.isArray(parsed) ? parsed.slice(-config.maxItems) : [];
28
- } catch (e) {
29
- memory = [];
30
- }
31
- }
32
- function persist() {
33
- if (!config.persistHistory) return;
34
- if (!canUseLocalStorage()) return;
35
- try {
36
- window.localStorage.setItem(STORAGE_KEY, JSON.stringify(memory));
37
- } catch (e) {
38
- }
39
- }
40
- function initStorage(cfg) {
41
- config = { ...config, ...cfg || {} };
42
- if (config.persistHistory) load();
43
- }
44
- function saveEntry(entry) {
45
- memory.push(entry);
46
- if (config.maxItems && memory.length > config.maxItems) {
47
- memory = memory.slice(-config.maxItems);
48
- }
49
- persist();
50
- notify();
51
- }
52
- function getEntries() {
53
- return memory.slice().reverse();
54
- }
55
- function clearEntries() {
56
- memory = [];
57
- if (canUseLocalStorage()) {
58
- try {
59
- window.localStorage.removeItem(STORAGE_KEY);
60
- } catch (e) {
61
- }
62
- }
63
- notify();
64
- }
65
- function subscribe(fn) {
66
- subscribers.push(fn);
67
- fn(memory.slice().reverse());
68
- return () => {
69
- const idx = subscribers.indexOf(fn);
70
- if (idx !== -1) subscribers.splice(idx, 1);
71
- };
72
- }
73
- function replaceAll(entries) {
74
- memory = entries.slice(-config.maxItems);
75
- persist();
76
- notify();
77
- }
78
- var storage_default = {
79
- initStorage,
80
- saveEntry,
81
- getEntries,
82
- clearEntries,
83
- subscribe,
84
- replaceAll
85
- };
86
-
87
- export {
88
- initStorage,
89
- saveEntry,
90
- getEntries,
91
- clearEntries,
92
- subscribe,
93
- replaceAll,
94
- storage_default
95
- };
96
- //# sourceMappingURL=chunk-DKID2ES7.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/storage.ts"],"sourcesContent":["import { ReqwiseEntry, ReqwiseConfig } from './types'\r\n\r\nconst STORAGE_KEY = 'reqwise_history_v1'\r\n\r\nlet config: ReqwiseConfig = {\r\n maxItems: 200,\r\n persistHistory: true,\r\n}\r\n\r\nlet memory: ReqwiseEntry[] = []\r\nconst subscribers: Array<(items: ReqwiseEntry[]) => void> = []\r\n\r\nfunction canUseLocalStorage() {\r\n try {\r\n return typeof window !== 'undefined' && typeof window.localStorage !== 'undefined'\r\n } catch (e) {\r\n return false\r\n }\r\n}\r\n\r\nfunction notify() {\r\n const snapshot = memory.slice()\r\n for (const s of subscribers) s(snapshot)\r\n}\r\n\r\nfunction load() {\r\n if (!config.persistHistory) return\r\n if (!canUseLocalStorage()) return\r\n try {\r\n const raw = window.localStorage.getItem(STORAGE_KEY)\r\n if (!raw) return\r\n const parsed = JSON.parse(raw) as ReqwiseEntry[]\r\n memory = Array.isArray(parsed) ? parsed.slice(-config.maxItems!) : []\r\n } catch (e) {\r\n memory = []\r\n }\r\n}\r\n\r\nfunction persist() {\r\n if (!config.persistHistory) return\r\n if (!canUseLocalStorage()) return\r\n try {\r\n window.localStorage.setItem(STORAGE_KEY, JSON.stringify(memory))\r\n } catch (e) {\r\n // ignore\r\n }\r\n}\r\n\r\nexport function initStorage(cfg?: Partial<ReqwiseConfig>) {\r\n config = { ...config, ...(cfg || {}) } as ReqwiseConfig\r\n if (config.persistHistory) load()\r\n}\r\n\r\nexport function saveEntry(entry: ReqwiseEntry) {\r\n memory.push(entry)\r\n if (config.maxItems && memory.length > config.maxItems) {\r\n memory = memory.slice(-config.maxItems)\r\n }\r\n persist()\r\n notify()\r\n}\r\n\r\nexport function getEntries(): ReqwiseEntry[] {\r\n return memory.slice().reverse()\r\n}\r\n\r\nexport function clearEntries() {\r\n memory = []\r\n if (canUseLocalStorage()) {\r\n try {\r\n window.localStorage.removeItem(STORAGE_KEY)\r\n } catch (e) {\r\n // ignore\r\n }\r\n }\r\n notify()\r\n}\r\n\r\nexport function subscribe(fn: (items: ReqwiseEntry[]) => void) {\r\n subscribers.push(fn)\r\n // call immediately with current snapshot\r\n fn(memory.slice().reverse())\r\n return () => {\r\n const idx = subscribers.indexOf(fn)\r\n if (idx !== -1) subscribers.splice(idx, 1)\r\n }\r\n}\r\n\r\nexport function replaceAll(entries: ReqwiseEntry[]) {\r\n memory = entries.slice(-config.maxItems!)\r\n persist()\r\n notify()\r\n}\r\n\r\nexport default {\r\n initStorage,\r\n saveEntry,\r\n getEntries,\r\n clearEntries,\r\n subscribe,\r\n replaceAll,\r\n}\r\n"],"mappings":";AAEA,IAAM,cAAc;AAEpB,IAAI,SAAwB;AAAA,EAC1B,UAAU;AAAA,EACV,gBAAgB;AAClB;AAEA,IAAI,SAAyB,CAAC;AAC9B,IAAM,cAAsD,CAAC;AAE7D,SAAS,qBAAqB;AAC5B,MAAI;AACF,WAAO,OAAO,WAAW,eAAe,OAAO,OAAO,iBAAiB;AAAA,EACzE,SAA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