find-primordials 1.0.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/CHANGELOG.md +13 -0
- package/LICENSE +21 -0
- package/README.md +178 -0
- package/analyzer.mjs +2209 -0
- package/ignore.mjs +161 -0
- package/index.d.mts +201 -0
- package/index.mjs +381 -0
- package/package.json +85 -0
- package/primordials.d.mts +32 -0
- package/primordials.mjs +836 -0
- package/worker.mjs +35 -0
package/index.mjs
ADDED
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
|
|
5
|
+
import * as minimatchModule from 'minimatch';
|
|
6
|
+
|
|
7
|
+
import { resolveMinimatch } from '#/ignore';
|
|
8
|
+
|
|
9
|
+
/* Handle both minimatch v3 (CJS default) and v10+ (named export) */
|
|
10
|
+
const minimatch = resolveMinimatch(minimatchModule);
|
|
11
|
+
|
|
12
|
+
/** The loosely-typed AST node the predicates accept; re-exported for downstream typing. */
|
|
13
|
+
/** @typedef {import('#/analyzer').ASTNode} ASTNode */
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
analyzeFile,
|
|
17
|
+
analyzeFiles,
|
|
18
|
+
analyzeFilesParallel,
|
|
19
|
+
applyFixes,
|
|
20
|
+
applyPushFixes,
|
|
21
|
+
applyUndefinedFixes,
|
|
22
|
+
canBeArrayLiteral,
|
|
23
|
+
canRewriteUndefined,
|
|
24
|
+
categoryLabel,
|
|
25
|
+
describeType,
|
|
26
|
+
formatAsTAP,
|
|
27
|
+
formatFindingAsTAP,
|
|
28
|
+
groupFindingsByCategory,
|
|
29
|
+
isCalled,
|
|
30
|
+
isReevaluable,
|
|
31
|
+
isRepeatable,
|
|
32
|
+
literalIndex,
|
|
33
|
+
startsAStatement,
|
|
34
|
+
voidNeedsParens,
|
|
35
|
+
} from '#/analyzer';
|
|
36
|
+
|
|
37
|
+
/** @typedef {import('./analyzer.mjs').AnalysisResult} AnalysisResult */
|
|
38
|
+
/** @typedef {import('./analyzer.mjs').AnalyzeOptions} AnalyzeOptions */
|
|
39
|
+
/** @typedef {import('./analyzer.mjs').Finding} Finding */
|
|
40
|
+
/** @typedef {import('./analyzer.mjs').FixKind} FixKind */
|
|
41
|
+
/** @typedef {import('./ignore.mjs').IgnoreConfig} IgnoreConfig */
|
|
42
|
+
/** @typedef {import('./ignore.mjs').RawIgnoreConfig} RawIgnoreConfig */
|
|
43
|
+
|
|
44
|
+
export {
|
|
45
|
+
allGlobals,
|
|
46
|
+
allInstanceMethods,
|
|
47
|
+
allStaticMethods,
|
|
48
|
+
ambiguousInstanceMethods,
|
|
49
|
+
globalToCategory,
|
|
50
|
+
primordials,
|
|
51
|
+
typedArrayGlobals,
|
|
52
|
+
} from '#/primordials';
|
|
53
|
+
|
|
54
|
+
export {
|
|
55
|
+
filterFindings,
|
|
56
|
+
getValidTypes,
|
|
57
|
+
normalizeIgnoreConfig,
|
|
58
|
+
shouldIgnoreFile,
|
|
59
|
+
shouldIgnoreFinding,
|
|
60
|
+
} from '#/ignore';
|
|
61
|
+
|
|
62
|
+
export const defaultExtensions = [
|
|
63
|
+
'.js',
|
|
64
|
+
'.mjs',
|
|
65
|
+
'.cjs',
|
|
66
|
+
'.jsx',
|
|
67
|
+
'.ts',
|
|
68
|
+
'.mts',
|
|
69
|
+
'.cts',
|
|
70
|
+
'.tsx',
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
const TEST_PATTERNS = [
|
|
74
|
+
/[/\\]tests?[/\\]/i,
|
|
75
|
+
/[/\\]__tests__[/\\]/i,
|
|
76
|
+
/[/\\]spec[/\\]/i,
|
|
77
|
+
/\.test\.[mc]?[jt]sx?$/i,
|
|
78
|
+
/\.spec\.[mc]?[jt]sx?$/i,
|
|
79
|
+
/_test\.[mc]?[jt]sx?$/i,
|
|
80
|
+
/-test\.[mc]?[jt]sx?$/i,
|
|
81
|
+
];
|
|
82
|
+
|
|
83
|
+
// Common config file patterns (eslint, prettier, jest, babel, webpack, rollup, vite, etc.)
|
|
84
|
+
const CONFIG_PATTERNS = [
|
|
85
|
+
// eslint configs
|
|
86
|
+
/[/\\]eslint\.config\.[mc]?[jt]s$/i,
|
|
87
|
+
/[/\\]\.eslintrc\.[mc]?js$/i,
|
|
88
|
+
// prettier configs
|
|
89
|
+
/[/\\]prettier\.config\.[mc]?[jt]s$/i,
|
|
90
|
+
/[/\\]\.prettierrc\.[mc]?js$/i,
|
|
91
|
+
// jest configs
|
|
92
|
+
/[/\\]jest\.config\.[mc]?[jt]s$/i,
|
|
93
|
+
// babel configs
|
|
94
|
+
/[/\\]babel\.config\.[mc]?[jt]s$/i,
|
|
95
|
+
/[/\\]\.babelrc\.[mc]?js$/i,
|
|
96
|
+
// bundler configs
|
|
97
|
+
/[/\\]webpack\.config\.[mc]?[jt]s$/i,
|
|
98
|
+
/[/\\]rollup\.config\.[mc]?[jt]s$/i,
|
|
99
|
+
/[/\\]vite\.config\.[mc]?[jt]s$/i,
|
|
100
|
+
/[/\\]esbuild\.config\.[mc]?[jt]s$/i,
|
|
101
|
+
// task runners
|
|
102
|
+
/[/\\]gulpfile\.[mc]?[jt]s$/i,
|
|
103
|
+
/[/\\]gulpfile\.babel\.[mc]?js$/i,
|
|
104
|
+
/[/\\]gulpfile\.esm\.[mc]?js$/i,
|
|
105
|
+
/[/\\]Gruntfile\.[mc]?js$/i,
|
|
106
|
+
// other common configs
|
|
107
|
+
/[/\\]postcss\.config\.[mc]?[jt]s$/i,
|
|
108
|
+
/[/\\]tailwind\.config\.[mc]?[jt]s$/i,
|
|
109
|
+
/[/\\]next\.config\.[mc]?[jt]s$/i,
|
|
110
|
+
/[/\\]nuxt\.config\.[mc]?[jt]s$/i,
|
|
111
|
+
/[/\\]vitest\.config\.[mc]?[jt]s$/i,
|
|
112
|
+
/[/\\]karma\.conf\.[mc]?js$/i,
|
|
113
|
+
/[/\\]\.mocharc\.[mc]?js$/i,
|
|
114
|
+
/[/\\]nyc\.config\.[mc]?js$/i,
|
|
115
|
+
/[/\\]commitlint\.config\.[mc]?[jt]s$/i,
|
|
116
|
+
/[/\\]lint-staged\.config\.[mc]?[jt]s$/i,
|
|
117
|
+
/[/\\]\.lintstagedrc\.[mc]?js$/i,
|
|
118
|
+
/[/\\]release\.config\.[mc]?[jt]s$/i,
|
|
119
|
+
/[/\\]metro\.config\.[mc]?[jt]s$/i,
|
|
120
|
+
/[/\\]tsup\.config\.[mc]?[jt]s$/i,
|
|
121
|
+
/[/\\]ava\.config\.[mc]?[jt]s$/i,
|
|
122
|
+
/[/\\]\.c8rc\.[mc]?js$/i,
|
|
123
|
+
];
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Check if a file path matches common test file patterns
|
|
127
|
+
* @param {string} filePath
|
|
128
|
+
*/
|
|
129
|
+
export function isTestFile(filePath) {
|
|
130
|
+
for (let i = 0; i < TEST_PATTERNS.length; i += 1) {
|
|
131
|
+
if (TEST_PATTERNS[i].test(filePath)) {
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Check if a file path matches common config file patterns
|
|
140
|
+
* @param {string} filePath
|
|
141
|
+
*/
|
|
142
|
+
export function isConfigFile(filePath) {
|
|
143
|
+
for (let i = 0; i < CONFIG_PATTERNS.length; i += 1) {
|
|
144
|
+
if (CONFIG_PATTERNS[i].test(filePath)) {
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** @typedef {Record<string, unknown>} PackageJSON */
|
|
152
|
+
/** @typedef {{ dir: string, pkg: PackageJSON }} PackageJSONCacheValue */
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Cache for findPackageJson results
|
|
156
|
+
* @type {Map<string, PackageJSONCacheValue | null>}
|
|
157
|
+
*/
|
|
158
|
+
const packageJsonCache = new Map();
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Find the nearest package.json for a file (cached)
|
|
162
|
+
* @param {string} filePath
|
|
163
|
+
*/
|
|
164
|
+
function findPackageJson(filePath) {
|
|
165
|
+
const startDir = path.dirname(path.resolve(filePath));
|
|
166
|
+
|
|
167
|
+
if (packageJsonCache.has(startDir)) {
|
|
168
|
+
return packageJsonCache.get(startDir);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const { root } = path.parse(startDir);
|
|
172
|
+
let dir = startDir;
|
|
173
|
+
const visited = [];
|
|
174
|
+
|
|
175
|
+
while (dir !== root) {
|
|
176
|
+
if (packageJsonCache.has(dir)) {
|
|
177
|
+
const result = /** @type {PackageJSONCacheValue} */ (packageJsonCache.get(dir));
|
|
178
|
+
for (const v of visited) {
|
|
179
|
+
packageJsonCache.set(v, result);
|
|
180
|
+
}
|
|
181
|
+
return result;
|
|
182
|
+
}
|
|
183
|
+
visited[visited.length] = dir;
|
|
184
|
+
const pkgPath = path.join(dir, 'package.json');
|
|
185
|
+
try {
|
|
186
|
+
const content = fs.readFileSync(pkgPath, 'utf8');
|
|
187
|
+
const result = { dir, pkg: JSON.parse(content) };
|
|
188
|
+
for (const v of visited) {
|
|
189
|
+
packageJsonCache.set(v, result);
|
|
190
|
+
}
|
|
191
|
+
return result;
|
|
192
|
+
} catch {
|
|
193
|
+
// Continue searching
|
|
194
|
+
}
|
|
195
|
+
dir = path.dirname(dir);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
for (const v of visited) {
|
|
199
|
+
packageJsonCache.set(v, null);
|
|
200
|
+
}
|
|
201
|
+
return null;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Extract all file paths referenced in a package.json exports field
|
|
206
|
+
* @param {string | { [k: string]: string }} exportsValue
|
|
207
|
+
*/
|
|
208
|
+
function getExportsFiles(exportsValue) {
|
|
209
|
+
/** @type {string[]} */
|
|
210
|
+
const files = [];
|
|
211
|
+
if (typeof exportsValue === 'string') {
|
|
212
|
+
files[files.length] = exportsValue;
|
|
213
|
+
} else if (Array.isArray(exportsValue)) {
|
|
214
|
+
for (const item of exportsValue) {
|
|
215
|
+
const nested = getExportsFiles(item);
|
|
216
|
+
for (const f of nested) {
|
|
217
|
+
files[files.length] = f;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
} else if (typeof exportsValue === 'object' && exportsValue !== null) {
|
|
221
|
+
for (const value of Object.values(exportsValue)) {
|
|
222
|
+
const nested = getExportsFiles(value);
|
|
223
|
+
for (const f of nested) {
|
|
224
|
+
files[files.length] = f;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return files;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Check if a file is a bin-only entry point (not also accessible via exports)
|
|
233
|
+
* @param {string} filePath
|
|
234
|
+
*/
|
|
235
|
+
export function isBinFile(filePath) {
|
|
236
|
+
const result = findPackageJson(filePath);
|
|
237
|
+
if (!result) {
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
const { dir, pkg } = result;
|
|
242
|
+
const { bin } = pkg;
|
|
243
|
+
if (!bin) {
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
const resolved = path.resolve(filePath);
|
|
248
|
+
const relativePath = path.relative(dir, resolved);
|
|
249
|
+
const normalizedRelPath = path.normalize(relativePath);
|
|
250
|
+
|
|
251
|
+
/** @param {string} binValue */
|
|
252
|
+
function matchesBin(binValue) {
|
|
253
|
+
return relativePath === binValue || normalizedRelPath === path.normalize(binValue);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
let isBin = false;
|
|
257
|
+
if (typeof bin === 'string') {
|
|
258
|
+
isBin = matchesBin(bin);
|
|
259
|
+
} else if (typeof bin === 'object') {
|
|
260
|
+
isBin = Object.values(bin).some(matchesBin);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
if (!isBin) {
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// If the file is also accessible via exports, it should be linted
|
|
268
|
+
if (pkg.exports) {
|
|
269
|
+
for (const f of getExportsFiles(pkg.exports)) {
|
|
270
|
+
if (!f.includes('*') && path.normalize(f) === normalizedRelPath) {
|
|
271
|
+
return false;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Check if a file is in a private package
|
|
281
|
+
* @param {string} filePath
|
|
282
|
+
*/
|
|
283
|
+
export function isPrivatePackage(filePath) {
|
|
284
|
+
const result = findPackageJson(filePath);
|
|
285
|
+
return result !== null && typeof result !== 'undefined' && result.pkg.private === true;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/** Patterns for files npm always includes in published packages */
|
|
289
|
+
const ALWAYS_PUBLISHED_PATTERNS = [
|
|
290
|
+
/^package\.json$/i,
|
|
291
|
+
/^readme[^/\\]*$/i,
|
|
292
|
+
/^licen[sc]e[^/\\]*$/i,
|
|
293
|
+
/^changelog[^/\\]*$/i,
|
|
294
|
+
/^changes[^/\\]*$/i,
|
|
295
|
+
/^history[^/\\]*$/i,
|
|
296
|
+
];
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Check if a file would not be included in the published npm package
|
|
300
|
+
* @param {string} filePath
|
|
301
|
+
*/
|
|
302
|
+
export function isUnpublishedFile(filePath) {
|
|
303
|
+
const result = findPackageJson(filePath);
|
|
304
|
+
if (!result) {
|
|
305
|
+
return false;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
const { dir, pkg } = result;
|
|
309
|
+
|
|
310
|
+
// Private packages are never published
|
|
311
|
+
if (pkg.private === true) {
|
|
312
|
+
return true;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// If no files field, can't determine from package.json alone
|
|
316
|
+
if (!Array.isArray(pkg.files)) {
|
|
317
|
+
return false;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
const resolved = path.resolve(filePath);
|
|
321
|
+
const relativePath = path.relative(dir, resolved);
|
|
322
|
+
|
|
323
|
+
// Check mandatory includes (root-level files only)
|
|
324
|
+
if (!relativePath.includes(path.sep)) {
|
|
325
|
+
for (const pattern of ALWAYS_PUBLISHED_PATTERNS) {
|
|
326
|
+
if (pattern.test(relativePath)) {
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// Check files referenced by main, browser, exports, types (not bin - bin-only files are safe)
|
|
333
|
+
/** @type {Set<string>} */
|
|
334
|
+
const mandatoryFiles = new Set();
|
|
335
|
+
if (typeof pkg.main === 'string') {
|
|
336
|
+
mandatoryFiles.add(path.normalize(pkg.main));
|
|
337
|
+
}
|
|
338
|
+
if (typeof pkg.browser === 'string') {
|
|
339
|
+
mandatoryFiles.add(path.normalize(pkg.browser));
|
|
340
|
+
}
|
|
341
|
+
if (pkg.exports) {
|
|
342
|
+
for (const f of getExportsFiles(pkg.exports)) {
|
|
343
|
+
if (!f.includes('*')) {
|
|
344
|
+
mandatoryFiles.add(path.normalize(f));
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
if (typeof pkg.types === 'string') {
|
|
349
|
+
mandatoryFiles.add(path.normalize(pkg.types));
|
|
350
|
+
}
|
|
351
|
+
if (typeof pkg.typings === 'string') {
|
|
352
|
+
mandatoryFiles.add(path.normalize(pkg.typings));
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
if (mandatoryFiles.has(path.normalize(relativePath))) {
|
|
356
|
+
return false;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
// Check against files whitelist patterns
|
|
360
|
+
for (const rawPattern of pkg.files) {
|
|
361
|
+
const pattern = rawPattern.replace(/^\.\//, '').replace(/\/+$/, '');
|
|
362
|
+
|
|
363
|
+
if (minimatch(relativePath, pattern, { dot: true })) {
|
|
364
|
+
return false;
|
|
365
|
+
}
|
|
366
|
+
// Also match as directory contents (e.g., "lib" matches "lib/foo.js")
|
|
367
|
+
if (minimatch(relativePath, `${pattern}/**`, { dot: true })) {
|
|
368
|
+
return false;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
return true;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Check if a file is safe (unpublished, bin entry, test file, or config file)
|
|
377
|
+
* @param {string} filePath
|
|
378
|
+
*/
|
|
379
|
+
export function isSafeFile(filePath) {
|
|
380
|
+
return isUnpublishedFile(filePath) || isTestFile(filePath) || isBinFile(filePath) || isConfigFile(filePath);
|
|
381
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "find-primordials",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Find primordials in use in a JavaScript/TypeScript project",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"primordials",
|
|
7
|
+
"intrinsics",
|
|
8
|
+
"javascript",
|
|
9
|
+
"typescript",
|
|
10
|
+
"ast",
|
|
11
|
+
"robustness"
|
|
12
|
+
],
|
|
13
|
+
"main": "index.mjs",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": "./index.mjs",
|
|
16
|
+
"./primordials": "./primordials.mjs",
|
|
17
|
+
"./package.json": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
"imports": {
|
|
20
|
+
"#/*": "./*.mjs"
|
|
21
|
+
},
|
|
22
|
+
"type": "module",
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"scripts": {
|
|
25
|
+
"attw": "attw -P --profile esm-only",
|
|
26
|
+
"prepack": "node -e \"require('fs').copyFileSync('../../LICENSE', 'LICENSE')\" && npmignore --auto --commentLines=autogenerated",
|
|
27
|
+
"prepublish": "not-in-publish || npm run prepublishOnly",
|
|
28
|
+
"prepublishOnly": "safe-publish-latest",
|
|
29
|
+
"version": "node ../../release.mjs",
|
|
30
|
+
"dependencies": "node -p \"process.env.npm_command\" | npx \"dt-clean@^1.2.2\" --auto",
|
|
31
|
+
"tests-only": "cd ../.. && npm run tests-only"
|
|
32
|
+
},
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/ljharb/find-primordials.git",
|
|
36
|
+
"directory": "packages/lib"
|
|
37
|
+
},
|
|
38
|
+
"author": "Jordan Harband <ljharb@gmail.com>",
|
|
39
|
+
"license": "MIT",
|
|
40
|
+
"bugs": {
|
|
41
|
+
"url": "https://github.com/ljharb/find-primordials/issues"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/ljharb/find-primordials/tree/main/packages/lib#readme",
|
|
44
|
+
"funding": {
|
|
45
|
+
"url": "https://github.com/sponsors/ljharb"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@typescript-eslint/parser": "^8.65.0",
|
|
49
|
+
"@typescript-eslint/typescript-estree": "^8.65.0",
|
|
50
|
+
"minimatch": "^10.2.6",
|
|
51
|
+
"traverse": "^0.6.11"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@types/traverse": "^0.6.37",
|
|
55
|
+
"auto-changelog": "^2.6.0",
|
|
56
|
+
"in-publish": "^2.0.1",
|
|
57
|
+
"npmignore": "^0.3.5",
|
|
58
|
+
"safe-publish-latest": "^2.0.0",
|
|
59
|
+
"typescript": "^6.0.3"
|
|
60
|
+
},
|
|
61
|
+
"peerDependencies": {
|
|
62
|
+
"typescript": "^6.0.3"
|
|
63
|
+
},
|
|
64
|
+
"engines": {
|
|
65
|
+
"node": "^24.18 || >= 26.5"
|
|
66
|
+
},
|
|
67
|
+
"auto-changelog": {
|
|
68
|
+
"output": "CHANGELOG.md",
|
|
69
|
+
"template": "keepachangelog",
|
|
70
|
+
"unreleased": false,
|
|
71
|
+
"commitLimit": false,
|
|
72
|
+
"backfillLimit": false,
|
|
73
|
+
"hideCredit": true,
|
|
74
|
+
"appendGitLog": ".",
|
|
75
|
+
"tagPrefix": "find-primordials@"
|
|
76
|
+
},
|
|
77
|
+
"publishConfig": {
|
|
78
|
+
"ignore": [
|
|
79
|
+
".editorconfig",
|
|
80
|
+
".github/",
|
|
81
|
+
"eslint.config.mjs",
|
|
82
|
+
"tsconfig.json"
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Type declarations for `find-primordials/primordials`.
|
|
2
|
+
|
|
3
|
+
/** A primordial category: the globals, methods, and properties one intrinsic family owns. */
|
|
4
|
+
export type PrimordialCategory = {
|
|
5
|
+
globals: string[];
|
|
6
|
+
instanceMethods: string[];
|
|
7
|
+
staticMethods: string[];
|
|
8
|
+
instanceProperties?: string[];
|
|
9
|
+
staticProperties?: string[];
|
|
10
|
+
wellKnownSymbols?: string[];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/** Every primordial category, keyed by name (e.g. `Array`, `Object`, `RegExp`). */
|
|
14
|
+
export const primordials: Record<string, PrimordialCategory>;
|
|
15
|
+
|
|
16
|
+
/** Every primordial global name. */
|
|
17
|
+
export const allGlobals: Set<string>;
|
|
18
|
+
|
|
19
|
+
/** Static method name to the category names that own it. */
|
|
20
|
+
export const allStaticMethods: Map<string, string[]>;
|
|
21
|
+
|
|
22
|
+
/** Instance method name to the category names that own it. */
|
|
23
|
+
export const allInstanceMethods: Map<string, string[]>;
|
|
24
|
+
|
|
25
|
+
/** Global name to its category name. */
|
|
26
|
+
export const globalToCategory: Map<string, string>;
|
|
27
|
+
|
|
28
|
+
/** The typed-array global names (`Int8Array`, `Uint8Array`, ...). */
|
|
29
|
+
export const typedArrayGlobals: Set<string>;
|
|
30
|
+
|
|
31
|
+
/** Instance method names owned by more than one category. */
|
|
32
|
+
export const ambiguousInstanceMethods: Set<string>;
|