mergestory 0.0.0-stage → 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/LICENSE +202 -0
- package/NOTICE +2 -0
- package/README.md +48 -2
- package/assets/kokoro-plugin/package-lock.json +1139 -0
- package/dist/analyzer/analyze.d.ts +8 -0
- package/dist/analyzer/analyze.js +328 -0
- package/dist/analyzer/components.d.ts +18 -0
- package/dist/analyzer/components.js +266 -0
- package/dist/analyzer/dependencies.d.ts +13 -0
- package/dist/analyzer/dependencies.js +349 -0
- package/dist/analyzer/evidence.d.ts +15 -0
- package/dist/analyzer/evidence.js +73 -0
- package/dist/analyzer/hunks.d.ts +21 -0
- package/dist/analyzer/hunks.js +88 -0
- package/dist/analyzer/imports.d.ts +46 -0
- package/dist/analyzer/imports.js +87 -0
- package/dist/analyzer/index.d.ts +14 -0
- package/dist/analyzer/index.js +16 -0
- package/dist/analyzer/languages/go.d.ts +2 -0
- package/dist/analyzer/languages/go.js +76 -0
- package/dist/analyzer/languages/index.d.ts +18 -0
- package/dist/analyzer/languages/index.js +72 -0
- package/dist/analyzer/languages/javascript.d.ts +2 -0
- package/dist/analyzer/languages/javascript.js +336 -0
- package/dist/analyzer/languages/jvm.d.ts +2 -0
- package/dist/analyzer/languages/jvm.js +157 -0
- package/dist/analyzer/languages/others.d.ts +2 -0
- package/dist/analyzer/languages/others.js +40 -0
- package/dist/analyzer/languages/php.d.ts +2 -0
- package/dist/analyzer/languages/php.js +81 -0
- package/dist/analyzer/languages/python.d.ts +2 -0
- package/dist/analyzer/languages/python.js +180 -0
- package/dist/analyzer/languages/ruby.d.ts +2 -0
- package/dist/analyzer/languages/ruby.js +99 -0
- package/dist/analyzer/languages/rust.d.ts +2 -0
- package/dist/analyzer/languages/rust.js +164 -0
- package/dist/analyzer/languages/shared.d.ts +35 -0
- package/dist/analyzer/languages/shared.js +43 -0
- package/dist/analyzer/languages/types.d.ts +78 -0
- package/dist/analyzer/languages/types.js +2 -0
- package/dist/analyzer/pack-format.d.ts +27 -0
- package/dist/analyzer/pack-format.js +139 -0
- package/dist/analyzer/pack.d.ts +26 -0
- package/dist/analyzer/pack.js +498 -0
- package/dist/analyzer/relationships.d.ts +17 -0
- package/dist/analyzer/relationships.js +34 -0
- package/dist/analyzer/risk-rules.d.ts +287 -0
- package/dist/analyzer/risk-rules.js +373 -0
- package/dist/analyzer/risks.d.ts +36 -0
- package/dist/analyzer/risks.js +480 -0
- package/dist/analyzer/roles.d.ts +11 -0
- package/dist/analyzer/roles.js +280 -0
- package/dist/analyzer/scan.d.ts +26 -0
- package/dist/analyzer/scan.js +157 -0
- package/dist/analyzer/signals.d.ts +20 -0
- package/dist/analyzer/signals.js +51 -0
- package/dist/analyzer/symbol-changes.d.ts +11 -0
- package/dist/analyzer/symbol-changes.js +101 -0
- package/dist/analyzer/symbol-types.d.ts +17 -0
- package/dist/analyzer/symbol-types.js +9 -0
- package/dist/analyzer/symbols.d.ts +4 -0
- package/dist/analyzer/symbols.js +16 -0
- package/dist/analyzer/trivial.d.ts +13 -0
- package/dist/analyzer/trivial.js +137 -0
- package/dist/analyzer/util.d.ts +6 -0
- package/dist/analyzer/util.js +24 -0
- package/dist/cli/commands/authoring.d.ts +9 -0
- package/dist/cli/commands/authoring.js +98 -0
- package/dist/cli/commands/cache.d.ts +4 -0
- package/dist/cli/commands/cache.js +37 -0
- package/dist/cli/commands/doctor.d.ts +5 -0
- package/dist/cli/commands/doctor.js +37 -0
- package/dist/cli/commands/generate.d.ts +8 -0
- package/dist/cli/commands/generate.js +69 -0
- package/dist/cli/commands/jobs.d.ts +8 -0
- package/dist/cli/commands/jobs.js +70 -0
- package/dist/cli/commands/publish.d.ts +8 -0
- package/dist/cli/commands/publish.js +120 -0
- package/dist/cli/commands/serve.d.ts +4 -0
- package/dist/cli/commands/serve.js +69 -0
- package/dist/cli/commands/setup.d.ts +14 -0
- package/dist/cli/commands/setup.js +108 -0
- package/dist/cli/commands/shared.d.ts +18 -0
- package/dist/cli/commands/shared.js +24 -0
- package/dist/cli/files.d.ts +26 -0
- package/dist/cli/files.js +98 -0
- package/dist/cli/format.d.ts +55 -0
- package/dist/cli/format.js +295 -0
- package/dist/cli/inputs.d.ts +23 -0
- package/dist/cli/inputs.js +96 -0
- package/dist/cli/io.d.ts +19 -0
- package/dist/cli/io.js +31 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.js +15 -0
- package/dist/cli/options.d.ts +105 -0
- package/dist/cli/options.js +324 -0
- package/dist/cli/program.d.ts +12 -0
- package/dist/cli/program.js +146 -0
- package/dist/cli/runtime.d.ts +59 -0
- package/dist/cli/runtime.js +83 -0
- package/dist/cli/style.d.ts +13 -0
- package/dist/cli/style.js +27 -0
- package/dist/core/binaries.d.ts +7 -0
- package/dist/core/binaries.js +33 -0
- package/dist/core/binary-paths.d.ts +5 -0
- package/dist/core/binary-paths.js +92 -0
- package/dist/core/cache.d.ts +14 -0
- package/dist/core/cache.js +43 -0
- package/dist/core/child-env.d.ts +9 -0
- package/dist/core/child-env.js +61 -0
- package/dist/core/concurrency.d.ts +13 -0
- package/dist/core/concurrency.js +58 -0
- package/dist/core/config.d.ts +223 -0
- package/dist/core/config.js +454 -0
- package/dist/core/context.d.ts +39 -0
- package/dist/core/context.js +44 -0
- package/dist/core/cost.d.ts +46 -0
- package/dist/core/cost.js +108 -0
- package/dist/core/diagram-metrics.d.ts +57 -0
- package/dist/core/diagram-metrics.js +63 -0
- package/dist/core/diff-view.d.ts +44 -0
- package/dist/core/diff-view.js +136 -0
- package/dist/core/errors.d.ts +47 -0
- package/dist/core/errors.js +94 -0
- package/dist/core/ids.d.ts +11 -0
- package/dist/core/ids.js +36 -0
- package/dist/core/json.d.ts +8 -0
- package/dist/core/json.js +17 -0
- package/dist/core/languages.d.ts +19 -0
- package/dist/core/languages.js +292 -0
- package/dist/core/logger.d.ts +29 -0
- package/dist/core/logger.js +68 -0
- package/dist/core/net.d.ts +16 -0
- package/dist/core/net.js +80 -0
- package/dist/core/path-policy.d.ts +20 -0
- package/dist/core/path-policy.js +202 -0
- package/dist/core/paths.d.ts +18 -0
- package/dist/core/paths.js +53 -0
- package/dist/core/posix.d.ts +12 -0
- package/dist/core/posix.js +50 -0
- package/dist/core/process.d.ts +22 -0
- package/dist/core/process.js +117 -0
- package/dist/core/providers.d.ts +204 -0
- package/dist/core/providers.js +2 -0
- package/dist/core/redact.d.ts +11 -0
- package/dist/core/redact.js +70 -0
- package/dist/core/render-plan.d.ts +307 -0
- package/dist/core/render-plan.js +7 -0
- package/dist/core/retry.d.ts +54 -0
- package/dist/core/retry.js +116 -0
- package/dist/core/run-folder.d.ts +74 -0
- package/dist/core/run-folder.js +129 -0
- package/dist/core/secrets.d.ts +56 -0
- package/dist/core/secrets.js +301 -0
- package/dist/core/storyboard-facts.d.ts +22 -0
- package/dist/core/storyboard-facts.js +61 -0
- package/dist/core/storyboard-schema.d.ts +1279 -0
- package/dist/core/storyboard-schema.js +342 -0
- package/dist/core/text.d.ts +43 -0
- package/dist/core/text.js +94 -0
- package/dist/core/types.d.ts +459 -0
- package/dist/core/types.js +17 -0
- package/dist/doctor/check.d.ts +6 -0
- package/dist/doctor/check.js +18 -0
- package/dist/doctor/deps.d.ts +2 -0
- package/dist/doctor/deps.js +90 -0
- package/dist/doctor/format.d.ts +9 -0
- package/dist/doctor/format.js +19 -0
- package/dist/doctor/github.d.ts +2 -0
- package/dist/doctor/github.js +13 -0
- package/dist/doctor/home.d.ts +2 -0
- package/dist/doctor/home.js +26 -0
- package/dist/doctor/index.d.ts +18 -0
- package/dist/doctor/index.js +81 -0
- package/dist/doctor/llm.d.ts +2 -0
- package/dist/doctor/llm.js +32 -0
- package/dist/doctor/publish.d.ts +2 -0
- package/dist/doctor/publish.js +16 -0
- package/dist/doctor/s3.d.ts +2 -0
- package/dist/doctor/s3.js +125 -0
- package/dist/doctor/speech.d.ts +2 -0
- package/dist/doctor/speech.js +112 -0
- package/dist/doctor/tools.d.ts +5 -0
- package/dist/doctor/tools.js +58 -0
- package/dist/doctor/types.d.ts +92 -0
- package/dist/doctor/types.js +2 -0
- package/dist/doctor/youtube.d.ts +2 -0
- package/dist/doctor/youtube.js +73 -0
- package/dist/github/client.d.ts +108 -0
- package/dist/github/client.js +499 -0
- package/dist/github/errors.d.ts +37 -0
- package/dist/github/errors.js +155 -0
- package/dist/github/index.d.ts +13 -0
- package/dist/github/index.js +9 -0
- package/dist/github/linked-issues.d.ts +37 -0
- package/dist/github/linked-issues.js +131 -0
- package/dist/github/model.d.ts +81 -0
- package/dist/github/model.js +114 -0
- package/dist/github/notify.d.ts +27 -0
- package/dist/github/notify.js +118 -0
- package/dist/github/pr-url.d.ts +27 -0
- package/dist/github/pr-url.js +122 -0
- package/dist/github/token.d.ts +16 -0
- package/dist/github/token.js +69 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +19 -0
- package/dist/jobs/input-rules.d.ts +20 -0
- package/dist/jobs/input-rules.js +100 -0
- package/dist/jobs/model.d.ts +47 -0
- package/dist/jobs/model.js +18 -0
- package/dist/jobs/runner.d.ts +43 -0
- package/dist/jobs/runner.js +165 -0
- package/dist/jobs/store.d.ts +67 -0
- package/dist/jobs/store.js +314 -0
- package/dist/jobs/view.d.ts +48 -0
- package/dist/jobs/view.js +111 -0
- package/dist/jobs/worker.d.ts +24 -0
- package/dist/jobs/worker.js +47 -0
- package/dist/llm/anthropic.d.ts +11 -0
- package/dist/llm/anthropic.js +225 -0
- package/dist/llm/index.d.ts +10 -0
- package/dist/llm/index.js +27 -0
- package/dist/llm/openai-compatible.d.ts +33 -0
- package/dist/llm/openai-compatible.js +378 -0
- package/dist/llm/prices.d.ts +26 -0
- package/dist/llm/prices.js +41 -0
- package/dist/llm/shared.d.ts +30 -0
- package/dist/llm/shared.js +115 -0
- package/dist/narration/assemble.d.ts +36 -0
- package/dist/narration/assemble.js +282 -0
- package/dist/narration/audio.d.ts +61 -0
- package/dist/narration/audio.js +301 -0
- package/dist/narration/captions.d.ts +37 -0
- package/dist/narration/captions.js +195 -0
- package/dist/narration/chunking.d.ts +6 -0
- package/dist/narration/chunking.js +46 -0
- package/dist/narration/convert.d.ts +9 -0
- package/dist/narration/convert.js +90 -0
- package/dist/narration/elevenlabs.d.ts +5 -0
- package/dist/narration/elevenlabs.js +53 -0
- package/dist/narration/http-errors.d.ts +14 -0
- package/dist/narration/http-errors.js +74 -0
- package/dist/narration/index.d.ts +21 -0
- package/dist/narration/index.js +22 -0
- package/dist/narration/kokoro-install.d.ts +30 -0
- package/dist/narration/kokoro-install.js +284 -0
- package/dist/narration/kokoro-model.d.ts +54 -0
- package/dist/narration/kokoro-model.js +168 -0
- package/dist/narration/kokoro-plugin.d.ts +78 -0
- package/dist/narration/kokoro-plugin.js +245 -0
- package/dist/narration/kokoro.d.ts +22 -0
- package/dist/narration/kokoro.js +231 -0
- package/dist/narration/openai.d.ts +4 -0
- package/dist/narration/openai.js +54 -0
- package/dist/narration/pricing.d.ts +8 -0
- package/dist/narration/pricing.js +17 -0
- package/dist/narration/remote-speech.d.ts +53 -0
- package/dist/narration/remote-speech.js +100 -0
- package/dist/narration/say.d.ts +28 -0
- package/dist/narration/say.js +178 -0
- package/dist/narration/select.d.ts +27 -0
- package/dist/narration/select.js +80 -0
- package/dist/narration/silent.d.ts +2 -0
- package/dist/narration/silent.js +18 -0
- package/dist/narration/speakable.d.ts +20 -0
- package/dist/narration/speakable.js +398 -0
- package/dist/narration/synthesize.d.ts +25 -0
- package/dist/narration/synthesize.js +220 -0
- package/dist/narration/wav.d.ts +37 -0
- package/dist/narration/wav.js +170 -0
- package/dist/pipeline/authoring.d.ts +8 -0
- package/dist/pipeline/authoring.js +117 -0
- package/dist/pipeline/commands.d.ts +9 -0
- package/dist/pipeline/commands.js +21 -0
- package/dist/pipeline/fit-duration.d.ts +41 -0
- package/dist/pipeline/fit-duration.js +150 -0
- package/dist/pipeline/index.d.ts +9 -0
- package/dist/pipeline/index.js +9 -0
- package/dist/pipeline/inputs.d.ts +42 -0
- package/dist/pipeline/inputs.js +171 -0
- package/dist/pipeline/plan.d.ts +8 -0
- package/dist/pipeline/plan.js +85 -0
- package/dist/pipeline/planned-egress.d.ts +21 -0
- package/dist/pipeline/planned-egress.js +43 -0
- package/dist/pipeline/prepare.d.ts +26 -0
- package/dist/pipeline/prepare.js +84 -0
- package/dist/pipeline/presentation.d.ts +26 -0
- package/dist/pipeline/presentation.js +110 -0
- package/dist/pipeline/publish-run.d.ts +71 -0
- package/dist/pipeline/publish-run.js +295 -0
- package/dist/pipeline/run.d.ts +7 -0
- package/dist/pipeline/run.js +196 -0
- package/dist/pipeline/storyboard-choice.d.ts +34 -0
- package/dist/pipeline/storyboard-choice.js +129 -0
- package/dist/pipeline/types.d.ts +76 -0
- package/dist/pipeline/types.js +2 -0
- package/dist/publish/access-probe.d.ts +55 -0
- package/dist/publish/access-probe.js +249 -0
- package/dist/publish/bundle.d.ts +20 -0
- package/dist/publish/bundle.js +57 -0
- package/dist/publish/comment.d.ts +10 -0
- package/dist/publish/comment.js +184 -0
- package/dist/publish/content-types.d.ts +15 -0
- package/dist/publish/content-types.js +41 -0
- package/dist/publish/index.d.ts +18 -0
- package/dist/publish/index.js +30 -0
- package/dist/publish/keys.d.ts +10 -0
- package/dist/publish/keys.js +30 -0
- package/dist/publish/local.d.ts +33 -0
- package/dist/publish/local.js +143 -0
- package/dist/publish/privacy.d.ts +20 -0
- package/dist/publish/privacy.js +21 -0
- package/dist/publish/s3/bucket.d.ts +22 -0
- package/dist/publish/s3/bucket.js +82 -0
- package/dist/publish/s3/client.d.ts +33 -0
- package/dist/publish/s3/client.js +134 -0
- package/dist/publish/s3/failures.d.ts +22 -0
- package/dist/publish/s3/failures.js +110 -0
- package/dist/publish/s3/index.d.ts +5 -0
- package/dist/publish/s3/index.js +6 -0
- package/dist/publish/s3/links.d.ts +38 -0
- package/dist/publish/s3/links.js +60 -0
- package/dist/publish/s3/protected-links.d.ts +29 -0
- package/dist/publish/s3/protected-links.js +67 -0
- package/dist/publish/s3/publisher.d.ts +32 -0
- package/dist/publish/s3/publisher.js +123 -0
- package/dist/publish/s3/settings.d.ts +29 -0
- package/dist/publish/s3/settings.js +64 -0
- package/dist/publish/s3/upload.d.ts +29 -0
- package/dist/publish/s3/upload.js +145 -0
- package/dist/publish/severity.d.ts +9 -0
- package/dist/publish/severity.js +18 -0
- package/dist/publish/text.d.ts +23 -0
- package/dist/publish/text.js +94 -0
- package/dist/publish/types.d.ts +67 -0
- package/dist/publish/types.js +12 -0
- package/dist/publish/vtt.d.ts +9 -0
- package/dist/publish/vtt.js +43 -0
- package/dist/publish/watch-page.d.ts +4 -0
- package/dist/publish/watch-page.js +463 -0
- package/dist/publish/youtube/credentials.d.ts +33 -0
- package/dist/publish/youtube/credentials.js +162 -0
- package/dist/publish/youtube/description.d.ts +56 -0
- package/dist/publish/youtube/description.js +197 -0
- package/dist/publish/youtube/google-api.d.ts +95 -0
- package/dist/publish/youtube/google-api.js +339 -0
- package/dist/publish/youtube/index.d.ts +7 -0
- package/dist/publish/youtube/index.js +8 -0
- package/dist/publish/youtube/loopback.d.ts +13 -0
- package/dist/publish/youtube/loopback.js +144 -0
- package/dist/publish/youtube/oauth.d.ts +68 -0
- package/dist/publish/youtube/oauth.js +159 -0
- package/dist/publish/youtube/prompt.d.ts +27 -0
- package/dist/publish/youtube/prompt.js +94 -0
- package/dist/publish/youtube/publisher.d.ts +38 -0
- package/dist/publish/youtube/publisher.js +346 -0
- package/dist/publish/youtube/scopes.d.ts +32 -0
- package/dist/publish/youtube/scopes.js +55 -0
- package/dist/publish/youtube/sign-in.d.ts +37 -0
- package/dist/publish/youtube/sign-in.js +137 -0
- package/dist/publish/youtube/upload.d.ts +43 -0
- package/dist/publish/youtube/upload.js +210 -0
- package/dist/render/browser.d.ts +23 -0
- package/dist/render/browser.js +219 -0
- package/dist/render/chromium-renderer.d.ts +56 -0
- package/dist/render/chromium-renderer.js +519 -0
- package/dist/render/ffmpeg.d.ts +55 -0
- package/dist/render/ffmpeg.js +212 -0
- package/dist/render/fonts.d.ts +10 -0
- package/dist/render/fonts.js +42 -0
- package/dist/render/index.d.ts +9 -0
- package/dist/render/index.js +11 -0
- package/dist/render/page.d.ts +46 -0
- package/dist/render/page.js +123 -0
- package/dist/render/playwright.d.ts +3 -0
- package/dist/render/playwright.js +6 -0
- package/dist/render/runtime-bundle.d.ts +2 -0
- package/dist/render/runtime-bundle.js +72 -0
- package/dist/runtime/runtime.js +1626 -0
- package/dist/server/auth.d.ts +17 -0
- package/dist/server/auth.js +58 -0
- package/dist/server/http.d.ts +43 -0
- package/dist/server/http.js +119 -0
- package/dist/server/index.d.ts +46 -0
- package/dist/server/index.js +310 -0
- package/dist/server/queue.d.ts +30 -0
- package/dist/server/queue.js +76 -0
- package/dist/server/schema.d.ts +103 -0
- package/dist/server/schema.js +121 -0
- package/dist/server/source.d.ts +17 -0
- package/dist/server/source.js +100 -0
- package/dist/sources/assemble.d.ts +86 -0
- package/dist/sources/assemble.js +117 -0
- package/dist/sources/diff-parser.d.ts +14 -0
- package/dist/sources/diff-parser.js +84 -0
- package/dist/sources/git.d.ts +28 -0
- package/dist/sources/git.js +108 -0
- package/dist/sources/github.d.ts +20 -0
- package/dist/sources/github.js +192 -0
- package/dist/sources/hunk-selection.d.ts +25 -0
- package/dist/sources/hunk-selection.js +46 -0
- package/dist/sources/index.d.ts +23 -0
- package/dist/sources/index.js +62 -0
- package/dist/sources/limits.d.ts +27 -0
- package/dist/sources/limits.js +22 -0
- package/dist/sources/local.d.ts +34 -0
- package/dist/sources/local.js +555 -0
- package/dist/sources/reader.d.ts +13 -0
- package/dist/sources/reader.js +45 -0
- package/dist/sources/remote.d.ts +13 -0
- package/dist/sources/remote.js +41 -0
- package/dist/sources/repo-context.d.ts +34 -0
- package/dist/sources/repo-context.js +144 -0
- package/dist/sources/text.d.ts +25 -0
- package/dist/sources/text.js +71 -0
- package/dist/storyboard/authoring.d.ts +108 -0
- package/dist/storyboard/authoring.js +196 -0
- package/dist/storyboard/claims.d.ts +35 -0
- package/dist/storyboard/claims.js +318 -0
- package/dist/storyboard/coderef.d.ts +28 -0
- package/dist/storyboard/coderef.js +118 -0
- package/dist/storyboard/generate.d.ts +25 -0
- package/dist/storyboard/generate.js +194 -0
- package/dist/storyboard/heuristic-code.d.ts +91 -0
- package/dist/storyboard/heuristic-code.js +524 -0
- package/dist/storyboard/heuristic-context.d.ts +42 -0
- package/dist/storyboard/heuristic-context.js +102 -0
- package/dist/storyboard/heuristic-facts.d.ts +106 -0
- package/dist/storyboard/heuristic-facts.js +415 -0
- package/dist/storyboard/heuristic-overview.d.ts +4 -0
- package/dist/storyboard/heuristic-overview.js +151 -0
- package/dist/storyboard/heuristic-review.d.ts +10 -0
- package/dist/storyboard/heuristic-review.js +158 -0
- package/dist/storyboard/heuristic-scenes.d.ts +8 -0
- package/dist/storyboard/heuristic-scenes.js +357 -0
- package/dist/storyboard/heuristic-shared.d.ts +43 -0
- package/dist/storyboard/heuristic-shared.js +136 -0
- package/dist/storyboard/heuristic.d.ts +15 -0
- package/dist/storyboard/heuristic.js +324 -0
- package/dist/storyboard/identifiers.d.ts +51 -0
- package/dist/storyboard/identifiers.js +195 -0
- package/dist/storyboard/index.d.ts +10 -0
- package/dist/storyboard/index.js +10 -0
- package/dist/storyboard/prompts.d.ts +16 -0
- package/dist/storyboard/prompts.js +61 -0
- package/dist/storyboard/run.d.ts +82 -0
- package/dist/storyboard/run.js +332 -0
- package/dist/storyboard/text.d.ts +16 -0
- package/dist/storyboard/text.js +103 -0
- package/dist/storyboard/types.d.ts +47 -0
- package/dist/storyboard/types.js +2 -0
- package/dist/storyboard/urls.d.ts +15 -0
- package/dist/storyboard/urls.js +83 -0
- package/dist/storyboard/validate.d.ts +8 -0
- package/dist/storyboard/validate.js +525 -0
- package/dist/storyboard/visuals.d.ts +23 -0
- package/dist/storyboard/visuals.js +324 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +3 -0
- package/dist/visuals/code.d.ts +68 -0
- package/dist/visuals/code.js +385 -0
- package/dist/visuals/highlight.d.ts +17 -0
- package/dist/visuals/highlight.js +85 -0
- package/dist/visuals/image.d.ts +12 -0
- package/dist/visuals/image.js +96 -0
- package/dist/visuals/index.d.ts +10 -0
- package/dist/visuals/index.js +10 -0
- package/dist/visuals/layout.d.ts +89 -0
- package/dist/visuals/layout.js +506 -0
- package/dist/visuals/plan.d.ts +33 -0
- package/dist/visuals/plan.js +511 -0
- package/dist/visuals/timeline.d.ts +31 -0
- package/dist/visuals/timeline.js +96 -0
- package/package.json +74 -4
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
// biome-ignore-all lint/suspicious/noAssignInExpressions: regex matches are assigned in the condition so the else-if chain stays flat
|
|
2
|
+
/**
|
|
3
|
+
* Java and Kotlin, and C#, whose declarations look alike (types, members, annotations or attributes
|
|
4
|
+
* that name a route). C# has no import support.
|
|
5
|
+
*/
|
|
6
|
+
import { blockEnd, nestingDepths } from '../scan.js';
|
|
7
|
+
import { C_COMMENTS, matchAll, symbolEmitter } from './shared.js';
|
|
8
|
+
const PROFILE = { lineComments: ['//'], blockComments: true, tripleQuotes: true };
|
|
9
|
+
const JVM_TYPE = /^(?:@\w+(?:\([^)]*\))?\s+|\[\w+(?:\([^)]*\))?\]\s*)*((?:(?:public|protected|private|internal|abstract|final|sealed|open|data|static|partial|enum|annotation|value|inner|inline|fun|record|unsafe|new)\s+)*)(class|interface|enum|record|object|struct|trait)\s+(\w+)/;
|
|
10
|
+
const JVM_MEMBER = /^(?:@\w+(?:\([^)]*\))?\s+|\[[\w.]+(?:\([^)]*\))?\]\s*)*((?:(?:public|protected|private|internal|static|final|abstract|synchronized|native|default|override|virtual|async|sealed|unsafe|extern|new|partial|readonly)\s+)*)(?:<[^>]+>\s+)?(?:([\w.<>,[\]?]+(?:\s*<[^>]*>)?)\s+)?(\w+)\s*\(/;
|
|
11
|
+
const KOTLIN_FUN = /^(?:@\w+(?:\([^)]*\))?\s+)*((?:(?:public|private|protected|internal|open|override|abstract|suspend|inline|operator|infix|tailrec|external|final|actual|expect)\s+)*)fun\s+(?:<[^>]+>\s+)?(?:[\w.<>?,\s]+\.)?(\w+)\s*\(/;
|
|
12
|
+
const NOT_MEMBERS = new Set([
|
|
13
|
+
'if',
|
|
14
|
+
'for',
|
|
15
|
+
'while',
|
|
16
|
+
'switch',
|
|
17
|
+
'catch',
|
|
18
|
+
'return',
|
|
19
|
+
'new',
|
|
20
|
+
'throw',
|
|
21
|
+
'else',
|
|
22
|
+
'synchronized',
|
|
23
|
+
'using',
|
|
24
|
+
'lock',
|
|
25
|
+
'foreach',
|
|
26
|
+
'when',
|
|
27
|
+
'try',
|
|
28
|
+
]);
|
|
29
|
+
const SPRING_ROUTE = /^@(Get|Post|Put|Delete|Patch|Request)Mapping(?:\(\s*(?:(?:value|path)\s*=\s*)?\{?\s*"([^"]*)")?/;
|
|
30
|
+
const ASPNET_ROUTE = /^\[Http(Get|Post|Put|Delete|Patch)(?:\(\s*"([^"]*)"\s*\))?\]/;
|
|
31
|
+
const ASPNET_PREFIX = /^\[Route\(\s*"([^"]*)"/;
|
|
32
|
+
function annotationRoute(lines, from, isType) {
|
|
33
|
+
let found = null;
|
|
34
|
+
for (let k = from - 1; k >= Math.max(0, from - 5); k--) {
|
|
35
|
+
const t = (lines[k] ?? '').trim();
|
|
36
|
+
if (!t.startsWith('@') && !t.startsWith('['))
|
|
37
|
+
break;
|
|
38
|
+
const spring = SPRING_ROUTE.exec(t);
|
|
39
|
+
if (spring) {
|
|
40
|
+
const [, verb = '', path = ''] = spring;
|
|
41
|
+
found = { method: verb === 'Request' ? 'ALL' : verb.toUpperCase(), path };
|
|
42
|
+
}
|
|
43
|
+
const asp = ASPNET_ROUTE.exec(t);
|
|
44
|
+
if (asp) {
|
|
45
|
+
const [, verb = '', path = ''] = asp;
|
|
46
|
+
found = { method: verb.toUpperCase(), path };
|
|
47
|
+
}
|
|
48
|
+
const prefix = ASPNET_PREFIX.exec(t);
|
|
49
|
+
if (prefix && isType)
|
|
50
|
+
found = { method: 'ALL', path: prefix[1] ?? '' };
|
|
51
|
+
}
|
|
52
|
+
return found;
|
|
53
|
+
}
|
|
54
|
+
function routePath(...parts) {
|
|
55
|
+
const joined = parts
|
|
56
|
+
.map((p) => p.replace(/^\/+|\/+$/g, ''))
|
|
57
|
+
.filter(Boolean)
|
|
58
|
+
.join('/');
|
|
59
|
+
return `/${joined}`;
|
|
60
|
+
}
|
|
61
|
+
function jvmSymbols(dialect) {
|
|
62
|
+
const kotlin = dialect === 'kotlin';
|
|
63
|
+
const csharp = dialect === 'csharp';
|
|
64
|
+
return (lines) => {
|
|
65
|
+
const depths = nestingDepths(lines, PROFILE);
|
|
66
|
+
const { symbols, emit } = symbolEmitter(lines, depths);
|
|
67
|
+
let current = null;
|
|
68
|
+
for (const [i, line] of lines.entries()) {
|
|
69
|
+
const t = line.trim();
|
|
70
|
+
if (!t || t.startsWith('//') || t.startsWith('*') || t.startsWith('/*'))
|
|
71
|
+
continue;
|
|
72
|
+
if (current && i > current.end)
|
|
73
|
+
current = null;
|
|
74
|
+
const d = depths[i] ?? 0;
|
|
75
|
+
let m;
|
|
76
|
+
if (d <= 1 && (m = JVM_TYPE.exec(t))) {
|
|
77
|
+
const [, modifiers = '', keyword = '', name = ''] = m;
|
|
78
|
+
const isPublic = csharp || !kotlin
|
|
79
|
+
? /\bpublic\b/.test(modifiers)
|
|
80
|
+
: !/\b(private|protected|internal)\b/.test(modifiers);
|
|
81
|
+
const kind = keyword === 'interface'
|
|
82
|
+
? 'interface'
|
|
83
|
+
: keyword === 'enum' || /\benum\b/.test(modifiers)
|
|
84
|
+
? 'type'
|
|
85
|
+
: 'class';
|
|
86
|
+
const end = blockEnd(depths, i, lines.length);
|
|
87
|
+
const typeRoute = annotationRoute(lines, i, true);
|
|
88
|
+
emit(name, kind, i, { exported: isPublic, end });
|
|
89
|
+
if (d === 0 || !current)
|
|
90
|
+
current = { name, depth: d, end, exported: isPublic, prefix: typeRoute?.path ?? '' };
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
const memberDepth = current ? current.depth + 1 : 0;
|
|
94
|
+
if (d !== memberDepth || (kotlin && !current && d !== 0))
|
|
95
|
+
continue;
|
|
96
|
+
let name = null;
|
|
97
|
+
let exported = false;
|
|
98
|
+
if (kotlin && (m = KOTLIN_FUN.exec(t))) {
|
|
99
|
+
const [, modifiers = '', fn = ''] = m;
|
|
100
|
+
name = fn;
|
|
101
|
+
exported = !/\b(private|protected|internal)\b/.test(modifiers);
|
|
102
|
+
}
|
|
103
|
+
else if (!kotlin && current && (m = JVM_MEMBER.exec(t))) {
|
|
104
|
+
const [, modifiers = '', type, candidate = ''] = m;
|
|
105
|
+
const before = t.slice(0, t.indexOf('('));
|
|
106
|
+
if (NOT_MEMBERS.has(candidate) ||
|
|
107
|
+
before.includes('=') ||
|
|
108
|
+
(!modifiers.trim() && !type && candidate !== current.name))
|
|
109
|
+
continue;
|
|
110
|
+
if (type && NOT_MEMBERS.has(type))
|
|
111
|
+
continue;
|
|
112
|
+
name = candidate;
|
|
113
|
+
exported = /\bpublic\b/.test(modifiers);
|
|
114
|
+
}
|
|
115
|
+
if (!name)
|
|
116
|
+
continue;
|
|
117
|
+
const route = annotationRoute(lines, i, false);
|
|
118
|
+
if (route && current) {
|
|
119
|
+
emit(`${route.method} ${routePath(current.prefix, route.path)}`, 'route', i);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
emit(current ? `${current.name}.${name}` : name, current ? 'method' : 'function', i, {
|
|
123
|
+
exported: exported && (!current || current.exported),
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return symbols;
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function extractImports(text) {
|
|
131
|
+
const pattern = /^\s*import\s+(?:static\s+)?([\w.]+)(\.\*)?\s*;?[ \t]*$/gm;
|
|
132
|
+
return matchAll(text, pattern).map(([, spec = '']) => ({ lang: 'jvm', spec }));
|
|
133
|
+
}
|
|
134
|
+
// Java and Kotlin share their import syntax and their file layout.
|
|
135
|
+
const IMPORTS = {
|
|
136
|
+
lang: 'jvm',
|
|
137
|
+
extract: extractImports,
|
|
138
|
+
resolve(_importer, { spec }, index) {
|
|
139
|
+
const parts = spec.split('.');
|
|
140
|
+
for (let n = parts.length; n >= 2; n--) {
|
|
141
|
+
const rel = parts.slice(0, n).join('/');
|
|
142
|
+
for (const ext of ['.java', '.kt']) {
|
|
143
|
+
const name = `${parts[n - 1]}${ext}`;
|
|
144
|
+
const hit = (index.byBase.get(name) ?? []).find((p) => p === `${rel}${ext}` || p.endsWith(`/${rel}${ext}`));
|
|
145
|
+
if (hit)
|
|
146
|
+
return [hit];
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return [];
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
export const JVM = [
|
|
153
|
+
{ extensions: ['.java'], symbols: jvmSymbols('java'), imports: IMPORTS, comments: C_COMMENTS },
|
|
154
|
+
{ extensions: ['.kt', '.kts'], symbols: jvmSymbols('kotlin'), imports: IMPORTS, comments: C_COMMENTS },
|
|
155
|
+
{ extensions: ['.cs'], symbols: jvmSymbols('csharp'), comments: C_COMMENTS },
|
|
156
|
+
];
|
|
157
|
+
//# sourceMappingURL=jvm.js.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Languages in which the analyzer reads neither declarations nor imports. It knows how their comments
|
|
3
|
+
* start and whether indentation carries meaning, which is enough to judge a change to them.
|
|
4
|
+
*/
|
|
5
|
+
import { C_COMMENTS, HASH_COMMENTS, MARKUP_COMMENTS, SQL_COMMENTS } from './shared.js';
|
|
6
|
+
export const OTHERS = [
|
|
7
|
+
{
|
|
8
|
+
extensions: [
|
|
9
|
+
'.scala',
|
|
10
|
+
'.swift',
|
|
11
|
+
'.c',
|
|
12
|
+
'.h',
|
|
13
|
+
'.cpp',
|
|
14
|
+
'.cc',
|
|
15
|
+
'.hpp',
|
|
16
|
+
'.dart',
|
|
17
|
+
'.css',
|
|
18
|
+
'.scss',
|
|
19
|
+
'.less',
|
|
20
|
+
'.proto',
|
|
21
|
+
'.groovy',
|
|
22
|
+
],
|
|
23
|
+
comments: C_COMMENTS,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
extensions: ['.sh', '.bash', '.zsh', '.toml', '.r', '.ex', '.exs', '.tf', '.hcl', '.nix'],
|
|
27
|
+
names: ['dockerfile'],
|
|
28
|
+
comments: HASH_COMMENTS,
|
|
29
|
+
},
|
|
30
|
+
{ extensions: ['.yaml', '.yml'], comments: HASH_COMMENTS, indentSensitive: true },
|
|
31
|
+
{ extensions: ['.sql', '.lua', '.hs', '.elm'], comments: SQL_COMMENTS },
|
|
32
|
+
{ extensions: ['.html', '.htm', '.xml'], comments: MARKUP_COMMENTS },
|
|
33
|
+
// Indentation structures the text; how a comment starts is not known.
|
|
34
|
+
{
|
|
35
|
+
extensions: ['.pug', '.haml', '.slim', '.coffee', '.styl', '.nim', '.mk', '.md'],
|
|
36
|
+
names: ['makefile'],
|
|
37
|
+
indentSensitive: true,
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
//# sourceMappingURL=others.js.map
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// biome-ignore-all lint/suspicious/noAssignInExpressions: regex matches are assigned in the condition so the else-if chain stays flat
|
|
2
|
+
/** PHP, with the routes of `Route::get('/x', ...)`. */
|
|
3
|
+
import { basename, dirname, joinPosix, normalizePosix } from '../../core/posix.js';
|
|
4
|
+
import { blockEnd, nestingDepths } from '../scan.js';
|
|
5
|
+
import { C_COMMENTS, matchAll, symbolEmitter } from './shared.js';
|
|
6
|
+
const PROFILE = { lineComments: ['//', '#'], blockComments: true };
|
|
7
|
+
const PHP_TYPE = /^(?:(?:abstract|final|readonly)\s+)*(class|interface|trait|enum)\s+(\w+)/;
|
|
8
|
+
const PHP_FUNC = /^((?:(?:public|protected|private|static|final|abstract)\s+)*)function\s+&?(\w+)\s*\(/;
|
|
9
|
+
const PHP_ROUTE = /\bRoute::(get|post|put|patch|delete|any|options)\(\s*['"]([^'"]+)['"]/;
|
|
10
|
+
function detectPhp(lines) {
|
|
11
|
+
const depths = nestingDepths(lines, PROFILE);
|
|
12
|
+
const { symbols, emit } = symbolEmitter(lines, depths);
|
|
13
|
+
let current = null;
|
|
14
|
+
for (const [i, line] of lines.entries()) {
|
|
15
|
+
const t = line.trim();
|
|
16
|
+
if (!t || t.startsWith('//') || t.startsWith('#') || t.startsWith('*') || t.startsWith('/*'))
|
|
17
|
+
continue;
|
|
18
|
+
if (current && i > current.end)
|
|
19
|
+
current = null;
|
|
20
|
+
const route = PHP_ROUTE.exec(t);
|
|
21
|
+
if (route) {
|
|
22
|
+
const [, verb = '', target = ''] = route;
|
|
23
|
+
emit(`${verb === 'any' ? 'ALL' : verb.toUpperCase()} /${target.replace(/^\//, '')}`, 'route', i);
|
|
24
|
+
}
|
|
25
|
+
const d = depths[i] ?? 0;
|
|
26
|
+
let m;
|
|
27
|
+
if (d === 0 && (m = PHP_TYPE.exec(t))) {
|
|
28
|
+
const [, keyword = '', name = ''] = m;
|
|
29
|
+
const end = blockEnd(depths, i, lines.length);
|
|
30
|
+
emit(name, keyword === 'interface' ? 'interface' : keyword === 'enum' ? 'type' : 'class', i, { end });
|
|
31
|
+
current = { name, end };
|
|
32
|
+
}
|
|
33
|
+
else if ((m = PHP_FUNC.exec(t))) {
|
|
34
|
+
const [, modifiers = '', name = ''] = m;
|
|
35
|
+
if (d === 0)
|
|
36
|
+
emit(name, 'function', i);
|
|
37
|
+
else if (d === 1 && current) {
|
|
38
|
+
emit(`${current.name}.${name}`, 'method', i, {
|
|
39
|
+
exported: !/\b(private|protected)\b/.test(modifiers),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return symbols;
|
|
45
|
+
}
|
|
46
|
+
function extractImports(text) {
|
|
47
|
+
const refs = [];
|
|
48
|
+
for (const [, spec = ''] of matchAll(text, /^\s*use\s+([\w\\]+)(?:\s+as\s+\w+)?\s*;/gm)) {
|
|
49
|
+
if (spec !== 'function' && spec !== 'const')
|
|
50
|
+
refs.push({ lang: 'php', spec });
|
|
51
|
+
}
|
|
52
|
+
const inclusion = /\b(?:require|include)(?:_once)?\s*\(?\s*(?:__DIR__\s*\.\s*)?['"]([^'"\n]+)['"]/g;
|
|
53
|
+
for (const [, file = ''] of matchAll(text, inclusion)) {
|
|
54
|
+
refs.push({ lang: 'php', spec: `./${file.replace(/^\//, '')}` });
|
|
55
|
+
}
|
|
56
|
+
return refs;
|
|
57
|
+
}
|
|
58
|
+
const IMPORTS = {
|
|
59
|
+
lang: 'php',
|
|
60
|
+
extract: extractImports,
|
|
61
|
+
resolve(importer, { spec }, index) {
|
|
62
|
+
if (spec.startsWith('.')) {
|
|
63
|
+
const p = normalizePosix(joinPosix(dirname(importer), spec));
|
|
64
|
+
return p ? [p] : [];
|
|
65
|
+
}
|
|
66
|
+
const parts = spec.split('\\').filter(Boolean);
|
|
67
|
+
for (let start = 0; start < parts.length; start++) {
|
|
68
|
+
const rel = `${parts.slice(start).join('/')}.php`;
|
|
69
|
+
if (parts.length - start < 2 && parts.length > 1)
|
|
70
|
+
break;
|
|
71
|
+
const hit = (index.byBase.get(basename(rel)) ?? []).find((p) => p === rel || p.toLowerCase().endsWith(`/${rel.toLowerCase()}`));
|
|
72
|
+
if (hit)
|
|
73
|
+
return [hit];
|
|
74
|
+
}
|
|
75
|
+
return [];
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
export const PHP = [
|
|
79
|
+
{ extensions: ['.php'], symbols: detectPhp, imports: IMPORTS, comments: [...C_COMMENTS, '#'] },
|
|
80
|
+
];
|
|
81
|
+
//# sourceMappingURL=php.js.map
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
// biome-ignore-all lint/suspicious/noAssignInExpressions: regex matches are assigned in the condition so the else-if chain stays flat
|
|
2
|
+
/** Python, with the routes that decorators such as `@app.get("/x")` register. */
|
|
3
|
+
import { dirname, joinPosix, normalizePosix } from '../../core/posix.js';
|
|
4
|
+
import { collapse } from '../symbol-types.js';
|
|
5
|
+
import { HASH_COMMENTS, matchAll, packageRootOf, symbolEmitter } from './shared.js';
|
|
6
|
+
const PY_DEF = /^([ \t]*)(?:async\s+)?def\s+(\w+)\s*\(/;
|
|
7
|
+
const PY_CLASS = /^([ \t]*)class\s+(\w+)/;
|
|
8
|
+
const PY_CONST = /^([A-Z][A-Z0-9_]*)\s*(?::[^=]+)?=\s*\S/;
|
|
9
|
+
const PY_ROUTE = /^@(\w+)\.(route|get|post|put|patch|delete|head|options|websocket|api_route)\(\s*(['"])([^'"]*)\3([^)]*)/;
|
|
10
|
+
function detectPython(lines) {
|
|
11
|
+
const { symbols, emit } = symbolEmitter(lines);
|
|
12
|
+
const indentOf = (l) => (/^[ \t]*/.exec(l)?.[0] ?? '').replace(/\t/g, ' ').length;
|
|
13
|
+
const skippable = (l) => l.trim() === '' || l.trim().startsWith('#');
|
|
14
|
+
const endOf = (i, ind) => {
|
|
15
|
+
let last = i;
|
|
16
|
+
for (let j = i + 1; j < lines.length; j++) {
|
|
17
|
+
const l = lines[j] ?? '';
|
|
18
|
+
if (skippable(l))
|
|
19
|
+
continue;
|
|
20
|
+
if (indentOf(l) <= ind) {
|
|
21
|
+
if (/^\s*[)\]}]/.test(l)) {
|
|
22
|
+
last = j;
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
last = j;
|
|
28
|
+
}
|
|
29
|
+
return last;
|
|
30
|
+
};
|
|
31
|
+
const header = (i) => {
|
|
32
|
+
let text = '';
|
|
33
|
+
for (let j = i; j < Math.min(lines.length, i + 8); j++) {
|
|
34
|
+
text += ` ${(lines[j] ?? '').trim()}`;
|
|
35
|
+
if ((lines[j] ?? '').trimEnd().endsWith(':'))
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
return collapse(text);
|
|
39
|
+
};
|
|
40
|
+
const decorators = (i) => {
|
|
41
|
+
let start = i;
|
|
42
|
+
let route = null;
|
|
43
|
+
for (let j = i - 1; j >= 0 && (lines[j] ?? '').trim().startsWith('@'); j--) {
|
|
44
|
+
start = j;
|
|
45
|
+
const m = PY_ROUTE.exec((lines[j] ?? '').trim());
|
|
46
|
+
if (m) {
|
|
47
|
+
const [, , verb = '', , path = '', rest = ''] = m;
|
|
48
|
+
const verbs = verb === 'route' || verb === 'api_route'
|
|
49
|
+
? [...(/methods\s*=\s*\[([^\]]*)\]/.exec(rest)?.[1] ?? '').matchAll(/['"](\w+)['"]/g)].map((x) => (x[1] ?? '').toUpperCase())
|
|
50
|
+
: [verb.toUpperCase()];
|
|
51
|
+
route = `${(verbs.length ? verbs : ['GET']).join(',')} ${path}`;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return { start, route };
|
|
55
|
+
};
|
|
56
|
+
let currentClass = null;
|
|
57
|
+
for (const [i, line] of lines.entries()) {
|
|
58
|
+
if (skippable(line))
|
|
59
|
+
continue;
|
|
60
|
+
const ind = indentOf(line);
|
|
61
|
+
if (currentClass && i > currentClass.end)
|
|
62
|
+
currentClass = null;
|
|
63
|
+
let m;
|
|
64
|
+
if ((m = PY_CLASS.exec(line)) && ind === 0) {
|
|
65
|
+
const [, , name = ''] = m;
|
|
66
|
+
const end = endOf(i, 0);
|
|
67
|
+
const { start } = decorators(i);
|
|
68
|
+
const exported = !name.startsWith('_');
|
|
69
|
+
emit(name, 'class', i, { exported, start, end, decl: header(i) });
|
|
70
|
+
let body = ind + 4;
|
|
71
|
+
for (let j = i + 1; j <= end; j++)
|
|
72
|
+
if (!skippable(lines[j] ?? '')) {
|
|
73
|
+
body = indentOf(lines[j] ?? '');
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
currentClass = { name, exported, end, body };
|
|
77
|
+
}
|
|
78
|
+
else if ((m = PY_DEF.exec(line))) {
|
|
79
|
+
const [, , name = ''] = m;
|
|
80
|
+
const asMethod = currentClass !== null && ind === currentClass.body;
|
|
81
|
+
if (ind !== 0 && !asMethod)
|
|
82
|
+
continue;
|
|
83
|
+
const end = endOf(i, ind);
|
|
84
|
+
const { start, route } = decorators(i);
|
|
85
|
+
if (route) {
|
|
86
|
+
emit(route, 'route', i, { start, end, decl: header(i) });
|
|
87
|
+
}
|
|
88
|
+
else if (asMethod && currentClass) {
|
|
89
|
+
emit(`${currentClass.name}.${name}`, 'method', i, {
|
|
90
|
+
exported: currentClass.exported && !name.startsWith('_'),
|
|
91
|
+
start,
|
|
92
|
+
end,
|
|
93
|
+
decl: header(i),
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
emit(name, 'function', i, { exported: !name.startsWith('_'), start, end, decl: header(i) });
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
else if (ind === 0 && (m = PY_CONST.exec(line))) {
|
|
101
|
+
const [, name = ''] = m;
|
|
102
|
+
emit(name, 'constant', i, { end: endOf(i, 0), decl: collapse(line.split('=')[0] ?? '') });
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return symbols;
|
|
106
|
+
}
|
|
107
|
+
const FROM_IMPORT = /^[ \t]*from\s+(\.*)([\w.]*)\s+import\s+([^\n#]+)/gm;
|
|
108
|
+
const IMPORT = /^[ \t]*import\s+([\w.]+(?:\s+as\s+\w+)?(?:\s*,\s*[\w.]+(?:\s+as\s+\w+)?)*)/gm;
|
|
109
|
+
/** The first word of "name as alias". */
|
|
110
|
+
const nameOf = (part) => part.trim().split(/\s+as\s+/)[0] ?? '';
|
|
111
|
+
function extractImports(text) {
|
|
112
|
+
const refs = [];
|
|
113
|
+
for (const m of matchAll(text, FROM_IMPORT)) {
|
|
114
|
+
const [, dots = '', spec = '', list = ''] = m;
|
|
115
|
+
const names = list
|
|
116
|
+
.replace(/[()\\]/g, ' ')
|
|
117
|
+
.split(',')
|
|
118
|
+
.map(nameOf)
|
|
119
|
+
.filter((n) => /^\w+$/.test(n));
|
|
120
|
+
if (spec || names.length > 0)
|
|
121
|
+
refs.push({ lang: 'py', spec, dots: dots.length, names });
|
|
122
|
+
}
|
|
123
|
+
for (const m of matchAll(text, IMPORT)) {
|
|
124
|
+
const [, list = ''] = m;
|
|
125
|
+
for (const part of list.split(',')) {
|
|
126
|
+
const spec = nameOf(part);
|
|
127
|
+
if (spec)
|
|
128
|
+
refs.push({ lang: 'py', spec, dots: 0, names: [] });
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return refs;
|
|
132
|
+
}
|
|
133
|
+
function resolveImport(importer, ref, index) {
|
|
134
|
+
const modulePath = ref.spec.replace(/\./g, '/');
|
|
135
|
+
const roots = [];
|
|
136
|
+
if (ref.dots > 0) {
|
|
137
|
+
let dir = dirname(importer);
|
|
138
|
+
for (let i = 1; i < ref.dots; i++)
|
|
139
|
+
dir = dirname(dir);
|
|
140
|
+
roots.push(dir);
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
const pkg = packageRootOf(importer);
|
|
144
|
+
roots.push('', 'src', pkg, joinPosix(pkg, 'src'), importer.split('/')[0] ?? '');
|
|
145
|
+
}
|
|
146
|
+
const found = [];
|
|
147
|
+
for (const root of [...new Set(roots)]) {
|
|
148
|
+
const base = joinPosix(root, modulePath);
|
|
149
|
+
const candidates = [
|
|
150
|
+
`${base}.py`,
|
|
151
|
+
`${base}/__init__.py`,
|
|
152
|
+
...ref.names.flatMap((n) => [`${base}/${n}.py`, `${base}/${n}/__init__.py`]),
|
|
153
|
+
];
|
|
154
|
+
for (const c of candidates) {
|
|
155
|
+
const n = normalizePosix(c);
|
|
156
|
+
if (n !== null && index.known.has(n))
|
|
157
|
+
found.push(n);
|
|
158
|
+
}
|
|
159
|
+
if (found.length > 0)
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
return [...new Set(found)];
|
|
163
|
+
}
|
|
164
|
+
const IMPORTS = {
|
|
165
|
+
lang: 'py',
|
|
166
|
+
extract: extractImports,
|
|
167
|
+
resolve: resolveImport,
|
|
168
|
+
};
|
|
169
|
+
export const PYTHON = [
|
|
170
|
+
{
|
|
171
|
+
extensions: ['.py'],
|
|
172
|
+
symbols: detectPython,
|
|
173
|
+
imports: IMPORTS,
|
|
174
|
+
comments: HASH_COMMENTS,
|
|
175
|
+
indentSensitive: true,
|
|
176
|
+
},
|
|
177
|
+
// Type stubs: their declarations and imports are not read.
|
|
178
|
+
{ extensions: ['.pyi'], comments: HASH_COMMENTS, indentSensitive: true },
|
|
179
|
+
];
|
|
180
|
+
//# sourceMappingURL=python.js.map
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// biome-ignore-all lint/suspicious/noAssignInExpressions: regex matches are assigned in the condition so the else-if chain stays flat
|
|
2
|
+
/** Ruby, with the routes of a `routes.rb`. */
|
|
3
|
+
import { dirname, joinPosix, normalizePosix } from '../../core/posix.js';
|
|
4
|
+
import { HASH_COMMENTS, matchAll, packageRootOf, symbolEmitter } from './shared.js';
|
|
5
|
+
const RB_DEF = /^(\s*)def\s+(self\.)?(\w+[?!=]?)/;
|
|
6
|
+
const RB_CLASS = /^(\s*)(class|module)\s+([A-Z][\w:]*)/;
|
|
7
|
+
const RB_ROUTE = /^\s*(get|post|put|patch|delete)\s+['"]([^'"]+)['"]/;
|
|
8
|
+
const indentOf = (line) => (/^\s*/.exec(line)?.[0] ?? '').length;
|
|
9
|
+
function rubyEnd(lines, i, indent) {
|
|
10
|
+
for (let j = i + 1; j < lines.length; j++) {
|
|
11
|
+
const l = lines[j] ?? '';
|
|
12
|
+
if (l.trim() === '')
|
|
13
|
+
continue;
|
|
14
|
+
const ind = indentOf(l);
|
|
15
|
+
if (ind === indent && /^end\b/.test(l.trim()))
|
|
16
|
+
return j;
|
|
17
|
+
if (ind < indent)
|
|
18
|
+
return j - 1;
|
|
19
|
+
}
|
|
20
|
+
return i;
|
|
21
|
+
}
|
|
22
|
+
function detectRuby(lines, path) {
|
|
23
|
+
const { symbols, emit } = symbolEmitter(lines);
|
|
24
|
+
const isRoutes = /(^|\/)routes\.rb$/.test(path);
|
|
25
|
+
const stack = [];
|
|
26
|
+
for (const [i, line] of lines.entries()) {
|
|
27
|
+
const t = line.trim();
|
|
28
|
+
if (!t || t.startsWith('#'))
|
|
29
|
+
continue;
|
|
30
|
+
const indent = indentOf(line);
|
|
31
|
+
let top = stack.at(-1);
|
|
32
|
+
while (top && i > top.end) {
|
|
33
|
+
stack.pop();
|
|
34
|
+
top = stack.at(-1);
|
|
35
|
+
}
|
|
36
|
+
if (isRoutes) {
|
|
37
|
+
const route = RB_ROUTE.exec(line);
|
|
38
|
+
if (route) {
|
|
39
|
+
const [, verb = '', target = ''] = route;
|
|
40
|
+
emit(`${verb.toUpperCase()} ${target}`, 'route', i);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (top && indent === top.indent + 2 && /^(private|protected|public)$/.test(t)) {
|
|
44
|
+
top.visibility = t;
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
let m;
|
|
48
|
+
if ((m = RB_CLASS.exec(line))) {
|
|
49
|
+
const [, , keyword = '', local = ''] = m;
|
|
50
|
+
const end = rubyEnd(lines, i, indent);
|
|
51
|
+
const name = top ? `${top.name}::${local}` : local;
|
|
52
|
+
emit(name, keyword === 'module' ? 'other' : 'class', i, { end });
|
|
53
|
+
stack.push({ name, indent, end, visibility: 'public' });
|
|
54
|
+
}
|
|
55
|
+
else if ((m = RB_DEF.exec(line))) {
|
|
56
|
+
const [, , self, local = ''] = m;
|
|
57
|
+
const end = rubyEnd(lines, i, indent);
|
|
58
|
+
if (top && indent > top.indent) {
|
|
59
|
+
emit(`${top.name}.${local}`, 'method', i, { exported: top.visibility === 'public' || !!self, end });
|
|
60
|
+
}
|
|
61
|
+
else if (!top) {
|
|
62
|
+
emit(local, 'function', i, { end });
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return symbols;
|
|
67
|
+
}
|
|
68
|
+
function extractImports(text) {
|
|
69
|
+
const refs = [];
|
|
70
|
+
for (const [, file = ''] of matchAll(text, /^\s*require_relative\s+['"]([^'"\n]+)['"]/gm)) {
|
|
71
|
+
refs.push({ lang: 'rb', spec: `./${file}` });
|
|
72
|
+
}
|
|
73
|
+
for (const [, spec = ''] of matchAll(text, /^\s*require\s+['"]([^'"\n]+)['"]/gm)) {
|
|
74
|
+
refs.push({ lang: 'rb', spec });
|
|
75
|
+
}
|
|
76
|
+
return refs;
|
|
77
|
+
}
|
|
78
|
+
const IMPORTS = {
|
|
79
|
+
lang: 'rb',
|
|
80
|
+
extract: extractImports,
|
|
81
|
+
resolve(importer, { spec }, index) {
|
|
82
|
+
const file = spec.endsWith('.rb') ? spec : `${spec}.rb`;
|
|
83
|
+
if (spec.startsWith('.')) {
|
|
84
|
+
const p = normalizePosix(joinPosix(dirname(importer), file));
|
|
85
|
+
return p ? [p] : [];
|
|
86
|
+
}
|
|
87
|
+
const hit = index.firstKnown([
|
|
88
|
+
`lib/${file}`,
|
|
89
|
+
file,
|
|
90
|
+
`app/${file}`,
|
|
91
|
+
`${packageRootOf(importer)}/lib/${file}`,
|
|
92
|
+
]);
|
|
93
|
+
return hit ? [hit] : [];
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
export const RUBY = [
|
|
97
|
+
{ extensions: ['.rb'], symbols: detectRuby, imports: IMPORTS, comments: HASH_COMMENTS },
|
|
98
|
+
];
|
|
99
|
+
//# sourceMappingURL=ruby.js.map
|