@mherod/get-cookie 2.1.3 → 4.0.2

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 (109) hide show
  1. package/.husky/commit-msg +2 -0
  2. package/.husky/pre-commit +4 -0
  3. package/.husky/pre-push +4 -0
  4. package/README.md +163 -18
  5. package/commitlint.config.js +12 -0
  6. package/dist/chunk-56Z35D5R.js +2 -0
  7. package/dist/chunk-56Z35D5R.js.map +1 -0
  8. package/dist/chunk-5FUMK7M3.js +4 -0
  9. package/dist/chunk-5FUMK7M3.js.map +1 -0
  10. package/dist/chunk-5ZT2G45S.js +2 -0
  11. package/dist/chunk-5ZT2G45S.js.map +1 -0
  12. package/dist/chunk-FR2MKDHT.js +2 -0
  13. package/dist/chunk-FR2MKDHT.js.map +1 -0
  14. package/dist/chunk-HMKSQBDC.js +2 -0
  15. package/dist/chunk-HMKSQBDC.js.map +1 -0
  16. package/dist/chunk-VMBA4NVU.js +2 -0
  17. package/dist/chunk-VMBA4NVU.js.map +1 -0
  18. package/dist/chunk-W3JALMAX.js +2 -0
  19. package/dist/chunk-W3JALMAX.js.map +1 -0
  20. package/dist/cli.cjs +19 -0
  21. package/dist/cli.cjs.map +1 -0
  22. package/dist/cli.d.cts +1 -0
  23. package/dist/getChromeCookie-4ZWACG6M.js +2 -0
  24. package/dist/getChromeCookie-4ZWACG6M.js.map +1 -0
  25. package/dist/getChromePassword-GTIXL733.js +2 -0
  26. package/dist/getChromePassword-GTIXL733.js.map +1 -0
  27. package/dist/getCookie-43FKMQEZ.js +2 -0
  28. package/dist/getCookie-43FKMQEZ.js.map +1 -0
  29. package/dist/getFirefoxCookie-OJYYZFZP.js +2 -0
  30. package/dist/getFirefoxCookie-OJYYZFZP.js.map +1 -0
  31. package/dist/getGroupedRenderedCookies-P5VZXZUC.js +2 -0
  32. package/dist/getGroupedRenderedCookies-P5VZXZUC.js.map +1 -0
  33. package/dist/getMergedRenderedCookies-C6TXK2I4.js +2 -0
  34. package/dist/getMergedRenderedCookies-C6TXK2I4.js.map +1 -0
  35. package/dist/index.cjs +4 -0
  36. package/dist/index.cjs.map +1 -0
  37. package/dist/index.d.cts +252 -0
  38. package/dist/index.d.ts +252 -0
  39. package/dist/index.js +2 -24712
  40. package/dist/index.js.map +1 -0
  41. package/eslint.config.js +243 -0
  42. package/jest.setup.js +11 -0
  43. package/package.json +87 -36
  44. package/tsconfig.build.json +9 -0
  45. package/tsup.cli.ts +27 -0
  46. package/tsup.config.ts +27 -0
  47. package/tsup.lib.ts +27 -0
  48. package/typedoc.json +22 -0
  49. package/.parcelrc +0 -7
  50. package/.prettierignore +0 -5
  51. package/.prettierrc +0 -12
  52. package/.terserrc +0 -26
  53. package/build-indexes.ts +0 -108
  54. package/bun.lockb +0 -0
  55. package/dist/cli.js +0 -18319
  56. package/dist/types.d.ts +0 -361
  57. package/jest.config.ts +0 -14
  58. package/package-lock.json +0 -5608
  59. package/src/CookieRow.ts +0 -43
  60. package/src/CookieSpec.ts +0 -42
  61. package/src/ExportedCookie.ts +0 -19
  62. package/src/FetchResponse.ts +0 -13
  63. package/src/SpecialCases.ts +0 -15
  64. package/src/StringToRegex.ts +0 -16
  65. package/src/argv.ts +0 -30
  66. package/src/browsers/CompositeCookieQueryStrategy.ts +0 -76
  67. package/src/browsers/CookieQueryStrategy.ts +0 -7
  68. package/src/browsers/CookieStoreQueryStrategy.ts +0 -115
  69. package/src/browsers/QuerySqliteThenTransform.ts +0 -48
  70. package/src/browsers/chrome/ChromeApplicationSupport.ts +0 -14
  71. package/src/browsers/chrome/ChromeCookieQueryStrategy.ts +0 -158
  72. package/src/browsers/chrome/decrypt.ts +0 -154
  73. package/src/browsers/chrome/getChromePassword.ts +0 -28
  74. package/src/browsers/firefox/FirefoxCookieQueryStrategy.ts +0 -109
  75. package/src/browsers/getEncryptedChromeCookie.ts +0 -122
  76. package/src/browsers/index.ts +0 -12
  77. package/src/browsers/mock/MockCookieQueryStrategy.ts +0 -22
  78. package/src/browsers/safari/SafariCookieQueryStrategy.ts +0 -42
  79. package/src/cli.ts +0 -94
  80. package/src/cliQueryCookies.ts +0 -65
  81. package/src/comboQueryCookieSpec.test.ts +0 -92
  82. package/src/comboQueryCookieSpec.ts +0 -26
  83. package/src/cookieQueryOptions.ts +0 -27
  84. package/src/cookieSpecsFromUrl.test.ts +0 -65
  85. package/src/cookieSpecsFromUrl.ts +0 -73
  86. package/src/decodeBinaryCookies.ts +0 -72
  87. package/src/execSimple.ts +0 -12
  88. package/src/fetchWithCookies.test.ts +0 -32
  89. package/src/fetchWithCookies.ts +0 -217
  90. package/src/findAllFiles.ts +0 -48
  91. package/src/getChromeCookie.ts +0 -19
  92. package/src/getCookie.ts +0 -22
  93. package/src/getFirefoxCookie.ts +0 -25
  94. package/src/getGroupedRenderedCookies.ts +0 -42
  95. package/src/getMergedRenderedCookies.test.ts +0 -43
  96. package/src/getMergedRenderedCookies.ts +0 -19
  97. package/src/global.ts +0 -8
  98. package/src/index.ts +0 -16
  99. package/src/isValidJwt.ts +0 -26
  100. package/src/listChromeProfiles.ts +0 -53
  101. package/src/logger.ts +0 -12
  102. package/src/processBeforeReturn.ts +0 -29
  103. package/src/queryCookies.ts +0 -41
  104. package/src/resultsRendered.ts +0 -24
  105. package/src/unpackHeaders.ts +0 -18
  106. package/src/util/flatMapAsync.test.ts +0 -55
  107. package/src/util/flatMapAsync.ts +0 -41
  108. package/src/util/index.ts +0 -1
  109. package/tsconfig.json +0 -26
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/cookies/dynamicImports.ts"],"sourcesContent":["import type { RenderOptions } from \"../../types/CookieRender\";\nimport type { CookieSpec } from \"../../types/CookieSpec\";\nimport type { ExportedCookie } from \"../../types/ExportedCookie\";\n\n/**\n * Dynamic import for the getCookie function.\n * @internal\n * @returns Promise resolving to the getCookie function\n * @example\n * ```typescript\n * const getCookieFn = await getCookie();\n * const cookies = await getCookieFn({ domain: 'example.com' });\n * // Returns: [{ name: 'sessionId', value: 'abc123', domain: 'example.com' }, ...]\n * ```\n */\nexport const getCookie = (): Promise<\n (cookieSpec: CookieSpec) => Promise<ExportedCookie[]>\n> => import(\"./getCookie\").then((module) => module.getCookie);\n\n/**\n * Dynamic import for Chrome-specific cookie retrieval.\n * @internal\n * @returns Promise resolving to the getChromeCookie function\n * @example\n * ```typescript\n * const chromeCookieFn = await getChromeCookie();\n * const cookies = await chromeCookieFn({ domain: 'example.com', secure: true });\n * // Returns Chrome-format cookies: [{ name: 'auth', value: 'xyz789', secure: true }, ...]\n * ```\n */\nexport const getChromeCookie = (): Promise<\n (cookieSpec: CookieSpec) => Promise<ExportedCookie[]>\n> => import(\"./getChromeCookie\").then((module) => module.getChromeCookie);\n\n/**\n * Dynamic import for Firefox-specific cookie retrieval.\n * @internal\n * @returns Promise resolving to the getFirefoxCookie function\n * @example\n * ```typescript\n * const firefoxCookieFn = await getFirefoxCookie();\n * const cookies = await firefoxCookieFn({ path: '/api' });\n * // Returns Firefox-format cookies: [{ name: 'token', value: 'def456', path: '/api' }, ...]\n * ```\n */\nexport const getFirefoxCookie = (): Promise<\n (cookieSpec: CookieSpec) => Promise<ExportedCookie[]>\n> => import(\"./getFirefoxCookie\").then((module) => module.getFirefoxCookie);\n\n/**\n * Dynamic import for retrieving grouped and rendered cookies.\n * @internal\n * @returns Promise resolving to the getGroupedRenderedCookies function\n * @example\n * ```typescript\n * const groupedCookiesFn = await getGroupedRenderedCookies();\n * const cookieStrings = await groupedCookiesFn({ domain: 'example.com' });\n * // Returns: ['sessionId=abc123; Domain=example.com', 'auth=xyz789; Domain=example.com']\n * ```\n */\nexport const getGroupedRenderedCookies = (): Promise<\n (cookieSpec: CookieSpec) => Promise<string[]>\n> =>\n import(\"./getGroupedRenderedCookies\").then(\n (module) => module.getGroupedRenderedCookies,\n );\n\n/**\n * Dynamic import for retrieving merged and rendered cookies.\n * @internal\n * @returns Promise resolving to the getMergedRenderedCookies function\n * @example\n * ```typescript\n * const mergedCookiesFn = await getMergedRenderedCookies();\n * const cookieString = await mergedCookiesFn(\n * { domain: 'example.com' },\n * { separator: '; ' }\n * );\n * // Returns: \"sessionId=abc123; auth=xyz789\"\n * ```\n */\nexport const getMergedRenderedCookies = (): Promise<\n (\n cookieSpec: CookieSpec,\n options?: Omit<RenderOptions, \"format\">,\n ) => Promise<string>\n> =>\n import(\"./getMergedRenderedCookies\").then(\n (module) => module.getMergedRenderedCookies,\n );\n"],"mappings":"4BAeO,IAAMA,EAAY,IAEpB,OAAO,yBAAa,EAAE,KAAMC,GAAWA,EAAO,SAAS,EAa/CC,EAAkB,IAE1B,OAAO,+BAAmB,EAAE,KAAMD,GAAWA,EAAO,eAAe,EAa3DE,EAAmB,IAE3B,OAAO,gCAAoB,EAAE,KAAMF,GAAWA,EAAO,gBAAgB,EAa7DG,EAA4B,IAGvC,OAAO,yCAA6B,EAAE,KACnCH,GAAWA,EAAO,yBACrB,EAgBWI,EAA2B,IAMtC,OAAO,wCAA4B,EAAE,KAClCJ,GAAWA,EAAO,wBACrB","names":["getCookie","module","getChromeCookie","getFirefoxCookie","getGroupedRenderedCookies","getMergedRenderedCookies"]}
@@ -0,0 +1,243 @@
1
+ import tsParser from "@typescript-eslint/parser";
2
+ import tsPlugin from "@typescript-eslint/eslint-plugin";
3
+ import importPlugin from "eslint-plugin-import";
4
+ import jsdocPlugin from "eslint-plugin-jsdoc";
5
+ import globals from "globals";
6
+
7
+ export default [
8
+ {
9
+ ignores: ["dist/**/*", "node_modules/**/*"],
10
+ },
11
+ {
12
+ files: ["**/*.js", "**/*.mjs"],
13
+ languageOptions: {
14
+ ecmaVersion: "latest",
15
+ sourceType: "module",
16
+ globals: {
17
+ ...globals.node,
18
+ },
19
+ },
20
+ },
21
+ {
22
+ files: ["**/*.ts"],
23
+ languageOptions: {
24
+ parser: tsParser,
25
+ parserOptions: {
26
+ ecmaVersion: "latest",
27
+ sourceType: "module",
28
+ project: ["./tsconfig.json", "./tsconfig.build.json"],
29
+ tsconfigRootDir: import.meta.dirname,
30
+ },
31
+ globals: {
32
+ ...globals.node,
33
+ ...globals.es2022,
34
+ },
35
+ },
36
+ plugins: {
37
+ "@typescript-eslint": tsPlugin,
38
+ import: importPlugin,
39
+ jsdoc: jsdocPlugin,
40
+ },
41
+ rules: {
42
+ ...tsPlugin.configs.recommended.rules,
43
+ ...tsPlugin.configs["recommended-requiring-type-checking"].rules,
44
+ ...tsPlugin.configs.strict.rules,
45
+ ...importPlugin.configs.typescript.rules,
46
+ ...jsdocPlugin.configs["recommended-typescript"].rules,
47
+ "@typescript-eslint/explicit-function-return-type": [
48
+ "error",
49
+ {
50
+ allowExpressions: true,
51
+ allowTypedFunctionExpressions: true,
52
+ },
53
+ ],
54
+ "@typescript-eslint/no-explicit-any": "error",
55
+ "@typescript-eslint/explicit-member-accessibility": [
56
+ "error",
57
+ {
58
+ accessibility: "explicit",
59
+ },
60
+ ],
61
+ "@typescript-eslint/no-floating-promises": "error",
62
+ "@typescript-eslint/no-misused-promises": "error",
63
+ "@typescript-eslint/await-thenable": "error",
64
+ "@typescript-eslint/no-unnecessary-type-assertion": "error",
65
+ "@typescript-eslint/prefer-nullish-coalescing": "error",
66
+ "@typescript-eslint/prefer-optional-chain": "error",
67
+ "@typescript-eslint/strict-boolean-expressions": "error",
68
+ "@typescript-eslint/no-unnecessary-condition": "error",
69
+ "import/order": [
70
+ "error",
71
+ {
72
+ groups: [
73
+ "builtin",
74
+ "external",
75
+ "internal",
76
+ "parent",
77
+ "sibling",
78
+ "index",
79
+ ],
80
+ pathGroups: [
81
+ {
82
+ pattern: "@core/**",
83
+ group: "internal",
84
+ },
85
+ {
86
+ pattern: "@utils/**",
87
+ group: "internal",
88
+ },
89
+ {
90
+ pattern: "@/**",
91
+ group: "internal",
92
+ },
93
+ ],
94
+ pathGroupsExcludedImportTypes: ["builtin"],
95
+ "newlines-between": "always",
96
+ alphabetize: { order: "asc", caseInsensitive: true },
97
+ },
98
+ ],
99
+ "import/newline-after-import": "error",
100
+ "no-prototype-builtins": "error",
101
+ "@typescript-eslint/no-unused-vars": [
102
+ "error",
103
+ {
104
+ argsIgnorePattern: "^_",
105
+ varsIgnorePattern: "^_",
106
+ destructuredArrayIgnorePattern: "^_",
107
+ caughtErrorsIgnorePattern: "^_",
108
+ },
109
+ ],
110
+ "no-useless-catch": "error",
111
+ "@typescript-eslint/ban-ts-comment": [
112
+ "error",
113
+ {
114
+ "ts-expect-error": "allow-with-description",
115
+ "ts-ignore": false,
116
+ "ts-nocheck": false,
117
+ "ts-check": false,
118
+ minimumDescriptionLength: 10,
119
+ },
120
+ ],
121
+ "jsdoc/require-jsdoc": [
122
+ "error",
123
+ {
124
+ publicOnly: true,
125
+ require: {
126
+ ArrowFunctionExpression: true,
127
+ ClassDeclaration: true,
128
+ ClassExpression: true,
129
+ FunctionDeclaration: true,
130
+ MethodDefinition: true,
131
+ },
132
+ contexts: [
133
+ "ExportDefaultDeclaration",
134
+ "ExportNamedDeclaration",
135
+ "TSInterfaceDeclaration",
136
+ "TSTypeAliasDeclaration",
137
+ "TSEnumDeclaration",
138
+ "PropertyDefinition",
139
+ ],
140
+ },
141
+ ],
142
+ "jsdoc/require-description": [
143
+ "error",
144
+ {
145
+ contexts: ["any"],
146
+ checkConstructors: true,
147
+ checkGetters: true,
148
+ checkSetters: true,
149
+ exemptedBy: ["internal", "private", "test"],
150
+ },
151
+ ],
152
+ "jsdoc/require-description-complete-sentence": "off",
153
+ "jsdoc/check-line-alignment": "error",
154
+ "jsdoc/check-syntax": "error",
155
+ "jsdoc/check-values": "error",
156
+ "jsdoc/check-types": "error",
157
+ "jsdoc/check-property-names": "error",
158
+ "jsdoc/check-indentation": "error",
159
+ "jsdoc/multiline-blocks": "error",
160
+ "jsdoc/require-hyphen-before-param-description": "error",
161
+ "jsdoc/require-throws": "error",
162
+ "jsdoc/require-yields": "error",
163
+ "jsdoc/sort-tags": "error",
164
+ "jsdoc/check-examples": "off",
165
+ "jsdoc/require-example": [
166
+ "error",
167
+ {
168
+ contexts: [
169
+ "ExportDefaultDeclaration",
170
+ "ExportNamedDeclaration:not(TSTypeAliasDeclaration)",
171
+ "ExportNamedDeclaration:not(TSInterfaceDeclaration)",
172
+ "FunctionDeclaration",
173
+ "MethodDefinition",
174
+ ],
175
+ exemptedBy: ["internal", "private", "test"],
176
+ exemptNoArguments: true,
177
+ checkConstructors: true,
178
+ checkGetters: true,
179
+ checkSetters: true,
180
+ },
181
+ ],
182
+ "jsdoc/check-tag-names": [
183
+ "error",
184
+ {
185
+ definedTags: [
186
+ "remarks",
187
+ "internal",
188
+ "private",
189
+ "test",
190
+ "throws",
191
+ "yields",
192
+ "example",
193
+ ],
194
+ },
195
+ ],
196
+ "jsdoc/require-param-type": "off",
197
+ "jsdoc/require-returns-type": "off",
198
+ "jsdoc/require-property": "error",
199
+ "jsdoc/require-property-description": "error",
200
+ "jsdoc/require-property-name": "error",
201
+ "jsdoc/require-property-type": "off",
202
+ "jsdoc/require-returns": [
203
+ "error",
204
+ {
205
+ checkGetters: true,
206
+ checkConstructors: false,
207
+ },
208
+ ],
209
+ "jsdoc/check-param-names": [
210
+ "error",
211
+ {
212
+ checkRestProperty: true,
213
+ enableFixer: true,
214
+ },
215
+ ],
216
+ "jsdoc/require-param-description": "error",
217
+ "jsdoc/require-returns-description": "error",
218
+ eqeqeq: ["error", "always"],
219
+ "no-return-await": "error",
220
+ "prefer-const": "error",
221
+ "no-var": "error",
222
+ curly: ["error", "all"],
223
+ "max-depth": ["error", 3],
224
+ "max-lines-per-function": ["error", { max: 50 }],
225
+ complexity: ["error", 10],
226
+ "jsdoc/no-types": "off",
227
+ },
228
+ },
229
+ {
230
+ files: [
231
+ "**/__tests__/**",
232
+ "**/__mocks__/**",
233
+ "**/tests/**",
234
+ "**/utils/**",
235
+ "**/types/**",
236
+ "**/browsers/**",
237
+ ],
238
+ rules: {
239
+ "jsdoc/require-example": "off",
240
+ "jsdoc/require-description": "off",
241
+ },
242
+ },
243
+ ];
package/jest.setup.js ADDED
@@ -0,0 +1,11 @@
1
+ const lodash = require("lodash");
2
+
3
+ jest.mock("lodash-es", () => lodash);
4
+ jest.mock("lodash-es/merge", () => require("lodash/merge"));
5
+ jest.mock("lodash-es/memoize", () => require("lodash/memoize"));
6
+ jest.mock("lodash-es/uniqBy", () => require("lodash/uniqBy"));
7
+
8
+ // Mock the logger
9
+ jest.mock("@utils/logger");
10
+
11
+ // Add any other global setup here
package/package.json CHANGED
@@ -1,56 +1,107 @@
1
1
  {
2
2
  "name": "@mherod/get-cookie",
3
- "version": "2.1.3",
3
+ "version": "4.0.2",
4
4
  "description": "Node.js module for querying a local user's Chrome cookie",
5
+ "type": "module",
5
6
  "source": "src/index.ts",
6
- "bin": "dist/cli.js",
7
+ "bin": {
8
+ "get-cookie": "./dist/cli.cjs"
9
+ },
7
10
  "main": "dist/index.js",
8
- "types": "dist/types.d.ts",
11
+ "types": "dist/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.mjs",
16
+ "require": "./dist/index.js"
17
+ },
18
+ "./cli": {
19
+ "types": "./dist/cli/cli.d.ts",
20
+ "import": "./dist/cli/cli.mjs",
21
+ "require": "./dist/cli/cli.js"
22
+ }
23
+ },
9
24
  "publishConfig": {
10
25
  "access": "public"
11
26
  },
12
- "scripts": {
13
- "clean": "git clean -fdX && rm -rf dist && yarn install",
14
- "tsc": "tsc",
15
- "build": "bun build src/index.ts --target=node --outdir=dist && bun build src/cli.ts --target=node --outdir=dist && tsc --emitDeclarationOnly",
16
- "test": "jest",
17
- "prepublish": "bun run build",
18
- "install:global": "bun run build && npm install --global .",
19
- "prettier": "prettier --write .",
20
- "copy-files": "cp -r src/cli.js dist/cli.js && cp -r src/index.js dist/index.js && cp -r src/types.d.ts dist/types.d.ts"
21
- },
22
27
  "engines": {
23
- "node": ">= 16"
28
+ "node": "^20.0.0 || ^22.0.0"
24
29
  },
25
30
  "keywords": [],
26
31
  "author": "Matthew Herod",
27
32
  "license": "ISC",
28
33
  "dependencies": {
29
- "consola": "3.2.3",
30
- "cross-fetch": "^4.0.0",
31
- "destr": "2.0.2",
32
- "fast-glob": "^3.3.1",
33
- "jsonwebtoken": "9.0.0",
34
- "lodash": "^4.17.21",
34
+ "better-sqlite3": "^11.7.0",
35
+ "consola": "^3.3.3",
36
+ "destr": "^2.0.3",
37
+ "fast-glob": "^3.3.2",
38
+ "jsonwebtoken": "^9.0.2",
35
39
  "lodash-es": "^4.17.21",
36
- "lru-cache": "^7.14.0",
37
- "minimist": "^1.2.7",
38
- "tough-cookie": "^4.1.2"
40
+ "lru-cache": "^11.0.2",
41
+ "minimist": "^1.2.8",
42
+ "tough-cookie": "^5.0.0",
43
+ "tsconfig-paths": "^4.2.0",
44
+ "zod": "^3.24.1"
39
45
  },
40
46
  "devDependencies": {
47
+ "@commitlint/cli": "19.6.1",
48
+ "@commitlint/config-conventional": "19.6.0",
41
49
  "@jest/globals": "^29.7.0",
42
- "@types/bun": "^1.1.3",
43
- "@types/jest": "^29.5.6",
44
- "@types/jsonwebtoken": "^8.5.9",
45
- "@types/lodash": "^4.14.186",
46
- "@types/minimist": "^1.2.2",
47
- "@types/node": "^18.19.34",
48
- "@types/tough-cookie": "^4.0.2",
49
- "@types/user-agents": "^1.0.2",
50
+ "@types/better-sqlite3": "^7.6.12",
51
+ "@types/jest": "^29.5.14",
52
+ "@types/jsonwebtoken": "^9.0.7",
53
+ "@types/lodash": "^4.17.13",
54
+ "@types/lodash-es": "4.17.12",
55
+ "@types/minimist": "^1.2.5",
56
+ "@types/node": "^22.10.4",
57
+ "@types/tough-cookie": "^4.0.5",
58
+ "@typescript-eslint/eslint-plugin": "^8.19.0",
59
+ "@typescript-eslint/parser": "^8.19.0",
60
+ "eslint": "^9.17.0",
61
+ "eslint-formatter-codeframe": "^7.32.1",
62
+ "eslint-import-resolver-typescript": "^3.7.0",
63
+ "eslint-plugin-import": "^2.31.0",
64
+ "eslint-plugin-jsdoc": "^50.6.1",
65
+ "globals": "15.14.0",
66
+ "husky": "^9.1.7",
50
67
  "jest": "^29.7.0",
51
- "prettier": "^3.0.3",
52
- "ts-jest": "^29.1.1",
53
- "ts-node": "^10.9.1",
54
- "typescript": "^5.1.6"
68
+ "lint-staged": "^15.3.0",
69
+ "lodash": "4.17.21",
70
+ "prettier": "^3.4.2",
71
+ "ts-jest": "^29.2.5",
72
+ "ts-node": "^10.9.2",
73
+ "tsc-alias": "^1.8.10",
74
+ "tsup": "^8.3.5",
75
+ "tsx": "4.19.2",
76
+ "typedoc": "^0.27.6",
77
+ "typedoc-plugin-markdown": "^4.4.1",
78
+ "typescript": "^5.7.2",
79
+ "vitepress": "^1.5.0"
80
+ },
81
+ "lint-staged": {
82
+ "*.{js,ts}": [
83
+ "eslint --fix --format=codeframe",
84
+ "prettier --write"
85
+ ],
86
+ "*.{json,md,yml,yaml}": [
87
+ "prettier --write"
88
+ ]
89
+ },
90
+ "scripts": {
91
+ "clean": "rm -rf dist",
92
+ "build:lib": "tsup --config tsup.lib.ts",
93
+ "build:cli": "tsup --config tsup.cli.ts",
94
+ "build": "pnpm run build:lib && pnpm run build:cli",
95
+ "test": "jest",
96
+ "type-check": "tsc --noEmit",
97
+ "lint": "eslint . --format=codeframe",
98
+ "lint:fix": "eslint . --format=codeframe --fix",
99
+ "validate": "pnpm run type-check && pnpm run lint && pnpm run test",
100
+ "format": "prettier --write .",
101
+ "dev": "tsc -w -p tsconfig.json & tsc-alias -w -p tsconfig.json",
102
+ "read-github": "NODE_OPTIONS=\"-r tsconfig-paths/register\" tsx scripts/readGithubCookies.ts",
103
+ "docs": "typedoc && ./scripts/fix-typedoc.sh && vitepress build docs",
104
+ "docs:dev": "vitepress dev docs",
105
+ "docs:preview": "vitepress preview docs"
55
106
  }
56
- }
107
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "include": ["jest.config.ts", "tsup.*.ts"],
4
+ "exclude": ["node_modules", "dist"],
5
+ "compilerOptions": {
6
+ "module": "ESNext",
7
+ "moduleResolution": "bundler"
8
+ }
9
+ }
package/tsup.cli.ts ADDED
@@ -0,0 +1,27 @@
1
+ import { defineConfig } from "tsup";
2
+
3
+ /**
4
+ * Configuration for building the CLI bundle
5
+ * @example
6
+ * ```typescript
7
+ * // Build the CLI bundle
8
+ * import config from './tsup.cli';
9
+ * await build(config);
10
+ * ```
11
+ */
12
+ export default defineConfig({
13
+ entry: ["src/cli/cli.ts"],
14
+ format: ["cjs"],
15
+ dts: true,
16
+ clean: false,
17
+ sourcemap: true,
18
+ minify: true,
19
+ platform: "node",
20
+ bundle: true,
21
+ noExternal: ["lodash-es"],
22
+ esbuildOptions(options) {
23
+ options.alias = {
24
+ lodash: "lodash-es",
25
+ };
26
+ },
27
+ });
package/tsup.config.ts ADDED
@@ -0,0 +1,27 @@
1
+ import { defineConfig } from "tsup";
2
+
3
+ /**
4
+ * Main configuration for building both library and CLI bundles
5
+ * @example
6
+ * ```typescript
7
+ * // Build both library and CLI bundles
8
+ * import config from './tsup.config';
9
+ * await build(config);
10
+ * ```
11
+ */
12
+ export default defineConfig({
13
+ entry: ["src/index.ts", "src/cli/cli.ts"],
14
+ format: ["cjs", "esm"],
15
+ dts: true,
16
+ clean: true,
17
+ sourcemap: true,
18
+ minify: true,
19
+ platform: "node",
20
+ bundle: true,
21
+ external: ["fs", "path", "crypto", "os", "child_process"],
22
+ esbuildOptions(options) {
23
+ options.alias = {
24
+ lodash: "lodash-es",
25
+ };
26
+ },
27
+ });
package/tsup.lib.ts ADDED
@@ -0,0 +1,27 @@
1
+ import { defineConfig } from "tsup";
2
+
3
+ /**
4
+ * Configuration for building the library bundle
5
+ * @example
6
+ * ```typescript
7
+ * // Build the library bundle
8
+ * import config from './tsup.lib';
9
+ * await build(config);
10
+ * ```
11
+ */
12
+ export default defineConfig({
13
+ entry: ["src/index.ts"],
14
+ format: ["cjs", "esm"],
15
+ dts: true,
16
+ clean: true,
17
+ sourcemap: true,
18
+ minify: true,
19
+ platform: "node",
20
+ bundle: true,
21
+ external: ["fs", "path", "crypto", "os", "child_process"],
22
+ esbuildOptions(options) {
23
+ options.alias = {
24
+ lodash: "lodash-es",
25
+ };
26
+ },
27
+ });
package/typedoc.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "$schema": "https://typedoc.org/schema.json",
3
+ "entryPoints": [
4
+ "src/index.ts",
5
+ "src/cli/cli.ts",
6
+ "src/types/ExportedCookie.ts",
7
+ "src/types/CookieSpec.ts",
8
+ "src/types/CookieRender.ts"
9
+ ],
10
+ "out": "docs/reference",
11
+ "plugin": ["typedoc-plugin-markdown"],
12
+ "readme": "none",
13
+ "cleanOutputDir": true,
14
+ "githubPages": false,
15
+ "hideBreadcrumbs": true,
16
+ "excludePrivate": true,
17
+ "excludeProtected": true,
18
+ "excludeExternals": true,
19
+ "includeVersion": true,
20
+ "categorizeByGroup": true,
21
+ "categoryOrder": ["Core", "Browsers", "CLI", "*"]
22
+ }
package/.parcelrc DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "@parcel/config-default",
3
- "transformers": {
4
- "*.{ts,tsx}": ["@parcel/transformer-typescript-tsc", "..."],
5
- "*": ["..."]
6
- }
7
- }
package/.prettierignore DELETED
@@ -1,5 +0,0 @@
1
- .idea/**/workspace.xml
2
- *.log
3
- node_modules/
4
- .parcel-cache
5
- dist
package/.prettierrc DELETED
@@ -1,12 +0,0 @@
1
- {
2
- "useTabs": false,
3
- "overrides": [
4
- {
5
- "files": [".prettierrc", ".parcelrc"],
6
- "options": {
7
- "parser": "json",
8
- "tabWidth": 2
9
- }
10
- }
11
- ]
12
- }
package/.terserrc DELETED
@@ -1,26 +0,0 @@
1
- {
2
- "toplevel": true,
3
- "keep_fnames": true,
4
- "keep_classnames": true,
5
- "parse": {
6
- "bare_returns": true,
7
- "html5_comments": true,
8
- "shebang": true,
9
- },
10
- "compress": {
11
- "drop_console": false,
12
- "toplevel": true,
13
- "evaluate": true,
14
- "passes": 3,
15
- "keep_fnames": true,
16
- "keep_classnames": true,
17
- "hoist_funs": true,
18
- },
19
- "mangle": {
20
- "toplevel": true,
21
- },
22
- "format": {
23
- "comments": false,
24
- "beautify": false,
25
- }
26
- }