deslop-js 0.6.2 → 0.7.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.
- package/dist/analyzed-inputs.cjs +5 -0
- package/dist/analyzed-inputs.d.cts +5 -0
- package/dist/analyzed-inputs.d.mts +5 -0
- package/dist/analyzed-inputs.mjs +3 -0
- package/dist/constants-CD9NXHxi.cjs +530 -0
- package/dist/constants-oYYofMhb.mjs +344 -0
- package/dist/entries-worker.mjs +3736 -0
- package/dist/index.cjs +672 -476
- package/dist/index.d.cts +22 -0
- package/dist/index.d.mts +22 -0
- package/dist/index.mjs +625 -430
- package/dist/parse-worker.mjs +1 -2212
- package/dist/parse-xkrZfjHl.mjs +2308 -0
- package/package.json +11 -1
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
//#region src/constants.ts
|
|
2
|
+
const DEFAULT_EXTENSIONS = [
|
|
3
|
+
".ts",
|
|
4
|
+
".tsx",
|
|
5
|
+
".js",
|
|
6
|
+
".jsx",
|
|
7
|
+
".mts",
|
|
8
|
+
".mjs",
|
|
9
|
+
".cts",
|
|
10
|
+
".cjs",
|
|
11
|
+
".mdx",
|
|
12
|
+
".astro",
|
|
13
|
+
".graphql",
|
|
14
|
+
".gql",
|
|
15
|
+
".css",
|
|
16
|
+
".scss",
|
|
17
|
+
".vue",
|
|
18
|
+
".svelte"
|
|
19
|
+
];
|
|
20
|
+
const STANDALONE_PROJECT_LOCKFILES = [
|
|
21
|
+
"package-lock.json",
|
|
22
|
+
"yarn.lock",
|
|
23
|
+
"pnpm-lock.yaml",
|
|
24
|
+
"bun.lockb"
|
|
25
|
+
];
|
|
26
|
+
const MONOREPO_ROOT_MARKERS = [
|
|
27
|
+
"pnpm-workspace.yaml",
|
|
28
|
+
"pnpm-workspace.yml",
|
|
29
|
+
"lerna.json",
|
|
30
|
+
"nx.json",
|
|
31
|
+
"turbo.json",
|
|
32
|
+
"rush.json"
|
|
33
|
+
];
|
|
34
|
+
const LOCKFILE_MARKERS = [
|
|
35
|
+
"pnpm-lock.yaml",
|
|
36
|
+
"yarn.lock",
|
|
37
|
+
"package-lock.json",
|
|
38
|
+
"bun.lockb",
|
|
39
|
+
"bun.lock"
|
|
40
|
+
];
|
|
41
|
+
const ANALYZED_MANIFEST_FILENAMES = [...new Set([
|
|
42
|
+
"package.json",
|
|
43
|
+
"pnpm-workspace.yaml",
|
|
44
|
+
"lerna.json",
|
|
45
|
+
"app.json",
|
|
46
|
+
"ng-package.json",
|
|
47
|
+
".gitignore",
|
|
48
|
+
...STANDALONE_PROJECT_LOCKFILES,
|
|
49
|
+
...MONOREPO_ROOT_MARKERS,
|
|
50
|
+
...LOCKFILE_MARKERS
|
|
51
|
+
])];
|
|
52
|
+
const HIDDEN_DIRECTORY_ALLOWLIST = [
|
|
53
|
+
".storybook",
|
|
54
|
+
".vitepress",
|
|
55
|
+
".well-known",
|
|
56
|
+
".changeset",
|
|
57
|
+
".github",
|
|
58
|
+
".client",
|
|
59
|
+
".server"
|
|
60
|
+
];
|
|
61
|
+
const OUTPUT_DIRECTORIES = [
|
|
62
|
+
"dist",
|
|
63
|
+
"build",
|
|
64
|
+
"out",
|
|
65
|
+
"esm",
|
|
66
|
+
"cjs"
|
|
67
|
+
];
|
|
68
|
+
const SOURCE_EXTENSIONS = [
|
|
69
|
+
"ts",
|
|
70
|
+
"tsx",
|
|
71
|
+
"mts",
|
|
72
|
+
"cts",
|
|
73
|
+
"js",
|
|
74
|
+
"jsx",
|
|
75
|
+
"mjs",
|
|
76
|
+
"cjs"
|
|
77
|
+
];
|
|
78
|
+
const DEFAULT_EXCLUSIONS = [
|
|
79
|
+
"**/node_modules/**",
|
|
80
|
+
"**/.git/**",
|
|
81
|
+
"**/coverage/**",
|
|
82
|
+
"**/*.min.js",
|
|
83
|
+
"**/*.min.mjs",
|
|
84
|
+
"**/mockServiceWorker.js"
|
|
85
|
+
];
|
|
86
|
+
const SCRIPT_FILE_PATTERN = /(?:^|\s)(?:node|tsx|ts-node|tsc|npx|bun|esr|esno|jiti|babel-node|zx)\s+(?:\S+\s+)*?([\w./@-]+\.(?:ts|tsx|js|jsx|mts|mjs|cts|cjs))(?:\s|$)/;
|
|
87
|
+
const SCRIPT_EXTENSIONLESS_FILE_PATTERN = /(?:^|\s)(?:node|tsx|ts-node|bun|esr|esno|jiti|babel-node|zx)\s+(?:\S+\s+)*?((?:[./]|[\w@][\w@-]*\/)[\w./@-]+)(?:\s|$)/;
|
|
88
|
+
const SCRIPT_CONFIG_FILE_PATTERN = /--config\s+([\w./@-]+\.(?:ts|tsx|js|jsx|mts|mjs|cts|cjs))/;
|
|
89
|
+
const SCRIPT_ENTRY_PATTERNS = [];
|
|
90
|
+
const DEFAULT_ENTRY_GLOBS = [
|
|
91
|
+
"src/index.{ts,tsx,js,jsx}",
|
|
92
|
+
"src/main.{ts,tsx,js,jsx}",
|
|
93
|
+
"index.{ts,tsx,js,jsx}",
|
|
94
|
+
"main.{ts,tsx,js,jsx}"
|
|
95
|
+
];
|
|
96
|
+
const KNOWN_CONFIG_PREFIXES = [
|
|
97
|
+
"babel.config.",
|
|
98
|
+
"rollup.config.",
|
|
99
|
+
"webpack.config.",
|
|
100
|
+
"postcss.config.",
|
|
101
|
+
"stencil.config.",
|
|
102
|
+
"remotion.config.",
|
|
103
|
+
"metro.config.",
|
|
104
|
+
"tsup.config.",
|
|
105
|
+
"tsdown.config.",
|
|
106
|
+
"unbuild.config.",
|
|
107
|
+
"esbuild.config.",
|
|
108
|
+
"swc.config.",
|
|
109
|
+
"turbo.",
|
|
110
|
+
"jest.config.",
|
|
111
|
+
"jest.setup.",
|
|
112
|
+
"vitest.config.",
|
|
113
|
+
"vitest.ci.config.",
|
|
114
|
+
"vitest.setup.",
|
|
115
|
+
"vitest.workspace.",
|
|
116
|
+
"playwright.config.",
|
|
117
|
+
"cypress.config.",
|
|
118
|
+
"karma.conf.",
|
|
119
|
+
"eslint.config.",
|
|
120
|
+
"prettier.config.",
|
|
121
|
+
"stylelint.config.",
|
|
122
|
+
"lint-staged.config.",
|
|
123
|
+
"commitlint.config.",
|
|
124
|
+
"next.config.",
|
|
125
|
+
"next-sitemap.config.",
|
|
126
|
+
"nuxt.config.",
|
|
127
|
+
"astro.config.",
|
|
128
|
+
"sanity.config.",
|
|
129
|
+
"vite.config.",
|
|
130
|
+
"tailwind.config.",
|
|
131
|
+
"drizzle.config.",
|
|
132
|
+
"knexfile.",
|
|
133
|
+
"sentry.client.config.",
|
|
134
|
+
"sentry.server.config.",
|
|
135
|
+
"sentry.edge.config.",
|
|
136
|
+
"react-router.config.",
|
|
137
|
+
"typedoc.",
|
|
138
|
+
"deslop.config.",
|
|
139
|
+
"i18next-parser.config.",
|
|
140
|
+
"codegen.config.",
|
|
141
|
+
"graphql.config.",
|
|
142
|
+
"npmpackagejsonlint.config.",
|
|
143
|
+
"release-it.",
|
|
144
|
+
"release.config.",
|
|
145
|
+
"contentlayer.config.",
|
|
146
|
+
"rspack.config.",
|
|
147
|
+
"rsbuild.config.",
|
|
148
|
+
"module-federation.config.",
|
|
149
|
+
"vercel.",
|
|
150
|
+
"next-env.d.",
|
|
151
|
+
"env.d.",
|
|
152
|
+
"vite-env.d."
|
|
153
|
+
];
|
|
154
|
+
const IMPLICIT_DEPENDENCIES = new Set([
|
|
155
|
+
"typescript",
|
|
156
|
+
"@types/node",
|
|
157
|
+
"@types/react",
|
|
158
|
+
"@types/react-dom",
|
|
159
|
+
"eslint",
|
|
160
|
+
"prettier",
|
|
161
|
+
"husky",
|
|
162
|
+
"lint-staged",
|
|
163
|
+
"tslib",
|
|
164
|
+
"@babel/core",
|
|
165
|
+
"@babel/runtime",
|
|
166
|
+
"babel-core",
|
|
167
|
+
"babel-jest",
|
|
168
|
+
"babel-loader",
|
|
169
|
+
"postcss",
|
|
170
|
+
"cross-env",
|
|
171
|
+
"sass",
|
|
172
|
+
"node-sass",
|
|
173
|
+
"less",
|
|
174
|
+
"oxlint",
|
|
175
|
+
"biome",
|
|
176
|
+
"@biomejs/biome",
|
|
177
|
+
"patch-package",
|
|
178
|
+
"simple-git-hooks",
|
|
179
|
+
"lefthook",
|
|
180
|
+
"ts-node",
|
|
181
|
+
"ts-jest",
|
|
182
|
+
"tsx",
|
|
183
|
+
"jsdom",
|
|
184
|
+
"rimraf",
|
|
185
|
+
"concurrently",
|
|
186
|
+
"npm-run-all",
|
|
187
|
+
"npm-run-all2",
|
|
188
|
+
"dotenv-cli",
|
|
189
|
+
"webpack",
|
|
190
|
+
"rollup",
|
|
191
|
+
"terser",
|
|
192
|
+
"autoprefixer",
|
|
193
|
+
"tailwindcss",
|
|
194
|
+
"react-test-renderer",
|
|
195
|
+
"esbuild",
|
|
196
|
+
"typedoc",
|
|
197
|
+
"commitizen",
|
|
198
|
+
"cz-conventional-changelog"
|
|
199
|
+
]);
|
|
200
|
+
const BUILTIN_MODULES = new Set([
|
|
201
|
+
"assert",
|
|
202
|
+
"async_hooks",
|
|
203
|
+
"buffer",
|
|
204
|
+
"child_process",
|
|
205
|
+
"cluster",
|
|
206
|
+
"console",
|
|
207
|
+
"constants",
|
|
208
|
+
"crypto",
|
|
209
|
+
"dgram",
|
|
210
|
+
"diagnostics_channel",
|
|
211
|
+
"dns",
|
|
212
|
+
"domain",
|
|
213
|
+
"events",
|
|
214
|
+
"fs",
|
|
215
|
+
"http",
|
|
216
|
+
"http2",
|
|
217
|
+
"https",
|
|
218
|
+
"inspector",
|
|
219
|
+
"module",
|
|
220
|
+
"net",
|
|
221
|
+
"os",
|
|
222
|
+
"path",
|
|
223
|
+
"perf_hooks",
|
|
224
|
+
"process",
|
|
225
|
+
"punycode",
|
|
226
|
+
"querystring",
|
|
227
|
+
"readline",
|
|
228
|
+
"repl",
|
|
229
|
+
"stream",
|
|
230
|
+
"string_decoder",
|
|
231
|
+
"sys",
|
|
232
|
+
"timers",
|
|
233
|
+
"tls",
|
|
234
|
+
"trace_events",
|
|
235
|
+
"tty",
|
|
236
|
+
"url",
|
|
237
|
+
"util",
|
|
238
|
+
"v8",
|
|
239
|
+
"vm",
|
|
240
|
+
"wasi",
|
|
241
|
+
"worker_threads",
|
|
242
|
+
"zlib"
|
|
243
|
+
]);
|
|
244
|
+
const PLATFORM_SUFFIXES = [
|
|
245
|
+
".web",
|
|
246
|
+
".react-native",
|
|
247
|
+
".native",
|
|
248
|
+
".ios",
|
|
249
|
+
".android",
|
|
250
|
+
".desktop",
|
|
251
|
+
".windows",
|
|
252
|
+
".macos",
|
|
253
|
+
".any",
|
|
254
|
+
".react-server",
|
|
255
|
+
".server",
|
|
256
|
+
".client"
|
|
257
|
+
];
|
|
258
|
+
const REACT_NATIVE_PLATFORM_EXTENSIONS = [
|
|
259
|
+
".web.ts",
|
|
260
|
+
".web.tsx",
|
|
261
|
+
".web.js",
|
|
262
|
+
".web.jsx",
|
|
263
|
+
".native.ts",
|
|
264
|
+
".native.tsx",
|
|
265
|
+
".native.js",
|
|
266
|
+
".native.jsx",
|
|
267
|
+
".ios.ts",
|
|
268
|
+
".ios.tsx",
|
|
269
|
+
".ios.js",
|
|
270
|
+
".ios.jsx",
|
|
271
|
+
".android.ts",
|
|
272
|
+
".android.tsx",
|
|
273
|
+
".android.js",
|
|
274
|
+
".android.jsx"
|
|
275
|
+
];
|
|
276
|
+
const RESOLVER_EXTENSIONS = [
|
|
277
|
+
...DEFAULT_EXTENSIONS,
|
|
278
|
+
".d.ts",
|
|
279
|
+
".d.mts",
|
|
280
|
+
".d.cts",
|
|
281
|
+
".json",
|
|
282
|
+
".node",
|
|
283
|
+
".css",
|
|
284
|
+
".scss",
|
|
285
|
+
".less",
|
|
286
|
+
".svg",
|
|
287
|
+
".png",
|
|
288
|
+
".jpg",
|
|
289
|
+
".graphql",
|
|
290
|
+
".gql"
|
|
291
|
+
];
|
|
292
|
+
const SEMANTIC_MAX_PROGRAM_FILES = 5e3;
|
|
293
|
+
const MAX_PARSE_FILE_SIZE_BYTES = 2e6;
|
|
294
|
+
const MAX_ANALYSIS_ERRORS = 5e3;
|
|
295
|
+
const MAX_ERROR_DETAIL_LENGTH = 1e3;
|
|
296
|
+
const SUMMARY_CACHE_MAX_BYTES = 256 * 1024 * 1024;
|
|
297
|
+
const BINARY_DETECTION_SAMPLE_BYTES = 2048;
|
|
298
|
+
const MINIFIED_DETECTION_MIN_BYTES = 5e3;
|
|
299
|
+
/**
|
|
300
|
+
* Numeric literals below 1000 are dominated by indices, counters, small
|
|
301
|
+
* ranges, ports, percentages, and array sizes that coincide by accident
|
|
302
|
+
* (every `MAX_RETRIES = 3` is not a duplicate of every `LIMIT = 3`).
|
|
303
|
+
* 1000 admits real shared constants (timeouts in ms, byte sizes, polling
|
|
304
|
+
* intervals) without producing the noise floor that smaller magnitudes do.
|
|
305
|
+
* NOTE: even at 1000, the rule still produces medium-confidence false
|
|
306
|
+
* positives when constants share a value coincidentally with different
|
|
307
|
+
* names (e.g. `STEP_DELAY_MS` vs `MINIMUM_TOKENS`); the report explicitly
|
|
308
|
+
* downgrades those to `confidence: "medium"`.
|
|
309
|
+
*/
|
|
310
|
+
const MIN_NUMERIC_LITERAL_MAGNITUDE_FOR_DUPLICATE = 1e3;
|
|
311
|
+
const DEFAULT_SEMANTIC_DECORATOR_ALLOWLIST = [
|
|
312
|
+
"Component",
|
|
313
|
+
"Injectable",
|
|
314
|
+
"NgModule",
|
|
315
|
+
"Pipe",
|
|
316
|
+
"Directive",
|
|
317
|
+
"Controller",
|
|
318
|
+
"Module",
|
|
319
|
+
"Resolver",
|
|
320
|
+
"Query",
|
|
321
|
+
"Mutation",
|
|
322
|
+
"Get",
|
|
323
|
+
"Post",
|
|
324
|
+
"Put",
|
|
325
|
+
"Patch",
|
|
326
|
+
"Delete",
|
|
327
|
+
"Head",
|
|
328
|
+
"Options",
|
|
329
|
+
"All",
|
|
330
|
+
"Sse",
|
|
331
|
+
"WebSocketGateway",
|
|
332
|
+
"SubscribeMessage"
|
|
333
|
+
];
|
|
334
|
+
const DEFAULT_SEMANTIC_TSCONFIG_NAMES = [
|
|
335
|
+
"tsconfig.json",
|
|
336
|
+
"tsconfig.app.json",
|
|
337
|
+
"tsconfig.build.json",
|
|
338
|
+
"tsconfig.src.json",
|
|
339
|
+
"jsconfig.json"
|
|
340
|
+
];
|
|
341
|
+
const GIT_CHECK_IGNORE_MAX_BUFFER_BYTES = 10 * 1024 * 1024;
|
|
342
|
+
|
|
343
|
+
//#endregion
|
|
344
|
+
export { STANDALONE_PROJECT_LOCKFILES as A, RESOLVER_EXTENSIONS as C, SCRIPT_FILE_PATTERN as D, SCRIPT_EXTENSIONLESS_FILE_PATTERN as E, SEMANTIC_MAX_PROGRAM_FILES as O, REACT_NATIVE_PLATFORM_EXTENSIONS as S, SCRIPT_ENTRY_PATTERNS as T, MINIFIED_DETECTION_MIN_BYTES as _, DEFAULT_EXCLUSIONS as a, OUTPUT_DIRECTORIES as b, DEFAULT_SEMANTIC_TSCONFIG_NAMES as c, IMPLICIT_DEPENDENCIES as d, KNOWN_CONFIG_PREFIXES as f, MAX_PARSE_FILE_SIZE_BYTES as g, MAX_ERROR_DETAIL_LENGTH as h, DEFAULT_ENTRY_GLOBS as i, SUMMARY_CACHE_MAX_BYTES as j, SOURCE_EXTENSIONS as k, GIT_CHECK_IGNORE_MAX_BUFFER_BYTES as l, MAX_ANALYSIS_ERRORS as m, BINARY_DETECTION_SAMPLE_BYTES as n, DEFAULT_EXTENSIONS as o, LOCKFILE_MARKERS as p, BUILTIN_MODULES as r, DEFAULT_SEMANTIC_DECORATOR_ALLOWLIST as s, ANALYZED_MANIFEST_FILENAMES as t, HIDDEN_DIRECTORY_ALLOWLIST as u, MIN_NUMERIC_LITERAL_MAGNITUDE_FOR_DUPLICATE as v, SCRIPT_CONFIG_FILE_PATTERN as w, PLATFORM_SUFFIXES as x, MONOREPO_ROOT_MARKERS as y };
|