0sec-cli 0.18.0 → 0.22.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/{0sec.js → 0.js} +90 -82
- package/LICENSE +1 -1
- package/README.md +62 -46
- package/chunks/adapt-loop-7I57LXXR.js +18 -0
- package/chunks/{adgraph-JLGA6RYI.js → adgraph-AUDQTBYA.js} +5 -5
- package/chunks/agent/skills/frameworks/entra-id.yaml +2 -2
- package/chunks/agent/skills/techniques/assumption-mining.yaml +2 -2
- package/chunks/agent/skills/techniques/cve-poc-adaptation.yaml +2 -2
- package/chunks/agent/skills/techniques/entra-attack-paths.yaml +1 -1
- package/chunks/agent/skills/techniques/kernel-weaponization.yaml +1 -1
- package/chunks/agent/skills/techniques/llm-prompt-injection.yaml +2 -2
- package/chunks/agent/skills/techniques/npm-ecosystem.yaml +1 -1
- package/chunks/agent/skills/techniques/poc-verification.yaml +1 -1
- package/chunks/agent/skills/techniques/seedless-depth-review.yaml +20 -38
- package/chunks/{artifact-scraper-HQ7HLP6V.js → artifact-scraper-PYZ3RU3O.js} +6 -6
- package/chunks/{assumption-mining-5SNIVVDN.js → assumption-mining-MFLF43IR.js} +24 -26
- package/chunks/{chunk-7DQEV5QI.js → chunk-23DG5YKS.js} +4 -4
- package/chunks/{chunk-UR4ELX2Y.js → chunk-2GV4HQKE.js} +340 -703
- package/chunks/{chunk-P6WKNFWX.js → chunk-2OQOQ2FZ.js} +8 -8
- package/chunks/{chunk-5G3ZXFBW.js → chunk-2WNCI664.js} +3 -3
- package/chunks/{chunk-DW5UWPFY.js → chunk-4VGLO2YS.js} +6 -5
- package/chunks/{chunk-KLTNTE2Z.js → chunk-5IBCBQEH.js} +13 -14
- package/chunks/{chunk-N7BOUYEV.js → chunk-5MWAG3FT.js} +14 -14
- package/chunks/{chunk-OEFNRYI2.js → chunk-6GHSR47F.js} +3 -6
- package/chunks/chunk-6YNKRUMC.js +4474 -0
- package/chunks/{chunk-6L26OBWI.js → chunk-76KSBWOQ.js} +255 -35
- package/chunks/chunk-7DEHG7YT.js +2143 -0
- package/chunks/{chunk-AD7WXDH6.js → chunk-7UFUALR2.js} +288 -22
- package/chunks/{chunk-53G27VPS.js → chunk-AZ7L3HFD.js} +7 -2
- package/chunks/{chunk-TSK2AG6J.js → chunk-CAYANSH6.js} +173 -1757
- package/chunks/{chunk-SAFFWQW4.js → chunk-DKSCN2AB.js} +7 -7
- package/chunks/{chunk-2JCCA2JL.js → chunk-DM5C5L5D.js} +3 -3
- package/chunks/{chunk-RWONANDA.js → chunk-DQTNI3KY.js} +5 -5
- package/chunks/{chunk-5JI7L7KV.js → chunk-EGZGZFAH.js} +10036 -12938
- package/chunks/{chunk-6LKRLK2R.js → chunk-FHC2B7LN.js} +3 -3
- package/chunks/{chunk-MYVT64FN.js → chunk-GHWODZMR.js} +2 -2
- package/chunks/{chunk-2RMLOJVB.js → chunk-GVD6SJGH.js} +2 -2
- package/chunks/{chunk-SF4KZ4O3.js → chunk-HLFS6WV2.js} +2 -2
- package/chunks/chunk-HR2TU42B.js +1228 -0
- package/chunks/{chunk-BFRB6HB2.js → chunk-HUNAPTKV.js} +3 -3
- package/chunks/chunk-IO7R7WBM.js +114 -0
- package/chunks/{chunk-WEBMRWEG.js → chunk-IXT64DV5.js} +656 -1868
- package/chunks/{chunk-3MOLBTLS.js → chunk-K2PWUPUI.js} +2 -2
- package/chunks/{chunk-WXQ6BJ6A.js → chunk-LCRTAQN2.js} +7 -7
- package/chunks/{chunk-SVJEDVYK.js → chunk-LPTRPRZR.js} +5 -5
- package/chunks/{chunk-CMKXP5RR.js → chunk-LYUAM3TG.js} +3 -3
- package/chunks/{chunk-BVAZO4WA.js → chunk-MICHDTBK.js} +3 -3
- package/chunks/{chunk-UCYRA73C.js → chunk-OAYUPGF6.js} +4 -4
- package/chunks/{chunk-XM5NLHYU.js → chunk-OWLJYJ5O.js} +14 -14
- package/chunks/{chunk-BKZFDZ23.js → chunk-QCUFBVIZ.js} +3 -3
- package/chunks/chunk-RE5EZDG2.js +5523 -0
- package/chunks/{chunk-ASUR522M.js → chunk-RRD4XXPU.js} +9 -9
- package/chunks/{chunk-AHTBZC3E.js → chunk-RSIUX3RW.js} +4 -4
- package/chunks/{chunk-BZNEY2ZS.js → chunk-SJBCK2EI.js} +15268 -16053
- package/chunks/{chunk-IOL7D5YV.js → chunk-SQCBHFWN.js} +3 -3
- package/chunks/chunk-TH2LW437.js +7829 -0
- package/chunks/{chunk-WVTBZEQO.js → chunk-TM74SSHC.js} +8 -8
- package/chunks/{chunk-U5FLXGHT.js → chunk-TO35Y326.js} +13 -729
- package/chunks/chunk-TRH2PJSN.js +547 -0
- package/chunks/{chunk-YYRBQVFE.js → chunk-TZFIAMWZ.js} +70 -16
- package/chunks/chunk-UELXHK2Y.js +1950 -0
- package/chunks/{chunk-RJWOYEOG.js → chunk-UEX7PFSE.js} +5 -5
- package/chunks/{chunk-VQG4FT5D.js → chunk-UFHN6RIU.js} +2 -2
- package/chunks/{chunk-JQHOLLTD.js → chunk-UU7PQP6N.js} +9 -9
- package/chunks/{chunk-BFR2CDV5.js → chunk-UV5QWZGE.js} +283 -153
- package/chunks/{chunk-WU6AFRAZ.js → chunk-V36HVTUL.js} +12 -12
- package/chunks/{chunk-IR537GON.js → chunk-VCSFCHAJ.js} +2 -2
- package/chunks/{chunk-YLMN3N25.js → chunk-VIT5ALXF.js} +3 -3
- package/chunks/{chunk-BATRQBOR.js → chunk-VMRRNRMR.js} +41 -41
- package/chunks/{chunk-72CISA2D.js → chunk-VNRY6AWF.js} +89 -41
- package/chunks/chunk-W6UWZFKL.js +298 -0
- package/chunks/{chunk-3KPWWJCI.js → chunk-XFCTUKXR.js} +88 -88
- package/chunks/{chunk-GMT2AZKM.js → chunk-YIQSGNAA.js} +897 -130
- package/chunks/codex-models-7TLJSY3L.js +17 -0
- package/chunks/{commands-TBC2F5CE.js → commands-NEI7L3QA.js} +2836 -1424
- package/chunks/corpus-v1.json +2 -2
- package/chunks/data/appsec-archetypes.json +2 -2
- package/chunks/data/chromium-archetypes.json +1 -1
- package/chunks/data/freebsd-archetypes.json +1 -1
- package/chunks/data/kernel-archetypes.json +2 -2
- package/chunks/db-5AP3JB4W.js +16 -0
- package/chunks/{disclose-EKTWSCGW.js → disclose-LDNKAVRH.js} +13 -11
- package/chunks/{dist-4YICS2J2.js → dist-3FNZIBB4.js} +394 -404
- package/chunks/{dist-4MAW5X6L.js → dist-5YHYNLI3.js} +6 -6
- package/chunks/{dist-FMGSR3DW.js → dist-DD4H6HMQ.js} +13 -5
- package/chunks/dist-KEULE5IQ.js +21914 -0
- package/chunks/dist-XZB53PS5.js +53 -0
- package/chunks/eval-runner-43BO2C4T.js +26 -0
- package/chunks/example-manifest.json +2 -2
- package/chunks/{exploit-agent-45YQOHPJ.js → exploit-agent-N4A5ELBK.js} +4 -4
- package/chunks/{exploit-autoclimb-UZGEMGYT.js → exploit-autoclimb-N7P6KIF5.js} +6 -6
- package/chunks/{exploit-climb-SG23KB2G.js → exploit-climb-WNEJUB5W.js} +12 -12
- package/chunks/fix-Z452M4EC.js +26 -0
- package/chunks/{github-issues-MJ6OYOOU.js → github-issues-IGTTWM7V.js} +7 -7
- package/chunks/harness-QJJJVSG4.js +22 -0
- package/chunks/http-conformance-U5F6GKYG.js +11 -0
- package/chunks/http-sender-I5XFFY35.js +10 -0
- package/chunks/hunt-scan-K6D2V3PX.js +36 -0
- package/chunks/{identity-6ZAIIWOR.js → identity-62SVRW4H.js} +5 -5
- package/chunks/{kernel-primitive-7U6CWHXD.js → kernel-primitive-TKUACPKD.js} +6 -6
- package/chunks/{kernel-vm-runner-3JAU4O6J.js → kernel-vm-runner-RAAO2PGT.js} +6 -6
- package/chunks/memsafety-scan-FCPAXIZE.js +16 -0
- package/chunks/{native-loop-RJCJPOUS.js → native-loop-2ZRJENZ3.js} +17 -18
- package/chunks/{npm-detectors-KB5Y5ZFX.js → npm-detectors-Z2ZIQCN4.js} +6 -6
- package/chunks/npm-dynamic-discovery-5J7FT3XM.js +13 -0
- package/chunks/orchestrate-2GWGNTBF.js +58 -0
- package/chunks/{pre-recon-cve-66EB6G4M.js → pre-recon-cve-X2K2P5YQ.js} +4 -4
- package/chunks/prepare-KYHGFWCJ.js +13 -0
- package/chunks/process-N245QIQG.js +12 -0
- package/chunks/{run-D56MPDKY.js → run-U3XU4CTC.js} +11507 -13632
- package/chunks/{runtime-G7YWIO3B.js → runtime-G75TEWQY.js} +10 -11
- package/chunks/runtime-XFWJTBUO.js +12 -0
- package/chunks/{scan-stream-FHI2FYZE.js → scan-stream-BMOCPKQX.js} +7 -7
- package/chunks/scope-WXI46UHJ.js +21 -0
- package/chunks/{session-store-GZ4A4KYT.js → session-store-27L3ZU73.js} +6 -6
- package/chunks/source-files-REHOM44I.js +12 -0
- package/chunks/{specdrift-WCLH6TTQ.js → specdrift-AFS54WEJ.js} +5 -5
- package/chunks/token-KRWP5JYA.js +72 -0
- package/chunks/token-util-DWTL33S3.js +8 -0
- package/chunks/variant-candidates-YWZORZMK.js +13 -0
- package/chunks/{web-recon-prepass-JJGPEOLE.js → web-recon-prepass-YVMFXCIK.js} +9 -9
- package/cli-path-traversal-fixture.js +352 -0
- package/dashboard/assets/bot-Bg1Tp9_d.js +1 -0
- package/dashboard/assets/dist-B_dDCPbu.js +1 -0
- package/dashboard/assets/findings-page-mayGhNx6.js +5 -0
- package/dashboard/assets/format--susmHX7.js +1 -0
- package/dashboard/assets/input-TuVPR3Zl.js +1 -0
- package/dashboard/assets/jsx-runtime-MGseXjj5.js +3 -0
- package/dashboard/assets/live-page-HWWHX99U.js +1 -0
- package/dashboard/assets/meta-tile-ckHo-w7k.js +1 -0
- package/dashboard/assets/operations-BxZ0OoXO.js +10 -0
- package/dashboard/assets/operations-CMFVrXEe.css +2 -0
- package/dashboard/assets/operations-app-D3d35rgo.js +46 -0
- package/dashboard/assets/overview-page-W_4IteEr.js +1 -0
- package/dashboard/assets/page-header-Bw9AJgBV.js +1 -0
- package/dashboard/assets/scans-page-CgzVXHnn.js +1 -0
- package/dashboard/assets/siren-KQj8QAnJ.js +1 -0
- package/dashboard/assets/table-8EDklulN.js +1 -0
- package/dashboard/assets/tabs-CFHPOwg8.js +1 -0
- package/dashboard/index.html +4 -5
- package/node_modules/node-addon-api/LICENSE.md +9 -0
- package/node_modules/node-addon-api/README.md +95 -0
- package/node_modules/node-addon-api/common.gypi +21 -0
- package/node_modules/node-addon-api/except.gypi +25 -0
- package/node_modules/node-addon-api/index.js +14 -0
- package/node_modules/node-addon-api/napi-inl.deprecated.h +186 -0
- package/node_modules/node-addon-api/napi-inl.h +7250 -0
- package/node_modules/node-addon-api/napi.h +3463 -0
- package/node_modules/node-addon-api/node_addon_api.gyp +42 -0
- package/node_modules/node-addon-api/node_api.gyp +9 -0
- package/node_modules/node-addon-api/noexcept.gypi +26 -0
- package/node_modules/node-addon-api/nothing.c +0 -0
- package/node_modules/node-addon-api/package-support.json +21 -0
- package/node_modules/node-addon-api/package.json +481 -0
- package/node_modules/node-addon-api/tools/README.md +73 -0
- package/node_modules/node-addon-api/tools/check-napi.js +99 -0
- package/node_modules/node-addon-api/tools/clang-format.js +71 -0
- package/node_modules/node-addon-api/tools/conversion.js +301 -0
- package/node_modules/node-gyp-build/LICENSE +21 -0
- package/node_modules/node-gyp-build/README.md +58 -0
- package/node_modules/node-gyp-build/SECURITY.md +5 -0
- package/node_modules/node-gyp-build/bin.js +84 -0
- package/node_modules/node-gyp-build/build-test.js +19 -0
- package/node_modules/node-gyp-build/index.js +6 -0
- package/node_modules/node-gyp-build/node-gyp-build.js +207 -0
- package/node_modules/node-gyp-build/optional.js +7 -0
- package/node_modules/node-gyp-build/package.json +43 -0
- package/node_modules/tree-sitter/LICENSE +21 -0
- package/node_modules/tree-sitter/README.md +90 -0
- package/node_modules/tree-sitter/binding.gyp +76 -0
- package/node_modules/tree-sitter/index.js +895 -0
- package/node_modules/tree-sitter/package.json +62 -0
- package/node_modules/tree-sitter/prebuilds/darwin-arm64/tree-sitter.node +0 -0
- package/node_modules/tree-sitter/prebuilds/darwin-x64/tree-sitter.node +0 -0
- package/node_modules/tree-sitter/prebuilds/linux-x64/tree-sitter.node +0 -0
- package/node_modules/tree-sitter/prebuilds/win32-x64/tree-sitter.node +0 -0
- package/node_modules/tree-sitter/src/addon_data.h +47 -0
- package/node_modules/tree-sitter/src/binding.cc +35 -0
- package/node_modules/tree-sitter/src/conversions.cc +140 -0
- package/node_modules/tree-sitter/src/conversions.h +22 -0
- package/node_modules/tree-sitter/src/language.cc +106 -0
- package/node_modules/tree-sitter/src/language.h +17 -0
- package/node_modules/tree-sitter/src/logger.cc +70 -0
- package/node_modules/tree-sitter/src/logger.h +19 -0
- package/node_modules/tree-sitter/src/lookaheaditerator.cc +122 -0
- package/node_modules/tree-sitter/src/lookaheaditerator.h +33 -0
- package/node_modules/tree-sitter/src/node.cc +1056 -0
- package/node_modules/tree-sitter/src/node.h +30 -0
- package/node_modules/tree-sitter/src/parser.cc +298 -0
- package/node_modules/tree-sitter/src/parser.h +35 -0
- package/node_modules/tree-sitter/src/query.cc +383 -0
- package/node_modules/tree-sitter/src/query.h +39 -0
- package/node_modules/tree-sitter/src/tree.cc +307 -0
- package/node_modules/tree-sitter/src/tree.h +45 -0
- package/node_modules/tree-sitter/src/tree_cursor.cc +213 -0
- package/node_modules/tree-sitter/src/tree_cursor.h +52 -0
- package/node_modules/tree-sitter/tree-sitter.d.ts +211 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/LICENSE +21 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/README.md +21 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/README.md +6 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/include/tree_sitter/api.h +1266 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/alloc.c +48 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/alloc.h +41 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/array.h +290 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/atomic.h +68 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/clock.h +146 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/error_costs.h +11 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/get_changed_ranges.c +501 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/get_changed_ranges.h +36 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/host.h +21 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/language.c +221 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/language.h +299 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/length.h +52 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lexer.c +419 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lexer.h +49 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lib.c +14 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/node.c +774 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/parser.c +2151 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/parser.h +230 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/point.h +62 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/query.c +4134 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/reduce_action.h +34 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/reusable_node.h +95 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/stack.c +899 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/stack.h +133 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/subtree.c +1060 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/subtree.h +382 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree.c +165 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree.h +31 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree_cursor.c +714 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree_cursor.h +48 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/ICU_SHA +1 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/LICENSE +414 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/README.md +29 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/ptypes.h +1 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/umachine.h +448 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/urename.h +1 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf.h +1 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf16.h +733 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf8.h +881 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode.h +50 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/stdlib-symbols.txt +23 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/stdlib.c +109 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/wasm-stdlib.h +1294 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm_store.c +1823 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm_store.h +31 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/test/fixtures/grammars/.gitkeep +0 -0
- package/node_modules/tree-sitter-c/LICENSE +21 -0
- package/node_modules/tree-sitter-c/README.md +18 -0
- package/node_modules/tree-sitter-c/binding.gyp +20 -0
- package/node_modules/tree-sitter-c/bindings/node/binding.cc +20 -0
- package/node_modules/tree-sitter-c/bindings/node/index.d.ts +28 -0
- package/node_modules/tree-sitter-c/bindings/node/index.js +7 -0
- package/node_modules/tree-sitter-c/grammar.js +1463 -0
- package/node_modules/tree-sitter-c/package.json +108 -0
- package/node_modules/tree-sitter-c/prebuilds/darwin-arm64/tree-sitter-c.node +0 -0
- package/node_modules/tree-sitter-c/prebuilds/darwin-x64/tree-sitter-c.node +0 -0
- package/node_modules/tree-sitter-c/prebuilds/linux-x64/tree-sitter-c.node +0 -0
- package/node_modules/tree-sitter-c/prebuilds/win32-x64/tree-sitter-c.node +0 -0
- package/node_modules/tree-sitter-c/queries/highlights.scm +81 -0
- package/node_modules/tree-sitter-c/queries/tags.scm +9 -0
- package/node_modules/tree-sitter-c/src/grammar.json +9682 -0
- package/node_modules/tree-sitter-c/src/node-types.json +4556 -0
- package/node_modules/tree-sitter-c/src/parser.c +113852 -0
- package/node_modules/tree-sitter-c/src/tree_sitter/alloc.h +54 -0
- package/node_modules/tree-sitter-c/src/tree_sitter/array.h +290 -0
- package/node_modules/tree-sitter-c/src/tree_sitter/parser.h +265 -0
- package/package.json +20 -13
- package/vendor/tree-sitter-0.21.1-node24.json +16 -0
- package/vendor/tree-sitter-0.21.1-node24.tgz +0 -0
- package/chunks/adapt-loop-SMH6V4PD.js +0 -18
- package/chunks/appsec-catalog-CBWHGTEL.js +0 -24
- package/chunks/chunk-242TMK6G.js +0 -110
- package/chunks/chunk-57ZENEX2.js +0 -169
- package/chunks/chunk-ADOLI6DT.js +0 -102
- package/chunks/chunk-ATATQACO.js +0 -471
- package/chunks/chunk-C2WXWFBB.js +0 -1070
- package/chunks/chunk-F3WBKITT.js +0 -687
- package/chunks/chunk-H2FFLZNK.js +0 -3
- package/chunks/chunk-LP3HHYQU.js +0 -245
- package/chunks/chunk-QI233I24.js +0 -333
- package/chunks/chunk-RRMJC3ZE.js +0 -105
- package/chunks/chunk-Z5FA2XOX.js +0 -2798
- package/chunks/cost-ledger-NU63MYZM.js +0 -13
- package/chunks/db-KFWOAUUB.js +0 -16
- package/chunks/eval-runner-7ZF472KV.js +0 -27
- package/chunks/fix-IG7LYXH3.js +0 -12
- package/chunks/harness-7ODOLOWU.js +0 -22
- package/chunks/http-conformance-DU66MZIU.js +0 -11
- package/chunks/http-sender-GWH2IYEA.js +0 -10
- package/chunks/hunt-scan-MMKUOETU.js +0 -38
- package/chunks/memsafety-scan-J7SECV5W.js +0 -16
- package/chunks/npm-dynamic-discovery-AHROOZDB.js +0 -13
- package/chunks/orchestrate-OC2VZN2X.js +0 -62
- package/chunks/pipeline-BZK5BLJR.js +0 -14
- package/chunks/prepare-MYY743TK.js +0 -13
- package/chunks/process-LQRCS5OY.js +0 -13
- package/chunks/replay-runner-45G3VU7X.js +0 -39
- package/chunks/runtime-J7PLXZNM.js +0 -12
- package/chunks/scope-BI7BF4ZY.js +0 -18
- package/chunks/source-files-PWRQR6LY.js +0 -12
- package/chunks/variant-candidates-YERCYMPD.js +0 -13
- package/dashboard/assets/0sec-icon-66SreztZ.gif +0 -0
- package/dashboard/assets/bot-yILPnRgD.js +0 -1
- package/dashboard/assets/chevron-down-BeDJ-Vka.js +0 -1
- package/dashboard/assets/circle-alert-BEnMBMT-.js +0 -1
- package/dashboard/assets/client-DRYsuOGl.js +0 -9
- package/dashboard/assets/copy-Bi5vzoF9.js +0 -1
- package/dashboard/assets/desktop-CXTQonNm.js +0 -32
- package/dashboard/assets/desktop-NOekk4QS.css +0 -1
- package/dashboard/assets/dist-CmX-h7a4.js +0 -1
- package/dashboard/assets/dist-DAwYQmf_.js +0 -45
- package/dashboard/assets/findings-page-CACW9nw2.js +0 -5
- package/dashboard/assets/format-PoISqsES.js +0 -1
- package/dashboard/assets/jsx-runtime-C7oxC63R.js +0 -1
- package/dashboard/assets/live-page-DrgQqQK5.js +0 -1
- package/dashboard/assets/meta-tile-CcskIV_o.js +0 -1
- package/dashboard/assets/operations-BKE8T-vY.css +0 -2
- package/dashboard/assets/operations-D8nUP5_m.js +0 -4
- package/dashboard/assets/operations-app-CQQhG54n.js +0 -2
- package/dashboard/assets/overview-page-DTGS8dPo.js +0 -1
- package/dashboard/assets/page-header-MFVvEtZW.js +0 -1
- package/dashboard/assets/play-Dwo-9xt6.js +0 -1
- package/dashboard/assets/scans-page-ChVtq8Us.js +0 -1
- package/dashboard/assets/search-CiooTLck.js +0 -1
- package/dashboard/assets/siren-CCBwTSuk.js +0 -1
- package/dashboard/assets/table-BYS-nIVA.js +0 -1
- package/dashboard/assets/tabs-DivxbhQy.js +0 -1
- package/dashboard/desktop.html +0 -21
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
#include "./query.h"
|
|
2
|
+
#include "./language.h"
|
|
3
|
+
#include "./node.h"
|
|
4
|
+
|
|
5
|
+
#include <napi.h>
|
|
6
|
+
#include <string>
|
|
7
|
+
#include <vector>
|
|
8
|
+
|
|
9
|
+
using std::vector;
|
|
10
|
+
using namespace Napi;
|
|
11
|
+
|
|
12
|
+
namespace node_tree_sitter {
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
tstag() {
|
|
16
|
+
b2sum -l64 <(printf tree-sitter) <(printf "$1") | \
|
|
17
|
+
awk '{printf "0x" toupper($1) (NR == 1 ? ", " : "\n")}'
|
|
18
|
+
}
|
|
19
|
+
tstag query # => 0x8AF2E5212AD58ABF, 0x7B1FAB666CBD6803
|
|
20
|
+
*/
|
|
21
|
+
const napi_type_tag QUERY_TYPE_TAG = {
|
|
22
|
+
0x8AF2E5212AD58ABF, 0x7B1FAB666CBD6803
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const char *query_error_names[] = {
|
|
26
|
+
"TSQueryErrorNone",
|
|
27
|
+
"TSQueryErrorSyntax",
|
|
28
|
+
"TSQueryErrorNodeType",
|
|
29
|
+
"TSQueryErrorField",
|
|
30
|
+
"TSQueryErrorCapture",
|
|
31
|
+
"TSQueryErrorStructure",
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
void Query::Init(Napi::Env env, Napi::Object exports) {
|
|
35
|
+
auto *data = env.GetInstanceData<AddonData>();
|
|
36
|
+
data->ts_query_cursor = ts_query_cursor_new();
|
|
37
|
+
|
|
38
|
+
Function ctor = DefineClass(env, "Query", {
|
|
39
|
+
InstanceAccessor("matchLimit", &Query::MatchLimit, nullptr, napi_default_method),
|
|
40
|
+
|
|
41
|
+
InstanceMethod("_matches", &Query::Matches, napi_default_method),
|
|
42
|
+
InstanceMethod("_captures", &Query::Captures, napi_default_method),
|
|
43
|
+
InstanceMethod("_getPredicates", &Query::GetPredicates, napi_default_method),
|
|
44
|
+
InstanceMethod("disableCapture", &Query::DisableCapture, napi_default_method),
|
|
45
|
+
InstanceMethod("disablePattern", &Query::DisablePattern, napi_default_method),
|
|
46
|
+
InstanceMethod("isPatternGuaranteedAtStep", &Query::IsPatternGuaranteedAtStep, napi_default_method),
|
|
47
|
+
InstanceMethod("isPatternRooted", &Query::IsPatternRooted, napi_default_method),
|
|
48
|
+
InstanceMethod("isPatternNonLocal", &Query::IsPatternNonLocal, napi_default_method),
|
|
49
|
+
InstanceMethod("startIndexForPattern", &Query::StartIndexForPattern, napi_default_method),
|
|
50
|
+
InstanceMethod("didExceedMatchLimit", &Query::DidExceedMatchLimit, napi_default_method),
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
data->query_constructor = Napi::Persistent(ctor);
|
|
54
|
+
exports["Query"] = ctor;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
Query::Query(const Napi::CallbackInfo &info) : Napi::ObjectWrap<Query>(info) , query_(nullptr) {
|
|
58
|
+
Napi::Env env = info.Env();
|
|
59
|
+
|
|
60
|
+
Value().TypeTag(&QUERY_TYPE_TAG);
|
|
61
|
+
|
|
62
|
+
const TSLanguage *language = language_methods::UnwrapLanguage(info[0]);
|
|
63
|
+
const char *source;
|
|
64
|
+
uint32_t source_len;
|
|
65
|
+
uint32_t error_offset = 0;
|
|
66
|
+
TSQueryError error_type = TSQueryErrorNone;
|
|
67
|
+
|
|
68
|
+
if (language == nullptr) {
|
|
69
|
+
throw Error::New(env, "Missing language argument");
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (info[1].IsString()) {
|
|
73
|
+
auto string = info[1].As<String>();
|
|
74
|
+
std::string utf8_string = string.Utf8Value();
|
|
75
|
+
source = utf8_string.data();
|
|
76
|
+
source_len = utf8_string.length();
|
|
77
|
+
query_ = ts_query_new(language, source, source_len, &error_offset, &error_type);
|
|
78
|
+
} else if (info[1].IsBuffer()) {
|
|
79
|
+
auto buf = info[1].As<Buffer<char>>();
|
|
80
|
+
source = buf.Data();
|
|
81
|
+
source_len = buf.Length();
|
|
82
|
+
query_ = ts_query_new(language, source, source_len, &error_offset, &error_type);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
throw Error::New(env, "Missing source argument");
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (error_offset > 0) {
|
|
89
|
+
const char *error_name = query_error_names[error_type];
|
|
90
|
+
std::string message = "Query error of type ";
|
|
91
|
+
message += error_name;
|
|
92
|
+
message += " at position ";
|
|
93
|
+
message += std::to_string(error_offset);
|
|
94
|
+
throw Error::New(env, message.c_str());
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
info.This().As<Napi::Object>().Get("_init").As<Napi::Function>().Call(info.This(), {});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
Query::~Query() {
|
|
101
|
+
ts_query_delete(query_);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
Query *Query::UnwrapQuery(const Napi::Value &value) {
|
|
105
|
+
if (!value.IsObject()) {
|
|
106
|
+
return nullptr;
|
|
107
|
+
}
|
|
108
|
+
auto js_query = value.As<Object>();
|
|
109
|
+
if (!js_query.CheckTypeTag(&QUERY_TYPE_TAG)) {
|
|
110
|
+
return nullptr;
|
|
111
|
+
}
|
|
112
|
+
return Query::Unwrap(js_query);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
Napi::Value Query::GetPredicates(const Napi::CallbackInfo &info) {
|
|
116
|
+
Napi::Env env = info.Env();
|
|
117
|
+
Query *query = Query::UnwrapQuery(info.This());
|
|
118
|
+
auto *ts_query = query->query_;
|
|
119
|
+
|
|
120
|
+
auto pattern_len = ts_query_pattern_count(ts_query);
|
|
121
|
+
|
|
122
|
+
Array js_predicates = Array::New(env);
|
|
123
|
+
|
|
124
|
+
for (size_t pattern_index = 0; pattern_index < pattern_len; pattern_index++) {
|
|
125
|
+
uint32_t predicates_len;
|
|
126
|
+
const TSQueryPredicateStep *predicates = ts_query_predicates_for_pattern(
|
|
127
|
+
ts_query, pattern_index, &predicates_len);
|
|
128
|
+
|
|
129
|
+
Array js_pattern_predicates = Array::New(env);
|
|
130
|
+
|
|
131
|
+
if (predicates_len > 0) {
|
|
132
|
+
Array js_predicate = Array::New(env);
|
|
133
|
+
|
|
134
|
+
size_t a_index = 0;
|
|
135
|
+
size_t p_index = 0;
|
|
136
|
+
for (size_t i = 0; i < predicates_len; i++) {
|
|
137
|
+
const TSQueryPredicateStep predicate = predicates[i];
|
|
138
|
+
uint32_t len;
|
|
139
|
+
switch (predicate.type) {
|
|
140
|
+
case TSQueryPredicateStepTypeCapture:
|
|
141
|
+
js_predicate[p_index++] = Number::New(env, TSQueryPredicateStepTypeCapture);
|
|
142
|
+
js_predicate[p_index++] = String::New(env,
|
|
143
|
+
ts_query_capture_name_for_id(ts_query, predicate.value_id, &len)
|
|
144
|
+
);
|
|
145
|
+
break;
|
|
146
|
+
case TSQueryPredicateStepTypeString:
|
|
147
|
+
js_predicate[p_index++] = Number::New(env, TSQueryPredicateStepTypeString);
|
|
148
|
+
js_predicate[p_index++] = String::New(env,
|
|
149
|
+
ts_query_string_value_for_id(ts_query, predicate.value_id, &len)
|
|
150
|
+
);
|
|
151
|
+
break;
|
|
152
|
+
case TSQueryPredicateStepTypeDone:
|
|
153
|
+
js_pattern_predicates[a_index++] = js_predicate;
|
|
154
|
+
js_predicate = Array::New(env);
|
|
155
|
+
p_index = 0;
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
js_predicates[pattern_index] = js_pattern_predicates;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return js_predicates;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
Napi::Value Query::Matches(const Napi::CallbackInfo &info) {
|
|
168
|
+
Napi::Env env = info.Env();
|
|
169
|
+
auto *data = env.GetInstanceData<AddonData>();
|
|
170
|
+
Query *query = Query::UnwrapQuery(info.This());
|
|
171
|
+
const Tree *tree = Tree::UnwrapTree(info[0]);
|
|
172
|
+
|
|
173
|
+
uint32_t start_row = 0, start_column = 0, end_row = 0, end_column = 0, start_index = 0, end_index = 0,
|
|
174
|
+
match_limit = UINT32_MAX, max_start_depth = UINT32_MAX;
|
|
175
|
+
|
|
176
|
+
if (info.Length() > 1 && info[1].IsNumber()) {
|
|
177
|
+
start_row = info[1].As<Number>().Uint32Value();
|
|
178
|
+
}
|
|
179
|
+
if (info.Length() > 2 && info[2].IsNumber()) {
|
|
180
|
+
start_column = info[2].As<Number>().Uint32Value() << 1;
|
|
181
|
+
}
|
|
182
|
+
if (info.Length() > 3 && info[3].IsNumber()) {
|
|
183
|
+
end_row = info[3].As<Number>().Uint32Value();
|
|
184
|
+
}
|
|
185
|
+
if (info.Length() > 4 && info[4].IsNumber()) {
|
|
186
|
+
end_column = info[4].As<Number>().Uint32Value() << 1;
|
|
187
|
+
}
|
|
188
|
+
if (info.Length() > 5 && info[5].IsNumber()) {
|
|
189
|
+
start_index = info[5].As<Number>().Uint32Value();
|
|
190
|
+
}
|
|
191
|
+
if (info.Length() > 6 && info[6].IsNumber()) {
|
|
192
|
+
end_index = info[6].As<Number>().Uint32Value() << 1;
|
|
193
|
+
}
|
|
194
|
+
if (info.Length() > 7 && info[7].IsNumber()) {
|
|
195
|
+
match_limit = info[7].As<Number>().Uint32Value();
|
|
196
|
+
}
|
|
197
|
+
if (info.Length() > 8 && info[8].IsNumber()) {
|
|
198
|
+
max_start_depth = info[8].As<Number>().Uint32Value();
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (query == nullptr) {
|
|
202
|
+
throw Error::New(env, "Missing argument query");
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (tree == nullptr) {
|
|
206
|
+
throw Error::New(env, "Missing argument tree");
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
TSQuery *ts_query = query->query_;
|
|
210
|
+
TSNode root_node = node_methods::UnmarshalNode(env, tree);
|
|
211
|
+
TSPoint start_point = {start_row, start_column};
|
|
212
|
+
TSPoint end_point = {end_row, end_column};
|
|
213
|
+
ts_query_cursor_set_point_range(data->ts_query_cursor, start_point, end_point);
|
|
214
|
+
ts_query_cursor_set_byte_range(data->ts_query_cursor, start_index, end_index);
|
|
215
|
+
ts_query_cursor_set_match_limit(data->ts_query_cursor, match_limit);
|
|
216
|
+
ts_query_cursor_set_max_start_depth(data->ts_query_cursor, max_start_depth);
|
|
217
|
+
ts_query_cursor_exec(data->ts_query_cursor, ts_query, root_node);
|
|
218
|
+
|
|
219
|
+
Array js_matches = Array::New(env);
|
|
220
|
+
unsigned index = 0;
|
|
221
|
+
vector<TSNode> nodes;
|
|
222
|
+
TSQueryMatch match;
|
|
223
|
+
|
|
224
|
+
while (ts_query_cursor_next_match(data->ts_query_cursor, &match)) {
|
|
225
|
+
js_matches[index++] = Number::New(env, match.pattern_index);
|
|
226
|
+
|
|
227
|
+
for (uint16_t i = 0; i < match.capture_count; i++) {
|
|
228
|
+
const TSQueryCapture &capture = match.captures[i];
|
|
229
|
+
|
|
230
|
+
uint32_t capture_name_len = 0;
|
|
231
|
+
const char *capture_name = ts_query_capture_name_for_id(
|
|
232
|
+
ts_query, capture.index, &capture_name_len);
|
|
233
|
+
|
|
234
|
+
TSNode node = capture.node;
|
|
235
|
+
nodes.push_back(node);
|
|
236
|
+
|
|
237
|
+
String js_capture = String::New(env, capture_name);;
|
|
238
|
+
js_matches[index++] = js_capture;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
auto js_nodes = node_methods::GetMarshalNodes(info, tree, nodes.data(), nodes.size());
|
|
243
|
+
|
|
244
|
+
auto result = Array::New(env);
|
|
245
|
+
result[0U] = js_matches;
|
|
246
|
+
result[1] = js_nodes;
|
|
247
|
+
return result;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
Napi::Value Query::Captures(const Napi::CallbackInfo &info) {
|
|
251
|
+
Napi::Env env = info.Env();
|
|
252
|
+
auto *data = env.GetInstanceData<AddonData>();
|
|
253
|
+
Query *query = Query::UnwrapQuery(info.This());
|
|
254
|
+
const Tree *tree = Tree::UnwrapTree(info[0]);
|
|
255
|
+
|
|
256
|
+
uint32_t start_row = 0, start_column = 0, end_row = 0, end_column = 0, start_index = 0, end_index = 0,
|
|
257
|
+
match_limit = UINT32_MAX, max_start_depth = UINT32_MAX;
|
|
258
|
+
|
|
259
|
+
if (info.Length() > 1 && info[1].IsNumber()) {
|
|
260
|
+
start_row = info[1].As<Number>().Uint32Value();
|
|
261
|
+
}
|
|
262
|
+
if (info.Length() > 2 && info[2].IsNumber()) {
|
|
263
|
+
start_column = info[2].As<Number>().Uint32Value() << 1;
|
|
264
|
+
}
|
|
265
|
+
if (info.Length() > 3 && info[3].IsNumber()) {
|
|
266
|
+
end_row = info[3].As<Number>().Uint32Value();
|
|
267
|
+
}
|
|
268
|
+
if (info.Length() > 4 && info[4].IsNumber()) {
|
|
269
|
+
end_column = info[4].As<Number>().Uint32Value() << 1;
|
|
270
|
+
}
|
|
271
|
+
if (info.Length() > 5 && info[5].IsNumber()) {
|
|
272
|
+
start_index = info[5].As<Number>().Uint32Value();
|
|
273
|
+
}
|
|
274
|
+
if (info.Length() > 6 && info[6].IsNumber()) {
|
|
275
|
+
end_index = info[6].As<Number>().Uint32Value() << 1;
|
|
276
|
+
}
|
|
277
|
+
if (info.Length() > 7 && info[7].IsNumber()) {
|
|
278
|
+
match_limit = info[7].As<Number>().Uint32Value();
|
|
279
|
+
}
|
|
280
|
+
if (info.Length() > 8 && info[8].IsNumber()) {
|
|
281
|
+
max_start_depth = info[8].As<Number>().Uint32Value();
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
if (query == nullptr) {
|
|
285
|
+
throw Error::New(env, "Missing argument query");
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
if (tree == nullptr) {
|
|
289
|
+
throw Error::New(env, "Missing argument tree");
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
TSQuery *ts_query = query->query_;
|
|
293
|
+
TSNode root_node = node_methods::UnmarshalNode(env, tree);
|
|
294
|
+
TSPoint start_point = {start_row, start_column};
|
|
295
|
+
TSPoint end_point = {end_row, end_column};
|
|
296
|
+
ts_query_cursor_set_point_range(data->ts_query_cursor, start_point, end_point);
|
|
297
|
+
ts_query_cursor_set_byte_range(data->ts_query_cursor, start_index, end_index);
|
|
298
|
+
ts_query_cursor_set_match_limit(data->ts_query_cursor, match_limit);
|
|
299
|
+
ts_query_cursor_set_max_start_depth(data->ts_query_cursor, max_start_depth);
|
|
300
|
+
ts_query_cursor_exec(data->ts_query_cursor, ts_query, root_node);
|
|
301
|
+
|
|
302
|
+
Array js_matches = Array::New(env);
|
|
303
|
+
unsigned index = 0;
|
|
304
|
+
vector<TSNode> nodes;
|
|
305
|
+
TSQueryMatch match;
|
|
306
|
+
uint32_t capture_index;
|
|
307
|
+
|
|
308
|
+
while (ts_query_cursor_next_capture(
|
|
309
|
+
data->ts_query_cursor,
|
|
310
|
+
&match,
|
|
311
|
+
&capture_index
|
|
312
|
+
)) {
|
|
313
|
+
|
|
314
|
+
js_matches[index++] = Number::New(env, match.pattern_index);
|
|
315
|
+
js_matches[index++] = Number::New(env, capture_index);
|
|
316
|
+
|
|
317
|
+
for (uint16_t i = 0; i < match.capture_count; i++) {
|
|
318
|
+
const TSQueryCapture &capture = match.captures[i];
|
|
319
|
+
|
|
320
|
+
uint32_t capture_name_len = 0;
|
|
321
|
+
const char *capture_name = ts_query_capture_name_for_id(
|
|
322
|
+
ts_query, capture.index, &capture_name_len);
|
|
323
|
+
|
|
324
|
+
TSNode node = capture.node;
|
|
325
|
+
nodes.push_back(node);
|
|
326
|
+
|
|
327
|
+
String js_capture = String::New(env, capture_name);;
|
|
328
|
+
js_matches[index++] = js_capture;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
auto js_nodes = node_methods::GetMarshalNodes(info, tree, nodes.data(), nodes.size());
|
|
333
|
+
|
|
334
|
+
auto result = Array::New(env);
|
|
335
|
+
result[0U] = js_matches;
|
|
336
|
+
result[1] = js_nodes;
|
|
337
|
+
return result;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
Napi::Value Query::DisableCapture(const Napi::CallbackInfo &info) {
|
|
341
|
+
std::string string = info[0].As<String>().Utf8Value();
|
|
342
|
+
const char *capture_name = string.c_str();
|
|
343
|
+
ts_query_disable_capture(query_, capture_name, string.length());
|
|
344
|
+
return info.Env().Undefined();
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
Napi::Value Query::DisablePattern(const Napi::CallbackInfo &info) {
|
|
348
|
+
uint32_t pattern_index = info[0].As<Number>().Uint32Value();
|
|
349
|
+
ts_query_disable_pattern(query_, pattern_index);
|
|
350
|
+
return info.Env().Undefined();
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
Napi::Value Query::IsPatternGuaranteedAtStep(const Napi::CallbackInfo &info) {
|
|
354
|
+
uint32_t byte_offset = info[0].As<Number>().Uint32Value();
|
|
355
|
+
return Boolean::New(info.Env(), ts_query_is_pattern_guaranteed_at_step(query_, byte_offset));
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
Napi::Value Query::IsPatternRooted(const Napi::CallbackInfo &info) {
|
|
359
|
+
uint32_t pattern_index = info[0].As<Number>().Uint32Value();
|
|
360
|
+
return Boolean::New(info.Env(), ts_query_is_pattern_rooted(query_, pattern_index));
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
Napi::Value Query::IsPatternNonLocal(const Napi::CallbackInfo &info) {
|
|
364
|
+
uint32_t pattern_index = info[0].As<Number>().Uint32Value();
|
|
365
|
+
return Boolean::New(info.Env(), ts_query_is_pattern_non_local(query_, pattern_index));
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
Napi::Value Query::StartIndexForPattern(const Napi::CallbackInfo &info) {
|
|
369
|
+
uint32_t pattern_index = info[0].As<Number>().Uint32Value();
|
|
370
|
+
return Number::New(info.Env(), ts_query_start_byte_for_pattern(query_, pattern_index));
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
Napi::Value Query::DidExceedMatchLimit(const Napi::CallbackInfo &info) {
|
|
374
|
+
auto *data = info.Env().GetInstanceData<AddonData>();
|
|
375
|
+
return Boolean::New(info.Env(), ts_query_cursor_did_exceed_match_limit(data->ts_query_cursor));
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
Napi::Value Query::MatchLimit(const Napi::CallbackInfo &info) {
|
|
379
|
+
auto *data = info.Env().GetInstanceData<AddonData>();
|
|
380
|
+
return Number::New(info.Env(), ts_query_cursor_match_limit(data->ts_query_cursor));
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
} // namespace node_tree_sitter
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#ifndef NODE_TREE_SITTER_QUERY_H_
|
|
2
|
+
#define NODE_TREE_SITTER_QUERY_H_
|
|
3
|
+
|
|
4
|
+
#include "./addon_data.h"
|
|
5
|
+
#include "tree_sitter/api.h"
|
|
6
|
+
|
|
7
|
+
#include <napi.h>
|
|
8
|
+
#include <node_object_wrap.h>
|
|
9
|
+
|
|
10
|
+
namespace node_tree_sitter {
|
|
11
|
+
|
|
12
|
+
class Query final : public Napi::ObjectWrap<Query> {
|
|
13
|
+
public:
|
|
14
|
+
static void Init(Napi::Env env, Napi::Object exports);
|
|
15
|
+
static Query *UnwrapQuery(const Napi::Value &);
|
|
16
|
+
|
|
17
|
+
explicit Query(const Napi::CallbackInfo &info);
|
|
18
|
+
~Query() final;
|
|
19
|
+
|
|
20
|
+
private:
|
|
21
|
+
TSQuery *query_;
|
|
22
|
+
|
|
23
|
+
Napi::Value New(const Napi::CallbackInfo &);
|
|
24
|
+
Napi::Value Matches(const Napi::CallbackInfo &);
|
|
25
|
+
Napi::Value Captures(const Napi::CallbackInfo &);
|
|
26
|
+
Napi::Value GetPredicates(const Napi::CallbackInfo &);
|
|
27
|
+
Napi::Value DisableCapture(const Napi::CallbackInfo &);
|
|
28
|
+
Napi::Value DisablePattern(const Napi::CallbackInfo &);
|
|
29
|
+
Napi::Value IsPatternGuaranteedAtStep(const Napi::CallbackInfo &);
|
|
30
|
+
Napi::Value IsPatternRooted(const Napi::CallbackInfo &);
|
|
31
|
+
Napi::Value IsPatternNonLocal(const Napi::CallbackInfo &);
|
|
32
|
+
Napi::Value StartIndexForPattern(const Napi::CallbackInfo &);
|
|
33
|
+
Napi::Value DidExceedMatchLimit(const Napi::CallbackInfo &);
|
|
34
|
+
Napi::Value MatchLimit(const Napi::CallbackInfo &);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
} // namespace node_tree_sitter
|
|
38
|
+
|
|
39
|
+
#endif // NODE_TREE_SITTER_QUERY_H_
|