@mherod/get-cookie 2.1.2 → 4.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/.husky/commit-msg +2 -0
- package/.husky/pre-commit +4 -0
- package/.husky/pre-push +4 -0
- package/README.md +163 -18
- package/commitlint.config.js +12 -0
- package/dist/chunk-4I5M3M7H.js +6 -0
- package/dist/chunk-4I5M3M7H.js.map +1 -0
- package/dist/chunk-ACXFQWII.js +2 -0
- package/dist/chunk-ACXFQWII.js.map +1 -0
- package/dist/chunk-BKU5PKJ5.js +2 -0
- package/dist/chunk-BKU5PKJ5.js.map +1 -0
- package/dist/chunk-DR2EQC4R.js +2 -0
- package/dist/chunk-DR2EQC4R.js.map +1 -0
- package/dist/chunk-FZ5IFH4R.js +2 -0
- package/dist/chunk-FZ5IFH4R.js.map +1 -0
- package/dist/chunk-S5FU4HO5.js +2 -0
- package/dist/chunk-S5FU4HO5.js.map +1 -0
- package/dist/chunk-TUGIEFXM.js +2 -0
- package/dist/chunk-TUGIEFXM.js.map +1 -0
- package/dist/cli/cli.cjs +8 -0
- package/dist/cli/cli.cjs.map +1 -0
- package/dist/cli/cli.d.cts +1 -0
- package/dist/cli/cli.d.ts +1 -0
- package/dist/cli/cli.js +4 -0
- package/dist/cli/cli.js.map +1 -0
- package/dist/getChromeCookie-P623SIWB.js +2 -0
- package/dist/getChromeCookie-P623SIWB.js.map +1 -0
- package/dist/getChromePassword-74BC3LXO.js +2 -0
- package/dist/getChromePassword-74BC3LXO.js.map +1 -0
- package/dist/getCookie-FBQKCKJB.js +2 -0
- package/dist/getCookie-FBQKCKJB.js.map +1 -0
- package/dist/getFirefoxCookie-CGJJJ7VC.js +2 -0
- package/dist/getFirefoxCookie-CGJJJ7VC.js.map +1 -0
- package/dist/getGroupedRenderedCookies-RNB6DKBL.js +2 -0
- package/dist/getGroupedRenderedCookies-RNB6DKBL.js.map +1 -0
- package/dist/getMergedRenderedCookies-NC3UTOIC.js +2 -0
- package/dist/getMergedRenderedCookies-NC3UTOIC.js.map +1 -0
- package/dist/index.cjs +6 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +252 -0
- package/dist/index.d.ts +252 -0
- package/dist/index.js +2 -24914
- package/dist/index.js.map +1 -0
- package/eslint.config.js +243 -0
- package/jest.setup.js +4 -0
- package/package.json +81 -35
- package/tsconfig.build.json +5 -0
- package/typedoc.json +22 -0
- package/.parcelrc +0 -7
- package/.prettierignore +0 -5
- package/.prettierrc +0 -12
- package/.terserrc +0 -26
- package/build-indexes.ts +0 -108
- package/bun.lockb +0 -0
- package/dist/cli.js +0 -18319
- package/dist/types.d.ts +0 -361
- package/jest.config.ts +0 -14
- package/package-lock.json +0 -5608
- package/src/CookieRow.ts +0 -43
- package/src/CookieSpec.ts +0 -42
- package/src/ExportedCookie.ts +0 -19
- package/src/FetchResponse.ts +0 -13
- package/src/SpecialCases.ts +0 -15
- package/src/StringToRegex.ts +0 -16
- package/src/argv.ts +0 -30
- package/src/browsers/CompositeCookieQueryStrategy.ts +0 -76
- package/src/browsers/CookieQueryStrategy.ts +0 -7
- package/src/browsers/CookieStoreQueryStrategy.ts +0 -115
- package/src/browsers/QuerySqliteThenTransform.ts +0 -48
- package/src/browsers/chrome/ChromeApplicationSupport.ts +0 -14
- package/src/browsers/chrome/ChromeCookieQueryStrategy.ts +0 -158
- package/src/browsers/chrome/decrypt.ts +0 -154
- package/src/browsers/chrome/getChromePassword.ts +0 -28
- package/src/browsers/firefox/FirefoxCookieQueryStrategy.ts +0 -109
- package/src/browsers/getEncryptedChromeCookie.ts +0 -122
- package/src/browsers/index.ts +0 -12
- package/src/browsers/mock/MockCookieQueryStrategy.ts +0 -22
- package/src/browsers/safari/SafariCookieQueryStrategy.ts +0 -42
- package/src/cli.ts +0 -94
- package/src/cliQueryCookies.ts +0 -65
- package/src/comboQueryCookieSpec.test.ts +0 -92
- package/src/comboQueryCookieSpec.ts +0 -26
- package/src/cookieQueryOptions.ts +0 -27
- package/src/cookieSpecsFromUrl.test.ts +0 -65
- package/src/cookieSpecsFromUrl.ts +0 -73
- package/src/decodeBinaryCookies.ts +0 -72
- package/src/execSimple.ts +0 -12
- package/src/fetchWithCookies.test.ts +0 -32
- package/src/fetchWithCookies.ts +0 -217
- package/src/findAllFiles.ts +0 -48
- package/src/getChromeCookie.ts +0 -19
- package/src/getCookie.ts +0 -22
- package/src/getFirefoxCookie.ts +0 -25
- package/src/getGroupedRenderedCookies.ts +0 -42
- package/src/getMergedRenderedCookies.test.ts +0 -43
- package/src/getMergedRenderedCookies.ts +0 -19
- package/src/global.ts +0 -8
- package/src/index.ts +0 -26
- package/src/isValidJwt.ts +0 -26
- package/src/listChromeProfiles.ts +0 -53
- package/src/logger.ts +0 -12
- package/src/processBeforeReturn.ts +0 -29
- package/src/queryCookies.ts +0 -41
- package/src/resultsRendered.ts +0 -24
- package/src/unpackHeaders.ts +0 -18
- package/src/util/flatMapAsync.test.ts +0 -55
- package/src/util/flatMapAsync.ts +0 -41
- package/src/util/index.ts +0 -1
- 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"]}
|
package/eslint.config.js
ADDED
|
@@ -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
package/package.json
CHANGED
|
@@ -1,56 +1,102 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mherod/get-cookie",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
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": "dist/cli/cli.js",
|
|
7
8
|
"main": "dist/index.js",
|
|
8
|
-
"types": "dist/
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.mjs",
|
|
14
|
+
"require": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./cli": {
|
|
17
|
+
"types": "./dist/cli/cli.d.ts",
|
|
18
|
+
"import": "./dist/cli/cli.mjs",
|
|
19
|
+
"require": "./dist/cli/cli.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
9
22
|
"publishConfig": {
|
|
10
23
|
"access": "public"
|
|
11
24
|
},
|
|
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
25
|
"engines": {
|
|
23
|
-
"node": "
|
|
26
|
+
"node": "^20.0.0 || ^22.0.0"
|
|
24
27
|
},
|
|
25
28
|
"keywords": [],
|
|
26
29
|
"author": "Matthew Herod",
|
|
27
30
|
"license": "ISC",
|
|
28
31
|
"dependencies": {
|
|
29
|
-
"consola": "3.
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"jsonwebtoken": "9.0.0",
|
|
32
|
+
"consola": "^3.3.3",
|
|
33
|
+
"destr": "^2.0.3",
|
|
34
|
+
"fast-glob": "^3.3.2",
|
|
35
|
+
"jsonwebtoken": "^9.0.2",
|
|
34
36
|
"lodash": "^4.17.21",
|
|
35
37
|
"lodash-es": "^4.17.21",
|
|
36
|
-
"lru-cache": "^
|
|
37
|
-
"minimist": "^1.2.
|
|
38
|
-
"tough-cookie": "^
|
|
38
|
+
"lru-cache": "^11.0.2",
|
|
39
|
+
"minimist": "^1.2.8",
|
|
40
|
+
"tough-cookie": "^5.0.0",
|
|
41
|
+
"tsconfig-paths": "^4.2.0",
|
|
42
|
+
"zod": "^3.24.1"
|
|
39
43
|
},
|
|
40
44
|
"devDependencies": {
|
|
45
|
+
"@commitlint/cli": "19.6.1",
|
|
46
|
+
"@commitlint/config-conventional": "19.6.0",
|
|
41
47
|
"@jest/globals": "^29.7.0",
|
|
42
|
-
"@types/
|
|
43
|
-
"@types/jest": "^29.5.
|
|
44
|
-
"@types/jsonwebtoken": "^
|
|
45
|
-
"@types/lodash": "^4.
|
|
46
|
-
"@types/minimist": "^1.2.
|
|
47
|
-
"@types/node": "^
|
|
48
|
-
"@types/tough-cookie": "^4.0.
|
|
49
|
-
"@
|
|
48
|
+
"@types/better-sqlite3": "^7.6.12",
|
|
49
|
+
"@types/jest": "^29.5.14",
|
|
50
|
+
"@types/jsonwebtoken": "^9.0.7",
|
|
51
|
+
"@types/lodash": "^4.17.13",
|
|
52
|
+
"@types/minimist": "^1.2.5",
|
|
53
|
+
"@types/node": "^22.10.4",
|
|
54
|
+
"@types/tough-cookie": "^4.0.5",
|
|
55
|
+
"@typescript-eslint/eslint-plugin": "^8.19.0",
|
|
56
|
+
"@typescript-eslint/parser": "^8.19.0",
|
|
57
|
+
"better-sqlite3": "^11.7.0",
|
|
58
|
+
"eslint": "^9.17.0",
|
|
59
|
+
"eslint-formatter-codeframe": "^7.32.1",
|
|
60
|
+
"eslint-import-resolver-typescript": "^3.7.0",
|
|
61
|
+
"eslint-plugin-import": "^2.31.0",
|
|
62
|
+
"eslint-plugin-jsdoc": "^50.6.1",
|
|
63
|
+
"globals": "15.14.0",
|
|
64
|
+
"husky": "^9.1.7",
|
|
50
65
|
"jest": "^29.7.0",
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"ts-
|
|
54
|
-
"
|
|
66
|
+
"lint-staged": "^15.3.0",
|
|
67
|
+
"prettier": "^3.4.2",
|
|
68
|
+
"ts-jest": "^29.2.5",
|
|
69
|
+
"ts-node": "^10.9.2",
|
|
70
|
+
"tsc-alias": "^1.8.10",
|
|
71
|
+
"tsup": "^8.3.5",
|
|
72
|
+
"tsx": "4.19.2",
|
|
73
|
+
"typedoc": "^0.27.6",
|
|
74
|
+
"typedoc-plugin-markdown": "^4.4.1",
|
|
75
|
+
"typescript": "^5.7.2",
|
|
76
|
+
"vitepress": "^1.5.0"
|
|
77
|
+
},
|
|
78
|
+
"lint-staged": {
|
|
79
|
+
"*.{js,ts}": [
|
|
80
|
+
"eslint --fix --format=codeframe",
|
|
81
|
+
"prettier --write"
|
|
82
|
+
],
|
|
83
|
+
"*.{json,md,yml,yaml}": [
|
|
84
|
+
"prettier --write"
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
"scripts": {
|
|
88
|
+
"clean": "rm -rf dist node_modules && pnpm install",
|
|
89
|
+
"build": "tsup src/index.ts src/cli/cli.ts --format cjs,esm --dts --clean --sourcemap --minify",
|
|
90
|
+
"test": "jest",
|
|
91
|
+
"type-check": "tsc --noEmit",
|
|
92
|
+
"lint": "eslint . --format=codeframe",
|
|
93
|
+
"lint:fix": "eslint . --format=codeframe --fix",
|
|
94
|
+
"validate": "pnpm run type-check && pnpm run lint && pnpm run test",
|
|
95
|
+
"format": "prettier --write .",
|
|
96
|
+
"dev": "tsc -w -p tsconfig.json & tsc-alias -w -p tsconfig.json",
|
|
97
|
+
"read-github": "NODE_OPTIONS=\"-r tsconfig-paths/register\" tsx scripts/readGithubCookies.ts",
|
|
98
|
+
"docs": "typedoc && ./scripts/fix-typedoc.sh && vitepress build docs",
|
|
99
|
+
"docs:dev": "vitepress dev docs",
|
|
100
|
+
"docs:preview": "vitepress preview docs"
|
|
55
101
|
}
|
|
56
|
-
}
|
|
102
|
+
}
|
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
package/.prettierignore
DELETED
package/.prettierrc
DELETED
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
|
-
}
|
package/build-indexes.ts
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
//#!/usr/bin/env bun run
|
|
2
|
-
|
|
3
|
-
import consola from "consola";
|
|
4
|
-
import { groupBy, orderBy } from "lodash";
|
|
5
|
-
import path from "path";
|
|
6
|
-
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
7
|
-
import { sync } from "fast-glob";
|
|
8
|
-
import prettier from "prettier";
|
|
9
|
-
|
|
10
|
-
async function main() {
|
|
11
|
-
// find all ts files in src and build indexes
|
|
12
|
-
|
|
13
|
-
const files = sync("src/**/*.ts", {
|
|
14
|
-
dot: true,
|
|
15
|
-
onlyFiles: true,
|
|
16
|
-
ignore: [
|
|
17
|
-
"**/index.ts",
|
|
18
|
-
"**/*.d.ts",
|
|
19
|
-
"**/*.test.{ts,tsx}",
|
|
20
|
-
"**/*.spec.{ts,tsx}",
|
|
21
|
-
"**/*.stories.tsx",
|
|
22
|
-
],
|
|
23
|
-
//
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
// group files by directory
|
|
27
|
-
const groups = groupBy(files, (file: string) => {
|
|
28
|
-
const parts = file.split("/");
|
|
29
|
-
parts.pop();
|
|
30
|
-
return parts.join("/");
|
|
31
|
-
});
|
|
32
|
-
// order by depth, so that we build indexes for subdirectories first
|
|
33
|
-
const dirs = orderBy(
|
|
34
|
-
Object.keys(groups),
|
|
35
|
-
(dir) => dir.split("/").length,
|
|
36
|
-
//
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
// build index for each directory
|
|
40
|
-
for (const dir of dirs) {
|
|
41
|
-
consola.info(`building index for ${dir}`);
|
|
42
|
-
const files = groups[dir].filter((file: string) => file.match(/\.ts$/));
|
|
43
|
-
const indexes = files
|
|
44
|
-
.map((file: string) => {
|
|
45
|
-
const content = readFileSync(file, "utf-8").split("\n");
|
|
46
|
-
if (!content.some((line) => line.trim().startsWith("export"))) {
|
|
47
|
-
// if none of the lines in the file start with an export, then we should not include it in the index
|
|
48
|
-
return "";
|
|
49
|
-
}
|
|
50
|
-
const name = path
|
|
51
|
-
.relative(dir, file) //
|
|
52
|
-
.replace(/\.ts$/, ""); //
|
|
53
|
-
return `export * from './${name}';`;
|
|
54
|
-
})
|
|
55
|
-
.filter(Boolean)
|
|
56
|
-
.sort() as string[];
|
|
57
|
-
|
|
58
|
-
// then find subdirectories and build index for them
|
|
59
|
-
|
|
60
|
-
const subIndex = sync(`${dir}/*/index.ts`, {
|
|
61
|
-
dot: true,
|
|
62
|
-
onlyFiles: true,
|
|
63
|
-
//
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
if (subIndex.length > 0) {
|
|
67
|
-
indexes.push(
|
|
68
|
-
...subIndex.map((file: string) => {
|
|
69
|
-
const name = path
|
|
70
|
-
.relative(dir, file) //
|
|
71
|
-
.replace(/\/index\.ts$/, ""); //
|
|
72
|
-
return `export * from './${name}';`;
|
|
73
|
-
}),
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const index = indexes.join("\n");
|
|
78
|
-
|
|
79
|
-
// const indexFile = `${dir}/index.ts`
|
|
80
|
-
const indexFile = path.join(dir, "index.ts");
|
|
81
|
-
|
|
82
|
-
const output = await prettier.format(index, { parser: "babel" });
|
|
83
|
-
|
|
84
|
-
if (existsSync(indexFile)) {
|
|
85
|
-
const existingContent = readFileSync(indexFile, "utf8");
|
|
86
|
-
if (existingContent === output) {
|
|
87
|
-
continue;
|
|
88
|
-
}
|
|
89
|
-
const lines = existingContent.split("\n");
|
|
90
|
-
if (lines.every((line) => line.startsWith("export * from")) == false) {
|
|
91
|
-
// if the existing index file is not an export index, then we should not overwrite it
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if (output.length > 0) {
|
|
97
|
-
console.log(`writing ${dir}/index.ts`, output.length);
|
|
98
|
-
|
|
99
|
-
writeFileSync(
|
|
100
|
-
indexFile,
|
|
101
|
-
output,
|
|
102
|
-
//
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
main().catch(consola.error);
|
package/bun.lockb
DELETED
|
Binary file
|