@mherod/get-cookie 4.3.2 → 4.4.0

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 (41) hide show
  1. package/.claude/settings.local.json +3 -0
  2. package/.dependency-cruiser.js +277 -0
  3. package/.husky/commit-msg +0 -0
  4. package/.husky/pre-commit +0 -0
  5. package/.husky/pre-push +0 -0
  6. package/README.md +106 -48
  7. package/biome.json +39 -16
  8. package/dist/cli.cjs +76 -3
  9. package/dist/cli.cjs.map +1 -1
  10. package/dist/index.cjs +76 -2
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.cts +647 -126
  13. package/dist/index.d.ts +647 -126
  14. package/dist/index.js +76 -2
  15. package/dist/index.js.map +1 -1
  16. package/dist/tsconfig.tsbuildinfo +1 -1
  17. package/eslint.config.js +23 -2
  18. package/examples/auth-tokens.ts +143 -0
  19. package/examples/chrome-cookies-demo.sh +117 -0
  20. package/examples/chrome-profile-demo.sh +126 -0
  21. package/examples/cli-examples.sh +0 -0
  22. package/examples/comprehensive-demo.ts +202 -0
  23. package/examples/curl-demo.sh +102 -0
  24. package/examples/curl-integration.sh +276 -0
  25. package/examples/curl-with-url.sh +136 -0
  26. package/examples/deduplication-demo.sh +110 -0
  27. package/examples/final-chrome-demo.sh +115 -0
  28. package/examples/github-api.sh +101 -0
  29. package/examples/github-private-access.sh +118 -0
  30. package/examples/list-profiles-demo.sh +120 -0
  31. package/examples/proper-curl-usage.sh +120 -0
  32. package/examples/simple-curl.sh +95 -0
  33. package/examples/test-expired-filtering.sh +68 -0
  34. package/examples/test-github-access.sh +245 -0
  35. package/examples/test-github-auth-improved.sh +136 -0
  36. package/examples/working-curl.sh +117 -0
  37. package/examples/working-github-auth.sh +87 -0
  38. package/package.json +46 -27
  39. package/tsconfig.cli.json +5 -1
  40. package/tsup.cli.ts +31 -1
  41. package/tsup.lib.ts +11 -1
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@mherod/get-cookie",
3
- "version": "4.3.2",
3
+ "version": "4.4.0",
4
4
  "description": "Node.js module for querying cookies from Chrome, Firefox, and Safari browsers",
5
+ "packageManager": "pnpm@9.15.2",
5
6
  "type": "module",
6
7
  "source": "src/index.ts",
7
8
  "bin": {
@@ -24,6 +25,37 @@
24
25
  "publishConfig": {
25
26
  "access": "public"
26
27
  },
28
+ "scripts": {
29
+ "clean": "rm -rf dist",
30
+ "build:lib": "tsup --config tsup.lib.ts",
31
+ "build:cli": "tsup --config tsup.cli.ts",
32
+ "build": "pnpm run build:lib && pnpm run build:cli",
33
+ "test": "jest",
34
+ "type-check": "tsc --noEmit --skipLibCheck",
35
+ "lint": "biome check --diagnostic-level=error .",
36
+ "lint:eslint": "eslint --config eslint.config.js \"src/**/*.{ts,js}\"",
37
+ "lint:all": "pnpm run lint && pnpm run lint:eslint",
38
+ "lint:fix": "biome check --write --unsafe . && eslint --config eslint.config.js --fix \"src/**/*.{ts,js}\"",
39
+ "lint:staged": "biome check --staged --write .",
40
+ "format": "biome format --write .",
41
+ "format:check": "biome check --diagnostic-level=error .",
42
+ "validate": "pnpm run type-check && pnpm run lint && pnpm run test && pnpm run check-links && pnpm run format:check",
43
+ "prepack": "pnpm run validate",
44
+ "prepublishOnly": "pnpm run clean && pnpm run validate && pnpm run build",
45
+ "dev": "tsc -w -p tsconfig.json & tsc-alias -w -p tsconfig.json",
46
+ "read-github": "NODE_OPTIONS=\"-r tsconfig-paths/register\" tsx scripts/read-github-cookies.ts",
47
+ "prepare": "husky install",
48
+ "docs": "typedoc && ./scripts/fix-typedoc.sh && vitepress build docs",
49
+ "docs:dev": "vitepress dev docs",
50
+ "docs:preview": "vitepress preview docs",
51
+ "check-links": "./scripts/check-vitepress-links.sh",
52
+ "deps": "madge --ts-config ./tsconfig.json src/index.ts",
53
+ "deps:circular": "madge --circular --ts-config ./tsconfig.json src/",
54
+ "deps:orphans": "madge --orphans --ts-config ./tsconfig.json src/",
55
+ "deps:text": "depcruise src --include-only \"^src\" --output-type text",
56
+ "deps:html": "depcruise src --include-only \"^src\" --output-type html --output-to dependency-report.html",
57
+ "deps:validate": "depcruise src --config .dependency-cruiser.js"
58
+ },
27
59
  "engines": {
28
60
  "node": "^20.0.0 || ^22.0.0 || ^24.0.0"
29
61
  },
@@ -47,11 +79,11 @@
47
79
  "@primno/dpapi": "^2.0.1"
48
80
  },
49
81
  "devDependencies": {
50
- "@biomejs/biome": "1.9.4",
82
+ "@biomejs/biome": "2.2.3",
51
83
  "@commitlint/cli": "19.8.1",
52
84
  "@commitlint/config-conventional": "19.8.1",
53
85
  "@jest/globals": "^30.0.4",
54
- "@types/better-sqlite3": "^7.6.12",
86
+ "@types/better-sqlite3": "^7.6.13",
55
87
  "@types/jest": "^29.5.14",
56
88
  "@types/jsonwebtoken": "^9.0.10",
57
89
  "@types/lodash": "^4.17.13",
@@ -60,18 +92,20 @@
60
92
  "@types/node": "^24.0.14",
61
93
  "@typescript-eslint/eslint-plugin": "^8.34.0",
62
94
  "@typescript-eslint/parser": "^8.35.1",
95
+ "dependency-cruiser": "17.0.1",
63
96
  "eslint": "^9.31.0",
64
97
  "eslint-formatter-codeframe": "^7.32.1",
65
- "eslint-import-resolver-typescript": "^3.7.0",
98
+ "eslint-import-resolver-typescript": "^4.4.4",
66
99
  "eslint-plugin-import": "^2.31.0",
67
- "eslint-plugin-jsdoc": "^51.3.3",
100
+ "eslint-plugin-jsdoc": "^54.3.1",
68
101
  "globals": "16.2.0",
69
102
  "husky": "^9.1.7",
70
103
  "jest": "^29.7.0",
71
104
  "lint-staged": "^15.3.0",
72
105
  "lodash": "4.17.21",
106
+ "madge": "8.0.0",
73
107
  "pnpm": "10.12.4",
74
- "prettier": "^3.4.2",
108
+ "prettier": "^3.6.2",
75
109
  "ts-jest": "^29.4.0",
76
110
  "ts-node": "^10.9.2",
77
111
  "tsc-alias": "^1.8.16",
@@ -82,6 +116,11 @@
82
116
  "typescript": "^5.8.3",
83
117
  "vitepress": "^1.6.3"
84
118
  },
119
+ "pnpm": {
120
+ "overrides": {
121
+ "esbuild": "^0.25.0"
122
+ }
123
+ },
85
124
  "lint-staged": {
86
125
  "*.{js,ts}": [
87
126
  "biome check --write --no-errors-on-unmatched"
@@ -93,25 +132,5 @@
93
132
  "biome format --write --no-errors-on-unmatched",
94
133
  "./scripts/check-vitepress-links.sh"
95
134
  ]
96
- },
97
- "scripts": {
98
- "clean": "rm -rf dist",
99
- "build:lib": "tsup --config tsup.lib.ts",
100
- "build:cli": "tsup --config tsup.cli.ts",
101
- "build": "pnpm run build:lib && pnpm run build:cli",
102
- "test": "jest",
103
- "type-check": "tsc --noEmit --skipLibCheck",
104
- "lint": "biome check --diagnostic-level=error .",
105
- "lint:fix": "biome check --write .",
106
- "lint:staged": "biome check --staged --write .",
107
- "format": "biome format --write .",
108
- "format:check": "biome check --diagnostic-level=error .",
109
- "validate": "pnpm run type-check && pnpm run lint && pnpm run test && pnpm run check-links && pnpm run format:check",
110
- "dev": "tsc -w -p tsconfig.json & tsc-alias -w -p tsconfig.json",
111
- "read-github": "NODE_OPTIONS=\"-r tsconfig-paths/register\" tsx scripts/read-github-cookies.ts",
112
- "docs": "typedoc && ./scripts/fix-typedoc.sh && vitepress build docs",
113
- "docs:dev": "vitepress dev docs",
114
- "docs:preview": "vitepress preview docs",
115
- "check-links": "./scripts/check-vitepress-links.sh"
116
135
  }
117
- }
136
+ }
package/tsconfig.cli.json CHANGED
@@ -7,6 +7,10 @@
7
7
  "moduleResolution": "bundler",
8
8
  "composite": false,
9
9
  "declaration": true,
10
- "declarationMap": true
10
+ "declarationMap": true,
11
+ "strict": true,
12
+ "noEmitOnError": true,
13
+ "isolatedModules": true,
14
+ "verbatimModuleSyntax": false
11
15
  }
12
16
  }
package/tsup.cli.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { execSync } from "node:child_process";
2
+
1
3
  import { defineConfig } from "tsup";
2
4
 
3
5
  /**
@@ -12,7 +14,14 @@ import { defineConfig } from "tsup";
12
14
  export default defineConfig({
13
15
  entry: ["src/cli/cli.ts"],
14
16
  format: ["cjs"],
15
- dts: true,
17
+ dts: {
18
+ resolve: true,
19
+ entry: ["src/cli/cli.ts"],
20
+ compilerOptions: {
21
+ strict: true,
22
+ noEmitOnError: true,
23
+ },
24
+ },
16
25
  clean: false,
17
26
  sourcemap: true,
18
27
  minify: true,
@@ -20,9 +29,30 @@ export default defineConfig({
20
29
  bundle: true,
21
30
  tsconfig: "./tsconfig.cli.json",
22
31
  noExternal: ["lodash-es"],
32
+ treeshake: true,
33
+ splitting: false,
34
+ skipNodeModulesBundle: true,
23
35
  esbuildOptions(options) {
24
36
  options.alias = {
25
37
  lodash: "lodash-es",
26
38
  };
39
+ // Inject build timestamp at compile time
40
+ const now = new Date();
41
+ const timestamp = now.toISOString().replace("T", " ").slice(0, 19);
42
+
43
+ // Try to get git branch name
44
+ let gitBranch = "local";
45
+ try {
46
+ gitBranch = execSync("git rev-parse --abbrev-ref HEAD", {
47
+ encoding: "utf8",
48
+ }).trim();
49
+ } catch {
50
+ // Ignore git errors
51
+ }
52
+
53
+ options.define = {
54
+ ...options.define,
55
+ BUILD_TIMESTAMP: JSON.stringify(`${timestamp} UTC (${gitBranch})`),
56
+ };
27
57
  },
28
58
  });
package/tsup.lib.ts CHANGED
@@ -12,7 +12,14 @@ import { defineConfig } from "tsup";
12
12
  export default defineConfig({
13
13
  entry: ["src/index.ts"],
14
14
  format: ["cjs", "esm"],
15
- dts: true,
15
+ dts: {
16
+ resolve: true,
17
+ entry: ["src/index.ts"],
18
+ compilerOptions: {
19
+ strict: true,
20
+ noEmitOnError: true,
21
+ },
22
+ },
16
23
  clean: true,
17
24
  sourcemap: true,
18
25
  minify: true,
@@ -20,6 +27,9 @@ export default defineConfig({
20
27
  bundle: true,
21
28
  tsconfig: "./tsconfig.tsup.json",
22
29
  external: ["fs", "path", "crypto", "os", "child_process", "lodash-es"],
30
+ treeshake: true,
31
+ splitting: false,
32
+ skipNodeModulesBundle: true,
23
33
  esbuildOptions(options) {
24
34
  options.alias = {
25
35
  lodash: "lodash-es",