@ptx-showcase/utils 0.0.2 → 0.0.4
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/README.md +72 -1
- package/dist/cookie/index.cjs +1 -0
- package/dist/{src/cookie → cookie}/index.d.ts +6 -3
- package/dist/cookie/index.js +14 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -0
- package/package.json +20 -6
- package/dist/src/index.d.ts +0 -1
package/README.md
CHANGED
|
@@ -1,3 +1,74 @@
|
|
|
1
1
|
# @ptx-showcase/utils
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Shared utilities for PTX Showcase projects.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 📦 Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @ptx-showcase/utils
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
or
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
bun add @ptx-showcase/utils
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 🚀 Usage
|
|
22
|
+
|
|
23
|
+
### Cookie utilities
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { setCookie, getCookie, deleteCookie } from '@ptx-showcase/utils/cookie'
|
|
27
|
+
|
|
28
|
+
// set cookie
|
|
29
|
+
setCookie('token', '123')
|
|
30
|
+
|
|
31
|
+
// get cookie
|
|
32
|
+
const token = getCookie('token')
|
|
33
|
+
|
|
34
|
+
// delete cookie
|
|
35
|
+
deleteCookie('token')
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 📁 Available modules
|
|
41
|
+
|
|
42
|
+
- `@ptx-showcase/utils` — base utilities
|
|
43
|
+
- `@ptx-showcase/utils/cookie` — cookie helpers
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 🧠 Features
|
|
48
|
+
|
|
49
|
+
- TypeScript support out of the box
|
|
50
|
+
- ESM + CommonJS compatibility
|
|
51
|
+
- Modular architecture (subpath imports)
|
|
52
|
+
- Lightweight and reusable across projects
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 🔄 Versioning
|
|
57
|
+
|
|
58
|
+
This package follows [Semantic Versioning](https://semver.org/):
|
|
59
|
+
|
|
60
|
+
- **patch** — bug fixes
|
|
61
|
+
- **minor** — new features (backward compatible)
|
|
62
|
+
- **major** — breaking changes
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## 📜 Changelog
|
|
67
|
+
|
|
68
|
+
See [CHANGELOG.md](./CHANGELOG.md) for all changes.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 📄 License
|
|
73
|
+
|
|
74
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`js-cookie`);c=s(c,1);var l=(e,t,n)=>{c.default.set(e,t,{expires:1/24,secure:!0,sameSite:`Strict`,...n})},u=e=>c.default.get(e),d=(e,t)=>{c.default.remove(e,t)};exports.deleteCookie=d,exports.getCookie=u,exports.setCookie=l;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
1
|
+
import { default as Cookies } from 'js-cookie'
|
|
2
|
+
type CookieOptions = Parameters<typeof Cookies.set>[2]
|
|
3
|
+
export declare const setCookie: (name: string, value: string, options?: CookieOptions) => void
|
|
4
|
+
export declare const getCookie: (name: string) => string | undefined
|
|
5
|
+
export declare const deleteCookie: (name: string, options?: CookieOptions) => void
|
|
6
|
+
export {}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import e from "js-cookie";
|
|
2
|
+
//#region src/cookie/index.ts
|
|
3
|
+
var t = (t, n, r) => {
|
|
4
|
+
e.set(t, n, {
|
|
5
|
+
expires: 1 / 24,
|
|
6
|
+
secure: !0,
|
|
7
|
+
sameSite: "Strict",
|
|
8
|
+
...r
|
|
9
|
+
});
|
|
10
|
+
}, n = (t) => e.get(t), r = (t, n) => {
|
|
11
|
+
e.remove(t, n);
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { r as deleteCookie, n as getCookie, t as setCookie };
|
package/dist/index.cjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(e){return`Hello, ${e}!`}exports.hello=e;
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare function hello(name: string): string;
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ptx-showcase/utils",
|
|
3
|
+
"author": "ptx-showcase",
|
|
3
4
|
"description": "Shared utilities for PTX Showcase projects",
|
|
4
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.4",
|
|
5
6
|
"private": false,
|
|
6
7
|
"type": "module",
|
|
7
8
|
"license": "MIT",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/gibPerviy/ptx-showcase-utils"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://github.com/gibPerviy/ptx-showcase-utils#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/gibPerviy/ptx-showcase-utils/issues"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"utils",
|
|
19
|
+
"helpers",
|
|
20
|
+
"typescript"
|
|
21
|
+
],
|
|
8
22
|
"files": [
|
|
9
23
|
"dist"
|
|
10
24
|
],
|
|
@@ -13,19 +27,19 @@
|
|
|
13
27
|
"types": "./dist/index.d.ts",
|
|
14
28
|
"exports": {
|
|
15
29
|
".": {
|
|
16
|
-
"types": "./dist/index.d.ts",
|
|
17
30
|
"import": "./dist/index.js",
|
|
18
|
-
"require": "./dist/index.cjs"
|
|
31
|
+
"require": "./dist/index.cjs",
|
|
32
|
+
"types": "./dist/index.d.ts"
|
|
19
33
|
},
|
|
20
34
|
"./cookie": {
|
|
21
|
-
"types": "./dist/cookie/index.d.ts",
|
|
22
35
|
"import": "./dist/cookie/index.js",
|
|
23
|
-
"require": "./dist/cookie/index.cjs"
|
|
36
|
+
"require": "./dist/cookie/index.cjs",
|
|
37
|
+
"types": "./dist/cookie/index.d.ts"
|
|
24
38
|
}
|
|
25
39
|
},
|
|
26
40
|
"scripts": {
|
|
27
41
|
"dev": "vite",
|
|
28
|
-
"build": "
|
|
42
|
+
"build": "vite build",
|
|
29
43
|
"preview": "vite preview"
|
|
30
44
|
},
|
|
31
45
|
"publishConfig": {
|
package/dist/src/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|