@metamask-previews/platform-api-docs 0.0.0-preview-1275d0fda
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 +14 -0
- package/LICENSE +6 -0
- package/LICENSE.APACHE2 +201 -0
- package/LICENSE.MIT +21 -0
- package/README.md +39 -0
- package/dist/cli.cjs +214 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +3 -0
- package/dist/cli.d.cts.map +1 -0
- package/dist/cli.d.mts +3 -0
- package/dist/cli.d.mts.map +1 -0
- package/dist/cli.mjs +212 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/discovery.cjs +53 -0
- package/dist/discovery.cjs.map +1 -0
- package/dist/discovery.d.cts +22 -0
- package/dist/discovery.d.cts.map +1 -0
- package/dist/discovery.d.mts +22 -0
- package/dist/discovery.d.mts.map +1 -0
- package/dist/discovery.mjs +48 -0
- package/dist/discovery.mjs.map +1 -0
- package/dist/extraction.cjs +745 -0
- package/dist/extraction.cjs.map +1 -0
- package/dist/extraction.d.cts +40 -0
- package/dist/extraction.d.cts.map +1 -0
- package/dist/extraction.d.mts +40 -0
- package/dist/extraction.d.mts.map +1 -0
- package/dist/extraction.mjs +716 -0
- package/dist/extraction.mjs.map +1 -0
- package/dist/generate.cjs +373 -0
- package/dist/generate.cjs.map +1 -0
- package/dist/generate.d.cts +37 -0
- package/dist/generate.d.cts.map +1 -0
- package/dist/generate.d.mts +37 -0
- package/dist/generate.d.mts.map +1 -0
- package/dist/generate.mjs +346 -0
- package/dist/generate.mjs.map +1 -0
- package/dist/markdown.cjs +239 -0
- package/dist/markdown.cjs.map +1 -0
- package/dist/markdown.d.cts +52 -0
- package/dist/markdown.d.cts.map +1 -0
- package/dist/markdown.d.mts +52 -0
- package/dist/markdown.d.mts.map +1 -0
- package/dist/markdown.mjs +232 -0
- package/dist/markdown.mjs.map +1 -0
- package/dist/types.cjs +3 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +63 -0
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +63 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +2 -0
- package/dist/types.mjs.map +1 -0
- package/package.json +75 -0
- package/site/docusaurus.config.ts +103 -0
- package/site/src/css/custom.css +336 -0
- package/site/static/fonts/MM-Sans/MM_Sans_Mono-Regular.woff2 +0 -0
- package/site/static/img/favicons/favicon-96x96.png +0 -0
- package/site/static/img/metamask-fox.svg +12 -0
- package/site/static/img/metamask-logo-dark.svg +3 -0
- package/site/static/img/metamask-logo.svg +3 -0
- package/site/tsconfig.json +13 -0
package/dist/cli.mjs
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
function $__filename(fileUrl) {
|
|
3
|
+
const url = new URL(fileUrl);
|
|
4
|
+
return url.pathname.replace(/^\/([a-zA-Z]:)/u, "$1");
|
|
5
|
+
}
|
|
6
|
+
function $getDirname(path) {
|
|
7
|
+
const sanitisedPath = path.toString().replace(/\\/gu, "/").replace(/\/$/u, "");
|
|
8
|
+
const index = sanitisedPath.lastIndexOf("/");
|
|
9
|
+
if (index === -1) {
|
|
10
|
+
return path;
|
|
11
|
+
}
|
|
12
|
+
if (index === 0) {
|
|
13
|
+
return "/";
|
|
14
|
+
}
|
|
15
|
+
return sanitisedPath.slice(0, index);
|
|
16
|
+
}
|
|
17
|
+
function $__dirname(url) {
|
|
18
|
+
return $getDirname($__filename(url));
|
|
19
|
+
}
|
|
20
|
+
function $importDefault(module) {
|
|
21
|
+
if (module?.__esModule) {
|
|
22
|
+
return module.default;
|
|
23
|
+
}
|
|
24
|
+
return module;
|
|
25
|
+
}
|
|
26
|
+
import $execa from "execa/index.js";
|
|
27
|
+
const execa = $importDefault($execa);
|
|
28
|
+
import * as fs from "node:fs/promises";
|
|
29
|
+
import * as path from "node:path";
|
|
30
|
+
import $npmWhich from "npm-which";
|
|
31
|
+
const npmWhich = $importDefault($npmWhich);
|
|
32
|
+
import yargs from "yargs";
|
|
33
|
+
import { generate } from "./generate.mjs";
|
|
34
|
+
/**
|
|
35
|
+
* Locate the Docusaurus binary in this package's `node_modules/.bin`. Using
|
|
36
|
+
* `npm-which` lets the lookup track wherever the installed Docusaurus puts
|
|
37
|
+
* its binary, so a future Docusaurus upgrade can't break this path.
|
|
38
|
+
*
|
|
39
|
+
* @returns Absolute path to the `docusaurus` executable.
|
|
40
|
+
*/
|
|
41
|
+
function resolveDocusaurus() {
|
|
42
|
+
return npmWhich($__dirname(import.meta.url)).sync('docusaurus');
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Run a Docusaurus command.
|
|
46
|
+
*
|
|
47
|
+
* @param command - The docusaurus command (start, build, serve).
|
|
48
|
+
* @param cwd - The site directory.
|
|
49
|
+
* @param extraEnv - Extra environment variables passed through to the
|
|
50
|
+
* Docusaurus process (e.g. `DOCS_PROJECT_LABEL`, `DOCS_COMMIT_SHA`).
|
|
51
|
+
*/
|
|
52
|
+
async function runDocusaurus(command, cwd, extraEnv = {}) {
|
|
53
|
+
await execa(resolveDocusaurus(), [command], {
|
|
54
|
+
cwd,
|
|
55
|
+
stdio: 'inherit',
|
|
56
|
+
env: { ...process.env, ...extraEnv },
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Copy site files into the output directory, skipping `node_modules` and
|
|
61
|
+
* `docs` (the latter is owned by the doc generator and shouldn't be carried
|
|
62
|
+
* over from the source `site/` directory).
|
|
63
|
+
*
|
|
64
|
+
* @param outDir - The output directory to set up.
|
|
65
|
+
*/
|
|
66
|
+
async function setupSite(outDir) {
|
|
67
|
+
const siteDir = path.resolve($__dirname(import.meta.url), '..', 'site');
|
|
68
|
+
const skip = new Set(['node_modules', 'docs']);
|
|
69
|
+
console.log(`\nSetting up Docusaurus site in ${outDir}...`);
|
|
70
|
+
// `fs.cp` has been available since Node 16.7 and only got the "stable"
|
|
71
|
+
// marker in 22.3 — it's functional throughout our supported Node range
|
|
72
|
+
// (`^18.18 || >=20`), even though the linter flags the older versions.
|
|
73
|
+
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
|
74
|
+
await fs.cp(siteDir, outDir, {
|
|
75
|
+
recursive: true,
|
|
76
|
+
filter: (source) => !skip.has(path.basename(source)),
|
|
77
|
+
});
|
|
78
|
+
// Write a minimal package.json so Docusaurus doesn't warn about a missing one
|
|
79
|
+
const pkgJsonPath = path.join(outDir, 'package.json');
|
|
80
|
+
try {
|
|
81
|
+
await fs.access(pkgJsonPath);
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
await fs.writeFile(pkgJsonPath, JSON.stringify({ name: 'platform-api-docs-site', private: true }, null, 2));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Resolve the short Git commit SHA the docs are being generated from.
|
|
89
|
+
* Returns null when the project isn't a git repo or git isn't available.
|
|
90
|
+
*
|
|
91
|
+
* @param projectPath - The project root path.
|
|
92
|
+
* @returns The short SHA, or null on failure.
|
|
93
|
+
*/
|
|
94
|
+
async function resolveCommitSha(projectPath) {
|
|
95
|
+
try {
|
|
96
|
+
const { stdout } = await execa('git', ['rev-parse', '--short', 'HEAD'], {
|
|
97
|
+
cwd: projectPath,
|
|
98
|
+
});
|
|
99
|
+
const trimmed = stdout.trim();
|
|
100
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Main CLI entry point.
|
|
108
|
+
*/
|
|
109
|
+
async function main() {
|
|
110
|
+
const argv = await yargs(process.argv.slice(2))
|
|
111
|
+
.command('$0 [project-path]', 'Produces documentation for the platform API, the set of actions and events available in clients through the message bus.', (yargsInstance) => {
|
|
112
|
+
yargsInstance.positional('project-path', {
|
|
113
|
+
type: 'string',
|
|
114
|
+
description: 'Path to the project to scan',
|
|
115
|
+
default: '.',
|
|
116
|
+
});
|
|
117
|
+
})
|
|
118
|
+
.option('build', {
|
|
119
|
+
type: 'boolean',
|
|
120
|
+
description: 'Generate platform API docs and build a production-ready site',
|
|
121
|
+
default: false,
|
|
122
|
+
})
|
|
123
|
+
.option('serve', {
|
|
124
|
+
type: 'boolean',
|
|
125
|
+
description: 'Generate platform API docs and serve a production-ready site',
|
|
126
|
+
default: false,
|
|
127
|
+
})
|
|
128
|
+
.option('dev', {
|
|
129
|
+
type: 'boolean',
|
|
130
|
+
description: 'Generate platform API docs and serve a development-only site',
|
|
131
|
+
default: false,
|
|
132
|
+
})
|
|
133
|
+
.option('scan-dir', {
|
|
134
|
+
type: 'string',
|
|
135
|
+
array: true,
|
|
136
|
+
description: 'Additional directories within the project to scan for messenger actions and events (note: may be specified multiple times)',
|
|
137
|
+
default: [],
|
|
138
|
+
})
|
|
139
|
+
.option('output', {
|
|
140
|
+
type: 'string',
|
|
141
|
+
description: 'Output directory',
|
|
142
|
+
})
|
|
143
|
+
.option('project-label', {
|
|
144
|
+
type: 'string',
|
|
145
|
+
description: 'Short label identifying the project (e.g. "Core", "Extension") — stamped on the site title and headings',
|
|
146
|
+
})
|
|
147
|
+
.option('site-url', {
|
|
148
|
+
type: 'string',
|
|
149
|
+
description: 'Absolute URL the built site will be served from, e.g. https://metamask.github.io',
|
|
150
|
+
})
|
|
151
|
+
.option('site-base-url', {
|
|
152
|
+
type: 'string',
|
|
153
|
+
description: 'Path prefix the built site will be served under, e.g. /core/platform-api/',
|
|
154
|
+
})
|
|
155
|
+
.help().argv;
|
|
156
|
+
const projectPathArg = argv['project-path'];
|
|
157
|
+
const resolvedProjectPath = path.resolve(typeof projectPathArg === 'string' ? projectPathArg : '.');
|
|
158
|
+
const resolvedOutputDir = path.resolve(argv.output ?? path.join(resolvedProjectPath, '.platform-api-docs'));
|
|
159
|
+
const scanDirs = ['src', ...argv['scan-dir']].filter((dir, index, dirs) => dirs.indexOf(dir) === index);
|
|
160
|
+
const projectLabel = typeof argv['project-label'] === 'string' &&
|
|
161
|
+
argv['project-label'].length > 0
|
|
162
|
+
? argv['project-label']
|
|
163
|
+
: null;
|
|
164
|
+
const commitSha = await resolveCommitSha(resolvedProjectPath);
|
|
165
|
+
// Step 1: Generate docs
|
|
166
|
+
await generate({
|
|
167
|
+
projectPath: resolvedProjectPath,
|
|
168
|
+
outputDir: resolvedOutputDir,
|
|
169
|
+
scanDirs,
|
|
170
|
+
projectLabel,
|
|
171
|
+
commitSha,
|
|
172
|
+
});
|
|
173
|
+
// Step 2: If --build, --serve, or --dev, set up and run Docusaurus
|
|
174
|
+
if (argv.build || argv.serve || argv.dev) {
|
|
175
|
+
await setupSite(resolvedOutputDir);
|
|
176
|
+
// Translate CLI flags into the environment variables Docusaurus's
|
|
177
|
+
// config reads. Keeping the CLI surface flag-only means consumers
|
|
178
|
+
// (workflow files, package.json scripts) don't have to know how the
|
|
179
|
+
// values are plumbed through to Docusaurus.
|
|
180
|
+
const docusaurusEnv = {};
|
|
181
|
+
if (projectLabel) {
|
|
182
|
+
docusaurusEnv.DOCS_PROJECT_LABEL = projectLabel;
|
|
183
|
+
}
|
|
184
|
+
if (commitSha) {
|
|
185
|
+
docusaurusEnv.DOCS_COMMIT_SHA = commitSha;
|
|
186
|
+
}
|
|
187
|
+
if (typeof argv['site-url'] === 'string' && argv['site-url'].length > 0) {
|
|
188
|
+
docusaurusEnv.DOCS_URL = argv['site-url'];
|
|
189
|
+
}
|
|
190
|
+
if (typeof argv['site-base-url'] === 'string' &&
|
|
191
|
+
argv['site-base-url'].length > 0) {
|
|
192
|
+
docusaurusEnv.DOCS_BASE_URL = argv['site-base-url'];
|
|
193
|
+
}
|
|
194
|
+
if (argv.dev) {
|
|
195
|
+
console.log('\nStarting dev server...');
|
|
196
|
+
await runDocusaurus('start', resolvedOutputDir, docusaurusEnv);
|
|
197
|
+
}
|
|
198
|
+
else if (argv.build || argv.serve) {
|
|
199
|
+
console.log('\nBuilding static site...');
|
|
200
|
+
await runDocusaurus('build', resolvedOutputDir, docusaurusEnv);
|
|
201
|
+
if (argv.serve) {
|
|
202
|
+
console.log('\nServing static site...');
|
|
203
|
+
await runDocusaurus('serve', resolvedOutputDir, docusaurusEnv);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
main().catch((error) => {
|
|
209
|
+
console.error(error);
|
|
210
|
+
process.exitCode = 1;
|
|
211
|
+
});
|
|
212
|
+
//# sourceMappingURL=cli.mjs.map
|
package/dist/cli.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.mjs","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAO,MAAK,uBAAc;;AAC1B,OAAO,KAAK,EAAE,yBAAyB;AACvC,OAAO,KAAK,IAAI,kBAAkB;AAClC,OAAO,SAAQ,kBAAkB;;AACjC,OAAO,KAAK,cAAc;AAE1B,OAAO,EAAE,QAAQ,EAAE,uBAAmB;AAEtC;;;;;;GAMG;AACH,SAAS,iBAAiB;IACxB,OAAO,QAAQ,6BAAW,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;AAChD,CAAC;AAED;;;;;;;GAOG;AACH,KAAK,UAAU,aAAa,CAC1B,OAAe,EACf,GAAW,EACX,WAAmC,EAAE;IAErC,MAAM,KAAK,CAAC,iBAAiB,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE;QAC1C,GAAG;QACH,KAAK,EAAE,SAAS;QAChB,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,QAAQ,EAAE;KACrC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,KAAK,UAAU,SAAS,CAAC,MAAc;IACrC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,8BAAY,IAAI,EAAE,MAAM,CAAC,CAAC;IACtD,MAAM,IAAI,GAAG,IAAI,GAAG,CAA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,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\n\nimport execa from 'execa';\nimport * as fs from 'node:fs/promises';\nimport * as path from 'node:path';\nimport npmWhich from 'npm-which';\nimport yargs from 'yargs';\n\nimport { generate } from './generate';\n\n/**\n * Locate the Docusaurus binary in this package's `node_modules/.bin`. Using\n * `npm-which` lets the lookup track wherever the installed Docusaurus puts\n * its binary, so a future Docusaurus upgrade can't break this path.\n *\n * @returns Absolute path to the `docusaurus` executable.\n */\nfunction resolveDocusaurus(): string {\n return npmWhich(__dirname).sync('docusaurus');\n}\n\n/**\n * Run a Docusaurus command.\n *\n * @param command - The docusaurus command (start, build, serve).\n * @param cwd - The site directory.\n * @param extraEnv - Extra environment variables passed through to the\n * Docusaurus process (e.g. `DOCS_PROJECT_LABEL`, `DOCS_COMMIT_SHA`).\n */\nasync function runDocusaurus(\n command: string,\n cwd: string,\n extraEnv: Record<string, string> = {},\n): Promise<void> {\n await execa(resolveDocusaurus(), [command], {\n cwd,\n stdio: 'inherit',\n env: { ...process.env, ...extraEnv },\n });\n}\n\n/**\n * Copy site files into the output directory, skipping `node_modules` and\n * `docs` (the latter is owned by the doc generator and shouldn't be carried\n * over from the source `site/` directory).\n *\n * @param outDir - The output directory to set up.\n */\nasync function setupSite(outDir: string): Promise<void> {\n const siteDir = path.resolve(__dirname, '..', 'site');\n const skip = new Set(['node_modules', 'docs']);\n\n console.log(`\\nSetting up Docusaurus site in ${outDir}...`);\n\n // `fs.cp` has been available since Node 16.7 and only got the \"stable\"\n // marker in 22.3 — it's functional throughout our supported Node range\n // (`^18.18 || >=20`), even though the linter flags the older versions.\n // eslint-disable-next-line n/no-unsupported-features/node-builtins\n await fs.cp(siteDir, outDir, {\n recursive: true,\n filter: (source) => !skip.has(path.basename(source)),\n });\n\n // Write a minimal package.json so Docusaurus doesn't warn about a missing one\n const pkgJsonPath = path.join(outDir, 'package.json');\n try {\n await fs.access(pkgJsonPath);\n } catch {\n await fs.writeFile(\n pkgJsonPath,\n JSON.stringify(\n { name: 'platform-api-docs-site', private: true },\n null,\n 2,\n ),\n );\n }\n}\n\n/**\n * Resolve the short Git commit SHA the docs are being generated from.\n * Returns null when the project isn't a git repo or git isn't available.\n *\n * @param projectPath - The project root path.\n * @returns The short SHA, or null on failure.\n */\nasync function resolveCommitSha(projectPath: string): Promise<string | null> {\n try {\n const { stdout } = await execa('git', ['rev-parse', '--short', 'HEAD'], {\n cwd: projectPath,\n });\n const trimmed = stdout.trim();\n return trimmed.length > 0 ? trimmed : null;\n } catch {\n return null;\n }\n}\n\n/**\n * Main CLI entry point.\n */\nasync function main(): Promise<void> {\n const argv = await yargs(process.argv.slice(2))\n .command(\n '$0 [project-path]',\n 'Produces documentation for the platform API, the set of actions and events available in clients through the message bus.',\n (yargsInstance) => {\n yargsInstance.positional('project-path', {\n type: 'string',\n description: 'Path to the project to scan',\n default: '.',\n });\n },\n )\n .option('build', {\n type: 'boolean',\n description:\n 'Generate platform API docs and build a production-ready site',\n default: false,\n })\n .option('serve', {\n type: 'boolean',\n description:\n 'Generate platform API docs and serve a production-ready site',\n default: false,\n })\n .option('dev', {\n type: 'boolean',\n description:\n 'Generate platform API docs and serve a development-only site',\n default: false,\n })\n .option('scan-dir', {\n type: 'string',\n array: true,\n description:\n 'Additional directories within the project to scan for messenger actions and events (note: may be specified multiple times)',\n default: [] as string[],\n })\n .option('output', {\n type: 'string',\n description: 'Output directory',\n })\n .option('project-label', {\n type: 'string',\n description:\n 'Short label identifying the project (e.g. \"Core\", \"Extension\") — stamped on the site title and headings',\n })\n .option('site-url', {\n type: 'string',\n description:\n 'Absolute URL the built site will be served from, e.g. https://metamask.github.io',\n })\n .option('site-base-url', {\n type: 'string',\n description:\n 'Path prefix the built site will be served under, e.g. /core/platform-api/',\n })\n .help().argv;\n\n const projectPathArg = argv['project-path'];\n const resolvedProjectPath = path.resolve(\n typeof projectPathArg === 'string' ? projectPathArg : '.',\n );\n const resolvedOutputDir = path.resolve(\n argv.output ?? path.join(resolvedProjectPath, '.platform-api-docs'),\n );\n const scanDirs = ['src', ...argv['scan-dir']].filter(\n (dir, index, dirs) => dirs.indexOf(dir) === index,\n );\n const projectLabel =\n typeof argv['project-label'] === 'string' &&\n argv['project-label'].length > 0\n ? argv['project-label']\n : null;\n const commitSha = await resolveCommitSha(resolvedProjectPath);\n\n // Step 1: Generate docs\n await generate({\n projectPath: resolvedProjectPath,\n outputDir: resolvedOutputDir,\n scanDirs,\n projectLabel,\n commitSha,\n });\n\n // Step 2: If --build, --serve, or --dev, set up and run Docusaurus\n if (argv.build || argv.serve || argv.dev) {\n await setupSite(resolvedOutputDir);\n\n // Translate CLI flags into the environment variables Docusaurus's\n // config reads. Keeping the CLI surface flag-only means consumers\n // (workflow files, package.json scripts) don't have to know how the\n // values are plumbed through to Docusaurus.\n const docusaurusEnv: Record<string, string> = {};\n if (projectLabel) {\n docusaurusEnv.DOCS_PROJECT_LABEL = projectLabel;\n }\n if (commitSha) {\n docusaurusEnv.DOCS_COMMIT_SHA = commitSha;\n }\n if (typeof argv['site-url'] === 'string' && argv['site-url'].length > 0) {\n docusaurusEnv.DOCS_URL = argv['site-url'];\n }\n if (\n typeof argv['site-base-url'] === 'string' &&\n argv['site-base-url'].length > 0\n ) {\n docusaurusEnv.DOCS_BASE_URL = argv['site-base-url'];\n }\n\n if (argv.dev) {\n console.log('\\nStarting dev server...');\n await runDocusaurus('start', resolvedOutputDir, docusaurusEnv);\n } else if (argv.build || argv.serve) {\n console.log('\\nBuilding static site...');\n await runDocusaurus('build', resolvedOutputDir, docusaurusEnv);\n\n if (argv.serve) {\n console.log('\\nServing static site...');\n await runDocusaurus('serve', resolvedOutputDir, docusaurusEnv);\n }\n }\n }\n}\n\nmain().catch((error) => {\n console.error(error);\n process.exitCode = 1;\n});\n"]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findDtsFiles = exports.findTsFiles = void 0;
|
|
4
|
+
const glob_1 = require("glob");
|
|
5
|
+
/**
|
|
6
|
+
* Find all non-test TypeScript source files in a directory.
|
|
7
|
+
* Skips node_modules, dist, test directories, and declaration files.
|
|
8
|
+
*
|
|
9
|
+
* Results are sorted lexicographically so that downstream consumers
|
|
10
|
+
* (extraction, deduplication, output ordering) behave deterministically
|
|
11
|
+
* across filesystems.
|
|
12
|
+
*
|
|
13
|
+
* @param dir - The directory to search.
|
|
14
|
+
* @returns A promise that resolves to a sorted array of absolute file paths.
|
|
15
|
+
*/
|
|
16
|
+
async function findTsFiles(dir) {
|
|
17
|
+
const matches = await (0, glob_1.glob)('**/*.ts', {
|
|
18
|
+
cwd: dir,
|
|
19
|
+
absolute: true,
|
|
20
|
+
ignore: [
|
|
21
|
+
'**/node_modules/**',
|
|
22
|
+
'**/dist/**',
|
|
23
|
+
'**/__tests__/**',
|
|
24
|
+
'**/tests/**',
|
|
25
|
+
'**/test/**',
|
|
26
|
+
'**/__mocks__/**',
|
|
27
|
+
'**/*.test.ts',
|
|
28
|
+
'**/*.test-d.ts',
|
|
29
|
+
'**/*.spec.ts',
|
|
30
|
+
'**/*.d.ts',
|
|
31
|
+
],
|
|
32
|
+
});
|
|
33
|
+
return matches.sort();
|
|
34
|
+
}
|
|
35
|
+
exports.findTsFiles = findTsFiles;
|
|
36
|
+
/**
|
|
37
|
+
* Find all `.d.cts` declaration files in a directory.
|
|
38
|
+
* Skips nested node_modules subdirectories. See {@link findTsFiles} for the
|
|
39
|
+
* note about sorting.
|
|
40
|
+
*
|
|
41
|
+
* @param dir - The directory to search.
|
|
42
|
+
* @returns A promise that resolves to a sorted array of absolute file paths.
|
|
43
|
+
*/
|
|
44
|
+
async function findDtsFiles(dir) {
|
|
45
|
+
const matches = await (0, glob_1.glob)('**/*.d.cts', {
|
|
46
|
+
cwd: dir,
|
|
47
|
+
absolute: true,
|
|
48
|
+
ignore: ['**/node_modules/**'],
|
|
49
|
+
});
|
|
50
|
+
return matches.sort();
|
|
51
|
+
}
|
|
52
|
+
exports.findDtsFiles = findDtsFiles;
|
|
53
|
+
//# sourceMappingURL=discovery.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovery.cjs","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAE5B;;;;;;;;;;GAUG;AACI,KAAK,UAAU,WAAW,CAAC,GAAW;IAC3C,MAAM,OAAO,GAAG,MAAM,IAAA,WAAI,EAAC,SAAS,EAAE;QACpC,GAAG,EAAE,GAAG;QACR,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE;YACN,oBAAoB;YACpB,YAAY;YACZ,iBAAiB;YACjB,aAAa;YACb,YAAY;YACZ,iBAAiB;YACjB,cAAc;YACd,gBAAgB;YAChB,cAAc;YACd,WAAW;SACZ;KACF,CAAC,CAAC;IACH,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC;AACxB,CAAC;AAlBD,kCAkBC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,YAAY,CAAC,GAAW;IAC5C,MAAM,OAAO,GAAG,MAAM,IAAA,WAAI,EAAC,YAAY,EAAE;QACvC,GAAG,EAAE,GAAG;QACR,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,CAAC,oBAAoB,CAAC;KAC/B,CAAC,CAAC;IACH,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC;AACxB,CAAC;AAPD,oCAOC","sourcesContent":["import { glob } from 'glob';\n\n/**\n * Find all non-test TypeScript source files in a directory.\n * Skips node_modules, dist, test directories, and declaration files.\n *\n * Results are sorted lexicographically so that downstream consumers\n * (extraction, deduplication, output ordering) behave deterministically\n * across filesystems.\n *\n * @param dir - The directory to search.\n * @returns A promise that resolves to a sorted array of absolute file paths.\n */\nexport async function findTsFiles(dir: string): Promise<string[]> {\n const matches = await glob('**/*.ts', {\n cwd: dir,\n absolute: true,\n ignore: [\n '**/node_modules/**',\n '**/dist/**',\n '**/__tests__/**',\n '**/tests/**',\n '**/test/**',\n '**/__mocks__/**',\n '**/*.test.ts',\n '**/*.test-d.ts',\n '**/*.spec.ts',\n '**/*.d.ts',\n ],\n });\n return matches.sort();\n}\n\n/**\n * Find all `.d.cts` declaration files in a directory.\n * Skips nested node_modules subdirectories. See {@link findTsFiles} for the\n * note about sorting.\n *\n * @param dir - The directory to search.\n * @returns A promise that resolves to a sorted array of absolute file paths.\n */\nexport async function findDtsFiles(dir: string): Promise<string[]> {\n const matches = await glob('**/*.d.cts', {\n cwd: dir,\n absolute: true,\n ignore: ['**/node_modules/**'],\n });\n return matches.sort();\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Find all non-test TypeScript source files in a directory.
|
|
3
|
+
* Skips node_modules, dist, test directories, and declaration files.
|
|
4
|
+
*
|
|
5
|
+
* Results are sorted lexicographically so that downstream consumers
|
|
6
|
+
* (extraction, deduplication, output ordering) behave deterministically
|
|
7
|
+
* across filesystems.
|
|
8
|
+
*
|
|
9
|
+
* @param dir - The directory to search.
|
|
10
|
+
* @returns A promise that resolves to a sorted array of absolute file paths.
|
|
11
|
+
*/
|
|
12
|
+
export declare function findTsFiles(dir: string): Promise<string[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Find all `.d.cts` declaration files in a directory.
|
|
15
|
+
* Skips nested node_modules subdirectories. See {@link findTsFiles} for the
|
|
16
|
+
* note about sorting.
|
|
17
|
+
*
|
|
18
|
+
* @param dir - The directory to search.
|
|
19
|
+
* @returns A promise that resolves to a sorted array of absolute file paths.
|
|
20
|
+
*/
|
|
21
|
+
export declare function findDtsFiles(dir: string): Promise<string[]>;
|
|
22
|
+
//# sourceMappingURL=discovery.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovery.d.cts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAkBhE;AAED;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAOjE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Find all non-test TypeScript source files in a directory.
|
|
3
|
+
* Skips node_modules, dist, test directories, and declaration files.
|
|
4
|
+
*
|
|
5
|
+
* Results are sorted lexicographically so that downstream consumers
|
|
6
|
+
* (extraction, deduplication, output ordering) behave deterministically
|
|
7
|
+
* across filesystems.
|
|
8
|
+
*
|
|
9
|
+
* @param dir - The directory to search.
|
|
10
|
+
* @returns A promise that resolves to a sorted array of absolute file paths.
|
|
11
|
+
*/
|
|
12
|
+
export declare function findTsFiles(dir: string): Promise<string[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Find all `.d.cts` declaration files in a directory.
|
|
15
|
+
* Skips nested node_modules subdirectories. See {@link findTsFiles} for the
|
|
16
|
+
* note about sorting.
|
|
17
|
+
*
|
|
18
|
+
* @param dir - The directory to search.
|
|
19
|
+
* @returns A promise that resolves to a sorted array of absolute file paths.
|
|
20
|
+
*/
|
|
21
|
+
export declare function findDtsFiles(dir: string): Promise<string[]>;
|
|
22
|
+
//# sourceMappingURL=discovery.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovery.d.mts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAkBhE;AAED;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAOjE"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { glob } from "glob";
|
|
2
|
+
/**
|
|
3
|
+
* Find all non-test TypeScript source files in a directory.
|
|
4
|
+
* Skips node_modules, dist, test directories, and declaration files.
|
|
5
|
+
*
|
|
6
|
+
* Results are sorted lexicographically so that downstream consumers
|
|
7
|
+
* (extraction, deduplication, output ordering) behave deterministically
|
|
8
|
+
* across filesystems.
|
|
9
|
+
*
|
|
10
|
+
* @param dir - The directory to search.
|
|
11
|
+
* @returns A promise that resolves to a sorted array of absolute file paths.
|
|
12
|
+
*/
|
|
13
|
+
export async function findTsFiles(dir) {
|
|
14
|
+
const matches = await glob('**/*.ts', {
|
|
15
|
+
cwd: dir,
|
|
16
|
+
absolute: true,
|
|
17
|
+
ignore: [
|
|
18
|
+
'**/node_modules/**',
|
|
19
|
+
'**/dist/**',
|
|
20
|
+
'**/__tests__/**',
|
|
21
|
+
'**/tests/**',
|
|
22
|
+
'**/test/**',
|
|
23
|
+
'**/__mocks__/**',
|
|
24
|
+
'**/*.test.ts',
|
|
25
|
+
'**/*.test-d.ts',
|
|
26
|
+
'**/*.spec.ts',
|
|
27
|
+
'**/*.d.ts',
|
|
28
|
+
],
|
|
29
|
+
});
|
|
30
|
+
return matches.sort();
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Find all `.d.cts` declaration files in a directory.
|
|
34
|
+
* Skips nested node_modules subdirectories. See {@link findTsFiles} for the
|
|
35
|
+
* note about sorting.
|
|
36
|
+
*
|
|
37
|
+
* @param dir - The directory to search.
|
|
38
|
+
* @returns A promise that resolves to a sorted array of absolute file paths.
|
|
39
|
+
*/
|
|
40
|
+
export async function findDtsFiles(dir) {
|
|
41
|
+
const matches = await glob('**/*.d.cts', {
|
|
42
|
+
cwd: dir,
|
|
43
|
+
absolute: true,
|
|
44
|
+
ignore: ['**/node_modules/**'],
|
|
45
|
+
});
|
|
46
|
+
return matches.sort();
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=discovery.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovery.mjs","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,aAAa;AAE5B;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,GAAW;IAC3C,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE;QACpC,GAAG,EAAE,GAAG;QACR,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE;YACN,oBAAoB;YACpB,YAAY;YACZ,iBAAiB;YACjB,aAAa;YACb,YAAY;YACZ,iBAAiB;YACjB,cAAc;YACd,gBAAgB;YAChB,cAAc;YACd,WAAW;SACZ;KACF,CAAC,CAAC;IACH,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC;AACxB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,GAAW;IAC5C,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,YAAY,EAAE;QACvC,GAAG,EAAE,GAAG;QACR,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,CAAC,oBAAoB,CAAC;KAC/B,CAAC,CAAC;IACH,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC;AACxB,CAAC","sourcesContent":["import { glob } from 'glob';\n\n/**\n * Find all non-test TypeScript source files in a directory.\n * Skips node_modules, dist, test directories, and declaration files.\n *\n * Results are sorted lexicographically so that downstream consumers\n * (extraction, deduplication, output ordering) behave deterministically\n * across filesystems.\n *\n * @param dir - The directory to search.\n * @returns A promise that resolves to a sorted array of absolute file paths.\n */\nexport async function findTsFiles(dir: string): Promise<string[]> {\n const matches = await glob('**/*.ts', {\n cwd: dir,\n absolute: true,\n ignore: [\n '**/node_modules/**',\n '**/dist/**',\n '**/__tests__/**',\n '**/tests/**',\n '**/test/**',\n '**/__mocks__/**',\n '**/*.test.ts',\n '**/*.test-d.ts',\n '**/*.spec.ts',\n '**/*.d.ts',\n ],\n });\n return matches.sort();\n}\n\n/**\n * Find all `.d.cts` declaration files in a directory.\n * Skips nested node_modules subdirectories. See {@link findTsFiles} for the\n * note about sorting.\n *\n * @param dir - The directory to search.\n * @returns A promise that resolves to a sorted array of absolute file paths.\n */\nexport async function findDtsFiles(dir: string): Promise<string[]> {\n const matches = await glob('**/*.d.cts', {\n cwd: dir,\n absolute: true,\n ignore: ['**/node_modules/**'],\n });\n return matches.sort();\n}\n"]}
|