@smthrs/std 0.0.0-stage → 1.0.0-rc.4
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 +130 -0
- package/LICENSE +21 -0
- package/README.md +152 -2
- package/dist/cjs/ApplyPatch.d.ts +174 -0
- package/dist/cjs/ApplyPatch.d.ts.map +1 -0
- package/dist/cjs/ApplyPatch.js +309 -0
- package/dist/cjs/ApplyPatch.js.map +7 -0
- package/dist/cjs/Bash.d.ts +380 -0
- package/dist/cjs/Bash.d.ts.map +1 -0
- package/dist/cjs/Bash.js +332 -0
- package/dist/cjs/Bash.js.map +7 -0
- package/dist/cjs/Checkpoints.d.ts +279 -0
- package/dist/cjs/Checkpoints.d.ts.map +1 -0
- package/dist/cjs/Checkpoints.js +145 -0
- package/dist/cjs/Checkpoints.js.map +7 -0
- package/dist/cjs/Container.d.ts +132 -0
- package/dist/cjs/Container.d.ts.map +1 -0
- package/dist/cjs/Container.js +113 -0
- package/dist/cjs/Container.js.map +7 -0
- package/dist/cjs/Edit.d.ts +203 -0
- package/dist/cjs/Edit.d.ts.map +1 -0
- package/dist/cjs/Edit.js +258 -0
- package/dist/cjs/Edit.js.map +7 -0
- package/dist/cjs/ExaWebSearch.d.ts +22 -0
- package/dist/cjs/ExaWebSearch.d.ts.map +1 -0
- package/dist/cjs/ExaWebSearch.js +138 -0
- package/dist/cjs/ExaWebSearch.js.map +7 -0
- package/dist/cjs/Explore.d.ts +328 -0
- package/dist/cjs/Explore.d.ts.map +1 -0
- package/dist/cjs/Explore.js +90 -0
- package/dist/cjs/Explore.js.map +7 -0
- package/dist/cjs/Fetch.d.ts +130 -0
- package/dist/cjs/Fetch.d.ts.map +1 -0
- package/dist/cjs/Fetch.js +64 -0
- package/dist/cjs/Fetch.js.map +7 -0
- package/dist/cjs/Glob.d.ts +204 -0
- package/dist/cjs/Glob.d.ts.map +1 -0
- package/dist/cjs/Glob.js +94 -0
- package/dist/cjs/Glob.js.map +7 -0
- package/dist/cjs/Grep.d.ts +347 -0
- package/dist/cjs/Grep.d.ts.map +1 -0
- package/dist/cjs/Grep.js +181 -0
- package/dist/cjs/Grep.js.map +7 -0
- package/dist/cjs/HttpPost.d.ts +130 -0
- package/dist/cjs/HttpPost.d.ts.map +1 -0
- package/dist/cjs/HttpPost.js +72 -0
- package/dist/cjs/HttpPost.js.map +7 -0
- package/dist/cjs/LanguageServer.d.ts +90 -0
- package/dist/cjs/LanguageServer.d.ts.map +1 -0
- package/dist/cjs/LanguageServer.js +60 -0
- package/dist/cjs/LanguageServer.js.map +7 -0
- package/dist/cjs/Ls.d.ts +164 -0
- package/dist/cjs/Ls.d.ts.map +1 -0
- package/dist/cjs/Ls.js +136 -0
- package/dist/cjs/Ls.js.map +7 -0
- package/dist/cjs/Lsp.d.ts +125 -0
- package/dist/cjs/Lsp.d.ts.map +1 -0
- package/dist/cjs/Lsp.js +137 -0
- package/dist/cjs/Lsp.js.map +7 -0
- package/dist/cjs/Manifest.d.ts +918 -0
- package/dist/cjs/Manifest.d.ts.map +1 -0
- package/dist/cjs/Manifest.js +144 -0
- package/dist/cjs/Manifest.js.map +7 -0
- package/dist/cjs/NativeSearch.d.ts +38 -0
- package/dist/cjs/NativeSearch.d.ts.map +1 -0
- package/dist/cjs/NativeSearch.js +326 -0
- package/dist/cjs/NativeSearch.js.map +7 -0
- package/dist/cjs/NodeLanguageServer.d.ts +128 -0
- package/dist/cjs/NodeLanguageServer.d.ts.map +1 -0
- package/dist/cjs/NodeLanguageServer.js +796 -0
- package/dist/cjs/NodeLanguageServer.js.map +7 -0
- package/dist/cjs/PortableSearch.d.ts +24 -0
- package/dist/cjs/PortableSearch.d.ts.map +1 -0
- package/dist/cjs/PortableSearch.js +233 -0
- package/dist/cjs/PortableSearch.js.map +7 -0
- package/dist/cjs/Probe.d.ts +193 -0
- package/dist/cjs/Probe.d.ts.map +1 -0
- package/dist/cjs/Probe.js +134 -0
- package/dist/cjs/Probe.js.map +7 -0
- package/dist/cjs/Read.d.ts +189 -0
- package/dist/cjs/Read.d.ts.map +1 -0
- package/dist/cjs/Read.js +223 -0
- package/dist/cjs/Read.js.map +7 -0
- package/dist/cjs/Relocate.d.ts +73 -0
- package/dist/cjs/Relocate.d.ts.map +1 -0
- package/dist/cjs/Relocate.js +72 -0
- package/dist/cjs/Relocate.js.map +7 -0
- package/dist/cjs/Search.d.ts +163 -0
- package/dist/cjs/Search.d.ts.map +1 -0
- package/dist/cjs/Search.js +51 -0
- package/dist/cjs/Search.js.map +7 -0
- package/dist/cjs/SearchConformance.d.ts +115 -0
- package/dist/cjs/SearchConformance.d.ts.map +1 -0
- package/dist/cjs/SearchConformance.js +172 -0
- package/dist/cjs/SearchConformance.js.map +7 -0
- package/dist/cjs/SearchContract.d.ts +114 -0
- package/dist/cjs/SearchContract.d.ts.map +1 -0
- package/dist/cjs/SearchContract.js +339 -0
- package/dist/cjs/SearchContract.js.map +7 -0
- package/dist/cjs/ShellCommand.d.ts +164 -0
- package/dist/cjs/ShellCommand.d.ts.map +1 -0
- package/dist/cjs/ShellCommand.js +102 -0
- package/dist/cjs/ShellCommand.js.map +7 -0
- package/dist/cjs/StdError.d.ts +55 -0
- package/dist/cjs/StdError.d.ts.map +1 -0
- package/dist/cjs/StdError.js +74 -0
- package/dist/cjs/StdError.js.map +7 -0
- package/dist/cjs/TestRun.d.ts +311 -0
- package/dist/cjs/TestRun.d.ts.map +1 -0
- package/dist/cjs/TestRun.js +228 -0
- package/dist/cjs/TestRun.js.map +7 -0
- package/dist/cjs/TestRunner.d.ts +102 -0
- package/dist/cjs/TestRunner.d.ts.map +1 -0
- package/dist/cjs/TestRunner.js +54 -0
- package/dist/cjs/TestRunner.js.map +7 -0
- package/dist/cjs/TreeFingerprint.d.ts +140 -0
- package/dist/cjs/TreeFingerprint.d.ts.map +1 -0
- package/dist/cjs/TreeFingerprint.js +87 -0
- package/dist/cjs/TreeFingerprint.js.map +7 -0
- package/dist/cjs/UpdatePlan.d.ts +152 -0
- package/dist/cjs/UpdatePlan.d.ts.map +1 -0
- package/dist/cjs/UpdatePlan.js +87 -0
- package/dist/cjs/UpdatePlan.js.map +7 -0
- package/dist/cjs/WebFetch.d.ts +134 -0
- package/dist/cjs/WebFetch.d.ts.map +1 -0
- package/dist/cjs/WebFetch.js +140 -0
- package/dist/cjs/WebFetch.js.map +7 -0
- package/dist/cjs/WebSearch.d.ts +181 -0
- package/dist/cjs/WebSearch.d.ts.map +1 -0
- package/dist/cjs/WebSearch.js +86 -0
- package/dist/cjs/WebSearch.js.map +7 -0
- package/dist/cjs/Write.d.ts +147 -0
- package/dist/cjs/Write.d.ts.map +1 -0
- package/dist/cjs/Write.js +122 -0
- package/dist/cjs/Write.js.map +7 -0
- package/dist/cjs/index.d.ts +127 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +99 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/internal/ApplyPatch.d.ts +145 -0
- package/dist/cjs/internal/ApplyPatch.d.ts.map +1 -0
- package/dist/cjs/internal/ApplyPatch.js +462 -0
- package/dist/cjs/internal/ApplyPatch.js.map +7 -0
- package/dist/cjs/internal/CodexText.d.ts +73 -0
- package/dist/cjs/internal/CodexText.d.ts.map +1 -0
- package/dist/cjs/internal/CodexText.js +108 -0
- package/dist/cjs/internal/CodexText.js.map +7 -0
- package/dist/cjs/internal/Declaration.d.ts +49 -0
- package/dist/cjs/internal/Declaration.d.ts.map +1 -0
- package/dist/cjs/internal/Declaration.js +46 -0
- package/dist/cjs/internal/Declaration.js.map +7 -0
- package/dist/cjs/internal/Diagnostics.d.ts +77 -0
- package/dist/cjs/internal/Diagnostics.d.ts.map +1 -0
- package/dist/cjs/internal/Diagnostics.js +89 -0
- package/dist/cjs/internal/Diagnostics.js.map +7 -0
- package/dist/cjs/internal/EnvelopePrecheck.d.ts +67 -0
- package/dist/cjs/internal/EnvelopePrecheck.d.ts.map +1 -0
- package/dist/cjs/internal/EnvelopePrecheck.js +124 -0
- package/dist/cjs/internal/EnvelopePrecheck.js.map +7 -0
- package/dist/cjs/internal/Exec.d.ts +139 -0
- package/dist/cjs/internal/Exec.d.ts.map +1 -0
- package/dist/cjs/internal/Exec.js +158 -0
- package/dist/cjs/internal/Exec.js.map +7 -0
- package/dist/cjs/internal/FileMutation.d.ts +109 -0
- package/dist/cjs/internal/FileMutation.d.ts.map +1 -0
- package/dist/cjs/internal/FileMutation.js +116 -0
- package/dist/cjs/internal/FileMutation.js.map +7 -0
- package/dist/cjs/internal/FsFailure.d.ts +38 -0
- package/dist/cjs/internal/FsFailure.d.ts.map +1 -0
- package/dist/cjs/internal/FsFailure.js +40 -0
- package/dist/cjs/internal/FsFailure.js.map +7 -0
- package/dist/cjs/internal/GitWorktree.d.ts +108 -0
- package/dist/cjs/internal/GitWorktree.d.ts.map +1 -0
- package/dist/cjs/internal/GitWorktree.js +276 -0
- package/dist/cjs/internal/GitWorktree.js.map +7 -0
- package/dist/cjs/internal/Grouping.d.ts +51 -0
- package/dist/cjs/internal/Grouping.d.ts.map +1 -0
- package/dist/cjs/internal/Grouping.js +83 -0
- package/dist/cjs/internal/Grouping.js.map +7 -0
- package/dist/cjs/internal/Html.d.ts +20 -0
- package/dist/cjs/internal/Html.d.ts.map +1 -0
- package/dist/cjs/internal/Html.js +81 -0
- package/dist/cjs/internal/Html.js.map +7 -0
- package/dist/cjs/internal/Http.d.ts +95 -0
- package/dist/cjs/internal/Http.d.ts.map +1 -0
- package/dist/cjs/internal/Http.js +153 -0
- package/dist/cjs/internal/Http.js.map +7 -0
- package/dist/cjs/internal/HttpNetwork.d.ts +27 -0
- package/dist/cjs/internal/HttpNetwork.d.ts.map +1 -0
- package/dist/cjs/internal/HttpNetwork.js +146 -0
- package/dist/cjs/internal/HttpNetwork.js.map +7 -0
- package/dist/cjs/internal/Ignore.d.ts +37 -0
- package/dist/cjs/internal/Ignore.d.ts.map +1 -0
- package/dist/cjs/internal/Ignore.js +100 -0
- package/dist/cjs/internal/Ignore.js.map +7 -0
- package/dist/cjs/internal/LinearRegex.d.ts +19 -0
- package/dist/cjs/internal/LinearRegex.d.ts.map +1 -0
- package/dist/cjs/internal/LinearRegex.js +166 -0
- package/dist/cjs/internal/LinearRegex.js.map +7 -0
- package/dist/cjs/internal/Match.d.ts +85 -0
- package/dist/cjs/internal/Match.d.ts.map +1 -0
- package/dist/cjs/internal/Match.js +99 -0
- package/dist/cjs/internal/Match.js.map +7 -0
- package/dist/cjs/internal/Paths.d.ts +23 -0
- package/dist/cjs/internal/Paths.d.ts.map +1 -0
- package/dist/cjs/internal/Paths.js +52 -0
- package/dist/cjs/internal/Paths.js.map +7 -0
- package/dist/cjs/internal/Preserve.d.ts +25 -0
- package/dist/cjs/internal/Preserve.d.ts.map +1 -0
- package/dist/cjs/internal/Preserve.js +88 -0
- package/dist/cjs/internal/Preserve.js.map +7 -0
- package/dist/cjs/internal/Prune.d.ts +35 -0
- package/dist/cjs/internal/Prune.d.ts.map +1 -0
- package/dist/cjs/internal/Prune.js +54 -0
- package/dist/cjs/internal/Prune.js.map +7 -0
- package/dist/cjs/internal/SearchContract.d.ts +63 -0
- package/dist/cjs/internal/SearchContract.d.ts.map +1 -0
- package/dist/cjs/internal/SearchContract.js +46 -0
- package/dist/cjs/internal/SearchContract.js.map +7 -0
- package/dist/cjs/internal/Symbols.d.ts +39 -0
- package/dist/cjs/internal/Symbols.d.ts.map +1 -0
- package/dist/cjs/internal/Symbols.js +59 -0
- package/dist/cjs/internal/Symbols.js.map +7 -0
- package/dist/cjs/internal/TestReport.d.ts +52 -0
- package/dist/cjs/internal/TestReport.d.ts.map +1 -0
- package/dist/cjs/internal/TestReport.js +131 -0
- package/dist/cjs/internal/TestReport.js.map +7 -0
- package/dist/cjs/internal/Text.d.ts +114 -0
- package/dist/cjs/internal/Text.d.ts.map +1 -0
- package/dist/cjs/internal/Text.js +82 -0
- package/dist/cjs/internal/Text.js.map +7 -0
- package/dist/cjs/internal/Url.d.ts +13 -0
- package/dist/cjs/internal/Url.d.ts.map +1 -0
- package/dist/cjs/internal/Url.js +35 -0
- package/dist/cjs/internal/Url.js.map +7 -0
- package/dist/cjs/internal/Walk.d.ts +72 -0
- package/dist/cjs/internal/Walk.d.ts.map +1 -0
- package/dist/cjs/internal/Walk.js +108 -0
- package/dist/cjs/internal/Walk.js.map +7 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/ApplyPatch.d.ts +174 -0
- package/dist/esm/ApplyPatch.d.ts.map +1 -0
- package/dist/esm/ApplyPatch.js +346 -0
- package/dist/esm/ApplyPatch.js.map +1 -0
- package/dist/esm/Bash.d.ts +380 -0
- package/dist/esm/Bash.d.ts.map +1 -0
- package/dist/esm/Bash.js +505 -0
- package/dist/esm/Bash.js.map +1 -0
- package/dist/esm/Checkpoints.d.ts +279 -0
- package/dist/esm/Checkpoints.d.ts.map +1 -0
- package/dist/esm/Checkpoints.js +298 -0
- package/dist/esm/Checkpoints.js.map +1 -0
- package/dist/esm/Container.d.ts +132 -0
- package/dist/esm/Container.d.ts.map +1 -0
- package/dist/esm/Container.js +151 -0
- package/dist/esm/Container.js.map +1 -0
- package/dist/esm/Edit.d.ts +203 -0
- package/dist/esm/Edit.d.ts.map +1 -0
- package/dist/esm/Edit.js +296 -0
- package/dist/esm/Edit.js.map +1 -0
- package/dist/esm/ExaWebSearch.d.ts +22 -0
- package/dist/esm/ExaWebSearch.d.ts.map +1 -0
- package/dist/esm/ExaWebSearch.js +107 -0
- package/dist/esm/ExaWebSearch.js.map +1 -0
- package/dist/esm/Explore.d.ts +328 -0
- package/dist/esm/Explore.d.ts.map +1 -0
- package/dist/esm/Explore.js +106 -0
- package/dist/esm/Explore.js.map +1 -0
- package/dist/esm/Fetch.d.ts +130 -0
- package/dist/esm/Fetch.d.ts.map +1 -0
- package/dist/esm/Fetch.js +91 -0
- package/dist/esm/Fetch.js.map +1 -0
- package/dist/esm/Glob.d.ts +204 -0
- package/dist/esm/Glob.d.ts.map +1 -0
- package/dist/esm/Glob.js +177 -0
- package/dist/esm/Glob.js.map +1 -0
- package/dist/esm/Grep.d.ts +347 -0
- package/dist/esm/Grep.d.ts.map +1 -0
- package/dist/esm/Grep.js +289 -0
- package/dist/esm/Grep.js.map +1 -0
- package/dist/esm/HttpPost.d.ts +130 -0
- package/dist/esm/HttpPost.d.ts.map +1 -0
- package/dist/esm/HttpPost.js +89 -0
- package/dist/esm/HttpPost.js.map +1 -0
- package/dist/esm/LanguageServer.d.ts +90 -0
- package/dist/esm/LanguageServer.d.ts.map +1 -0
- package/dist/esm/LanguageServer.js +57 -0
- package/dist/esm/LanguageServer.js.map +1 -0
- package/dist/esm/Ls.d.ts +164 -0
- package/dist/esm/Ls.d.ts.map +1 -0
- package/dist/esm/Ls.js +178 -0
- package/dist/esm/Ls.js.map +1 -0
- package/dist/esm/Lsp.d.ts +125 -0
- package/dist/esm/Lsp.d.ts.map +1 -0
- package/dist/esm/Lsp.js +165 -0
- package/dist/esm/Lsp.js.map +1 -0
- package/dist/esm/Manifest.d.ts +918 -0
- package/dist/esm/Manifest.d.ts.map +1 -0
- package/dist/esm/Manifest.js +153 -0
- package/dist/esm/Manifest.js.map +1 -0
- package/dist/esm/NativeSearch.d.ts +38 -0
- package/dist/esm/NativeSearch.d.ts.map +1 -0
- package/dist/esm/NativeSearch.js +378 -0
- package/dist/esm/NativeSearch.js.map +1 -0
- package/dist/esm/NodeLanguageServer.d.ts +128 -0
- package/dist/esm/NodeLanguageServer.d.ts.map +1 -0
- package/dist/esm/NodeLanguageServer.js +843 -0
- package/dist/esm/NodeLanguageServer.js.map +1 -0
- package/dist/esm/PortableSearch.d.ts +24 -0
- package/dist/esm/PortableSearch.d.ts.map +1 -0
- package/dist/esm/PortableSearch.js +240 -0
- package/dist/esm/PortableSearch.js.map +1 -0
- package/dist/esm/Probe.d.ts +193 -0
- package/dist/esm/Probe.d.ts.map +1 -0
- package/dist/esm/Probe.js +225 -0
- package/dist/esm/Probe.js.map +1 -0
- package/dist/esm/Read.d.ts +189 -0
- package/dist/esm/Read.d.ts.map +1 -0
- package/dist/esm/Read.js +300 -0
- package/dist/esm/Read.js.map +1 -0
- package/dist/esm/Relocate.d.ts +73 -0
- package/dist/esm/Relocate.d.ts.map +1 -0
- package/dist/esm/Relocate.js +153 -0
- package/dist/esm/Relocate.js.map +1 -0
- package/dist/esm/Search.d.ts +163 -0
- package/dist/esm/Search.d.ts.map +1 -0
- package/dist/esm/Search.js +47 -0
- package/dist/esm/Search.js.map +1 -0
- package/dist/esm/SearchConformance.d.ts +115 -0
- package/dist/esm/SearchConformance.d.ts.map +1 -0
- package/dist/esm/SearchConformance.js +193 -0
- package/dist/esm/SearchConformance.js.map +1 -0
- package/dist/esm/SearchContract.d.ts +114 -0
- package/dist/esm/SearchContract.d.ts.map +1 -0
- package/dist/esm/SearchContract.js +461 -0
- package/dist/esm/SearchContract.js.map +1 -0
- package/dist/esm/ShellCommand.d.ts +164 -0
- package/dist/esm/ShellCommand.d.ts.map +1 -0
- package/dist/esm/ShellCommand.js +159 -0
- package/dist/esm/ShellCommand.js.map +1 -0
- package/dist/esm/StdError.d.ts +55 -0
- package/dist/esm/StdError.d.ts.map +1 -0
- package/dist/esm/StdError.js +71 -0
- package/dist/esm/StdError.js.map +1 -0
- package/dist/esm/TestRun.d.ts +311 -0
- package/dist/esm/TestRun.d.ts.map +1 -0
- package/dist/esm/TestRun.js +316 -0
- package/dist/esm/TestRun.js.map +1 -0
- package/dist/esm/TestRunner.d.ts +102 -0
- package/dist/esm/TestRunner.d.ts.map +1 -0
- package/dist/esm/TestRunner.js +68 -0
- package/dist/esm/TestRunner.js.map +1 -0
- package/dist/esm/TreeFingerprint.d.ts +140 -0
- package/dist/esm/TreeFingerprint.d.ts.map +1 -0
- package/dist/esm/TreeFingerprint.js +170 -0
- package/dist/esm/TreeFingerprint.js.map +1 -0
- package/dist/esm/UpdatePlan.d.ts +152 -0
- package/dist/esm/UpdatePlan.d.ts.map +1 -0
- package/dist/esm/UpdatePlan.js +129 -0
- package/dist/esm/UpdatePlan.js.map +1 -0
- package/dist/esm/WebFetch.d.ts +134 -0
- package/dist/esm/WebFetch.d.ts.map +1 -0
- package/dist/esm/WebFetch.js +151 -0
- package/dist/esm/WebFetch.js.map +1 -0
- package/dist/esm/WebSearch.d.ts +181 -0
- package/dist/esm/WebSearch.d.ts.map +1 -0
- package/dist/esm/WebSearch.js +134 -0
- package/dist/esm/WebSearch.js.map +1 -0
- package/dist/esm/Write.d.ts +147 -0
- package/dist/esm/Write.d.ts.map +1 -0
- package/dist/esm/Write.js +144 -0
- package/dist/esm/Write.js.map +1 -0
- package/dist/esm/index.d.ts +127 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +127 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/internal/ApplyPatch.d.ts +145 -0
- package/dist/esm/internal/ApplyPatch.d.ts.map +1 -0
- package/dist/esm/internal/ApplyPatch.js +489 -0
- package/dist/esm/internal/ApplyPatch.js.map +1 -0
- package/dist/esm/internal/CodexText.d.ts +73 -0
- package/dist/esm/internal/CodexText.d.ts.map +1 -0
- package/dist/esm/internal/CodexText.js +156 -0
- package/dist/esm/internal/CodexText.js.map +1 -0
- package/dist/esm/internal/Declaration.d.ts +49 -0
- package/dist/esm/internal/Declaration.d.ts.map +1 -0
- package/dist/esm/internal/Declaration.js +42 -0
- package/dist/esm/internal/Declaration.js.map +1 -0
- package/dist/esm/internal/Diagnostics.d.ts +77 -0
- package/dist/esm/internal/Diagnostics.d.ts.map +1 -0
- package/dist/esm/internal/Diagnostics.js +99 -0
- package/dist/esm/internal/Diagnostics.js.map +1 -0
- package/dist/esm/internal/EnvelopePrecheck.d.ts +67 -0
- package/dist/esm/internal/EnvelopePrecheck.d.ts.map +1 -0
- package/dist/esm/internal/EnvelopePrecheck.js +167 -0
- package/dist/esm/internal/EnvelopePrecheck.js.map +1 -0
- package/dist/esm/internal/Exec.d.ts +139 -0
- package/dist/esm/internal/Exec.d.ts.map +1 -0
- package/dist/esm/internal/Exec.js +193 -0
- package/dist/esm/internal/Exec.js.map +1 -0
- package/dist/esm/internal/FileMutation.d.ts +109 -0
- package/dist/esm/internal/FileMutation.d.ts.map +1 -0
- package/dist/esm/internal/FileMutation.js +123 -0
- package/dist/esm/internal/FileMutation.js.map +1 -0
- package/dist/esm/internal/FsFailure.d.ts +38 -0
- package/dist/esm/internal/FsFailure.d.ts.map +1 -0
- package/dist/esm/internal/FsFailure.js +39 -0
- package/dist/esm/internal/FsFailure.js.map +1 -0
- package/dist/esm/internal/GitWorktree.d.ts +108 -0
- package/dist/esm/internal/GitWorktree.d.ts.map +1 -0
- package/dist/esm/internal/GitWorktree.js +352 -0
- package/dist/esm/internal/GitWorktree.js.map +1 -0
- package/dist/esm/internal/Grouping.d.ts +51 -0
- package/dist/esm/internal/Grouping.d.ts.map +1 -0
- package/dist/esm/internal/Grouping.js +99 -0
- package/dist/esm/internal/Grouping.js.map +1 -0
- package/dist/esm/internal/Html.d.ts +20 -0
- package/dist/esm/internal/Html.d.ts.map +1 -0
- package/dist/esm/internal/Html.js +70 -0
- package/dist/esm/internal/Html.js.map +1 -0
- package/dist/esm/internal/Http.d.ts +95 -0
- package/dist/esm/internal/Http.d.ts.map +1 -0
- package/dist/esm/internal/Http.js +154 -0
- package/dist/esm/internal/Http.js.map +1 -0
- package/dist/esm/internal/HttpNetwork.d.ts +27 -0
- package/dist/esm/internal/HttpNetwork.d.ts.map +1 -0
- package/dist/esm/internal/HttpNetwork.js +114 -0
- package/dist/esm/internal/HttpNetwork.js.map +1 -0
- package/dist/esm/internal/Ignore.d.ts +37 -0
- package/dist/esm/internal/Ignore.d.ts.map +1 -0
- package/dist/esm/internal/Ignore.js +128 -0
- package/dist/esm/internal/Ignore.js.map +1 -0
- package/dist/esm/internal/LinearRegex.d.ts +19 -0
- package/dist/esm/internal/LinearRegex.d.ts.map +1 -0
- package/dist/esm/internal/LinearRegex.js +176 -0
- package/dist/esm/internal/LinearRegex.js.map +1 -0
- package/dist/esm/internal/Match.d.ts +85 -0
- package/dist/esm/internal/Match.d.ts.map +1 -0
- package/dist/esm/internal/Match.js +142 -0
- package/dist/esm/internal/Match.js.map +1 -0
- package/dist/esm/internal/Paths.d.ts +23 -0
- package/dist/esm/internal/Paths.d.ts.map +1 -0
- package/dist/esm/internal/Paths.js +40 -0
- package/dist/esm/internal/Paths.js.map +1 -0
- package/dist/esm/internal/Preserve.d.ts +25 -0
- package/dist/esm/internal/Preserve.d.ts.map +1 -0
- package/dist/esm/internal/Preserve.js +70 -0
- package/dist/esm/internal/Preserve.js.map +1 -0
- package/dist/esm/internal/Prune.d.ts +35 -0
- package/dist/esm/internal/Prune.d.ts.map +1 -0
- package/dist/esm/internal/Prune.js +60 -0
- package/dist/esm/internal/Prune.js.map +1 -0
- package/dist/esm/internal/SearchContract.d.ts +63 -0
- package/dist/esm/internal/SearchContract.d.ts.map +1 -0
- package/dist/esm/internal/SearchContract.js +66 -0
- package/dist/esm/internal/SearchContract.js.map +1 -0
- package/dist/esm/internal/Symbols.d.ts +39 -0
- package/dist/esm/internal/Symbols.d.ts.map +1 -0
- package/dist/esm/internal/Symbols.js +79 -0
- package/dist/esm/internal/Symbols.js.map +1 -0
- package/dist/esm/internal/TestReport.d.ts +52 -0
- package/dist/esm/internal/TestReport.d.ts.map +1 -0
- package/dist/esm/internal/TestReport.js +172 -0
- package/dist/esm/internal/TestReport.js.map +1 -0
- package/dist/esm/internal/Text.d.ts +114 -0
- package/dist/esm/internal/Text.d.ts.map +1 -0
- package/dist/esm/internal/Text.js +130 -0
- package/dist/esm/internal/Text.js.map +1 -0
- package/dist/esm/internal/Url.d.ts +13 -0
- package/dist/esm/internal/Url.d.ts.map +1 -0
- package/dist/esm/internal/Url.js +27 -0
- package/dist/esm/internal/Url.js.map +1 -0
- package/dist/esm/internal/Walk.d.ts +72 -0
- package/dist/esm/internal/Walk.d.ts.map +1 -0
- package/dist/esm/internal/Walk.js +126 -0
- package/dist/esm/internal/Walk.js.map +1 -0
- package/docs/README.md +117 -0
- package/docs/api.md +472 -0
- package/docs/concepts/effects-and-capabilities.md +136 -0
- package/docs/concepts/flows-and-handlers.md +115 -0
- package/docs/concepts/limits-and-disclosure.md +102 -0
- package/docs/concepts/search-contract.md +182 -0
- package/docs/guides/bind-the-standard-flows.md +114 -0
- package/docs/guides/implement-a-search-peer.md +133 -0
- package/docs/guides/pin-a-checkpoint.md +141 -0
- package/docs/guides/query-a-language-server.md +257 -0
- package/docs/guides/reach-the-network.md +141 -0
- package/docs/guides/read-and-edit-a-file.md +240 -0
- package/docs/guides/run-a-shell-command.md +215 -0
- package/docs/guides/run-the-test-suite.md +154 -0
- package/docs/guides/search-a-workspace.md +148 -0
- package/docs/installation.md +111 -0
- package/docs/quickstart.md +125 -0
- package/docs/reference/flows.md +556 -0
- package/docs/troubleshooting.md +322 -0
- package/package.json +439 -3
- package/src/ApplyPatch.ts +458 -0
- package/src/Bash.ts +607 -0
- package/src/Checkpoints.ts +422 -0
- package/src/Container.ts +212 -0
- package/src/Edit.ts +366 -0
- package/src/ExaWebSearch.ts +145 -0
- package/src/Explore.ts +139 -0
- package/src/Fetch.ts +117 -0
- package/src/Glob.ts +200 -0
- package/src/Grep.ts +320 -0
- package/src/HttpPost.ts +120 -0
- package/src/LanguageServer.ts +110 -0
- package/src/Ls.ts +228 -0
- package/src/Lsp.ts +184 -0
- package/src/Manifest.ts +162 -0
- package/src/NativeSearch.ts +457 -0
- package/src/NodeLanguageServer.ts +1148 -0
- package/src/PortableSearch.ts +264 -0
- package/src/Probe.ts +284 -0
- package/src/Read.ts +359 -0
- package/src/Relocate.ts +166 -0
- package/src/Search.ts +185 -0
- package/src/SearchConformance.ts +288 -0
- package/src/SearchContract.ts +489 -0
- package/src/ShellCommand.ts +201 -0
- package/src/StdError.ts +80 -0
- package/src/TestRun.ts +401 -0
- package/src/TestRunner.ts +119 -0
- package/src/TreeFingerprint.ts +200 -0
- package/src/UpdatePlan.ts +171 -0
- package/src/WebFetch.ts +194 -0
- package/src/WebSearch.ts +165 -0
- package/src/Write.ts +195 -0
- package/src/index.ts +154 -0
- package/src/internal/ApplyPatch.ts +601 -0
- package/src/internal/CodexText.ts +182 -0
- package/src/internal/Declaration.ts +60 -0
- package/src/internal/Diagnostics.ts +134 -0
- package/src/internal/EnvelopePrecheck.ts +233 -0
- package/src/internal/Exec.ts +314 -0
- package/src/internal/FileMutation.ts +231 -0
- package/src/internal/FsFailure.ts +51 -0
- package/src/internal/GitWorktree.ts +491 -0
- package/src/internal/Grouping.ts +106 -0
- package/src/internal/Html.ts +87 -0
- package/src/internal/Http.ts +209 -0
- package/src/internal/HttpNetwork.ts +153 -0
- package/src/internal/Ignore.ts +135 -0
- package/src/internal/LinearRegex.ts +173 -0
- package/src/internal/Match.ts +172 -0
- package/src/internal/Paths.ts +42 -0
- package/src/internal/Preserve.ts +108 -0
- package/src/internal/Prune.ts +62 -0
- package/src/internal/SearchContract.ts +77 -0
- package/src/internal/Symbols.ts +88 -0
- package/src/internal/TestReport.ts +194 -0
- package/src/internal/Text.ts +170 -0
- package/src/internal/Url.ts +23 -0
- package/src/internal/Walk.ts +176 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var Search_exports = {};
|
|
30
|
+
__export(Search_exports, {
|
|
31
|
+
Search: () => Search,
|
|
32
|
+
layerNoop: () => layerNoop,
|
|
33
|
+
make: () => make,
|
|
34
|
+
makeNoop: () => makeNoop
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(Search_exports);
|
|
37
|
+
var import_effect = require("effect");
|
|
38
|
+
var StdError = __toESM(require("./StdError.js"), 1);
|
|
39
|
+
const Search = import_effect.Context.Service("@smthrs/std/Search");
|
|
40
|
+
const make = (service) => Search.of(service);
|
|
41
|
+
const makeNoop = () => {
|
|
42
|
+
const unavailable = () => import_effect.Effect.fail(
|
|
43
|
+
new StdError.StdError({
|
|
44
|
+
code: "provider_unavailable",
|
|
45
|
+
message: "No search implementation is configured"
|
|
46
|
+
})
|
|
47
|
+
);
|
|
48
|
+
return make({ grep: unavailable, glob: unavailable });
|
|
49
|
+
};
|
|
50
|
+
const layerNoop = import_effect.Layer.succeed(Search, makeNoop());
|
|
51
|
+
//# sourceMappingURL=Search.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Search.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * The implementation seam for the ripgrep search contract.\n *\n * Both implementations answer the same normalized calls. `PortableSearch`\n * performs the work in-process; `NativeSearch` drives the `rg` executable.\n * Callers select an implementation by Layer and cannot observe which one was\n * selected from the result.\n *\n * @since 1.0.0\n */\n\nimport { Context, Effect, Layer } from \"effect\"\nimport * as StdError from \"./StdError.ts\"\n\n/**\n * Normalized grep input shared by both implementations.\n *\n * @category models\n * @since 1.0.0\n */\nexport interface GrepInput {\n readonly pattern: string\n readonly root: string\n readonly fixedStrings: boolean\n readonly ignoreCase: boolean\n readonly smartCase: boolean\n readonly globs: ReadonlyArray<string>\n readonly beforeContext: number\n readonly afterContext: number\n readonly maxCount?: number | undefined\n readonly filesWithMatches: boolean\n /** Opt out of root-scoped .gitignore rules; defaults to false. */\n readonly noIgnore?: boolean | undefined\n readonly hidden: boolean\n readonly symbols: boolean\n readonly limit: number\n}\n\n/**\n * One matching or context line, as a peer produces it before grouping.\n *\n * @category models\n * @since 1.0.0\n */\nexport interface GrepLine {\n readonly file: string\n readonly line: number\n readonly text: string\n readonly kind: \"match\" | \"context\"\n}\n\n/**\n * One context line carried inside the match it belongs to.\n *\n * @category models\n * @since 1.0.0\n */\nexport interface ContextLine {\n readonly line: number\n readonly text: string\n}\n\n/**\n * The definition enclosing a hit, when the file's shape says so plainly.\n *\n * @category models\n * @since 1.0.0\n */\nexport interface Symbol {\n readonly kind: string\n readonly name: string\n readonly startLine: number\n readonly endLine: number\n}\n\n/**\n * One hit: the matching line, the context that belongs to it, and the\n * definition it sits in.\n *\n * @category models\n * @since 1.0.0\n */\nexport interface GrepMatch {\n readonly file: string\n readonly line: number\n readonly text: string\n readonly before: ReadonlyArray<ContextLine>\n readonly after: ReadonlyArray<ContextLine>\n readonly symbol?: Symbol | undefined\n}\n\n/**\n * Normalized grep output.\n *\n * @category models\n * @since 1.0.0\n */\nexport interface GrepOutput {\n readonly matches: ReadonlyArray<GrepMatch>\n readonly files: ReadonlyArray<string>\n readonly filesSearched: number\n readonly skippedBinary: number\n readonly truncated: boolean\n readonly notice?: string | undefined\n}\n\n/**\n * Normalized glob input.\n *\n * @category models\n * @since 1.0.0\n */\nexport interface GlobInput {\n readonly pattern: string\n readonly root: string\n /** Opt out of root-scoped .gitignore rules; defaults to false. */\n readonly noIgnore?: boolean | undefined\n readonly hidden: boolean\n readonly limit: number\n}\n\n/**\n * Normalized glob output.\n *\n * @category models\n * @since 1.0.0\n */\nexport interface GlobOutput {\n readonly paths: ReadonlyArray<string>\n readonly total: number\n readonly truncated: boolean\n readonly notice?: string | undefined\n}\n\n/**\n * The one search contract implemented by native and portable peers.\n *\n * @category services\n * @since 1.0.0\n */\nexport interface Search {\n readonly grep: (input: GrepInput) => Effect.Effect<GrepOutput, StdError.StdError>\n readonly glob: (input: GlobInput) => Effect.Effect<GlobOutput, StdError.StdError>\n}\n\n/**\n * The {@link Search} service tag.\n *\n * @category services\n * @since 1.0.0\n */\nexport const Search: Context.Service<Search, Search> = Context.Service(\"@smthrs/std/Search\")\n\n/**\n * Builds a search service from its two operations.\n *\n * @category constructors\n * @since 1.0.0\n */\nexport const make = (service: Search): Search => Search.of(service)\n\n/**\n * Builds an unavailable search service for compositions that deliberately omit search.\n *\n * @category constructors\n * @since 1.0.0\n */\nexport const makeNoop = (): Search => {\n const unavailable = () =>\n Effect.fail(\n new StdError.StdError({\n code: \"provider_unavailable\",\n message: \"No search implementation is configured\"\n })\n )\n return make({ grep: unavailable, glob: unavailable })\n}\n\n/**\n * Provides {@link makeNoop}.\n *\n * @category layers\n * @since 1.0.0\n */\nexport const layerNoop: Layer.Layer<Search> = Layer.succeed(Search, makeNoop())\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,oBAAuC;AACvC,eAA0B;AA2InB,MAAM,SAA0C,sBAAQ,QAAQ,oBAAoB;AAQpF,MAAM,OAAO,CAAC,YAA4B,OAAO,GAAG,OAAO;AAQ3D,MAAM,WAAW,MAAc;AACpC,QAAM,cAAc,MAClB,qBAAO;AAAA,IACL,IAAI,SAAS,SAAS;AAAA,MACpB,MAAM;AAAA,MACN,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AACF,SAAO,KAAK,EAAE,MAAM,aAAa,MAAM,YAAY,CAAC;AACtD;AAQO,MAAM,YAAiC,oBAAM,QAAQ,QAAQ,SAAS,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A differential conformance kit for {@link Search} implementations.
|
|
3
|
+
*
|
|
4
|
+
* `Search` is a public extension seam: a host binds its own implementation and
|
|
5
|
+
* every `grep` and `glob` call in the package goes through it. Two peers ship
|
|
6
|
+
* here, and the contract they are held to used to live only in
|
|
7
|
+
* `test/SearchConformance.test.ts` — a file `package.json` does not publish, so
|
|
8
|
+
* a third-party peer had the seam and no way to prove it filled it. Worse, the
|
|
9
|
+
* cases there are hand-picked: they pin the divergences somebody already
|
|
10
|
+
* found. A literal `?` matched `fo` in one peer and `foo?` in the other for as
|
|
11
|
+
* long as nobody thought to write that case down.
|
|
12
|
+
*
|
|
13
|
+
* This module is the other half. It generates a tree and a batch of calls from
|
|
14
|
+
* a seed, runs them through two implementations, and reports every answer that
|
|
15
|
+
* differs. Nothing here knows which peer is right: a divergence is the finding,
|
|
16
|
+
* and the reference peer to compare against is the caller's choice —
|
|
17
|
+
* `PortableSearch` is the obvious one, because it needs no external binary.
|
|
18
|
+
*
|
|
19
|
+
* The generator deliberately stays inside the ground both peers claim to
|
|
20
|
+
* share: no symlinks, no unreadable directories, no CRLF, no NUL bytes, no
|
|
21
|
+
* filename a shell would have to quote. Those are the cases the hand-written
|
|
22
|
+
* table pins one by one, with an expected value that says which behaviour is
|
|
23
|
+
* intended. A generator cannot say that; it can only say the two disagree.
|
|
24
|
+
*
|
|
25
|
+
* @since 1.0.0
|
|
26
|
+
*/
|
|
27
|
+
import * as Effect from "effect/Effect";
|
|
28
|
+
import * as FileSystem from "effect/FileSystem";
|
|
29
|
+
import * as Path from "effect/Path";
|
|
30
|
+
import type * as Search from "./Search.ts";
|
|
31
|
+
/**
|
|
32
|
+
* One file the generated tree contains.
|
|
33
|
+
*
|
|
34
|
+
* @category models
|
|
35
|
+
* @since 1.0.0
|
|
36
|
+
*/
|
|
37
|
+
export interface GeneratedFile {
|
|
38
|
+
/** Path relative to the tree root, always with `/` separators. */
|
|
39
|
+
readonly path: string;
|
|
40
|
+
readonly content: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A generated tree plus the calls to make against it.
|
|
44
|
+
*
|
|
45
|
+
* @category models
|
|
46
|
+
* @since 1.0.0
|
|
47
|
+
*/
|
|
48
|
+
export interface Plan {
|
|
49
|
+
readonly seed: number;
|
|
50
|
+
readonly root: string;
|
|
51
|
+
readonly files: ReadonlyArray<GeneratedFile>;
|
|
52
|
+
readonly grep: ReadonlyArray<Search.GrepInput>;
|
|
53
|
+
readonly glob: ReadonlyArray<Search.GlobInput>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* One call two implementations answered differently.
|
|
57
|
+
*
|
|
58
|
+
* `subject` and `reference` are the rendered answers, so a report names the
|
|
59
|
+
* bytes that differ rather than saying only that they did.
|
|
60
|
+
*
|
|
61
|
+
* @category models
|
|
62
|
+
* @since 1.0.0
|
|
63
|
+
*/
|
|
64
|
+
export interface Divergence {
|
|
65
|
+
readonly call: "grep" | "glob";
|
|
66
|
+
readonly input: Search.GrepInput | Search.GlobInput;
|
|
67
|
+
readonly subject: string;
|
|
68
|
+
readonly reference: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Builds a reproducible tree and call batch from a seed.
|
|
72
|
+
*
|
|
73
|
+
* The same seed and root always produce the same plan, so a divergence a run
|
|
74
|
+
* reports can be replayed exactly by rerunning that seed.
|
|
75
|
+
*
|
|
76
|
+
* @category generators
|
|
77
|
+
* @since 1.0.0
|
|
78
|
+
*/
|
|
79
|
+
export declare const plan: (options: {
|
|
80
|
+
readonly seed: number;
|
|
81
|
+
readonly root: string;
|
|
82
|
+
readonly files?: number | undefined;
|
|
83
|
+
readonly calls?: number | undefined;
|
|
84
|
+
}) => Plan;
|
|
85
|
+
/**
|
|
86
|
+
* Writes a plan's tree under its root.
|
|
87
|
+
*
|
|
88
|
+
* @category generators
|
|
89
|
+
* @since 1.0.0
|
|
90
|
+
*/
|
|
91
|
+
export declare const materialize: (target: Plan) => Effect.Effect<void, never, FileSystem.FileSystem | Path.Path>;
|
|
92
|
+
/**
|
|
93
|
+
* Runs every call in a plan through two implementations and reports the
|
|
94
|
+
* answers that differ.
|
|
95
|
+
*
|
|
96
|
+
* A failure is compared like any other answer: two peers that refuse the same
|
|
97
|
+
* call with the same code agree, and one that refuses where the other answers
|
|
98
|
+
* has diverged.
|
|
99
|
+
*
|
|
100
|
+
* @category conformance
|
|
101
|
+
* @since 1.0.0
|
|
102
|
+
*/
|
|
103
|
+
export declare const compare: (options: {
|
|
104
|
+
readonly plan: Plan;
|
|
105
|
+
readonly subject: Search.Search;
|
|
106
|
+
readonly reference: Search.Search;
|
|
107
|
+
}) => Effect.Effect<ReadonlyArray<Divergence>>;
|
|
108
|
+
/**
|
|
109
|
+
* Renders divergences as the report a failing conformance run should print.
|
|
110
|
+
*
|
|
111
|
+
* @category conformance
|
|
112
|
+
* @since 1.0.0
|
|
113
|
+
*/
|
|
114
|
+
export declare const report: (divergences: ReadonlyArray<Divergence>) => string;
|
|
115
|
+
//# sourceMappingURL=SearchConformance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchConformance.d.ts","sourceRoot":"","sources":["../../src/SearchConformance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe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WAAW,GACtB,QAAQ,IAAI,KACX,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,CAW3D,CAAA;AAaJ;;;;;;;;;;GAUG;AACH,eAAO,MAAM,OAAO,GAAI,SAAS;IAC/B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;IACnB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAA;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAA;CAClC,KAAG,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,CAcvC,CAAA;AAEJ;;;;;GAKG;AACH,eAAO,MAAM,MAAM,GAAI,aAAa,aAAa,CAAC,UAAU,CAAC,KAAG,MAOhD,CAAA"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var SearchConformance_exports = {};
|
|
30
|
+
__export(SearchConformance_exports, {
|
|
31
|
+
compare: () => compare,
|
|
32
|
+
materialize: () => materialize,
|
|
33
|
+
plan: () => plan,
|
|
34
|
+
report: () => report
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(SearchConformance_exports);
|
|
37
|
+
var Effect = __toESM(require("effect/Effect"), 1);
|
|
38
|
+
var FileSystem = __toESM(require("effect/FileSystem"), 1);
|
|
39
|
+
var Path = __toESM(require("effect/Path"), 1);
|
|
40
|
+
const random = (seed) => {
|
|
41
|
+
let state = seed >>> 0;
|
|
42
|
+
return () => {
|
|
43
|
+
state = state + 1831565813 >>> 0;
|
|
44
|
+
let value = Math.imul(state ^ state >>> 15, 1 | state);
|
|
45
|
+
value = value + Math.imul(value ^ value >>> 7, 61 | value) ^ value;
|
|
46
|
+
return ((value ^ value >>> 14) >>> 0) / 4294967296;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
const pick = (next, values) => values[Math.floor(next() * values.length)];
|
|
50
|
+
const chance = (next, probability) => next() < probability;
|
|
51
|
+
const stems = ["alpha", "beta", "gamma", "Delta", "e-psilon", "ze_ta", "eta2", "th.eta", "iota", "kappa"];
|
|
52
|
+
const extensions = [".ts", ".js", ".txt", ".py", ".md"];
|
|
53
|
+
const directories = ["", "one", "one/two", "three", "three/four/five"];
|
|
54
|
+
const lines = [
|
|
55
|
+
"needle",
|
|
56
|
+
"a needle in the line",
|
|
57
|
+
"Needle capitalised",
|
|
58
|
+
"no match here",
|
|
59
|
+
"needle? with a question mark",
|
|
60
|
+
"a+b and x*y and [z]",
|
|
61
|
+
"def widen(value):",
|
|
62
|
+
"class Widget:",
|
|
63
|
+
" needle = value",
|
|
64
|
+
"function widen(value) {",
|
|
65
|
+
"",
|
|
66
|
+
"trailing needle"
|
|
67
|
+
];
|
|
68
|
+
const patterns = ["needle", "Needle", "needle?", "a+b", "[z]", "^needle$", "widen", "no match at all"];
|
|
69
|
+
const globPatterns = ["**/*.ts", "*.ts", "**/*", "one/**/*.ts", "**/*.{ts,js}", "**/alpha*"];
|
|
70
|
+
const plan = (options) => {
|
|
71
|
+
const next = random(options.seed);
|
|
72
|
+
const fileCount = options.files ?? 12;
|
|
73
|
+
const callCount = options.calls ?? 12;
|
|
74
|
+
const files = [];
|
|
75
|
+
for (let index = 0; index < fileCount; index++) {
|
|
76
|
+
const directory = pick(next, directories);
|
|
77
|
+
const name = `${pick(next, stems)}${index}${pick(next, extensions)}`;
|
|
78
|
+
const path = directory === "" ? name : `${directory}/${name}`;
|
|
79
|
+
const body = [];
|
|
80
|
+
for (let line = 0; line < 1 + Math.floor(next() * 8); line++) body.push(pick(next, lines));
|
|
81
|
+
files.push({ path, content: `${body.join("\n")}${chance(next, 0.8) ? "\n" : ""}` });
|
|
82
|
+
}
|
|
83
|
+
if (fileCount > 0) {
|
|
84
|
+
files.push(
|
|
85
|
+
{ path: ".gitignore", content: "*.ignored\n!keep.ignored\n/root-only.ts\ncache/\n" },
|
|
86
|
+
{ path: "drop.ignored", content: "needle\n" },
|
|
87
|
+
{ path: "keep.ignored", content: "needle\n" },
|
|
88
|
+
{ path: "root-only.ts", content: "needle\n" },
|
|
89
|
+
{ path: "cache/a.ts", content: "needle\n" },
|
|
90
|
+
{ path: "nested/.gitignore", content: "!keep.ignored\n/anchored.ts\nframes/\n" },
|
|
91
|
+
{ path: "nested/keep.ignored", content: "needle\n" },
|
|
92
|
+
{ path: "nested/drop.ignored", content: "needle\n" },
|
|
93
|
+
{ path: "nested/anchored.ts", content: "needle\n" },
|
|
94
|
+
{ path: "nested/deep/anchored.ts", content: "needle\n" },
|
|
95
|
+
{ path: "nested/root-only.ts", content: "needle\n" },
|
|
96
|
+
{ path: "nested/frames/a.ts", content: "needle\n" },
|
|
97
|
+
{ path: "other/frames", content: "needle\n" }
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
const roots = [options.root, ...files.map((entry) => `${options.root}/${entry.path}`)];
|
|
101
|
+
const grep = [];
|
|
102
|
+
for (let index = 0; index < callCount; index++) {
|
|
103
|
+
const fixedStrings = chance(next, 0.4);
|
|
104
|
+
const ignoreCase = chance(next, 0.25);
|
|
105
|
+
grep.push({
|
|
106
|
+
pattern: pick(next, patterns),
|
|
107
|
+
root: chance(next, 0.75) ? options.root : pick(next, roots),
|
|
108
|
+
fixedStrings,
|
|
109
|
+
ignoreCase,
|
|
110
|
+
smartCase: !ignoreCase && chance(next, 0.3),
|
|
111
|
+
globs: chance(next, 0.4) ? [pick(next, ["*.ts", "*.txt", "!*.js", "**/*.ts"])] : [],
|
|
112
|
+
beforeContext: Math.floor(next() * 3),
|
|
113
|
+
afterContext: Math.floor(next() * 3),
|
|
114
|
+
...chance(next, 0.3) ? { maxCount: 1 + Math.floor(next() * 2) } : {},
|
|
115
|
+
filesWithMatches: chance(next, 0.25),
|
|
116
|
+
hidden: chance(next, 0.5),
|
|
117
|
+
noIgnore: chance(next, 0.25),
|
|
118
|
+
symbols: chance(next, 0.3),
|
|
119
|
+
limit: 1 + Math.floor(next() * 40)
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
const glob = [];
|
|
123
|
+
for (let index = 0; index < callCount; index++) {
|
|
124
|
+
glob.push({
|
|
125
|
+
pattern: pick(next, globPatterns),
|
|
126
|
+
root: options.root,
|
|
127
|
+
hidden: chance(next, 0.5),
|
|
128
|
+
noIgnore: chance(next, 0.25),
|
|
129
|
+
limit: 1 + Math.floor(next() * 20)
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
return { seed: options.seed, root: options.root, files, grep, glob };
|
|
133
|
+
};
|
|
134
|
+
const materialize = (target) => Effect.gen(function* () {
|
|
135
|
+
const fileSystem = yield* FileSystem.FileSystem;
|
|
136
|
+
const path = yield* Path.Path;
|
|
137
|
+
yield* Effect.forEach(target.files, (entry) => {
|
|
138
|
+
const absolute = path.join(target.root, ...entry.path.split("/"));
|
|
139
|
+
return fileSystem.makeDirectory(path.dirname(absolute), { recursive: true }).pipe(
|
|
140
|
+
Effect.andThen(fileSystem.writeFileString(absolute, entry.content)),
|
|
141
|
+
Effect.orDie
|
|
142
|
+
);
|
|
143
|
+
}, { discard: true });
|
|
144
|
+
});
|
|
145
|
+
const rendered = (effect) => effect.pipe(
|
|
146
|
+
Effect.match({
|
|
147
|
+
onSuccess: (value) => JSON.stringify(value),
|
|
148
|
+
onFailure: (error) => JSON.stringify({ failure: error.code })
|
|
149
|
+
})
|
|
150
|
+
);
|
|
151
|
+
const compare = (options) => Effect.gen(function* () {
|
|
152
|
+
const divergences = [];
|
|
153
|
+
for (const input of options.plan.grep) {
|
|
154
|
+
const subject = yield* rendered(options.subject.grep(input));
|
|
155
|
+
const reference = yield* rendered(options.reference.grep(input));
|
|
156
|
+
if (subject !== reference) divergences.push({ call: "grep", input, subject, reference });
|
|
157
|
+
}
|
|
158
|
+
for (const input of options.plan.glob) {
|
|
159
|
+
const subject = yield* rendered(options.subject.glob(input));
|
|
160
|
+
const reference = yield* rendered(options.reference.glob(input));
|
|
161
|
+
if (subject !== reference) divergences.push({ call: "glob", input, subject, reference });
|
|
162
|
+
}
|
|
163
|
+
return divergences;
|
|
164
|
+
});
|
|
165
|
+
const report = (divergences) => divergences.map(
|
|
166
|
+
(divergence) => [
|
|
167
|
+
`${divergence.call}(${JSON.stringify(divergence.input)})`,
|
|
168
|
+
` subject: ${divergence.subject}`,
|
|
169
|
+
` reference: ${divergence.reference}`
|
|
170
|
+
].join("\n")
|
|
171
|
+
).join("\n\n");
|
|
172
|
+
//# sourceMappingURL=SearchConformance.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/SearchConformance.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * A differential conformance kit for {@link Search} implementations.\n *\n * `Search` is a public extension seam: a host binds its own implementation and\n * every `grep` and `glob` call in the package goes through it. Two peers ship\n * here, and the contract they are held to used to live only in\n * `test/SearchConformance.test.ts` \u2014 a file `package.json` does not publish, so\n * a third-party peer had the seam and no way to prove it filled it. Worse, the\n * cases there are hand-picked: they pin the divergences somebody already\n * found. A literal `?` matched `fo` in one peer and `foo?` in the other for as\n * long as nobody thought to write that case down.\n *\n * This module is the other half. It generates a tree and a batch of calls from\n * a seed, runs them through two implementations, and reports every answer that\n * differs. Nothing here knows which peer is right: a divergence is the finding,\n * and the reference peer to compare against is the caller's choice \u2014\n * `PortableSearch` is the obvious one, because it needs no external binary.\n *\n * The generator deliberately stays inside the ground both peers claim to\n * share: no symlinks, no unreadable directories, no CRLF, no NUL bytes, no\n * filename a shell would have to quote. Those are the cases the hand-written\n * table pins one by one, with an expected value that says which behaviour is\n * intended. A generator cannot say that; it can only say the two disagree.\n *\n * @since 1.0.0\n */\n\nimport * as Effect from \"effect/Effect\"\nimport * as FileSystem from \"effect/FileSystem\"\nimport * as Path from \"effect/Path\"\nimport type * as Search from \"./Search.ts\"\nimport type * as StdError from \"./StdError.ts\"\n\n/**\n * One file the generated tree contains.\n *\n * @category models\n * @since 1.0.0\n */\nexport interface GeneratedFile {\n /** Path relative to the tree root, always with `/` separators. */\n readonly path: string\n readonly content: string\n}\n\n/**\n * A generated tree plus the calls to make against it.\n *\n * @category models\n * @since 1.0.0\n */\nexport interface Plan {\n readonly seed: number\n readonly root: string\n readonly files: ReadonlyArray<GeneratedFile>\n readonly grep: ReadonlyArray<Search.GrepInput>\n readonly glob: ReadonlyArray<Search.GlobInput>\n}\n\n/**\n * One call two implementations answered differently.\n *\n * `subject` and `reference` are the rendered answers, so a report names the\n * bytes that differ rather than saying only that they did.\n *\n * @category models\n * @since 1.0.0\n */\nexport interface Divergence {\n readonly call: \"grep\" | \"glob\"\n readonly input: Search.GrepInput | Search.GlobInput\n readonly subject: string\n readonly reference: string\n}\n\n/**\n * mulberry32: 32 bits of state, uniform enough for fixture generation and\n * reproducible from a seed on every host, which a shared `Math.random` is not.\n */\nconst random = (seed: number): () => number => {\n let state = seed >>> 0\n return () => {\n state = (state + 0x6D2B79F5) >>> 0\n let value = Math.imul(state ^ (state >>> 15), 1 | state)\n value = (value + Math.imul(value ^ (value >>> 7), 61 | value)) ^ value\n return ((value ^ (value >>> 14)) >>> 0) / 4_294_967_296\n }\n}\n\nconst pick = <A>(next: () => number, values: ReadonlyArray<A>): A => values[Math.floor(next() * values.length)]!\n\nconst chance = (next: () => number, probability: number): boolean => next() < probability\n\n// Names both peers walk identically: no separator, no dot prefix outside the\n// two deliberate hidden entries, no name a directory skip list contains, and\n// no character that would need quoting on a command line.\nconst stems = [\"alpha\", \"beta\", \"gamma\", \"Delta\", \"e-psilon\", \"ze_ta\", \"eta2\", \"th.eta\", \"iota\", \"kappa\"] as const\nconst extensions = [\".ts\", \".js\", \".txt\", \".py\", \".md\"] as const\nconst directories = [\"\", \"one\", \"one/two\", \"three\", \"three/four/five\"] as const\n\n// Lines drawn from a vocabulary that mixes the needle, near misses, regex\n// metacharacters that must survive `fixedStrings`, and definition headers the\n// `symbols` option reads.\nconst lines = [\n \"needle\",\n \"a needle in the line\",\n \"Needle capitalised\",\n \"no match here\",\n \"needle? with a question mark\",\n \"a+b and x*y and [z]\",\n \"def widen(value):\",\n \"class Widget:\",\n \" needle = value\",\n \"function widen(value) {\",\n \"\",\n \"trailing needle\"\n] as const\n\nconst patterns = [\"needle\", \"Needle\", \"needle?\", \"a+b\", \"[z]\", \"^needle$\", \"widen\", \"no match at all\"] as const\n\nconst globPatterns = [\"**/*.ts\", \"*.ts\", \"**/*\", \"one/**/*.ts\", \"**/*.{ts,js}\", \"**/alpha*\"] as const\n\n/**\n * Builds a reproducible tree and call batch from a seed.\n *\n * The same seed and root always produce the same plan, so a divergence a run\n * reports can be replayed exactly by rerunning that seed.\n *\n * @category generators\n * @since 1.0.0\n */\nexport const plan = (options: {\n readonly seed: number\n readonly root: string\n readonly files?: number | undefined\n readonly calls?: number | undefined\n}): Plan => {\n const next = random(options.seed)\n const fileCount = options.files ?? 12\n const callCount = options.calls ?? 12\n const files: Array<GeneratedFile> = []\n for (let index = 0; index < fileCount; index++) {\n const directory = pick(next, directories)\n // The index makes every generated path unique, including repeated random picks.\n const name = `${pick(next, stems)}${index}${pick(next, extensions)}`\n const path = directory === \"\" ? name : `${directory}/${name}`\n const body: Array<string> = []\n for (let line = 0; line < 1 + Math.floor(next() * 8); line++) body.push(pick(next, lines))\n files.push({ path, content: `${body.join(\"\\n\")}${chance(next, 0.8) ? \"\\n\" : \"\"}` })\n }\n\n // Always exercise precedence, anchoring, directory pruning and nested\n // negation alongside each seed's generated content (without a git repo).\n if (fileCount > 0) {\n files.push(\n { path: \".gitignore\", content: \"*.ignored\\n!keep.ignored\\n/root-only.ts\\ncache/\\n\" },\n { path: \"drop.ignored\", content: \"needle\\n\" },\n { path: \"keep.ignored\", content: \"needle\\n\" },\n { path: \"root-only.ts\", content: \"needle\\n\" },\n { path: \"cache/a.ts\", content: \"needle\\n\" },\n { path: \"nested/.gitignore\", content: \"!keep.ignored\\n/anchored.ts\\nframes/\\n\" },\n { path: \"nested/keep.ignored\", content: \"needle\\n\" },\n { path: \"nested/drop.ignored\", content: \"needle\\n\" },\n { path: \"nested/anchored.ts\", content: \"needle\\n\" },\n { path: \"nested/deep/anchored.ts\", content: \"needle\\n\" },\n { path: \"nested/root-only.ts\", content: \"needle\\n\" },\n { path: \"nested/frames/a.ts\", content: \"needle\\n\" },\n { path: \"other/frames\", content: \"needle\\n\" }\n )\n }\n\n const roots = [options.root, ...files.map((entry) => `${options.root}/${entry.path}`)]\n const grep: Array<Search.GrepInput> = []\n for (let index = 0; index < callCount; index++) {\n const fixedStrings = chance(next, 0.4)\n // `Grep.run` refuses `ignoreCase` together with `smartCase` as mutually\n // exclusive, so a generated call carrying both would be exploring ground\n // the contract does not describe.\n const ignoreCase = chance(next, 0.25)\n grep.push({\n pattern: pick(next, patterns),\n root: chance(next, 0.75) ? options.root : pick(next, roots),\n fixedStrings,\n ignoreCase,\n smartCase: !ignoreCase && chance(next, 0.3),\n globs: chance(next, 0.4) ? [pick(next, [\"*.ts\", \"*.txt\", \"!*.js\", \"**/*.ts\"])] : [],\n beforeContext: Math.floor(next() * 3),\n afterContext: Math.floor(next() * 3),\n ...(chance(next, 0.3) ? { maxCount: 1 + Math.floor(next() * 2) } : {}),\n filesWithMatches: chance(next, 0.25),\n hidden: chance(next, 0.5),\n noIgnore: chance(next, 0.25),\n symbols: chance(next, 0.3),\n limit: 1 + Math.floor(next() * 40)\n })\n }\n\n const glob: Array<Search.GlobInput> = []\n for (let index = 0; index < callCount; index++) {\n glob.push({\n pattern: pick(next, globPatterns),\n root: options.root,\n hidden: chance(next, 0.5),\n noIgnore: chance(next, 0.25),\n limit: 1 + Math.floor(next() * 20)\n })\n }\n\n return { seed: options.seed, root: options.root, files, grep, glob }\n}\n\n/**\n * Writes a plan's tree under its root.\n *\n * @category generators\n * @since 1.0.0\n */\nexport const materialize = (\n target: Plan\n): Effect.Effect<void, never, FileSystem.FileSystem | Path.Path> =>\n Effect.gen(function*() {\n const fileSystem = yield* FileSystem.FileSystem\n const path = yield* Path.Path\n yield* Effect.forEach(target.files, (entry) => {\n const absolute = path.join(target.root, ...entry.path.split(\"/\"))\n return fileSystem.makeDirectory(path.dirname(absolute), { recursive: true }).pipe(\n Effect.andThen(fileSystem.writeFileString(absolute, entry.content)),\n Effect.orDie\n )\n }, { discard: true })\n })\n\n/** A typed answer rendered so two of them can be compared as text. */\nconst rendered = <A>(\n effect: Effect.Effect<A, StdError.StdError>\n): Effect.Effect<string> =>\n effect.pipe(\n Effect.match({\n onSuccess: (value) => JSON.stringify(value),\n onFailure: (error) => JSON.stringify({ failure: error.code })\n })\n )\n\n/**\n * Runs every call in a plan through two implementations and reports the\n * answers that differ.\n *\n * A failure is compared like any other answer: two peers that refuse the same\n * call with the same code agree, and one that refuses where the other answers\n * has diverged.\n *\n * @category conformance\n * @since 1.0.0\n */\nexport const compare = (options: {\n readonly plan: Plan\n readonly subject: Search.Search\n readonly reference: Search.Search\n}): Effect.Effect<ReadonlyArray<Divergence>> =>\n Effect.gen(function*() {\n const divergences: Array<Divergence> = []\n for (const input of options.plan.grep) {\n const subject = yield* rendered(options.subject.grep(input))\n const reference = yield* rendered(options.reference.grep(input))\n if (subject !== reference) divergences.push({ call: \"grep\", input, subject, reference })\n }\n for (const input of options.plan.glob) {\n const subject = yield* rendered(options.subject.glob(input))\n const reference = yield* rendered(options.reference.glob(input))\n if (subject !== reference) divergences.push({ call: \"glob\", input, subject, reference })\n }\n return divergences\n })\n\n/**\n * Renders divergences as the report a failing conformance run should print.\n *\n * @category conformance\n * @since 1.0.0\n */\nexport const report = (divergences: ReadonlyArray<Divergence>): string =>\n divergences.map((divergence) =>\n [\n `${divergence.call}(${JSON.stringify(divergence.input)})`,\n ` subject: ${divergence.subject}`,\n ` reference: ${divergence.reference}`\n ].join(\"\\n\")\n ).join(\"\\n\\n\")\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BA,aAAwB;AACxB,iBAA4B;AAC5B,WAAsB;AAkDtB,MAAM,SAAS,CAAC,SAA+B;AAC7C,MAAI,QAAQ,SAAS;AACrB,SAAO,MAAM;AACX,YAAS,QAAQ,eAAgB;AACjC,QAAI,QAAQ,KAAK,KAAK,QAAS,UAAU,IAAK,IAAI,KAAK;AACvD,YAAS,QAAQ,KAAK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K,IAAI;AACb,EAAE,KAAK,MAAM;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The validation and matching rules every Search implementation shares.
|
|
3
|
+
*
|
|
4
|
+
* Both peers shipped here match globs through {@link includedByGlobs} and
|
|
5
|
+
* canonicalize them through {@link canonicalGlob}, so the two implementations
|
|
6
|
+
* cannot drift on what a pattern means, and an external peer binding its own
|
|
7
|
+
* `Search` builds on the same functions. {@link unsatisfiableNotice} is the
|
|
8
|
+
* shared explanation for empty answers caused by impossible globs or ignore
|
|
9
|
+
* exclusions.
|
|
10
|
+
*
|
|
11
|
+
* @since 1.0.0
|
|
12
|
+
*/
|
|
13
|
+
import type * as Path from "@smthrs/kernel/Path";
|
|
14
|
+
import { Effect } from "effect";
|
|
15
|
+
import type * as FileSystem from "effect/FileSystem";
|
|
16
|
+
import type * as StdError from "./StdError.ts";
|
|
17
|
+
/**
|
|
18
|
+
* Validates Smithers Ripgrep ASCII v1. It is deliberately the intersection of
|
|
19
|
+
* Rust regex and JavaScript RegExp: ASCII patterns, captures, alternation,
|
|
20
|
+
* ASCII character classes and ordinary quantifiers. Lookaround,
|
|
21
|
+
* backreferences, named/inline groups, Unicode/shorthand classes and control
|
|
22
|
+
* escapes are rejected before either implementation runs. Patterns are
|
|
23
|
+
* limited to 4096 bytes, counted repetitions to 1000, group nesting to 128
|
|
24
|
+
* and expanded state machines to 8192 states. Both peers share this
|
|
25
|
+
* compilation boundary; portable matching never backtracks over input.
|
|
26
|
+
*
|
|
27
|
+
* @category validation
|
|
28
|
+
* @since 1.0.0
|
|
29
|
+
*/
|
|
30
|
+
export declare const validatePattern: (pattern: string, fixedStrings: boolean) => StdError.StdError | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Whether `error` is a pattern or glob rejection this contract wrote.
|
|
33
|
+
*
|
|
34
|
+
* Those messages are host-authored and name the construct that broke, so a
|
|
35
|
+
* caller may show them to a model. A peer's `invalid_pattern` built from
|
|
36
|
+
* `rg`'s stderr is not one of them and stays private.
|
|
37
|
+
*
|
|
38
|
+
* @category validation
|
|
39
|
+
* @since 1.0.0
|
|
40
|
+
*/
|
|
41
|
+
export declare const isContractRejection: (error: StdError.StdError) => boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Validates the portable `-g` grammar before either peer sees it.
|
|
44
|
+
*
|
|
45
|
+
* @category validation
|
|
46
|
+
* @since 1.0.0
|
|
47
|
+
*/
|
|
48
|
+
export declare const validateGlob: (glob: string) => StdError.StdError | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Compiles a pattern after common validation.
|
|
51
|
+
*
|
|
52
|
+
* @category matching
|
|
53
|
+
* @since 1.0.0
|
|
54
|
+
*/
|
|
55
|
+
export declare const expression: (pattern: string, fixedStrings: boolean, insensitive: boolean) => RegExp;
|
|
56
|
+
/**
|
|
57
|
+
* Rewrites a glob into the one spelling both peers match against.
|
|
58
|
+
*
|
|
59
|
+
* `.` is never a path component either peer can produce, so a leading `./` and
|
|
60
|
+
* every interior `/./` would silently make a pattern unmatchable. Both are
|
|
61
|
+
* folded into the root anchor, which is what a caller writing `./src/**` means.
|
|
62
|
+
* Trailing spaces are dropped because `rg` reads `-g` by gitignore's rules and
|
|
63
|
+
* drops them too, so `"a.ts "` finds `a.ts` in the native peer and has to find
|
|
64
|
+
* it in the in-process one. A leading `!` is preserved so exclusion globs
|
|
65
|
+
* canonicalize the same way.
|
|
66
|
+
*
|
|
67
|
+
* @category matching
|
|
68
|
+
* @since 1.0.0
|
|
69
|
+
*/
|
|
70
|
+
export declare const canonicalGlob: (glob: string) => string;
|
|
71
|
+
/**
|
|
72
|
+
* Matches the supported `-g` subset against a root-relative candidate path.
|
|
73
|
+
*
|
|
74
|
+
* A pattern without `/` matches the basename at any depth. Every other pattern
|
|
75
|
+
* is matched against the candidate's path relative to the search root, anchored
|
|
76
|
+
* at the root, whether or not it carries the optional leading `/`.
|
|
77
|
+
*
|
|
78
|
+
* @category matching
|
|
79
|
+
* @since 1.0.0
|
|
80
|
+
*/
|
|
81
|
+
export declare const matchesGlob: (pattern: string, relative: string, basename: string) => boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Applies ripgrep `-g` ordering: positive globs include and `!` globs exclude.
|
|
84
|
+
*
|
|
85
|
+
* @category matching
|
|
86
|
+
* @since 1.0.0
|
|
87
|
+
*/
|
|
88
|
+
export declare const includedByGlobs: (globs: ReadonlyArray<string>, relative: string, basename: string) => boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Explains the positive globs that no file under the root could ever match.
|
|
91
|
+
*
|
|
92
|
+
* A search that returns nothing is ambiguous: the tree may hold no match, or
|
|
93
|
+
* the pattern may be unsatisfiable — an absolute path written where a
|
|
94
|
+
* root-relative one belongs, a directory that does not exist, a skipped
|
|
95
|
+
* directory, a hidden path with `hidden` left false. Callers attach the result
|
|
96
|
+
* to `notice` when they produced no entries. Ignore exclusions name the
|
|
97
|
+
* `noIgnore: true` escape hatch, while impossible globs explain the correction.
|
|
98
|
+
* This keeps the cases
|
|
99
|
+
* distinguishable. Exclusion globs are ignored: excluding what is not there
|
|
100
|
+
* changes nothing.
|
|
101
|
+
*
|
|
102
|
+
* @category diagnostics
|
|
103
|
+
* @since 1.0.0
|
|
104
|
+
*/
|
|
105
|
+
export declare const unsatisfiableNotice: (options: {
|
|
106
|
+
readonly fileSystem: FileSystem.FileSystem;
|
|
107
|
+
readonly path: Path.Path;
|
|
108
|
+
readonly root: string;
|
|
109
|
+
readonly globs: ReadonlyArray<string>;
|
|
110
|
+
readonly noIgnore?: boolean | undefined;
|
|
111
|
+
readonly ignored?: boolean | undefined;
|
|
112
|
+
readonly hidden: boolean;
|
|
113
|
+
}) => Effect.Effect<string | undefined>;
|
|
114
|
+
//# sourceMappingURL=SearchContract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchContract.d.ts","sourceRoot":"","sources":["../../src/SearchContract.ts"],"names":[],"mappings":"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