botversion-sdk 2.2.3 → 2.3.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/core.js +56 -0
- package/index.js +62 -495
- package/package.json +18 -5
- package/register.js +19 -0
- package/{bin → scanner-sdk/bin}/scan-backend.js +17 -0
- package/scanner-sdk/index.js +525 -0
- package/{interceptor.js → scanner-sdk/interceptor.js} +5 -0
- package/scanner-sdk/node_modules/.bin/jsesc +16 -0
- package/scanner-sdk/node_modules/.bin/jsesc.cmd +17 -0
- package/scanner-sdk/node_modules/.bin/jsesc.ps1 +28 -0
- package/scanner-sdk/node_modules/.bin/mime +16 -0
- package/scanner-sdk/node_modules/.bin/mime.cmd +17 -0
- package/scanner-sdk/node_modules/.bin/mime.ps1 +28 -0
- package/scanner-sdk/node_modules/.bin/parser +16 -0
- package/scanner-sdk/node_modules/.bin/parser.cmd +17 -0
- package/scanner-sdk/node_modules/.bin/parser.ps1 +28 -0
- package/scanner-sdk/node_modules/.package-lock.json +1031 -0
- package/scanner-sdk/node_modules/@babel/code-frame/LICENSE +22 -0
- package/scanner-sdk/node_modules/@babel/code-frame/README.md +19 -0
- package/scanner-sdk/node_modules/@babel/code-frame/lib/index.js +217 -0
- package/scanner-sdk/node_modules/@babel/code-frame/lib/index.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/code-frame/package.json +32 -0
- package/scanner-sdk/node_modules/@babel/generator/LICENSE +22 -0
- package/scanner-sdk/node_modules/@babel/generator/README.md +19 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/buffer.js +244 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/buffer.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/generators/base.js +86 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/generators/base.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/generators/classes.js +215 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/generators/classes.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/generators/deprecated.js +73 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/generators/deprecated.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/generators/expressions.js +309 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/generators/expressions.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/generators/flow.js +658 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/generators/flow.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/generators/index.js +128 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/generators/index.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/generators/jsx.js +124 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/generators/jsx.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/generators/methods.js +207 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/generators/methods.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/generators/modules.js +290 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/generators/modules.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/generators/statements.js +297 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/generators/statements.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/generators/template-literals.js +38 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/generators/template-literals.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/generators/types.js +183 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/generators/types.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/generators/typescript.js +726 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/generators/typescript.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/index.js +108 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/index.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/node/index.js +81 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/node/index.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/node/parentheses.js +298 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/node/parentheses.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/nodes.js +19 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/nodes.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/printer.js +782 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/printer.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/source-map.js +86 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/source-map.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/token-map.js +195 -0
- package/scanner-sdk/node_modules/@babel/generator/lib/token-map.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/generator/package.json +39 -0
- package/scanner-sdk/node_modules/@babel/helper-globals/LICENSE +22 -0
- package/scanner-sdk/node_modules/@babel/helper-globals/README.md +19 -0
- package/scanner-sdk/node_modules/@babel/helper-globals/data/browser-upper.json +911 -0
- package/scanner-sdk/node_modules/@babel/helper-globals/data/builtin-lower.json +15 -0
- package/scanner-sdk/node_modules/@babel/helper-globals/data/builtin-upper.json +51 -0
- package/scanner-sdk/node_modules/@babel/helper-globals/package.json +32 -0
- package/scanner-sdk/node_modules/@babel/helper-string-parser/LICENSE +22 -0
- package/scanner-sdk/node_modules/@babel/helper-string-parser/README.md +19 -0
- package/scanner-sdk/node_modules/@babel/helper-string-parser/lib/index.js +295 -0
- package/scanner-sdk/node_modules/@babel/helper-string-parser/lib/index.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/helper-string-parser/package.json +31 -0
- package/scanner-sdk/node_modules/@babel/helper-validator-identifier/LICENSE +22 -0
- package/scanner-sdk/node_modules/@babel/helper-validator-identifier/README.md +19 -0
- package/scanner-sdk/node_modules/@babel/helper-validator-identifier/lib/identifier.js +70 -0
- package/scanner-sdk/node_modules/@babel/helper-validator-identifier/lib/identifier.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/helper-validator-identifier/lib/index.js +57 -0
- package/scanner-sdk/node_modules/@babel/helper-validator-identifier/lib/index.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/helper-validator-identifier/lib/keyword.js +35 -0
- package/scanner-sdk/node_modules/@babel/helper-validator-identifier/lib/keyword.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/helper-validator-identifier/package.json +31 -0
- package/scanner-sdk/node_modules/@babel/parser/CHANGELOG.md +1073 -0
- package/scanner-sdk/node_modules/@babel/parser/LICENSE +19 -0
- package/scanner-sdk/node_modules/@babel/parser/README.md +19 -0
- package/scanner-sdk/node_modules/@babel/parser/bin/babel-parser.js +15 -0
- package/scanner-sdk/node_modules/@babel/parser/lib/index.js +14599 -0
- package/scanner-sdk/node_modules/@babel/parser/lib/index.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/parser/package.json +50 -0
- package/scanner-sdk/node_modules/@babel/parser/typings/babel-parser.d.ts +262 -0
- package/scanner-sdk/node_modules/@babel/template/LICENSE +22 -0
- package/scanner-sdk/node_modules/@babel/template/README.md +19 -0
- package/scanner-sdk/node_modules/@babel/template/lib/builder.js +69 -0
- package/scanner-sdk/node_modules/@babel/template/lib/builder.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/template/lib/formatters.js +61 -0
- package/scanner-sdk/node_modules/@babel/template/lib/formatters.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/template/lib/index.js +23 -0
- package/scanner-sdk/node_modules/@babel/template/lib/index.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/template/lib/literal.js +69 -0
- package/scanner-sdk/node_modules/@babel/template/lib/literal.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/template/lib/options.js +73 -0
- package/scanner-sdk/node_modules/@babel/template/lib/options.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/template/lib/parse.js +163 -0
- package/scanner-sdk/node_modules/@babel/template/lib/parse.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/template/lib/populate.js +138 -0
- package/scanner-sdk/node_modules/@babel/template/lib/populate.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/template/lib/string.js +20 -0
- package/scanner-sdk/node_modules/@babel/template/lib/string.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/template/package.json +27 -0
- package/scanner-sdk/node_modules/@babel/traverse/LICENSE +22 -0
- package/scanner-sdk/node_modules/@babel/traverse/README.md +19 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/cache.js +37 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/cache.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/context.js +125 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/context.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/hub.js +19 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/hub.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/index.js +87 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/index.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/ancestry.js +139 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/ancestry.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/comments.js +52 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/comments.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/context.js +254 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/context.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/conversion.js +608 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/conversion.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/evaluation.js +373 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/evaluation.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/family.js +346 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/family.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/index.js +288 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/index.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/inference/index.js +149 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/inference/index.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/inference/inferer-reference.js +151 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/inference/inferer-reference.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/inference/inferers.js +207 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/inference/inferers.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/inference/util.js +28 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/inference/util.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/introspection.js +395 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/introspection.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/lib/hoister.js +172 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/lib/hoister.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js +38 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/lib/virtual-types-validator.js +162 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/lib/virtual-types-validator.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/lib/virtual-types.js +26 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/lib/virtual-types.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/modification.js +229 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/modification.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/removal.js +67 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/removal.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/replacement.js +264 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/path/replacement.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/scope/binding.js +84 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/scope/binding.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/scope/index.js +1018 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/scope/index.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/scope/lib/renamer.js +132 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/scope/lib/renamer.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/scope/traverseForScope.js +66 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/scope/traverseForScope.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/traverse-node.js +137 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/traverse-node.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/types.js +3 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/types.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/visitors.js +252 -0
- package/scanner-sdk/node_modules/@babel/traverse/lib/visitors.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/traverse/node_modules/debug/LICENSE +20 -0
- package/scanner-sdk/node_modules/@babel/traverse/node_modules/debug/README.md +481 -0
- package/scanner-sdk/node_modules/@babel/traverse/node_modules/debug/package.json +64 -0
- package/scanner-sdk/node_modules/@babel/traverse/node_modules/debug/src/browser.js +272 -0
- package/scanner-sdk/node_modules/@babel/traverse/node_modules/debug/src/common.js +292 -0
- package/scanner-sdk/node_modules/@babel/traverse/node_modules/debug/src/index.js +10 -0
- package/scanner-sdk/node_modules/@babel/traverse/node_modules/debug/src/node.js +263 -0
- package/scanner-sdk/node_modules/@babel/traverse/node_modules/ms/index.js +162 -0
- package/scanner-sdk/node_modules/@babel/traverse/node_modules/ms/license.md +21 -0
- package/scanner-sdk/node_modules/@babel/traverse/node_modules/ms/package.json +38 -0
- package/scanner-sdk/node_modules/@babel/traverse/node_modules/ms/readme.md +59 -0
- package/scanner-sdk/node_modules/@babel/traverse/package.json +35 -0
- package/scanner-sdk/node_modules/@babel/traverse/tsconfig.overrides.json +6 -0
- package/scanner-sdk/node_modules/@babel/types/LICENSE +22 -0
- package/scanner-sdk/node_modules/@babel/types/README.md +19 -0
- package/scanner-sdk/node_modules/@babel/types/lib/asserts/assertNode.js +16 -0
- package/scanner-sdk/node_modules/@babel/types/lib/asserts/assertNode.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/asserts/generated/index.js +1251 -0
- package/scanner-sdk/node_modules/@babel/types/lib/asserts/generated/index.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/ast-types/generated/index.js +3 -0
- package/scanner-sdk/node_modules/@babel/types/lib/ast-types/generated/index.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js +18 -0
- package/scanner-sdk/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js +31 -0
- package/scanner-sdk/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/builders/generated/index.js +29 -0
- package/scanner-sdk/node_modules/@babel/types/lib/builders/generated/index.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/builders/generated/lowercase.js +2902 -0
- package/scanner-sdk/node_modules/@babel/types/lib/builders/generated/lowercase.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/builders/generated/uppercase.js +272 -0
- package/scanner-sdk/node_modules/@babel/types/lib/builders/generated/uppercase.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/builders/productions.js +12 -0
- package/scanner-sdk/node_modules/@babel/types/lib/builders/productions.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/builders/react/buildChildren.js +24 -0
- package/scanner-sdk/node_modules/@babel/types/lib/builders/react/buildChildren.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js +22 -0
- package/scanner-sdk/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/builders/validateNode.js +21 -0
- package/scanner-sdk/node_modules/@babel/types/lib/builders/validateNode.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/clone/clone.js +12 -0
- package/scanner-sdk/node_modules/@babel/types/lib/clone/clone.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/clone/cloneDeep.js +12 -0
- package/scanner-sdk/node_modules/@babel/types/lib/clone/cloneDeep.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js +12 -0
- package/scanner-sdk/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/clone/cloneNode.js +107 -0
- package/scanner-sdk/node_modules/@babel/types/lib/clone/cloneNode.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js +12 -0
- package/scanner-sdk/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/comments/addComment.js +15 -0
- package/scanner-sdk/node_modules/@babel/types/lib/comments/addComment.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/comments/addComments.js +22 -0
- package/scanner-sdk/node_modules/@babel/types/lib/comments/addComments.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/comments/inheritInnerComments.js +12 -0
- package/scanner-sdk/node_modules/@babel/types/lib/comments/inheritInnerComments.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/comments/inheritLeadingComments.js +12 -0
- package/scanner-sdk/node_modules/@babel/types/lib/comments/inheritLeadingComments.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/comments/inheritTrailingComments.js +12 -0
- package/scanner-sdk/node_modules/@babel/types/lib/comments/inheritTrailingComments.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/comments/inheritsComments.js +17 -0
- package/scanner-sdk/node_modules/@babel/types/lib/comments/inheritsComments.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/comments/removeComments.js +15 -0
- package/scanner-sdk/node_modules/@babel/types/lib/comments/removeComments.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/constants/generated/index.js +60 -0
- package/scanner-sdk/node_modules/@babel/types/lib/constants/generated/index.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/constants/index.js +31 -0
- package/scanner-sdk/node_modules/@babel/types/lib/constants/index.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/converters/ensureBlock.js +14 -0
- package/scanner-sdk/node_modules/@babel/types/lib/converters/ensureBlock.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js +65 -0
- package/scanner-sdk/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js +14 -0
- package/scanner-sdk/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/converters/toBlock.js +29 -0
- package/scanner-sdk/node_modules/@babel/types/lib/converters/toBlock.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/converters/toComputedKey.js +14 -0
- package/scanner-sdk/node_modules/@babel/types/lib/converters/toComputedKey.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/converters/toExpression.js +28 -0
- package/scanner-sdk/node_modules/@babel/types/lib/converters/toExpression.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/converters/toIdentifier.js +25 -0
- package/scanner-sdk/node_modules/@babel/types/lib/converters/toIdentifier.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/converters/toKeyAlias.js +38 -0
- package/scanner-sdk/node_modules/@babel/types/lib/converters/toKeyAlias.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/converters/toSequenceExpression.js +19 -0
- package/scanner-sdk/node_modules/@babel/types/lib/converters/toSequenceExpression.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/converters/toStatement.js +39 -0
- package/scanner-sdk/node_modules/@babel/types/lib/converters/toStatement.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/converters/valueToNode.js +89 -0
- package/scanner-sdk/node_modules/@babel/types/lib/converters/valueToNode.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/definitions/core.js +1725 -0
- package/scanner-sdk/node_modules/@babel/types/lib/definitions/core.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/definitions/deprecated-aliases.js +11 -0
- package/scanner-sdk/node_modules/@babel/types/lib/definitions/deprecated-aliases.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/definitions/experimental.js +124 -0
- package/scanner-sdk/node_modules/@babel/types/lib/definitions/experimental.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/definitions/flow.js +495 -0
- package/scanner-sdk/node_modules/@babel/types/lib/definitions/flow.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/definitions/index.js +106 -0
- package/scanner-sdk/node_modules/@babel/types/lib/definitions/index.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/definitions/jsx.js +157 -0
- package/scanner-sdk/node_modules/@babel/types/lib/definitions/jsx.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/definitions/misc.js +31 -0
- package/scanner-sdk/node_modules/@babel/types/lib/definitions/misc.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/definitions/placeholders.js +27 -0
- package/scanner-sdk/node_modules/@babel/types/lib/definitions/placeholders.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/definitions/typescript.js +528 -0
- package/scanner-sdk/node_modules/@babel/types/lib/definitions/typescript.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/definitions/utils.js +296 -0
- package/scanner-sdk/node_modules/@babel/types/lib/definitions/utils.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/index-legacy.d.ts +2797 -0
- package/scanner-sdk/node_modules/@babel/types/lib/index.d.ts +3617 -0
- package/scanner-sdk/node_modules/@babel/types/lib/index.js +582 -0
- package/scanner-sdk/node_modules/@babel/types/lib/index.js.flow +2650 -0
- package/scanner-sdk/node_modules/@babel/types/lib/index.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js +15 -0
- package/scanner-sdk/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js +65 -0
- package/scanner-sdk/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/modifications/inherits.js +28 -0
- package/scanner-sdk/node_modules/@babel/types/lib/modifications/inherits.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js +17 -0
- package/scanner-sdk/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/modifications/removeProperties.js +24 -0
- package/scanner-sdk/node_modules/@babel/types/lib/modifications/removeProperties.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js +14 -0
- package/scanner-sdk/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js +66 -0
- package/scanner-sdk/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/retrievers/getAssignmentIdentifiers.js +48 -0
- package/scanner-sdk/node_modules/@babel/types/lib/retrievers/getAssignmentIdentifiers.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js +102 -0
- package/scanner-sdk/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/retrievers/getFunctionName.js +63 -0
- package/scanner-sdk/node_modules/@babel/types/lib/retrievers/getFunctionName.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js +13 -0
- package/scanner-sdk/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/traverse/traverse.js +50 -0
- package/scanner-sdk/node_modules/@babel/types/lib/traverse/traverse.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/traverse/traverseFast.js +40 -0
- package/scanner-sdk/node_modules/@babel/types/lib/traverse/traverseFast.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/utils/deprecationWarning.js +44 -0
- package/scanner-sdk/node_modules/@babel/types/lib/utils/deprecationWarning.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/utils/inherit.js +13 -0
- package/scanner-sdk/node_modules/@babel/types/lib/utils/inherit.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js +40 -0
- package/scanner-sdk/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/utils/shallowEqual.js +17 -0
- package/scanner-sdk/node_modules/@babel/types/lib/utils/shallowEqual.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js +13 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/generated/index.js +2797 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/generated/index.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/is.js +27 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/is.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/isBinding.js +27 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/isBinding.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/isBlockScoped.js +13 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/isBlockScoped.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/isImmutable.js +21 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/isImmutable.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/isLet.js +13 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/isLet.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/isNode.js +12 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/isNode.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/isNodesEquivalent.js +57 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/isNodesEquivalent.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/isPlaceholderType.js +15 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/isPlaceholderType.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/isReferenced.js +96 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/isReferenced.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/isScope.js +18 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/isScope.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/isSpecifierDefault.js +14 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/isSpecifierDefault.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/isType.js +17 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/isType.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/isValidES3Identifier.js +13 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/isValidES3Identifier.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/isValidIdentifier.js +18 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/isValidIdentifier.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/isVar.js +15 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/isVar.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/matchesPattern.js +44 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/matchesPattern.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/react/isCompatTag.js +11 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/react/isCompatTag.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/react/isReactComponent.js +11 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/react/isReactComponent.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/validate.js +42 -0
- package/scanner-sdk/node_modules/@babel/types/lib/validators/validate.js.map +1 -0
- package/scanner-sdk/node_modules/@babel/types/package.json +39 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/LICENSE +19 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/README.md +227 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.mjs +292 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.mjs.map +6 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.umd.js +358 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.umd.js.map +6 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/dist/types/gen-mapping.d.ts +88 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/dist/types/set-array.d.ts +32 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/dist/types/sourcemap-segment.d.ts +12 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/dist/types/types.d.ts +43 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/package.json +67 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/src/gen-mapping.ts +614 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/src/set-array.ts +82 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/src/sourcemap-segment.ts +16 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/src/types.ts +61 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/types/gen-mapping.d.cts +89 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/types/gen-mapping.d.cts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/types/gen-mapping.d.mts +89 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/types/gen-mapping.d.mts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/types/set-array.d.cts +33 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/types/set-array.d.cts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/types/set-array.d.mts +33 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/types/set-array.d.mts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/types/sourcemap-segment.d.cts +13 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/types/sourcemap-segment.d.cts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/types/sourcemap-segment.d.mts +13 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/types/sourcemap-segment.d.mts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/types/types.d.cts +44 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/types/types.d.cts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/types/types.d.mts +44 -0
- package/scanner-sdk/node_modules/@jridgewell/gen-mapping/types/types.d.mts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/resolve-uri/LICENSE +19 -0
- package/scanner-sdk/node_modules/@jridgewell/resolve-uri/README.md +40 -0
- package/scanner-sdk/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs +232 -0
- package/scanner-sdk/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js +240 -0
- package/scanner-sdk/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/resolve-uri/dist/types/resolve-uri.d.ts +4 -0
- package/scanner-sdk/node_modules/@jridgewell/resolve-uri/package.json +69 -0
- package/scanner-sdk/node_modules/@jridgewell/sourcemap-codec/LICENSE +19 -0
- package/scanner-sdk/node_modules/@jridgewell/sourcemap-codec/README.md +264 -0
- package/scanner-sdk/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +423 -0
- package/scanner-sdk/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map +6 -0
- package/scanner-sdk/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js +464 -0
- package/scanner-sdk/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map +6 -0
- package/scanner-sdk/node_modules/@jridgewell/sourcemap-codec/package.json +63 -0
- package/scanner-sdk/node_modules/@jridgewell/sourcemap-codec/src/scopes.ts +345 -0
- package/scanner-sdk/node_modules/@jridgewell/sourcemap-codec/src/sourcemap-codec.ts +111 -0
- package/scanner-sdk/node_modules/@jridgewell/sourcemap-codec/src/strings.ts +65 -0
- package/scanner-sdk/node_modules/@jridgewell/sourcemap-codec/src/vlq.ts +55 -0
- package/scanner-sdk/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts +50 -0
- package/scanner-sdk/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts +50 -0
- package/scanner-sdk/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts +9 -0
- package/scanner-sdk/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts +9 -0
- package/scanner-sdk/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/sourcemap-codec/types/strings.d.cts +16 -0
- package/scanner-sdk/node_modules/@jridgewell/sourcemap-codec/types/strings.d.cts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/sourcemap-codec/types/strings.d.mts +16 -0
- package/scanner-sdk/node_modules/@jridgewell/sourcemap-codec/types/strings.d.mts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.cts +7 -0
- package/scanner-sdk/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.cts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts +7 -0
- package/scanner-sdk/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/LICENSE +19 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/README.md +348 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs +493 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs.map +6 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js +559 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js.map +6 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/package.json +67 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/src/binary-search.ts +115 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/src/by-source.ts +41 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/src/flatten-map.ts +192 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/src/resolve.ts +16 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/src/sort.ts +45 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/src/sourcemap-segment.ts +23 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/src/strip-filename.ts +8 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/src/trace-mapping.ts +502 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/src/types.ts +114 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/binary-search.d.cts +33 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/binary-search.d.cts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/binary-search.d.mts +33 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/binary-search.d.mts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/by-source.d.cts +4 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/by-source.d.cts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/by-source.d.mts +4 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/by-source.d.mts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/flatten-map.d.cts +9 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/flatten-map.d.cts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/flatten-map.d.mts +9 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/flatten-map.d.mts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/resolve.d.cts +4 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/resolve.d.cts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/resolve.d.mts +4 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/resolve.d.mts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/sort.d.cts +4 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/sort.d.cts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/sort.d.mts +4 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/sort.d.mts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/sourcemap-segment.d.cts +17 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/sourcemap-segment.d.cts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/sourcemap-segment.d.mts +17 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/sourcemap-segment.d.mts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/strip-filename.d.cts +5 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/strip-filename.d.cts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/strip-filename.d.mts +5 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/strip-filename.d.mts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/trace-mapping.d.cts +80 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/trace-mapping.d.cts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/trace-mapping.d.mts +80 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/trace-mapping.d.mts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/types.d.cts +107 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/types.d.cts.map +1 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/types.d.mts +107 -0
- package/scanner-sdk/node_modules/@jridgewell/trace-mapping/types/types.d.mts.map +1 -0
- package/scanner-sdk/node_modules/accepts/HISTORY.md +243 -0
- package/scanner-sdk/node_modules/accepts/LICENSE +23 -0
- package/scanner-sdk/node_modules/accepts/README.md +140 -0
- package/scanner-sdk/node_modules/accepts/index.js +238 -0
- package/scanner-sdk/node_modules/accepts/package.json +47 -0
- package/scanner-sdk/node_modules/array-flatten/LICENSE +21 -0
- package/scanner-sdk/node_modules/array-flatten/README.md +43 -0
- package/scanner-sdk/node_modules/array-flatten/array-flatten.js +64 -0
- package/scanner-sdk/node_modules/array-flatten/package.json +39 -0
- package/scanner-sdk/node_modules/body-parser/HISTORY.md +680 -0
- package/scanner-sdk/node_modules/body-parser/LICENSE +23 -0
- package/scanner-sdk/node_modules/body-parser/README.md +476 -0
- package/scanner-sdk/node_modules/body-parser/index.js +156 -0
- package/scanner-sdk/node_modules/body-parser/lib/read.js +205 -0
- package/scanner-sdk/node_modules/body-parser/lib/types/json.js +247 -0
- package/scanner-sdk/node_modules/body-parser/lib/types/raw.js +101 -0
- package/scanner-sdk/node_modules/body-parser/lib/types/text.js +121 -0
- package/scanner-sdk/node_modules/body-parser/lib/types/urlencoded.js +300 -0
- package/scanner-sdk/node_modules/body-parser/package.json +55 -0
- package/scanner-sdk/node_modules/bytes/History.md +97 -0
- package/scanner-sdk/node_modules/bytes/LICENSE +23 -0
- package/scanner-sdk/node_modules/bytes/Readme.md +152 -0
- package/scanner-sdk/node_modules/bytes/index.js +170 -0
- package/scanner-sdk/node_modules/bytes/package.json +42 -0
- package/scanner-sdk/node_modules/call-bind-apply-helpers/.eslintrc +17 -0
- package/scanner-sdk/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +12 -0
- package/scanner-sdk/node_modules/call-bind-apply-helpers/.nycrc +9 -0
- package/scanner-sdk/node_modules/call-bind-apply-helpers/CHANGELOG.md +30 -0
- package/scanner-sdk/node_modules/call-bind-apply-helpers/LICENSE +21 -0
- package/scanner-sdk/node_modules/call-bind-apply-helpers/README.md +62 -0
- package/scanner-sdk/node_modules/call-bind-apply-helpers/actualApply.d.ts +1 -0
- package/scanner-sdk/node_modules/call-bind-apply-helpers/actualApply.js +10 -0
- package/scanner-sdk/node_modules/call-bind-apply-helpers/applyBind.d.ts +19 -0
- package/scanner-sdk/node_modules/call-bind-apply-helpers/applyBind.js +10 -0
- package/scanner-sdk/node_modules/call-bind-apply-helpers/functionApply.d.ts +1 -0
- package/scanner-sdk/node_modules/call-bind-apply-helpers/functionApply.js +4 -0
- package/scanner-sdk/node_modules/call-bind-apply-helpers/functionCall.d.ts +1 -0
- package/scanner-sdk/node_modules/call-bind-apply-helpers/functionCall.js +4 -0
- package/scanner-sdk/node_modules/call-bind-apply-helpers/index.d.ts +64 -0
- package/scanner-sdk/node_modules/call-bind-apply-helpers/index.js +15 -0
- package/scanner-sdk/node_modules/call-bind-apply-helpers/package.json +85 -0
- package/scanner-sdk/node_modules/call-bind-apply-helpers/reflectApply.d.ts +3 -0
- package/scanner-sdk/node_modules/call-bind-apply-helpers/reflectApply.js +4 -0
- package/scanner-sdk/node_modules/call-bind-apply-helpers/test/index.js +63 -0
- package/scanner-sdk/node_modules/call-bind-apply-helpers/tsconfig.json +9 -0
- package/scanner-sdk/node_modules/call-bound/.eslintrc +13 -0
- package/scanner-sdk/node_modules/call-bound/.github/FUNDING.yml +12 -0
- package/scanner-sdk/node_modules/call-bound/.nycrc +9 -0
- package/scanner-sdk/node_modules/call-bound/CHANGELOG.md +42 -0
- package/scanner-sdk/node_modules/call-bound/LICENSE +21 -0
- package/scanner-sdk/node_modules/call-bound/README.md +53 -0
- package/scanner-sdk/node_modules/call-bound/index.d.ts +94 -0
- package/scanner-sdk/node_modules/call-bound/index.js +19 -0
- package/scanner-sdk/node_modules/call-bound/package.json +99 -0
- package/scanner-sdk/node_modules/call-bound/test/index.js +61 -0
- package/scanner-sdk/node_modules/call-bound/tsconfig.json +10 -0
- package/scanner-sdk/node_modules/content-disposition/HISTORY.md +60 -0
- package/scanner-sdk/node_modules/content-disposition/LICENSE +22 -0
- package/scanner-sdk/node_modules/content-disposition/README.md +142 -0
- package/scanner-sdk/node_modules/content-disposition/index.js +458 -0
- package/scanner-sdk/node_modules/content-disposition/package.json +44 -0
- package/scanner-sdk/node_modules/content-type/HISTORY.md +29 -0
- package/scanner-sdk/node_modules/content-type/LICENSE +22 -0
- package/scanner-sdk/node_modules/content-type/README.md +94 -0
- package/scanner-sdk/node_modules/content-type/index.js +225 -0
- package/scanner-sdk/node_modules/content-type/package.json +42 -0
- package/scanner-sdk/node_modules/cookie/LICENSE +24 -0
- package/scanner-sdk/node_modules/cookie/README.md +317 -0
- package/scanner-sdk/node_modules/cookie/SECURITY.md +25 -0
- package/scanner-sdk/node_modules/cookie/index.js +335 -0
- package/scanner-sdk/node_modules/cookie/package.json +44 -0
- package/scanner-sdk/node_modules/cookie-signature/History.md +42 -0
- package/scanner-sdk/node_modules/cookie-signature/Readme.md +42 -0
- package/scanner-sdk/node_modules/cookie-signature/index.js +51 -0
- package/scanner-sdk/node_modules/cookie-signature/package.json +18 -0
- package/scanner-sdk/node_modules/debug/.coveralls.yml +1 -0
- package/scanner-sdk/node_modules/debug/.eslintrc +11 -0
- package/scanner-sdk/node_modules/debug/.travis.yml +14 -0
- package/scanner-sdk/node_modules/debug/CHANGELOG.md +362 -0
- package/scanner-sdk/node_modules/debug/LICENSE +19 -0
- package/scanner-sdk/node_modules/debug/Makefile +50 -0
- package/scanner-sdk/node_modules/debug/README.md +312 -0
- package/scanner-sdk/node_modules/debug/component.json +19 -0
- package/scanner-sdk/node_modules/debug/karma.conf.js +70 -0
- package/scanner-sdk/node_modules/debug/node.js +1 -0
- package/scanner-sdk/node_modules/debug/package.json +49 -0
- package/scanner-sdk/node_modules/debug/src/browser.js +185 -0
- package/scanner-sdk/node_modules/debug/src/debug.js +202 -0
- package/scanner-sdk/node_modules/debug/src/index.js +10 -0
- package/scanner-sdk/node_modules/debug/src/inspector-log.js +15 -0
- package/scanner-sdk/node_modules/debug/src/node.js +248 -0
- package/scanner-sdk/node_modules/depd/History.md +103 -0
- package/scanner-sdk/node_modules/depd/LICENSE +22 -0
- package/scanner-sdk/node_modules/depd/Readme.md +280 -0
- package/scanner-sdk/node_modules/depd/index.js +538 -0
- package/scanner-sdk/node_modules/depd/lib/browser/index.js +77 -0
- package/scanner-sdk/node_modules/depd/package.json +45 -0
- package/scanner-sdk/node_modules/destroy/LICENSE +23 -0
- package/scanner-sdk/node_modules/destroy/README.md +63 -0
- package/scanner-sdk/node_modules/destroy/index.js +209 -0
- package/scanner-sdk/node_modules/destroy/package.json +48 -0
- package/scanner-sdk/node_modules/dotenv/CHANGELOG.md +520 -0
- package/scanner-sdk/node_modules/dotenv/LICENSE +23 -0
- package/scanner-sdk/node_modules/dotenv/README-es.md +411 -0
- package/scanner-sdk/node_modules/dotenv/README.md +645 -0
- package/scanner-sdk/node_modules/dotenv/SECURITY.md +1 -0
- package/scanner-sdk/node_modules/dotenv/config.d.ts +1 -0
- package/scanner-sdk/node_modules/dotenv/config.js +9 -0
- package/scanner-sdk/node_modules/dotenv/lib/cli-options.js +17 -0
- package/scanner-sdk/node_modules/dotenv/lib/env-options.js +28 -0
- package/scanner-sdk/node_modules/dotenv/lib/main.d.ts +162 -0
- package/scanner-sdk/node_modules/dotenv/lib/main.js +386 -0
- package/scanner-sdk/node_modules/dotenv/package.json +62 -0
- package/scanner-sdk/node_modules/dunder-proto/.eslintrc +5 -0
- package/scanner-sdk/node_modules/dunder-proto/.github/FUNDING.yml +12 -0
- package/scanner-sdk/node_modules/dunder-proto/.nycrc +13 -0
- package/scanner-sdk/node_modules/dunder-proto/CHANGELOG.md +24 -0
- package/scanner-sdk/node_modules/dunder-proto/LICENSE +21 -0
- package/scanner-sdk/node_modules/dunder-proto/README.md +54 -0
- package/scanner-sdk/node_modules/dunder-proto/get.d.ts +5 -0
- package/scanner-sdk/node_modules/dunder-proto/get.js +30 -0
- package/scanner-sdk/node_modules/dunder-proto/package.json +76 -0
- package/scanner-sdk/node_modules/dunder-proto/set.d.ts +5 -0
- package/scanner-sdk/node_modules/dunder-proto/set.js +35 -0
- package/scanner-sdk/node_modules/dunder-proto/test/get.js +34 -0
- package/scanner-sdk/node_modules/dunder-proto/test/index.js +4 -0
- package/scanner-sdk/node_modules/dunder-proto/test/set.js +50 -0
- package/scanner-sdk/node_modules/dunder-proto/tsconfig.json +9 -0
- package/scanner-sdk/node_modules/ee-first/LICENSE +22 -0
- package/scanner-sdk/node_modules/ee-first/README.md +80 -0
- package/scanner-sdk/node_modules/ee-first/index.js +95 -0
- package/scanner-sdk/node_modules/ee-first/package.json +29 -0
- package/scanner-sdk/node_modules/encodeurl/LICENSE +22 -0
- package/scanner-sdk/node_modules/encodeurl/README.md +109 -0
- package/scanner-sdk/node_modules/encodeurl/index.js +60 -0
- package/scanner-sdk/node_modules/encodeurl/package.json +40 -0
- package/scanner-sdk/node_modules/es-define-property/.eslintrc +13 -0
- package/scanner-sdk/node_modules/es-define-property/.github/FUNDING.yml +12 -0
- package/scanner-sdk/node_modules/es-define-property/.nycrc +9 -0
- package/scanner-sdk/node_modules/es-define-property/CHANGELOG.md +29 -0
- package/scanner-sdk/node_modules/es-define-property/LICENSE +21 -0
- package/scanner-sdk/node_modules/es-define-property/README.md +49 -0
- package/scanner-sdk/node_modules/es-define-property/index.d.ts +3 -0
- package/scanner-sdk/node_modules/es-define-property/index.js +14 -0
- package/scanner-sdk/node_modules/es-define-property/package.json +81 -0
- package/scanner-sdk/node_modules/es-define-property/test/index.js +56 -0
- package/scanner-sdk/node_modules/es-define-property/tsconfig.json +10 -0
- package/scanner-sdk/node_modules/es-errors/.eslintrc +5 -0
- package/scanner-sdk/node_modules/es-errors/.github/FUNDING.yml +12 -0
- package/scanner-sdk/node_modules/es-errors/CHANGELOG.md +40 -0
- package/scanner-sdk/node_modules/es-errors/LICENSE +21 -0
- package/scanner-sdk/node_modules/es-errors/README.md +55 -0
- package/scanner-sdk/node_modules/es-errors/eval.d.ts +3 -0
- package/scanner-sdk/node_modules/es-errors/eval.js +4 -0
- package/scanner-sdk/node_modules/es-errors/index.d.ts +3 -0
- package/scanner-sdk/node_modules/es-errors/index.js +4 -0
- package/scanner-sdk/node_modules/es-errors/package.json +80 -0
- package/scanner-sdk/node_modules/es-errors/range.d.ts +3 -0
- package/scanner-sdk/node_modules/es-errors/range.js +4 -0
- package/scanner-sdk/node_modules/es-errors/ref.d.ts +3 -0
- package/scanner-sdk/node_modules/es-errors/ref.js +4 -0
- package/scanner-sdk/node_modules/es-errors/syntax.d.ts +3 -0
- package/scanner-sdk/node_modules/es-errors/syntax.js +4 -0
- package/scanner-sdk/node_modules/es-errors/test/index.js +19 -0
- package/scanner-sdk/node_modules/es-errors/tsconfig.json +49 -0
- package/scanner-sdk/node_modules/es-errors/type.d.ts +3 -0
- package/scanner-sdk/node_modules/es-errors/type.js +4 -0
- package/scanner-sdk/node_modules/es-errors/uri.d.ts +3 -0
- package/scanner-sdk/node_modules/es-errors/uri.js +4 -0
- package/scanner-sdk/node_modules/es-object-atoms/.eslintrc +16 -0
- package/scanner-sdk/node_modules/es-object-atoms/.github/FUNDING.yml +12 -0
- package/scanner-sdk/node_modules/es-object-atoms/CHANGELOG.md +37 -0
- package/scanner-sdk/node_modules/es-object-atoms/LICENSE +21 -0
- package/scanner-sdk/node_modules/es-object-atoms/README.md +63 -0
- package/scanner-sdk/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +3 -0
- package/scanner-sdk/node_modules/es-object-atoms/RequireObjectCoercible.js +11 -0
- package/scanner-sdk/node_modules/es-object-atoms/ToObject.d.ts +7 -0
- package/scanner-sdk/node_modules/es-object-atoms/ToObject.js +10 -0
- package/scanner-sdk/node_modules/es-object-atoms/index.d.ts +3 -0
- package/scanner-sdk/node_modules/es-object-atoms/index.js +4 -0
- package/scanner-sdk/node_modules/es-object-atoms/isObject.d.ts +3 -0
- package/scanner-sdk/node_modules/es-object-atoms/isObject.js +6 -0
- package/scanner-sdk/node_modules/es-object-atoms/package.json +80 -0
- package/scanner-sdk/node_modules/es-object-atoms/test/index.js +38 -0
- package/scanner-sdk/node_modules/es-object-atoms/tsconfig.json +6 -0
- package/scanner-sdk/node_modules/escape-html/LICENSE +24 -0
- package/scanner-sdk/node_modules/escape-html/Readme.md +43 -0
- package/scanner-sdk/node_modules/escape-html/index.js +78 -0
- package/scanner-sdk/node_modules/escape-html/package.json +24 -0
- package/scanner-sdk/node_modules/etag/HISTORY.md +83 -0
- package/scanner-sdk/node_modules/etag/LICENSE +22 -0
- package/scanner-sdk/node_modules/etag/README.md +159 -0
- package/scanner-sdk/node_modules/etag/index.js +131 -0
- package/scanner-sdk/node_modules/etag/package.json +47 -0
- package/scanner-sdk/node_modules/express/History.md +3667 -0
- package/scanner-sdk/node_modules/express/LICENSE +24 -0
- package/scanner-sdk/node_modules/express/Readme.md +260 -0
- package/scanner-sdk/node_modules/express/index.js +11 -0
- package/scanner-sdk/node_modules/express/lib/application.js +661 -0
- package/scanner-sdk/node_modules/express/lib/express.js +116 -0
- package/scanner-sdk/node_modules/express/lib/middleware/init.js +43 -0
- package/scanner-sdk/node_modules/express/lib/middleware/query.js +47 -0
- package/scanner-sdk/node_modules/express/lib/request.js +525 -0
- package/scanner-sdk/node_modules/express/lib/response.js +1179 -0
- package/scanner-sdk/node_modules/express/lib/router/index.js +673 -0
- package/scanner-sdk/node_modules/express/lib/router/layer.js +181 -0
- package/scanner-sdk/node_modules/express/lib/router/route.js +230 -0
- package/scanner-sdk/node_modules/express/lib/utils.js +303 -0
- package/scanner-sdk/node_modules/express/lib/view.js +182 -0
- package/scanner-sdk/node_modules/express/package.json +102 -0
- package/scanner-sdk/node_modules/finalhandler/HISTORY.md +216 -0
- package/scanner-sdk/node_modules/finalhandler/LICENSE +22 -0
- package/scanner-sdk/node_modules/finalhandler/README.md +147 -0
- package/scanner-sdk/node_modules/finalhandler/SECURITY.md +25 -0
- package/scanner-sdk/node_modules/finalhandler/index.js +341 -0
- package/scanner-sdk/node_modules/finalhandler/package.json +47 -0
- package/scanner-sdk/node_modules/forwarded/HISTORY.md +21 -0
- package/scanner-sdk/node_modules/forwarded/LICENSE +22 -0
- package/scanner-sdk/node_modules/forwarded/README.md +57 -0
- package/scanner-sdk/node_modules/forwarded/index.js +90 -0
- package/scanner-sdk/node_modules/forwarded/package.json +45 -0
- package/scanner-sdk/node_modules/fresh/HISTORY.md +70 -0
- package/scanner-sdk/node_modules/fresh/LICENSE +23 -0
- package/scanner-sdk/node_modules/fresh/README.md +119 -0
- package/scanner-sdk/node_modules/fresh/index.js +137 -0
- package/scanner-sdk/node_modules/fresh/package.json +46 -0
- package/scanner-sdk/node_modules/function-bind/.eslintrc +21 -0
- package/scanner-sdk/node_modules/function-bind/.github/FUNDING.yml +12 -0
- package/scanner-sdk/node_modules/function-bind/.github/SECURITY.md +3 -0
- package/scanner-sdk/node_modules/function-bind/.nycrc +13 -0
- package/scanner-sdk/node_modules/function-bind/CHANGELOG.md +136 -0
- package/scanner-sdk/node_modules/function-bind/LICENSE +20 -0
- package/scanner-sdk/node_modules/function-bind/README.md +46 -0
- package/scanner-sdk/node_modules/function-bind/implementation.js +84 -0
- package/scanner-sdk/node_modules/function-bind/index.js +5 -0
- package/scanner-sdk/node_modules/function-bind/package.json +87 -0
- package/scanner-sdk/node_modules/function-bind/test/.eslintrc +9 -0
- package/scanner-sdk/node_modules/function-bind/test/index.js +252 -0
- package/scanner-sdk/node_modules/get-intrinsic/.eslintrc +42 -0
- package/scanner-sdk/node_modules/get-intrinsic/.github/FUNDING.yml +12 -0
- package/scanner-sdk/node_modules/get-intrinsic/.nycrc +9 -0
- package/scanner-sdk/node_modules/get-intrinsic/CHANGELOG.md +186 -0
- package/scanner-sdk/node_modules/get-intrinsic/LICENSE +21 -0
- package/scanner-sdk/node_modules/get-intrinsic/README.md +71 -0
- package/scanner-sdk/node_modules/get-intrinsic/index.js +378 -0
- package/scanner-sdk/node_modules/get-intrinsic/package.json +97 -0
- package/scanner-sdk/node_modules/get-intrinsic/test/GetIntrinsic.js +274 -0
- package/scanner-sdk/node_modules/get-proto/.eslintrc +10 -0
- package/scanner-sdk/node_modules/get-proto/.github/FUNDING.yml +12 -0
- package/scanner-sdk/node_modules/get-proto/.nycrc +9 -0
- package/scanner-sdk/node_modules/get-proto/CHANGELOG.md +21 -0
- package/scanner-sdk/node_modules/get-proto/LICENSE +21 -0
- package/scanner-sdk/node_modules/get-proto/Object.getPrototypeOf.d.ts +5 -0
- package/scanner-sdk/node_modules/get-proto/Object.getPrototypeOf.js +6 -0
- package/scanner-sdk/node_modules/get-proto/README.md +50 -0
- package/scanner-sdk/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +3 -0
- package/scanner-sdk/node_modules/get-proto/Reflect.getPrototypeOf.js +4 -0
- package/scanner-sdk/node_modules/get-proto/index.d.ts +5 -0
- package/scanner-sdk/node_modules/get-proto/index.js +27 -0
- package/scanner-sdk/node_modules/get-proto/package.json +81 -0
- package/scanner-sdk/node_modules/get-proto/test/index.js +68 -0
- package/scanner-sdk/node_modules/get-proto/tsconfig.json +9 -0
- package/scanner-sdk/node_modules/gopd/.eslintrc +16 -0
- package/scanner-sdk/node_modules/gopd/.github/FUNDING.yml +12 -0
- package/scanner-sdk/node_modules/gopd/CHANGELOG.md +45 -0
- package/scanner-sdk/node_modules/gopd/LICENSE +21 -0
- package/scanner-sdk/node_modules/gopd/README.md +40 -0
- package/scanner-sdk/node_modules/gopd/gOPD.d.ts +1 -0
- package/scanner-sdk/node_modules/gopd/gOPD.js +4 -0
- package/scanner-sdk/node_modules/gopd/index.d.ts +5 -0
- package/scanner-sdk/node_modules/gopd/index.js +15 -0
- package/scanner-sdk/node_modules/gopd/package.json +77 -0
- package/scanner-sdk/node_modules/gopd/test/index.js +36 -0
- package/scanner-sdk/node_modules/gopd/tsconfig.json +9 -0
- package/scanner-sdk/node_modules/has-symbols/.eslintrc +11 -0
- package/scanner-sdk/node_modules/has-symbols/.github/FUNDING.yml +12 -0
- package/scanner-sdk/node_modules/has-symbols/.nycrc +9 -0
- package/scanner-sdk/node_modules/has-symbols/CHANGELOG.md +91 -0
- package/scanner-sdk/node_modules/has-symbols/LICENSE +21 -0
- package/scanner-sdk/node_modules/has-symbols/README.md +46 -0
- package/scanner-sdk/node_modules/has-symbols/index.d.ts +3 -0
- package/scanner-sdk/node_modules/has-symbols/index.js +14 -0
- package/scanner-sdk/node_modules/has-symbols/package.json +111 -0
- package/scanner-sdk/node_modules/has-symbols/shams.d.ts +3 -0
- package/scanner-sdk/node_modules/has-symbols/shams.js +45 -0
- package/scanner-sdk/node_modules/has-symbols/test/index.js +22 -0
- package/scanner-sdk/node_modules/has-symbols/test/shams/core-js.js +29 -0
- package/scanner-sdk/node_modules/has-symbols/test/shams/get-own-property-symbols.js +29 -0
- package/scanner-sdk/node_modules/has-symbols/test/tests.js +58 -0
- package/scanner-sdk/node_modules/has-symbols/tsconfig.json +10 -0
- package/scanner-sdk/node_modules/hasown/.eslintrc +5 -0
- package/scanner-sdk/node_modules/hasown/.github/FUNDING.yml +12 -0
- package/scanner-sdk/node_modules/hasown/.nycrc +13 -0
- package/scanner-sdk/node_modules/hasown/CHANGELOG.md +40 -0
- package/scanner-sdk/node_modules/hasown/LICENSE +21 -0
- package/scanner-sdk/node_modules/hasown/README.md +40 -0
- package/scanner-sdk/node_modules/hasown/index.d.ts +3 -0
- package/scanner-sdk/node_modules/hasown/index.js +8 -0
- package/scanner-sdk/node_modules/hasown/package.json +92 -0
- package/scanner-sdk/node_modules/hasown/tsconfig.json +6 -0
- package/scanner-sdk/node_modules/http-errors/HISTORY.md +186 -0
- package/scanner-sdk/node_modules/http-errors/LICENSE +23 -0
- package/scanner-sdk/node_modules/http-errors/README.md +169 -0
- package/scanner-sdk/node_modules/http-errors/index.js +290 -0
- package/scanner-sdk/node_modules/http-errors/package.json +54 -0
- package/scanner-sdk/node_modules/iconv-lite/Changelog.md +162 -0
- package/scanner-sdk/node_modules/iconv-lite/LICENSE +21 -0
- package/scanner-sdk/node_modules/iconv-lite/README.md +156 -0
- package/scanner-sdk/node_modules/iconv-lite/encodings/dbcs-codec.js +555 -0
- package/scanner-sdk/node_modules/iconv-lite/encodings/dbcs-data.js +176 -0
- package/scanner-sdk/node_modules/iconv-lite/encodings/index.js +22 -0
- package/scanner-sdk/node_modules/iconv-lite/encodings/internal.js +188 -0
- package/scanner-sdk/node_modules/iconv-lite/encodings/sbcs-codec.js +72 -0
- package/scanner-sdk/node_modules/iconv-lite/encodings/sbcs-data-generated.js +451 -0
- package/scanner-sdk/node_modules/iconv-lite/encodings/sbcs-data.js +174 -0
- package/scanner-sdk/node_modules/iconv-lite/encodings/tables/big5-added.json +122 -0
- package/scanner-sdk/node_modules/iconv-lite/encodings/tables/cp936.json +264 -0
- package/scanner-sdk/node_modules/iconv-lite/encodings/tables/cp949.json +273 -0
- package/scanner-sdk/node_modules/iconv-lite/encodings/tables/cp950.json +177 -0
- package/scanner-sdk/node_modules/iconv-lite/encodings/tables/eucjp.json +182 -0
- package/scanner-sdk/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +1 -0
- package/scanner-sdk/node_modules/iconv-lite/encodings/tables/gbk-added.json +55 -0
- package/scanner-sdk/node_modules/iconv-lite/encodings/tables/shiftjis.json +125 -0
- package/scanner-sdk/node_modules/iconv-lite/encodings/utf16.js +177 -0
- package/scanner-sdk/node_modules/iconv-lite/encodings/utf7.js +290 -0
- package/scanner-sdk/node_modules/iconv-lite/lib/bom-handling.js +52 -0
- package/scanner-sdk/node_modules/iconv-lite/lib/extend-node.js +217 -0
- package/scanner-sdk/node_modules/iconv-lite/lib/index.d.ts +24 -0
- package/scanner-sdk/node_modules/iconv-lite/lib/index.js +153 -0
- package/scanner-sdk/node_modules/iconv-lite/lib/streams.js +121 -0
- package/scanner-sdk/node_modules/iconv-lite/package.json +46 -0
- package/scanner-sdk/node_modules/inherits/LICENSE +16 -0
- package/scanner-sdk/node_modules/inherits/README.md +42 -0
- package/scanner-sdk/node_modules/inherits/inherits.js +9 -0
- package/scanner-sdk/node_modules/inherits/inherits_browser.js +27 -0
- package/scanner-sdk/node_modules/inherits/package.json +29 -0
- package/scanner-sdk/node_modules/ipaddr.js/LICENSE +19 -0
- package/scanner-sdk/node_modules/ipaddr.js/README.md +233 -0
- package/scanner-sdk/node_modules/ipaddr.js/ipaddr.min.js +1 -0
- package/scanner-sdk/node_modules/ipaddr.js/lib/ipaddr.js +673 -0
- package/scanner-sdk/node_modules/ipaddr.js/lib/ipaddr.js.d.ts +68 -0
- package/scanner-sdk/node_modules/ipaddr.js/package.json +35 -0
- package/scanner-sdk/node_modules/js-tokens/CHANGELOG.md +151 -0
- package/scanner-sdk/node_modules/js-tokens/LICENSE +21 -0
- package/scanner-sdk/node_modules/js-tokens/README.md +240 -0
- package/scanner-sdk/node_modules/js-tokens/index.js +23 -0
- package/scanner-sdk/node_modules/js-tokens/package.json +30 -0
- package/scanner-sdk/node_modules/jsesc/LICENSE-MIT.txt +20 -0
- package/scanner-sdk/node_modules/jsesc/README.md +422 -0
- package/scanner-sdk/node_modules/jsesc/bin/jsesc +148 -0
- package/scanner-sdk/node_modules/jsesc/jsesc.js +337 -0
- package/scanner-sdk/node_modules/jsesc/man/jsesc.1 +94 -0
- package/scanner-sdk/node_modules/jsesc/package.json +56 -0
- package/scanner-sdk/node_modules/math-intrinsics/.eslintrc +16 -0
- package/scanner-sdk/node_modules/math-intrinsics/.github/FUNDING.yml +12 -0
- package/scanner-sdk/node_modules/math-intrinsics/CHANGELOG.md +24 -0
- package/scanner-sdk/node_modules/math-intrinsics/LICENSE +21 -0
- package/scanner-sdk/node_modules/math-intrinsics/README.md +50 -0
- package/scanner-sdk/node_modules/math-intrinsics/abs.d.ts +1 -0
- package/scanner-sdk/node_modules/math-intrinsics/abs.js +4 -0
- package/scanner-sdk/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +3 -0
- package/scanner-sdk/node_modules/math-intrinsics/constants/maxArrayLength.js +4 -0
- package/scanner-sdk/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +3 -0
- package/scanner-sdk/node_modules/math-intrinsics/constants/maxSafeInteger.js +5 -0
- package/scanner-sdk/node_modules/math-intrinsics/constants/maxValue.d.ts +3 -0
- package/scanner-sdk/node_modules/math-intrinsics/constants/maxValue.js +5 -0
- package/scanner-sdk/node_modules/math-intrinsics/floor.d.ts +1 -0
- package/scanner-sdk/node_modules/math-intrinsics/floor.js +4 -0
- package/scanner-sdk/node_modules/math-intrinsics/isFinite.d.ts +3 -0
- package/scanner-sdk/node_modules/math-intrinsics/isFinite.js +12 -0
- package/scanner-sdk/node_modules/math-intrinsics/isInteger.d.ts +3 -0
- package/scanner-sdk/node_modules/math-intrinsics/isInteger.js +16 -0
- package/scanner-sdk/node_modules/math-intrinsics/isNaN.d.ts +1 -0
- package/scanner-sdk/node_modules/math-intrinsics/isNaN.js +6 -0
- package/scanner-sdk/node_modules/math-intrinsics/isNegativeZero.d.ts +3 -0
- package/scanner-sdk/node_modules/math-intrinsics/isNegativeZero.js +6 -0
- package/scanner-sdk/node_modules/math-intrinsics/max.d.ts +1 -0
- package/scanner-sdk/node_modules/math-intrinsics/max.js +4 -0
- package/scanner-sdk/node_modules/math-intrinsics/min.d.ts +1 -0
- package/scanner-sdk/node_modules/math-intrinsics/min.js +4 -0
- package/scanner-sdk/node_modules/math-intrinsics/mod.d.ts +3 -0
- package/scanner-sdk/node_modules/math-intrinsics/mod.js +9 -0
- package/scanner-sdk/node_modules/math-intrinsics/package.json +86 -0
- package/scanner-sdk/node_modules/math-intrinsics/pow.d.ts +1 -0
- package/scanner-sdk/node_modules/math-intrinsics/pow.js +4 -0
- package/scanner-sdk/node_modules/math-intrinsics/round.d.ts +1 -0
- package/scanner-sdk/node_modules/math-intrinsics/round.js +4 -0
- package/scanner-sdk/node_modules/math-intrinsics/sign.d.ts +3 -0
- package/scanner-sdk/node_modules/math-intrinsics/sign.js +11 -0
- package/scanner-sdk/node_modules/math-intrinsics/test/index.js +192 -0
- package/scanner-sdk/node_modules/math-intrinsics/tsconfig.json +3 -0
- package/scanner-sdk/node_modules/media-typer/HISTORY.md +22 -0
- package/scanner-sdk/node_modules/media-typer/LICENSE +22 -0
- package/scanner-sdk/node_modules/media-typer/README.md +81 -0
- package/scanner-sdk/node_modules/media-typer/index.js +270 -0
- package/scanner-sdk/node_modules/media-typer/package.json +26 -0
- package/scanner-sdk/node_modules/merge-descriptors/HISTORY.md +21 -0
- package/scanner-sdk/node_modules/merge-descriptors/LICENSE +23 -0
- package/scanner-sdk/node_modules/merge-descriptors/README.md +49 -0
- package/scanner-sdk/node_modules/merge-descriptors/index.js +60 -0
- package/scanner-sdk/node_modules/merge-descriptors/package.json +39 -0
- package/scanner-sdk/node_modules/methods/HISTORY.md +29 -0
- package/scanner-sdk/node_modules/methods/LICENSE +24 -0
- package/scanner-sdk/node_modules/methods/README.md +51 -0
- package/scanner-sdk/node_modules/methods/index.js +69 -0
- package/scanner-sdk/node_modules/methods/package.json +36 -0
- package/scanner-sdk/node_modules/mime/CHANGELOG.md +164 -0
- package/scanner-sdk/node_modules/mime/LICENSE +21 -0
- package/scanner-sdk/node_modules/mime/README.md +90 -0
- package/scanner-sdk/node_modules/mime/cli.js +8 -0
- package/scanner-sdk/node_modules/mime/mime.js +108 -0
- package/scanner-sdk/node_modules/mime/package.json +44 -0
- package/scanner-sdk/node_modules/mime/src/build.js +53 -0
- package/scanner-sdk/node_modules/mime/src/test.js +60 -0
- package/scanner-sdk/node_modules/mime/types.json +1 -0
- package/scanner-sdk/node_modules/mime-db/HISTORY.md +507 -0
- package/scanner-sdk/node_modules/mime-db/LICENSE +23 -0
- package/scanner-sdk/node_modules/mime-db/README.md +100 -0
- package/scanner-sdk/node_modules/mime-db/db.json +8519 -0
- package/scanner-sdk/node_modules/mime-db/index.js +12 -0
- package/scanner-sdk/node_modules/mime-db/package.json +60 -0
- package/scanner-sdk/node_modules/mime-types/HISTORY.md +397 -0
- package/scanner-sdk/node_modules/mime-types/LICENSE +23 -0
- package/scanner-sdk/node_modules/mime-types/README.md +113 -0
- package/scanner-sdk/node_modules/mime-types/index.js +188 -0
- package/scanner-sdk/node_modules/mime-types/package.json +44 -0
- package/scanner-sdk/node_modules/ms/index.js +152 -0
- package/scanner-sdk/node_modules/ms/license.md +21 -0
- package/scanner-sdk/node_modules/ms/package.json +37 -0
- package/scanner-sdk/node_modules/ms/readme.md +51 -0
- package/scanner-sdk/node_modules/negotiator/HISTORY.md +108 -0
- package/scanner-sdk/node_modules/negotiator/LICENSE +24 -0
- package/scanner-sdk/node_modules/negotiator/README.md +203 -0
- package/scanner-sdk/node_modules/negotiator/index.js +82 -0
- package/scanner-sdk/node_modules/negotiator/lib/charset.js +169 -0
- package/scanner-sdk/node_modules/negotiator/lib/encoding.js +184 -0
- package/scanner-sdk/node_modules/negotiator/lib/language.js +179 -0
- package/scanner-sdk/node_modules/negotiator/lib/mediaType.js +294 -0
- package/scanner-sdk/node_modules/negotiator/package.json +42 -0
- package/scanner-sdk/node_modules/object-inspect/.eslintrc +53 -0
- package/scanner-sdk/node_modules/object-inspect/.github/FUNDING.yml +12 -0
- package/scanner-sdk/node_modules/object-inspect/.nycrc +13 -0
- package/scanner-sdk/node_modules/object-inspect/CHANGELOG.md +424 -0
- package/scanner-sdk/node_modules/object-inspect/LICENSE +21 -0
- package/scanner-sdk/node_modules/object-inspect/example/all.js +23 -0
- package/scanner-sdk/node_modules/object-inspect/example/circular.js +6 -0
- package/scanner-sdk/node_modules/object-inspect/example/fn.js +5 -0
- package/scanner-sdk/node_modules/object-inspect/example/inspect.js +10 -0
- package/scanner-sdk/node_modules/object-inspect/index.js +544 -0
- package/scanner-sdk/node_modules/object-inspect/package-support.json +20 -0
- package/scanner-sdk/node_modules/object-inspect/package.json +105 -0
- package/scanner-sdk/node_modules/object-inspect/readme.markdown +84 -0
- package/scanner-sdk/node_modules/object-inspect/test/bigint.js +58 -0
- package/scanner-sdk/node_modules/object-inspect/test/browser/dom.js +15 -0
- package/scanner-sdk/node_modules/object-inspect/test/circular.js +16 -0
- package/scanner-sdk/node_modules/object-inspect/test/deep.js +12 -0
- package/scanner-sdk/node_modules/object-inspect/test/element.js +53 -0
- package/scanner-sdk/node_modules/object-inspect/test/err.js +48 -0
- package/scanner-sdk/node_modules/object-inspect/test/fakes.js +29 -0
- package/scanner-sdk/node_modules/object-inspect/test/fn.js +76 -0
- package/scanner-sdk/node_modules/object-inspect/test/global.js +17 -0
- package/scanner-sdk/node_modules/object-inspect/test/has.js +15 -0
- package/scanner-sdk/node_modules/object-inspect/test/holes.js +15 -0
- package/scanner-sdk/node_modules/object-inspect/test/indent-option.js +271 -0
- package/scanner-sdk/node_modules/object-inspect/test/inspect.js +139 -0
- package/scanner-sdk/node_modules/object-inspect/test/lowbyte.js +12 -0
- package/scanner-sdk/node_modules/object-inspect/test/number.js +58 -0
- package/scanner-sdk/node_modules/object-inspect/test/quoteStyle.js +26 -0
- package/scanner-sdk/node_modules/object-inspect/test/toStringTag.js +40 -0
- package/scanner-sdk/node_modules/object-inspect/test/undef.js +12 -0
- package/scanner-sdk/node_modules/object-inspect/test/values.js +261 -0
- package/scanner-sdk/node_modules/object-inspect/test-core-js.js +26 -0
- package/scanner-sdk/node_modules/object-inspect/util.inspect.js +1 -0
- package/scanner-sdk/node_modules/on-finished/HISTORY.md +98 -0
- package/scanner-sdk/node_modules/on-finished/LICENSE +23 -0
- package/scanner-sdk/node_modules/on-finished/README.md +162 -0
- package/scanner-sdk/node_modules/on-finished/index.js +234 -0
- package/scanner-sdk/node_modules/on-finished/package.json +39 -0
- package/scanner-sdk/node_modules/parseurl/HISTORY.md +58 -0
- package/scanner-sdk/node_modules/parseurl/LICENSE +24 -0
- package/scanner-sdk/node_modules/parseurl/README.md +133 -0
- package/scanner-sdk/node_modules/parseurl/index.js +158 -0
- package/scanner-sdk/node_modules/parseurl/package.json +40 -0
- package/scanner-sdk/node_modules/path-to-regexp/LICENSE +21 -0
- package/scanner-sdk/node_modules/path-to-regexp/Readme.md +35 -0
- package/scanner-sdk/node_modules/path-to-regexp/index.js +158 -0
- package/scanner-sdk/node_modules/path-to-regexp/package.json +30 -0
- package/scanner-sdk/node_modules/picocolors/LICENSE +15 -0
- package/scanner-sdk/node_modules/picocolors/README.md +21 -0
- package/scanner-sdk/node_modules/picocolors/package.json +25 -0
- package/scanner-sdk/node_modules/picocolors/picocolors.browser.js +4 -0
- package/scanner-sdk/node_modules/picocolors/picocolors.d.ts +5 -0
- package/scanner-sdk/node_modules/picocolors/picocolors.js +75 -0
- package/scanner-sdk/node_modules/picocolors/types.d.ts +51 -0
- package/scanner-sdk/node_modules/proxy-addr/HISTORY.md +161 -0
- package/scanner-sdk/node_modules/proxy-addr/LICENSE +22 -0
- package/scanner-sdk/node_modules/proxy-addr/README.md +139 -0
- package/scanner-sdk/node_modules/proxy-addr/index.js +327 -0
- package/scanner-sdk/node_modules/proxy-addr/package.json +47 -0
- package/scanner-sdk/node_modules/qs/.editorconfig +46 -0
- package/scanner-sdk/node_modules/qs/.github/FUNDING.yml +12 -0
- package/scanner-sdk/node_modules/qs/.github/SECURITY.md +11 -0
- package/scanner-sdk/node_modules/qs/.github/THREAT_MODEL.md +78 -0
- package/scanner-sdk/node_modules/qs/.nycrc +13 -0
- package/scanner-sdk/node_modules/qs/CHANGELOG.md +644 -0
- package/scanner-sdk/node_modules/qs/LICENSE.md +29 -0
- package/scanner-sdk/node_modules/qs/README.md +740 -0
- package/scanner-sdk/node_modules/qs/dist/qs.js +141 -0
- package/scanner-sdk/node_modules/qs/eslint.config.mjs +56 -0
- package/scanner-sdk/node_modules/qs/lib/formats.js +23 -0
- package/scanner-sdk/node_modules/qs/lib/index.js +11 -0
- package/scanner-sdk/node_modules/qs/lib/parse.js +371 -0
- package/scanner-sdk/node_modules/qs/lib/stringify.js +356 -0
- package/scanner-sdk/node_modules/qs/lib/utils.js +340 -0
- package/scanner-sdk/node_modules/qs/package.json +94 -0
- package/scanner-sdk/node_modules/qs/test/empty-keys-cases.js +267 -0
- package/scanner-sdk/node_modules/qs/test/parse.js +1512 -0
- package/scanner-sdk/node_modules/qs/test/stringify.js +1310 -0
- package/scanner-sdk/node_modules/qs/test/utils.js +397 -0
- package/scanner-sdk/node_modules/range-parser/HISTORY.md +56 -0
- package/scanner-sdk/node_modules/range-parser/LICENSE +23 -0
- package/scanner-sdk/node_modules/range-parser/README.md +84 -0
- package/scanner-sdk/node_modules/range-parser/index.js +162 -0
- package/scanner-sdk/node_modules/range-parser/package.json +44 -0
- package/scanner-sdk/node_modules/raw-body/LICENSE +22 -0
- package/scanner-sdk/node_modules/raw-body/README.md +223 -0
- package/scanner-sdk/node_modules/raw-body/index.d.ts +87 -0
- package/scanner-sdk/node_modules/raw-body/index.js +336 -0
- package/scanner-sdk/node_modules/raw-body/package.json +47 -0
- package/scanner-sdk/node_modules/safe-buffer/LICENSE +21 -0
- package/scanner-sdk/node_modules/safe-buffer/README.md +584 -0
- package/scanner-sdk/node_modules/safe-buffer/index.d.ts +187 -0
- package/scanner-sdk/node_modules/safe-buffer/index.js +65 -0
- package/scanner-sdk/node_modules/safe-buffer/package.json +51 -0
- package/scanner-sdk/node_modules/safer-buffer/LICENSE +21 -0
- package/scanner-sdk/node_modules/safer-buffer/Porting-Buffer.md +268 -0
- package/scanner-sdk/node_modules/safer-buffer/Readme.md +156 -0
- package/scanner-sdk/node_modules/safer-buffer/dangerous.js +58 -0
- package/scanner-sdk/node_modules/safer-buffer/package.json +34 -0
- package/scanner-sdk/node_modules/safer-buffer/safer.js +77 -0
- package/scanner-sdk/node_modules/safer-buffer/tests.js +406 -0
- package/scanner-sdk/node_modules/send/HISTORY.md +538 -0
- package/scanner-sdk/node_modules/send/LICENSE +23 -0
- package/scanner-sdk/node_modules/send/README.md +327 -0
- package/scanner-sdk/node_modules/send/SECURITY.md +24 -0
- package/scanner-sdk/node_modules/send/index.js +1142 -0
- package/scanner-sdk/node_modules/send/node_modules/ms/index.js +162 -0
- package/scanner-sdk/node_modules/send/node_modules/ms/license.md +21 -0
- package/scanner-sdk/node_modules/send/node_modules/ms/package.json +38 -0
- package/scanner-sdk/node_modules/send/node_modules/ms/readme.md +59 -0
- package/scanner-sdk/node_modules/send/package.json +62 -0
- package/scanner-sdk/node_modules/serve-static/HISTORY.md +493 -0
- package/scanner-sdk/node_modules/serve-static/LICENSE +25 -0
- package/scanner-sdk/node_modules/serve-static/README.md +257 -0
- package/scanner-sdk/node_modules/serve-static/index.js +209 -0
- package/scanner-sdk/node_modules/serve-static/package.json +42 -0
- package/scanner-sdk/node_modules/setprototypeof/LICENSE +13 -0
- package/scanner-sdk/node_modules/setprototypeof/README.md +31 -0
- package/scanner-sdk/node_modules/setprototypeof/index.d.ts +2 -0
- package/scanner-sdk/node_modules/setprototypeof/index.js +17 -0
- package/scanner-sdk/node_modules/setprototypeof/package.json +38 -0
- package/scanner-sdk/node_modules/setprototypeof/test/index.js +24 -0
- package/scanner-sdk/node_modules/side-channel/.editorconfig +9 -0
- package/scanner-sdk/node_modules/side-channel/.eslintrc +12 -0
- package/scanner-sdk/node_modules/side-channel/.github/FUNDING.yml +12 -0
- package/scanner-sdk/node_modules/side-channel/.nycrc +13 -0
- package/scanner-sdk/node_modules/side-channel/CHANGELOG.md +110 -0
- package/scanner-sdk/node_modules/side-channel/LICENSE +21 -0
- package/scanner-sdk/node_modules/side-channel/README.md +61 -0
- package/scanner-sdk/node_modules/side-channel/index.d.ts +14 -0
- package/scanner-sdk/node_modules/side-channel/index.js +43 -0
- package/scanner-sdk/node_modules/side-channel/package.json +85 -0
- package/scanner-sdk/node_modules/side-channel/test/index.js +104 -0
- package/scanner-sdk/node_modules/side-channel/tsconfig.json +9 -0
- package/scanner-sdk/node_modules/side-channel-list/.editorconfig +9 -0
- package/scanner-sdk/node_modules/side-channel-list/.eslintrc +11 -0
- package/scanner-sdk/node_modules/side-channel-list/.github/FUNDING.yml +12 -0
- package/scanner-sdk/node_modules/side-channel-list/.nycrc +13 -0
- package/scanner-sdk/node_modules/side-channel-list/CHANGELOG.md +15 -0
- package/scanner-sdk/node_modules/side-channel-list/LICENSE +21 -0
- package/scanner-sdk/node_modules/side-channel-list/README.md +62 -0
- package/scanner-sdk/node_modules/side-channel-list/index.d.ts +13 -0
- package/scanner-sdk/node_modules/side-channel-list/index.js +113 -0
- package/scanner-sdk/node_modules/side-channel-list/list.d.ts +14 -0
- package/scanner-sdk/node_modules/side-channel-list/package.json +77 -0
- package/scanner-sdk/node_modules/side-channel-list/test/index.js +104 -0
- package/scanner-sdk/node_modules/side-channel-list/tsconfig.json +9 -0
- package/scanner-sdk/node_modules/side-channel-map/.editorconfig +9 -0
- package/scanner-sdk/node_modules/side-channel-map/.eslintrc +11 -0
- package/scanner-sdk/node_modules/side-channel-map/.github/FUNDING.yml +12 -0
- package/scanner-sdk/node_modules/side-channel-map/.nycrc +13 -0
- package/scanner-sdk/node_modules/side-channel-map/CHANGELOG.md +22 -0
- package/scanner-sdk/node_modules/side-channel-map/LICENSE +21 -0
- package/scanner-sdk/node_modules/side-channel-map/README.md +62 -0
- package/scanner-sdk/node_modules/side-channel-map/index.d.ts +15 -0
- package/scanner-sdk/node_modules/side-channel-map/index.js +68 -0
- package/scanner-sdk/node_modules/side-channel-map/package.json +80 -0
- package/scanner-sdk/node_modules/side-channel-map/test/index.js +114 -0
- package/scanner-sdk/node_modules/side-channel-map/tsconfig.json +9 -0
- package/scanner-sdk/node_modules/side-channel-weakmap/.editorconfig +9 -0
- package/scanner-sdk/node_modules/side-channel-weakmap/.eslintrc +12 -0
- package/scanner-sdk/node_modules/side-channel-weakmap/.github/FUNDING.yml +12 -0
- package/scanner-sdk/node_modules/side-channel-weakmap/.nycrc +13 -0
- package/scanner-sdk/node_modules/side-channel-weakmap/CHANGELOG.md +28 -0
- package/scanner-sdk/node_modules/side-channel-weakmap/LICENSE +21 -0
- package/scanner-sdk/node_modules/side-channel-weakmap/README.md +62 -0
- package/scanner-sdk/node_modules/side-channel-weakmap/index.d.ts +15 -0
- package/scanner-sdk/node_modules/side-channel-weakmap/index.js +84 -0
- package/scanner-sdk/node_modules/side-channel-weakmap/package.json +87 -0
- package/scanner-sdk/node_modules/side-channel-weakmap/test/index.js +114 -0
- package/scanner-sdk/node_modules/side-channel-weakmap/tsconfig.json +9 -0
- package/scanner-sdk/node_modules/statuses/HISTORY.md +87 -0
- package/scanner-sdk/node_modules/statuses/LICENSE +23 -0
- package/scanner-sdk/node_modules/statuses/README.md +139 -0
- package/scanner-sdk/node_modules/statuses/codes.json +65 -0
- package/scanner-sdk/node_modules/statuses/index.js +146 -0
- package/scanner-sdk/node_modules/statuses/package.json +49 -0
- package/scanner-sdk/node_modules/toidentifier/HISTORY.md +9 -0
- package/scanner-sdk/node_modules/toidentifier/LICENSE +21 -0
- package/scanner-sdk/node_modules/toidentifier/README.md +61 -0
- package/scanner-sdk/node_modules/toidentifier/index.js +32 -0
- package/scanner-sdk/node_modules/toidentifier/package.json +38 -0
- package/scanner-sdk/node_modules/type-is/HISTORY.md +259 -0
- package/scanner-sdk/node_modules/type-is/LICENSE +23 -0
- package/scanner-sdk/node_modules/type-is/README.md +170 -0
- package/scanner-sdk/node_modules/type-is/index.js +266 -0
- package/scanner-sdk/node_modules/type-is/package.json +45 -0
- package/scanner-sdk/node_modules/unpipe/HISTORY.md +4 -0
- package/scanner-sdk/node_modules/unpipe/LICENSE +22 -0
- package/scanner-sdk/node_modules/unpipe/README.md +43 -0
- package/scanner-sdk/node_modules/unpipe/index.js +69 -0
- package/scanner-sdk/node_modules/unpipe/package.json +27 -0
- package/scanner-sdk/node_modules/utils-merge/LICENSE +20 -0
- package/scanner-sdk/node_modules/utils-merge/README.md +34 -0
- package/scanner-sdk/node_modules/utils-merge/index.js +23 -0
- package/scanner-sdk/node_modules/utils-merge/package.json +40 -0
- package/scanner-sdk/node_modules/vary/HISTORY.md +39 -0
- package/scanner-sdk/node_modules/vary/LICENSE +22 -0
- package/scanner-sdk/node_modules/vary/README.md +101 -0
- package/scanner-sdk/node_modules/vary/index.js +149 -0
- package/scanner-sdk/node_modules/vary/package.json +43 -0
- package/scanner-sdk/package-lock.json +1046 -0
- package/scanner-sdk/package.json +25 -0
- package/scanner-sdk/scan/adonis.js +177 -0
- package/scanner-sdk/scan/express-files.js +326 -0
- package/scanner-sdk/scan/express-static.js +292 -0
- package/scanner-sdk/scan/express.js +217 -0
- package/scanner-sdk/scan/fastify.js +1162 -0
- package/scanner-sdk/scan/field-extractors.js +779 -0
- package/scanner-sdk/scan/frontend.js +563 -0
- package/scanner-sdk/scan/hapi.js +997 -0
- package/scanner-sdk/scan/koa.js +250 -0
- package/scanner-sdk/scan/nest-source.js +918 -0
- package/scanner-sdk/scan/nestjs.js +660 -0
- package/scanner-sdk/scan/nextjs.js +322 -0
- package/scanner-sdk/scan/nuxt-value-types.js +521 -0
- package/scanner-sdk/scan/nuxt.js +462 -0
- package/scanner-sdk/scan/remix-routes.js +261 -0
- package/scanner-sdk/scan/remix.js +348 -0
- package/scanner-sdk/scan/response-shape.js +415 -0
- package/scanner-sdk/scan/route-calls.js +663 -0
- package/scanner-sdk/scan/route-segments.js +378 -0
- package/scanner-sdk/scan/sveltekit-body.js +491 -0
- package/scanner-sdk/scan/sveltekit-reply.js +328 -0
- package/scanner-sdk/scan/sveltekit.js +149 -0
- package/scanner-sdk/scan/text-utils.js +517 -0
- package/scanner-sdk/scanner.js +52 -0
- package/undo/bin/scan.js +23 -0
- package/undo/index.js +104 -0
- package/undo/lib/action-id.js +38 -0
- package/undo/lib/capture-guard.js +8 -0
- package/undo/lib/capture-mongo.js +341 -0
- package/undo/lib/capture-mssql.js +901 -0
- package/undo/lib/capture-mysql.js +909 -0
- package/undo/lib/capture-prisma-mongo.js +297 -0
- package/undo/lib/capture-prisma.js +900 -0
- package/undo/lib/capture-sql.js +656 -0
- package/undo/lib/capture-sqlite.js +933 -0
- package/undo/lib/gate.js +190 -0
- package/undo/lib/hooks/better-sqlite3.js +198 -0
- package/undo/lib/hooks/mongodb.js +124 -0
- package/undo/lib/hooks/mssql.js +209 -0
- package/undo/lib/hooks/mysql2.js +148 -0
- package/undo/lib/hooks/pg.js +156 -0
- package/undo/lib/hooks/prisma.js +335 -0
- package/undo/lib/hooks/sqlite3.js +310 -0
- package/undo/lib/loader-watch.js +64 -0
- package/undo/lib/log.js +34 -0
- package/undo/lib/mssql-run.js +95 -0
- package/undo/lib/prisma-structure.js +397 -0
- package/undo/lib/report.js +50 -0
- package/undo/lib/requester.js +33 -0
- package/undo/lib/scanner.js +400 -0
- package/undo/lib/schema-reader.js +129 -0
- package/undo/lib/setup-check.js +294 -0
- package/undo/lib/snapshot-crypto.js +96 -0
- package/undo/lib/snapshot-sql.js +180 -0
- package/undo/lib/snapshot-store-mongo.js +154 -0
- package/undo/lib/snapshot-store-prisma-mongo.js +192 -0
- package/undo/lib/snapshot-store-sqlite.js +140 -0
- package/undo/lib/snapshot-store.js +272 -0
- package/undo/lib/sql-classify-mssql.js +230 -0
- package/undo/lib/sql-classify-mysql.js +167 -0
- package/undo/lib/sql-classify.js +169 -0
- package/undo/lib/sqlite-sql.js +357 -0
- package/undo/lib/tagger.js +333 -0
- package/undo/lib/undo-mongo.js +248 -0
- package/undo/lib/undo-mssql.js +389 -0
- package/undo/lib/undo-mysql.js +297 -0
- package/undo/lib/undo-pg.js +248 -0
- package/undo/lib/undo-prisma-mongo.js +263 -0
- package/undo/lib/undo-prisma.js +404 -0
- package/undo/lib/undo-route.js +197 -0
- package/undo/lib/undo-sqlite.js +332 -0
- package/undo/register.js +7 -0
- package/scanner.js +0 -3008
- /package/{bin → scanner-sdk/bin}/scan-frontend.js +0 -0
- /package/{client.js → scanner-sdk/client.js} +0 -0
package/scanner.js
DELETED
|
@@ -1,3008 +0,0 @@
|
|
|
1
|
-
// botversion-sdk/scanner.js
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Scans an Express app object and extracts all registered routes
|
|
6
|
-
*/
|
|
7
|
-
function scanExpressRoutes(app, cwd) {
|
|
8
|
-
const endpoints = [];
|
|
9
|
-
const seen = new Set();
|
|
10
|
-
|
|
11
|
-
// Build body map from ALL files upfront
|
|
12
|
-
const bodyMap = cwd ? buildBodyMap(cwd) : {};
|
|
13
|
-
|
|
14
|
-
if (app) {
|
|
15
|
-
if (app.lazyrouter) app.lazyrouter();
|
|
16
|
-
const router = app._router || app.router || (app.stack ? app : null);
|
|
17
|
-
if (router) {
|
|
18
|
-
const stack = router.stack || [];
|
|
19
|
-
extractRoutes(stack, "", endpoints, seen, bodyMap);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// ALSO scan all JS/TS files statically for route definitions
|
|
24
|
-
if (cwd) {
|
|
25
|
-
const allFiles = scanAllExpressFiles(cwd);
|
|
26
|
-
for (const file of allFiles) {
|
|
27
|
-
const fileEndpoints = scanExpressFileStatically(file, seen);
|
|
28
|
-
endpoints.push(...fileEndpoints);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return endpoints;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function scanExpressFileStatically(filePath, seen) {
|
|
36
|
-
const fs = require("fs");
|
|
37
|
-
const endpoints = [];
|
|
38
|
-
|
|
39
|
-
let content;
|
|
40
|
-
try {
|
|
41
|
-
content = fs.readFileSync(filePath, "utf8");
|
|
42
|
-
} catch {
|
|
43
|
-
return endpoints;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Match patterns like:
|
|
47
|
-
// app.get('/path', ...)
|
|
48
|
-
// router.post('/path', ...)
|
|
49
|
-
// app.all('/curd.php', ...)
|
|
50
|
-
const routePattern =
|
|
51
|
-
/\.(get|post|put|delete|patch|all)\s*\(\s*['"`]([^'"`]+)['"`]/gi;
|
|
52
|
-
|
|
53
|
-
let match;
|
|
54
|
-
while ((match = routePattern.exec(content)) !== null) {
|
|
55
|
-
const method = match[1].toUpperCase();
|
|
56
|
-
const routePath = match[2];
|
|
57
|
-
|
|
58
|
-
// Skip middleware patterns
|
|
59
|
-
if (routePath.includes("*")) continue;
|
|
60
|
-
|
|
61
|
-
const key = method + ":" + routePath;
|
|
62
|
-
if (seen.has(key)) continue;
|
|
63
|
-
seen.add(key);
|
|
64
|
-
|
|
65
|
-
const effectiveMethod = method === "ALL" ? "GET" : method;
|
|
66
|
-
const needsBody = ["POST", "PUT", "PATCH"].includes(effectiveMethod);
|
|
67
|
-
const bodyFields = needsBody ? extractBodyFieldsFromFile(content) : null;
|
|
68
|
-
|
|
69
|
-
// GET inputs come from the query string; read them from this route's own code
|
|
70
|
-
const queryFields =
|
|
71
|
-
effectiveMethod === "GET"
|
|
72
|
-
? extractQueryFieldsFromFile(
|
|
73
|
-
sliceRouteSegment(content, match.index, routePattern.source),
|
|
74
|
-
)
|
|
75
|
-
: null;
|
|
76
|
-
|
|
77
|
-
const routeParamMap = buildRouteParamMap(routePath, []);
|
|
78
|
-
|
|
79
|
-
endpoints.push({
|
|
80
|
-
method: effectiveMethod,
|
|
81
|
-
path: routePath,
|
|
82
|
-
description: "",
|
|
83
|
-
requestBody:
|
|
84
|
-
mergeBodyWithMultipart(
|
|
85
|
-
bodyFields,
|
|
86
|
-
["POST", "PUT", "PATCH"].includes(effectiveMethod)
|
|
87
|
-
? extractMultipartFieldsFromFile(
|
|
88
|
-
sliceRouteSegment(content, match.index, routePattern.source),
|
|
89
|
-
) ||
|
|
90
|
-
((content.match(new RegExp(routePattern.source, "gi")) || [])
|
|
91
|
-
.length === 1
|
|
92
|
-
? extractMultipartFieldsFromFile(content)
|
|
93
|
-
: null)
|
|
94
|
-
: null,
|
|
95
|
-
) || queryFields,
|
|
96
|
-
routeParamMap: routeParamMap,
|
|
97
|
-
responseBody: extractResponseFieldsForRoute(
|
|
98
|
-
content,
|
|
99
|
-
match.index,
|
|
100
|
-
routePattern.source,
|
|
101
|
-
),
|
|
102
|
-
detectedBy: "static-scan-file",
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return endpoints;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Recursively walks Express router stack and pulls out route layers
|
|
111
|
-
*
|
|
112
|
-
* Each layer in the stack is one of:
|
|
113
|
-
* - a route layer → layer.route exists, has .path and .methods
|
|
114
|
-
* - a router layer → layer.name === 'router', has its own .handle.stack
|
|
115
|
-
* - middleware → everything else (body-parser, cors, etc.) — skip these
|
|
116
|
-
*/
|
|
117
|
-
function extractRoutes(stack, prefix, endpoints, seen, bodyMap) {
|
|
118
|
-
prefix = prefix || "";
|
|
119
|
-
|
|
120
|
-
stack.forEach(function (layer) {
|
|
121
|
-
// ── Route layer (app.get / app.post / etc.) ──────────────────────────
|
|
122
|
-
if (layer.route) {
|
|
123
|
-
var routePath = prefix + (layer.route.path || "");
|
|
124
|
-
var methods = Object.keys(layer.route.methods).filter(function (m) {
|
|
125
|
-
return layer.route.methods[m] === true;
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
methods.forEach(function (method) {
|
|
129
|
-
method = method.toUpperCase();
|
|
130
|
-
if (method === "_ALL") return;
|
|
131
|
-
|
|
132
|
-
var key = method + ":" + routePath;
|
|
133
|
-
if (seen.has(key)) return;
|
|
134
|
-
seen.add(key);
|
|
135
|
-
|
|
136
|
-
const needsBody = ["POST", "PUT", "PATCH"].includes(method);
|
|
137
|
-
let requestBody = null;
|
|
138
|
-
|
|
139
|
-
if (needsBody) {
|
|
140
|
-
// Strategy 1: scan inline handler directly via fn.toString() — most accurate
|
|
141
|
-
for (const handler of layer.route.stack) {
|
|
142
|
-
const fn = handler.handle || handler;
|
|
143
|
-
const fnStr = fn.toString();
|
|
144
|
-
const fields = extractBodyFieldsFromFile(fnStr);
|
|
145
|
-
if (fields) {
|
|
146
|
-
requestBody = fields;
|
|
147
|
-
break;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// Strategy 2: fall back to bodyMap using handler name
|
|
152
|
-
if (!requestBody) {
|
|
153
|
-
const handlerName = extractHandlerName(layer);
|
|
154
|
-
if (handlerName && bodyMap[handlerName]) {
|
|
155
|
-
requestBody = bodyMap[handlerName];
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// GET inputs come from the query string, so read them from the handler code
|
|
161
|
-
if (method === "GET") {
|
|
162
|
-
requestBody = extractQueryFieldsFromHandlers(layer.route.stack);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
const routeParamMap = buildRouteParamMap(routePath, []);
|
|
166
|
-
|
|
167
|
-
endpoints.push({
|
|
168
|
-
method: method,
|
|
169
|
-
path: routePath,
|
|
170
|
-
description: "",
|
|
171
|
-
requestBody: requestBody,
|
|
172
|
-
responseBody: extractResponseFieldsFromHandlers(
|
|
173
|
-
layer.route.stack,
|
|
174
|
-
method,
|
|
175
|
-
),
|
|
176
|
-
routeParamMap: routeParamMap,
|
|
177
|
-
detectedBy: "static-scan",
|
|
178
|
-
});
|
|
179
|
-
});
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// ── Nested router layer (app.use('/prefix', router)) ─────────────────
|
|
184
|
-
if (layer.name === "router" && layer.handle && layer.handle.stack) {
|
|
185
|
-
// Extract the mount path from the regexp
|
|
186
|
-
var mountPath = prefix + regexpToPath(layer.regexp, layer.keys);
|
|
187
|
-
extractRoutes(layer.handle.stack, mountPath, endpoints, seen, bodyMap);
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
// ── Everything else is middleware — skip ─────────────────────────────
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Scans Next.js API routes from the pages/api directory
|
|
197
|
-
*/
|
|
198
|
-
function scanNextJsRoutes(pagesDir) {
|
|
199
|
-
const fs = require("fs");
|
|
200
|
-
const path = require("path");
|
|
201
|
-
const endpoints = [];
|
|
202
|
-
|
|
203
|
-
const apiDir = path.join(pagesDir, "api");
|
|
204
|
-
|
|
205
|
-
if (!fs.existsSync(apiDir)) {
|
|
206
|
-
return endpoints;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
function walkDir(dir, prefix) {
|
|
210
|
-
prefix = prefix || "/api";
|
|
211
|
-
const files = fs.readdirSync(dir);
|
|
212
|
-
|
|
213
|
-
files.forEach(function (file) {
|
|
214
|
-
const fullPath = path.join(dir, file);
|
|
215
|
-
const stat = fs.statSync(fullPath);
|
|
216
|
-
|
|
217
|
-
if (stat.isDirectory()) {
|
|
218
|
-
walkDir(fullPath, prefix + "/" + file);
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
if (!/\.(js|ts)$/.test(file)) return;
|
|
223
|
-
if (file.startsWith("_")) return;
|
|
224
|
-
// test files and type-declaration files are never endpoints
|
|
225
|
-
if (/\.(test|spec|d)\.(js|ts)$/.test(file)) return;
|
|
226
|
-
|
|
227
|
-
const routeName = file.replace(/\.(js|ts)$/, "");
|
|
228
|
-
const routePath =
|
|
229
|
-
routeName === "index" ? prefix : prefix + "/" + routeName;
|
|
230
|
-
const normalizedPath = routePath.replace(/\[([^\]]+)\]/g, ":$1");
|
|
231
|
-
|
|
232
|
-
const fileContent = fs.readFileSync(fullPath, "utf8");
|
|
233
|
-
// adapter files (tRPC): the real endpoints are the procedures behind them, learned from live traffic
|
|
234
|
-
if (/\bcreateNextApiHandler\b|@trpc\/server\/adapters/.test(fileContent))
|
|
235
|
-
return;
|
|
236
|
-
const methods = detectMethodsFromFile(fullPath);
|
|
237
|
-
|
|
238
|
-
methods.forEach(function (method) {
|
|
239
|
-
// In files that handle several methods, read only this method's own code
|
|
240
|
-
// (the whole file is used when the methods cannot be told apart)
|
|
241
|
-
const methodCode =
|
|
242
|
-
getMethodSegment(fileContent, method, methods, "pages") ||
|
|
243
|
-
fileContent;
|
|
244
|
-
// Body methods fall back to the whole file if their own code has no fields
|
|
245
|
-
const bodyFields =
|
|
246
|
-
method === "GET"
|
|
247
|
-
? null
|
|
248
|
-
: extractBodyFieldsFromFile(methodCode) ||
|
|
249
|
-
(method !== "DELETE"
|
|
250
|
-
? extractBodyFieldsFromFile(fileContent)
|
|
251
|
-
: null);
|
|
252
|
-
const queryFields = extractQueryFieldsFromFile(methodCode);
|
|
253
|
-
|
|
254
|
-
// Upload handlers read multipart fields, not req.body
|
|
255
|
-
const multipartFields =
|
|
256
|
-
method !== "GET" && method !== "DELETE"
|
|
257
|
-
? extractMultipartFieldsFromFile(methodCode) ||
|
|
258
|
-
extractMultipartFieldsFromFile(fileContent)
|
|
259
|
-
: null;
|
|
260
|
-
|
|
261
|
-
// GET inputs come from the query string; only this method's own code is read
|
|
262
|
-
const getQueryFields =
|
|
263
|
-
method === "GET"
|
|
264
|
-
? removePathParamFields(
|
|
265
|
-
extractQueryFieldsFromFile(
|
|
266
|
-
getMethodSegment(fileContent, "GET", methods, "pages") || "",
|
|
267
|
-
),
|
|
268
|
-
normalizedPath,
|
|
269
|
-
)
|
|
270
|
-
: null;
|
|
271
|
-
|
|
272
|
-
// For DELETE with no body fields, query params are the input
|
|
273
|
-
const effectiveRequestBody =
|
|
274
|
-
mergeBodyWithMultipart(bodyFields, multipartFields) ||
|
|
275
|
-
(method === "DELETE" && queryFields ? queryFields : null) ||
|
|
276
|
-
getQueryFields;
|
|
277
|
-
|
|
278
|
-
const routeParamMap = buildRouteParamMap(normalizedPath, []);
|
|
279
|
-
|
|
280
|
-
endpoints.push({
|
|
281
|
-
method: method,
|
|
282
|
-
path: normalizedPath,
|
|
283
|
-
description: "",
|
|
284
|
-
requestBody: effectiveRequestBody,
|
|
285
|
-
responseBody: extractResponseFieldsForMethod(
|
|
286
|
-
fileContent,
|
|
287
|
-
method,
|
|
288
|
-
methods,
|
|
289
|
-
"pages",
|
|
290
|
-
),
|
|
291
|
-
routeParamMap: routeParamMap,
|
|
292
|
-
detectedBy: "static-scan",
|
|
293
|
-
});
|
|
294
|
-
});
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
walkDir(apiDir);
|
|
299
|
-
return endpoints;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* Reads a file and detects which HTTP methods it handles
|
|
304
|
-
*/
|
|
305
|
-
// Matches any variable that holds the request method (req.method, method, httpMethod, ...)
|
|
306
|
-
const METHOD_REF =
|
|
307
|
-
"[\\w$.?]*[mM]ethod[\\w$]*(?:\\s*\\.\\s*toUpperCase\\s*\\(\\s*\\))?";
|
|
308
|
-
const HTTP_METHOD_NAMES = ["GET", "POST", "PUT", "DELETE", "PATCH"];
|
|
309
|
-
|
|
310
|
-
// Reads which HTTP methods a pages-style route file handles, whatever the variable is called
|
|
311
|
-
function detectMethodsFromFile(filePath) {
|
|
312
|
-
try {
|
|
313
|
-
const fs = require("fs");
|
|
314
|
-
const content = fs.readFileSync(filePath, "utf8");
|
|
315
|
-
const detected = new Set();
|
|
316
|
-
|
|
317
|
-
HTTP_METHOD_NAMES.forEach(function (m) {
|
|
318
|
-
const patterns = [
|
|
319
|
-
// method === "X" / method !== "X"
|
|
320
|
-
new RegExp(
|
|
321
|
-
METHOD_REF + "\\s*(?:===?|!==?)\\s*['\"`]" + m + "['\"`]",
|
|
322
|
-
"i",
|
|
323
|
-
),
|
|
324
|
-
// "X" === method
|
|
325
|
-
new RegExp(
|
|
326
|
-
"['\"`]" + m + "['\"`]\\s*(?:===?|!==?)\\s*" + METHOD_REF,
|
|
327
|
-
"i",
|
|
328
|
-
),
|
|
329
|
-
// switch (...) { case "X": }
|
|
330
|
-
new RegExp("case\\s*['\"`]" + m + "['\"`]", "i"),
|
|
331
|
-
];
|
|
332
|
-
if (
|
|
333
|
-
patterns.some(function (p) {
|
|
334
|
-
return p.test(content);
|
|
335
|
-
})
|
|
336
|
-
) {
|
|
337
|
-
detected.add(m);
|
|
338
|
-
}
|
|
339
|
-
});
|
|
340
|
-
|
|
341
|
-
// ["GET", "POST"].includes(method)
|
|
342
|
-
const includesRe = new RegExp(
|
|
343
|
-
"\\[([^\\]]*)\\]\\s*\\.includes\\s*\\(\\s*" + METHOD_REF,
|
|
344
|
-
"gi",
|
|
345
|
-
);
|
|
346
|
-
for (const found of content.matchAll(includesRe)) {
|
|
347
|
-
HTTP_METHOD_NAMES.forEach(function (m) {
|
|
348
|
-
if (new RegExp("['\"`]" + m + "['\"`]", "i").test(found[1])) {
|
|
349
|
-
detected.add(m);
|
|
350
|
-
}
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
// no recognizable method check means the file is treated as GET-only
|
|
355
|
-
if (detected.size === 0) {
|
|
356
|
-
return ["GET"];
|
|
357
|
-
}
|
|
358
|
-
return Array.from(detected);
|
|
359
|
-
} catch (e) {
|
|
360
|
-
return ["GET", "POST"];
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
* Extract :param names from a path like /users/:id/posts/:postId
|
|
366
|
-
*/
|
|
367
|
-
function extractPathParams(routePath) {
|
|
368
|
-
const params = [];
|
|
369
|
-
const matches = routePath.match(/:([a-zA-Z_][a-zA-Z0-9_]*)/g);
|
|
370
|
-
if (matches) {
|
|
371
|
-
matches.forEach(function (m) {
|
|
372
|
-
params.push(m.replace(":", ""));
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
|
-
return params;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
/**
|
|
379
|
-
* Build a simple schema object from param names
|
|
380
|
-
*/
|
|
381
|
-
function buildParamSchema(params) {
|
|
382
|
-
const schema = {};
|
|
383
|
-
params.forEach(function (p) {
|
|
384
|
-
schema[p] = "string";
|
|
385
|
-
});
|
|
386
|
-
return schema;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
function inferFieldType(fieldName, content) {
|
|
390
|
-
const arrayPatterns = [
|
|
391
|
-
new RegExp(
|
|
392
|
-
`${fieldName}\\s*\\.\\s*(map|filter|forEach|push|reduce|find|some|every|includes|join|slice|splice|length)\\b`,
|
|
393
|
-
),
|
|
394
|
-
new RegExp(`Array\\.isArray\\s*\\(\\s*${fieldName}\\s*\\)`),
|
|
395
|
-
new RegExp(`for\\s*\\(.*of\\s+${fieldName}\\b`),
|
|
396
|
-
new RegExp(`\\[\\s*\\.\\.\\.${fieldName}\\s*\\]`),
|
|
397
|
-
];
|
|
398
|
-
if (arrayPatterns.some((p) => p.test(content))) return "array";
|
|
399
|
-
|
|
400
|
-
const numberPatterns = [
|
|
401
|
-
new RegExp(`${fieldName}\\s*[+\\-*/%]\\s*\\d`),
|
|
402
|
-
new RegExp(`parseInt\\s*\\(\\s*${fieldName}`),
|
|
403
|
-
new RegExp(`parseFloat\\s*\\(\\s*${fieldName}`),
|
|
404
|
-
new RegExp(`Number\\s*\\(\\s*${fieldName}`),
|
|
405
|
-
];
|
|
406
|
-
if (numberPatterns.some((p) => p.test(content))) return "number";
|
|
407
|
-
|
|
408
|
-
const boolPatterns = [
|
|
409
|
-
new RegExp(`${fieldName}\\s*===?\\s*(true|false)`),
|
|
410
|
-
new RegExp(`(true|false)\\s*===?\\s*${fieldName}`),
|
|
411
|
-
new RegExp(`Boolean\\s*\\(\\s*${fieldName}`),
|
|
412
|
-
new RegExp(`typeof\\s+${fieldName}\\s*!==?\\s*["']boolean["']`),
|
|
413
|
-
new RegExp(`typeof\\s+${fieldName}\\s*===?\\s*["']boolean["']`),
|
|
414
|
-
];
|
|
415
|
-
if (boolPatterns.some((p) => p.test(content))) return "boolean";
|
|
416
|
-
|
|
417
|
-
return "string";
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
function extractBodyFieldsFromFile(content) {
|
|
421
|
-
const fields = new Set();
|
|
422
|
-
|
|
423
|
-
// Pattern 1
|
|
424
|
-
const destructureMatches = content.matchAll(
|
|
425
|
-
/const\s*\{([^}]+)\}\s*=\s*req\.body/g,
|
|
426
|
-
);
|
|
427
|
-
for (const destructureMatch of destructureMatches) {
|
|
428
|
-
destructureMatch[1].split(",").forEach(function (f) {
|
|
429
|
-
const clean = f.trim().split(":")[0].trim();
|
|
430
|
-
if (clean) fields.add(clean);
|
|
431
|
-
});
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
// Pattern 2
|
|
435
|
-
const dotMatches = content.matchAll(/req\.body\.([a-zA-Z_][a-zA-Z0-9_]*)/g);
|
|
436
|
-
for (const match of dotMatches) {
|
|
437
|
-
fields.add(match[1]);
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
// Pattern 3
|
|
441
|
-
const bodyDotMatches = content.matchAll(/body\.([a-zA-Z_][a-zA-Z0-9_]*)/g);
|
|
442
|
-
for (const match of bodyDotMatches) {
|
|
443
|
-
fields.add(match[1]);
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
// Pattern 4 — only if variable name is clearly body-related
|
|
447
|
-
const bodyVarMatch = content.match(/const\s+(\w+)\s*=\s*req\.body/);
|
|
448
|
-
if (bodyVarMatch) {
|
|
449
|
-
const varName = bodyVarMatch[1];
|
|
450
|
-
const isSafeVarName =
|
|
451
|
-
/^(body|payload|input|data|requestBody|reqBody|bodyData)$/.test(varName);
|
|
452
|
-
if (isSafeVarName) {
|
|
453
|
-
const varMatches = content.matchAll(
|
|
454
|
-
new RegExp(`${varName}\\.([a-zA-Z_][a-zA-Z0-9_]*)`, "g"),
|
|
455
|
-
);
|
|
456
|
-
for (const match of varMatches) {
|
|
457
|
-
fields.add(match[1]);
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
// Pattern 5 — optional chaining req.body?.name
|
|
463
|
-
const optionalMatches = content.matchAll(
|
|
464
|
-
/req\.body\?\.([a-zA-Z_][a-zA-Z0-9_]*)/g,
|
|
465
|
-
);
|
|
466
|
-
for (const match of optionalMatches) {
|
|
467
|
-
fields.add(match[1]);
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
if (fields.size === 0) return null;
|
|
471
|
-
|
|
472
|
-
const properties = {};
|
|
473
|
-
fields.forEach(function (field) {
|
|
474
|
-
const type = inferFieldType(field, content);
|
|
475
|
-
properties[field] =
|
|
476
|
-
type === "array"
|
|
477
|
-
? { type: "array", items: { type: "object" } }
|
|
478
|
-
: { type };
|
|
479
|
-
});
|
|
480
|
-
|
|
481
|
-
return { type: "object", properties };
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
// Reads field names from multipart/file-upload handlers (formData, multer, formidable).
|
|
485
|
-
// Returns null when the file is not an upload handler, so other routes are unaffected.
|
|
486
|
-
function extractMultipartFieldsFromFile(content) {
|
|
487
|
-
const text = String(content || "");
|
|
488
|
-
const usesFormData =
|
|
489
|
-
/formData\s*\(|readFormData\s*\(|parseMultipartFormData\s*\(/.test(text);
|
|
490
|
-
const usesMulter = /multer|upload\.(single|array|fields|any)\s*\(/.test(text);
|
|
491
|
-
const usesFormidable = /formidable|koa-?body/i.test(text);
|
|
492
|
-
// NestJS interceptors, AdonisJS request.file("x"), Nuxt readMultipartFormData, Hapi multipart payloads
|
|
493
|
-
const usesNest =
|
|
494
|
-
/\b(?:FileInterceptor|FilesInterceptor|FileFieldsInterceptor|AnyFilesInterceptor)\s*\(/.test(
|
|
495
|
-
text,
|
|
496
|
-
);
|
|
497
|
-
const usesRequestFile = /\brequest\.(?:file|files)\s*\(\s*['"`]/.test(text);
|
|
498
|
-
const usesNuxtParts = /readMultipartFormData\s*\(/.test(text);
|
|
499
|
-
const usesHapiPayload = /\bmultipart\s*:\s*(?:true|\{)/.test(text);
|
|
500
|
-
const usesOtherUpload =
|
|
501
|
-
usesNest || usesRequestFile || usesNuxtParts || usesHapiPayload;
|
|
502
|
-
if (!usesFormData && !usesMulter && !usesFormidable && !usesOtherUpload)
|
|
503
|
-
return null;
|
|
504
|
-
|
|
505
|
-
const fields = {}; // name -> "file" | "string"
|
|
506
|
-
|
|
507
|
-
if (usesFormData) {
|
|
508
|
-
// Only read .get() calls on the variable that holds the parsed form,
|
|
509
|
-
// so headers.get(...) / searchParams.get(...) are never mistaken for form fields
|
|
510
|
-
const formVars = [];
|
|
511
|
-
for (const fv of text.matchAll(
|
|
512
|
-
/(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(?:await\s+)?(?:[\w$.]+\.formData|readFormData|(?:unstable_)?parseMultipartFormData)\s*\(/g,
|
|
513
|
-
)) {
|
|
514
|
-
formVars.push(fv[1]);
|
|
515
|
-
}
|
|
516
|
-
const readFormGet = function (m) {
|
|
517
|
-
const varName = m[1];
|
|
518
|
-
const fieldName = m[2];
|
|
519
|
-
let kind = "string";
|
|
520
|
-
if (varName) {
|
|
521
|
-
const fileUse = new RegExp(
|
|
522
|
-
"\\b" +
|
|
523
|
-
varName +
|
|
524
|
-
"\\b\\s*(?:as\\s+File|instanceof\\s+File|\\.(?:arrayBuffer|stream|size|type|name)\\b)|instanceof\\s+File",
|
|
525
|
-
);
|
|
526
|
-
if (fileUse.test(text)) kind = "file";
|
|
527
|
-
}
|
|
528
|
-
if (fields[fieldName] !== "file") fields[fieldName] = kind;
|
|
529
|
-
};
|
|
530
|
-
formVars.forEach(function (formVar) {
|
|
531
|
-
const safeVar = formVar.replace(/\$/g, "\\$");
|
|
532
|
-
const getRe = new RegExp(
|
|
533
|
-
"(?:(?:const|let|var)\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*)?\\b" +
|
|
534
|
-
safeVar +
|
|
535
|
-
"\\s*\\.(?:get|getAll)\\s*\\(\\s*['\"`]([^'\"`]+)['\"`]\\s*\\)",
|
|
536
|
-
"g",
|
|
537
|
-
);
|
|
538
|
-
for (const m of text.matchAll(getRe)) readFormGet(m);
|
|
539
|
-
});
|
|
540
|
-
// Inline form: (await request.formData()).get("file")
|
|
541
|
-
const inlineRe =
|
|
542
|
-
/(?:(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*)?\(\s*await\s+[\w$.]+\.formData\s*\(\s*\)\s*\)\s*\.(?:get|getAll)\s*\(\s*['"`]([^'"`]+)['"`]\s*\)/g;
|
|
543
|
-
for (const m of text.matchAll(inlineRe)) readFormGet(m);
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
if (usesMulter) {
|
|
547
|
-
// upload.single("file") / upload.array("files")
|
|
548
|
-
for (const m of text.matchAll(
|
|
549
|
-
/\.(?:single|array)\s*\(\s*['"`]([^'"`]+)['"`]/g,
|
|
550
|
-
)) {
|
|
551
|
-
fields[m[1]] = "file";
|
|
552
|
-
}
|
|
553
|
-
// upload.fields([{ name: "avatar" }, { name: "docs" }])
|
|
554
|
-
for (const block of text.matchAll(/\.fields\s*\(\s*\[([\s\S]*?)\]\s*\)/g)) {
|
|
555
|
-
for (const n of block[1].matchAll(/name\s*:\s*['"`]([^'"`]+)['"`]/g)) {
|
|
556
|
-
fields[n[1]] = "file";
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
if (usesFormidable) {
|
|
562
|
-
// files.file / files["file"] and fields.title / fields["title"]
|
|
563
|
-
for (const m of text.matchAll(
|
|
564
|
-
/\bfiles(?:\?\.|\.)([A-Za-z_$][\w$]*)|\bfiles\s*\[\s*['"`]([^'"`]+)['"`]\s*\]/g,
|
|
565
|
-
)) {
|
|
566
|
-
fields[m[1] || m[2]] = "file";
|
|
567
|
-
}
|
|
568
|
-
for (const m of text.matchAll(
|
|
569
|
-
/\bfields(?:\?\.|\.)([A-Za-z_$][\w$]*)|\bfields\s*\[\s*['"`]([^'"`]+)['"`]\s*\]/g,
|
|
570
|
-
)) {
|
|
571
|
-
const name = m[1] || m[2];
|
|
572
|
-
if (!fields[name]) fields[name] = "string";
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
if (usesNest) {
|
|
577
|
-
// @UseInterceptors(FileInterceptor("file")) / FilesInterceptor("files")
|
|
578
|
-
for (const m of text.matchAll(
|
|
579
|
-
/\b(?:FileInterceptor|FilesInterceptor)\s*\(\s*['"`]([^'"`]+)['"`]/g,
|
|
580
|
-
)) {
|
|
581
|
-
fields[m[1]] = "file";
|
|
582
|
-
}
|
|
583
|
-
// FileFieldsInterceptor([{ name: "avatar" }, { name: "docs" }])
|
|
584
|
-
for (const block of text.matchAll(
|
|
585
|
-
/\bFileFieldsInterceptor\s*\(\s*\[([\s\S]*?)\]/g,
|
|
586
|
-
)) {
|
|
587
|
-
for (const n of block[1].matchAll(/name\s*:\s*['"`]([^'"`]+)['"`]/g)) {
|
|
588
|
-
fields[n[1]] = "file";
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
if (usesRequestFile) {
|
|
594
|
-
// request.file("avatar") / request.files("docs")
|
|
595
|
-
for (const m of text.matchAll(
|
|
596
|
-
/\brequest\.(?:file|files)\s*\(\s*['"`]([^'"`]+)['"`]/g,
|
|
597
|
-
)) {
|
|
598
|
-
fields[m[1]] = "file";
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
if (usesNuxtParts) {
|
|
603
|
-
// readMultipartFormData(event) -> parts.find((p) => p.name === "file")
|
|
604
|
-
for (const m of text.matchAll(
|
|
605
|
-
/(?:(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*)?[^\n;]*?\.name\s*===?\s*['"`]([^'"`]+)['"`]/g,
|
|
606
|
-
)) {
|
|
607
|
-
let kind = "string";
|
|
608
|
-
if (m[1]) {
|
|
609
|
-
const safeVar = m[1].replace(/\$/g, "\\$");
|
|
610
|
-
const fileUse = new RegExp(
|
|
611
|
-
"\\b" + safeVar + "\\b\\s*(?:\\?\\.|\\.)\\s*(?:filename|type)\\b",
|
|
612
|
-
);
|
|
613
|
-
if (fileUse.test(text)) kind = "file";
|
|
614
|
-
}
|
|
615
|
-
if (fields[m[2]] !== "file") fields[m[2]] = kind;
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
if (usesHapiPayload) {
|
|
620
|
-
// request.payload.file / const { file, title } = request.payload
|
|
621
|
-
const addHapiField = function (name) {
|
|
622
|
-
if (!/^[A-Za-z_$][\w$]*$/.test(name) || fields[name]) return;
|
|
623
|
-
const safeName = name.replace(/\$/g, "\\$");
|
|
624
|
-
const fileLike = new RegExp(
|
|
625
|
-
"\\b" + safeName + "\\b\\s*(?:\\?\\.|\\.)\\s*(?:hapi|_data|pipe)\\b",
|
|
626
|
-
).test(text);
|
|
627
|
-
fields[name] = fileLike ? "file" : "string";
|
|
628
|
-
};
|
|
629
|
-
for (const m of text.matchAll(/\bpayload(?:\?\.|\.)([A-Za-z_$][\w$]*)/g)) {
|
|
630
|
-
addHapiField(m[1]);
|
|
631
|
-
}
|
|
632
|
-
for (const d of text.matchAll(/\{([^}]+)\}\s*=\s*[\w$.]*\bpayload\b/g)) {
|
|
633
|
-
d[1].split(",").forEach(function (f) {
|
|
634
|
-
addHapiField(f.trim().split(":")[0].split("=")[0].trim());
|
|
635
|
-
});
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
const names = Object.keys(fields);
|
|
640
|
-
if (names.length === 0) return null;
|
|
641
|
-
|
|
642
|
-
const properties = {};
|
|
643
|
-
names.forEach(function (n) {
|
|
644
|
-
properties[n] =
|
|
645
|
-
fields[n] === "file"
|
|
646
|
-
? { type: "string", format: "binary" }
|
|
647
|
-
: { type: "string" };
|
|
648
|
-
});
|
|
649
|
-
return {
|
|
650
|
-
type: "object",
|
|
651
|
-
properties: properties,
|
|
652
|
-
"x-content-type": "multipart/form-data",
|
|
653
|
-
};
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
// Start of any Fastify route definition, used to cut a file into per-route pieces
|
|
657
|
-
const FASTIFY_ROUTE_START =
|
|
658
|
-
"(?:fastify|app|server|router)\\.(?:get|post|put|delete|patch|route)\\s*\\(";
|
|
659
|
-
|
|
660
|
-
// Combines text fields read from req.body with file fields from the upload parser
|
|
661
|
-
function mergeBodyWithMultipart(bodyFields, multipartFields) {
|
|
662
|
-
if (!multipartFields) return bodyFields;
|
|
663
|
-
if (!bodyFields) return multipartFields;
|
|
664
|
-
return {
|
|
665
|
-
type: "object",
|
|
666
|
-
properties: Object.assign(
|
|
667
|
-
{},
|
|
668
|
-
bodyFields.properties,
|
|
669
|
-
multipartFields.properties,
|
|
670
|
-
),
|
|
671
|
-
"x-content-type": "multipart/form-data",
|
|
672
|
-
};
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
function scanNextJsAppRoutes(appDir) {
|
|
676
|
-
const fs = require("fs");
|
|
677
|
-
const path = require("path");
|
|
678
|
-
const endpoints = [];
|
|
679
|
-
|
|
680
|
-
const apiDir = path.join(appDir, "api");
|
|
681
|
-
if (!fs.existsSync(apiDir)) {
|
|
682
|
-
return endpoints;
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
function walkDir(dir, routePath) {
|
|
686
|
-
routePath = routePath || "/api";
|
|
687
|
-
const files = fs.readdirSync(dir);
|
|
688
|
-
|
|
689
|
-
files.forEach(function (file) {
|
|
690
|
-
const fullPath = path.join(dir, file);
|
|
691
|
-
const stat = fs.statSync(fullPath);
|
|
692
|
-
|
|
693
|
-
if (stat.isDirectory()) {
|
|
694
|
-
// Convert [param] → :param
|
|
695
|
-
const segment = file.replace(/\[([^\]]+)\]/g, ":$1");
|
|
696
|
-
walkDir(fullPath, routePath + "/" + segment);
|
|
697
|
-
return;
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
// Only process route.ts / route.js
|
|
701
|
-
if (!/^route\.(js|ts)$/.test(file)) return;
|
|
702
|
-
|
|
703
|
-
const content = fs.readFileSync(fullPath, "utf8");
|
|
704
|
-
const methods = detectAppRouterMethods(content);
|
|
705
|
-
|
|
706
|
-
methods.forEach(function (method) {
|
|
707
|
-
// In files that handle several methods, read only this method's own code
|
|
708
|
-
// (the whole file is used when the methods cannot be told apart)
|
|
709
|
-
const methodCode =
|
|
710
|
-
getMethodSegment(content, method, methods, "app") || content;
|
|
711
|
-
// Body methods fall back to the whole file if their own code has no fields
|
|
712
|
-
const bodyFields =
|
|
713
|
-
method === "GET"
|
|
714
|
-
? null
|
|
715
|
-
: extractAppRouterBodyFields(methodCode) ||
|
|
716
|
-
(method !== "DELETE"
|
|
717
|
-
? extractAppRouterBodyFields(content)
|
|
718
|
-
: null);
|
|
719
|
-
const queryFields = extractQueryFieldsFromFile(methodCode);
|
|
720
|
-
const multipartFields =
|
|
721
|
-
method !== "GET" && method !== "DELETE"
|
|
722
|
-
? extractMultipartFieldsFromFile(methodCode) ||
|
|
723
|
-
extractMultipartFieldsFromFile(content)
|
|
724
|
-
: null;
|
|
725
|
-
|
|
726
|
-
const routeParamMap = buildRouteParamMap(routePath, []);
|
|
727
|
-
|
|
728
|
-
endpoints.push({
|
|
729
|
-
method: method,
|
|
730
|
-
path: routePath,
|
|
731
|
-
description: "",
|
|
732
|
-
requestBody:
|
|
733
|
-
mergeBodyWithMultipart(bodyFields, multipartFields) ||
|
|
734
|
-
(method === "DELETE" && queryFields ? queryFields : null) ||
|
|
735
|
-
(method === "GET"
|
|
736
|
-
? removePathParamFields(
|
|
737
|
-
extractQueryFieldsFromFile(
|
|
738
|
-
getMethodSegment(content, "GET", methods, "app") || "",
|
|
739
|
-
),
|
|
740
|
-
routePath,
|
|
741
|
-
)
|
|
742
|
-
: null),
|
|
743
|
-
responseBody: extractResponseFieldsForMethod(
|
|
744
|
-
content,
|
|
745
|
-
method,
|
|
746
|
-
methods,
|
|
747
|
-
"app",
|
|
748
|
-
),
|
|
749
|
-
routeParamMap: routeParamMap,
|
|
750
|
-
detectedBy: "static-scan",
|
|
751
|
-
});
|
|
752
|
-
});
|
|
753
|
-
});
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
walkDir(apiDir);
|
|
757
|
-
return endpoints;
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
// Reads every common way a route file exports its HTTP handlers (function, const, re-export, destructured)
|
|
761
|
-
function detectAppRouterMethods(content) {
|
|
762
|
-
const HTTP_METHODS = ["GET", "POST", "PUT", "DELETE", "PATCH"];
|
|
763
|
-
const methods = HTTP_METHODS.filter(function (m) {
|
|
764
|
-
return [
|
|
765
|
-
new RegExp("export\\s+(?:async\\s+)?function\\s+" + m + "\\b"),
|
|
766
|
-
new RegExp("export\\s+(?:const|let|var)\\s+" + m + "\\b"),
|
|
767
|
-
new RegExp("export\\s*\\{[^}]*\\b" + m + "\\b[^}]*\\}"),
|
|
768
|
-
new RegExp(
|
|
769
|
-
"export\\s+(?:const|let|var)\\s*\\{[^}]*\\b" + m + "\\b[^}]*\\}",
|
|
770
|
-
),
|
|
771
|
-
].some(function (re) {
|
|
772
|
-
return re.test(content);
|
|
773
|
-
});
|
|
774
|
-
});
|
|
775
|
-
return methods.length > 0 ? methods : ["GET"];
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
function extractAppRouterBodyFields(content) {
|
|
779
|
-
const fields = new Set();
|
|
780
|
-
|
|
781
|
-
// Pattern 1: const { userId, tokens } = await request.json()
|
|
782
|
-
const destructureMatches = content.matchAll(
|
|
783
|
-
/const\s*\{([^}]+)\}\s*=\s*await\s+\w+\.json\(\)/g,
|
|
784
|
-
);
|
|
785
|
-
for (const match of destructureMatches) {
|
|
786
|
-
match[1].split(",").forEach(function (f) {
|
|
787
|
-
const clean = f.trim().split(":")[0].trim();
|
|
788
|
-
if (clean) fields.add(clean);
|
|
789
|
-
});
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
// Pattern 2: const body = await request.json() then body.userId
|
|
793
|
-
const bodyVarMatch = content.match(
|
|
794
|
-
/const\s+(\w+)\s*=\s*await\s+\w+\.json\(\)/,
|
|
795
|
-
);
|
|
796
|
-
if (bodyVarMatch) {
|
|
797
|
-
const varName = bodyVarMatch[1];
|
|
798
|
-
const varMatches = content.matchAll(
|
|
799
|
-
new RegExp(`${varName}\\.([a-zA-Z_][a-zA-Z0-9_]*)`, "g"),
|
|
800
|
-
);
|
|
801
|
-
for (const match of varMatches) {
|
|
802
|
-
fields.add(match[1]);
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
|
|
806
|
-
// Pattern 3: (await request.json()).userId
|
|
807
|
-
const inlineMatches = content.matchAll(
|
|
808
|
-
/\(await\s+\w+\.json\(\)\)\.([a-zA-Z_][a-zA-Z0-9_]*)/g,
|
|
809
|
-
);
|
|
810
|
-
for (const match of inlineMatches) {
|
|
811
|
-
fields.add(match[1]);
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
if (fields.size === 0) return null;
|
|
815
|
-
|
|
816
|
-
const properties = {};
|
|
817
|
-
fields.forEach(function (field) {
|
|
818
|
-
const type = inferFieldType(field, content);
|
|
819
|
-
properties[field] =
|
|
820
|
-
type === "array"
|
|
821
|
-
? { type: "array", items: { type: "object" } }
|
|
822
|
-
: { type };
|
|
823
|
-
});
|
|
824
|
-
|
|
825
|
-
return { type: "object", properties };
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
function buildRouteParamMap(routePath, segments) {
|
|
829
|
-
const paramMap = {};
|
|
830
|
-
const parts = routePath.split("/").filter(Boolean);
|
|
831
|
-
|
|
832
|
-
for (let i = 0; i < parts.length; i++) {
|
|
833
|
-
const part = parts[i];
|
|
834
|
-
|
|
835
|
-
// Skip catch-all [...slug] and optional [[...slug]]
|
|
836
|
-
if (/^\[?\[\.\.\./.test(part)) continue;
|
|
837
|
-
|
|
838
|
-
// Check if this segment is a dynamic param
|
|
839
|
-
// Handles both Next.js style [id] and Express style :id
|
|
840
|
-
const nextParamMatch = part.match(/^\[([^\]]+)\]$/);
|
|
841
|
-
const expressParamMatch = part.match(/^:([a-zA-Z_][a-zA-Z0-9_]*)$/);
|
|
842
|
-
const paramMatch = nextParamMatch || expressParamMatch;
|
|
843
|
-
if (!paramMatch) continue;
|
|
844
|
-
|
|
845
|
-
const paramName = paramMatch[1];
|
|
846
|
-
|
|
847
|
-
// If param already has a descriptive name like [projectId], use it as-is
|
|
848
|
-
if (paramName !== "id" && paramName !== "slug" && paramName !== "param") {
|
|
849
|
-
paramMap[paramName] = paramName;
|
|
850
|
-
continue;
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
// If param is just [id], look at the parent folder name to figure out type
|
|
854
|
-
// e.g. projects/[id] → projectId
|
|
855
|
-
const parentSegment = parts[i - 1];
|
|
856
|
-
if (parentSegment) {
|
|
857
|
-
// Remove any dynamic brackets from parent if it's also a param
|
|
858
|
-
const cleanParent = parentSegment.replace(/^\[([^\]]+)\]$/, "$1");
|
|
859
|
-
// Singularize simple plural names: projects → project, users → user
|
|
860
|
-
const singular = cleanParent.replace(/ies$/, "y").replace(/s$/, "");
|
|
861
|
-
paramMap[paramName] = singular + "Id";
|
|
862
|
-
} else {
|
|
863
|
-
// No parent segment, just call it "id"
|
|
864
|
-
paramMap[paramName] = "id";
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
return paramMap;
|
|
869
|
-
}
|
|
870
|
-
|
|
871
|
-
function extractQueryFieldsFromFile(content) {
|
|
872
|
-
const fields = new Set();
|
|
873
|
-
const NAME = /^[A-Za-z_$][\w$.-]*$/;
|
|
874
|
-
const addField = function (raw) {
|
|
875
|
-
const name = String(raw).trim().split(":")[0].split("=")[0].trim();
|
|
876
|
-
if (name && NAME.test(name)) fields.add(name);
|
|
877
|
-
};
|
|
878
|
-
|
|
879
|
-
// const { id, page = 1 } = req.query
|
|
880
|
-
const destructureRe =
|
|
881
|
-
/(?:const|let|var)\s*\{([^}]+)\}\s*=\s*(?:await\s+)?(?:req|request|ctx(?:\.request)?)\.query\b/g;
|
|
882
|
-
for (const m of String(content).matchAll(destructureRe)) {
|
|
883
|
-
m[1].split(",").forEach(addField);
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
// req.query.id / req.query?.id
|
|
887
|
-
const dotRe =
|
|
888
|
-
/(?:req|request|ctx(?:\.request)?)\.query(?:\?\.|\.)([A-Za-z_$][\w$]*)/g;
|
|
889
|
-
for (const m of String(content).matchAll(dotRe)) addField(m[1]);
|
|
890
|
-
|
|
891
|
-
// req.query["id"]
|
|
892
|
-
const bracketRe =
|
|
893
|
-
/(?:req|request|ctx(?:\.request)?)\.query\s*\??\.?\[\s*['"`]([^'"`]+)['"`]\s*\]/g;
|
|
894
|
-
for (const m of String(content).matchAll(bracketRe)) addField(m[1]);
|
|
895
|
-
|
|
896
|
-
// url.searchParams.get("id") / nextUrl.searchParams.get("id")
|
|
897
|
-
const searchParamsRe =
|
|
898
|
-
/searchParams\s*\??\.\s*(?:get|getAll|has)\s*\(\s*['"`]([^'"`]+)['"`]/g;
|
|
899
|
-
for (const m of String(content).matchAll(searchParamsRe)) addField(m[1]);
|
|
900
|
-
|
|
901
|
-
if (fields.size === 0) return null;
|
|
902
|
-
|
|
903
|
-
const properties = {};
|
|
904
|
-
fields.forEach(function (field) {
|
|
905
|
-
properties[field] = { type: "string" };
|
|
906
|
-
});
|
|
907
|
-
|
|
908
|
-
return { type: "object", properties };
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
// Drops fields that are really path params (Next.js Pages puts [id] into req.query too)
|
|
912
|
-
function removePathParamFields(schema, routePath) {
|
|
913
|
-
if (!schema || !schema.properties) return null;
|
|
914
|
-
const pathParams = new Set(extractPathParams(routePath));
|
|
915
|
-
const properties = {};
|
|
916
|
-
Object.keys(schema.properties).forEach(function (k) {
|
|
917
|
-
if (!pathParams.has(k)) properties[k] = schema.properties[k];
|
|
918
|
-
});
|
|
919
|
-
return Object.keys(properties).length > 0
|
|
920
|
-
? { type: "object", properties }
|
|
921
|
-
: null;
|
|
922
|
-
}
|
|
923
|
-
|
|
924
|
-
// Returns only the code belonging to one HTTP method in a multi-method file.
|
|
925
|
-
// Returns null when it cannot be told apart, so no guess is made.
|
|
926
|
-
function getMethodSegment(content, method, allMethods, style) {
|
|
927
|
-
if (!allMethods || allMethods.length < 2) return content;
|
|
928
|
-
const markers = [];
|
|
929
|
-
allMethods.forEach(function (m) {
|
|
930
|
-
const index = findStaticMethodMarkerIndex(content, style, m);
|
|
931
|
-
if (index !== -1) markers.push({ method: m, index: index });
|
|
932
|
-
});
|
|
933
|
-
const own = markers.find(function (x) {
|
|
934
|
-
return x.method === method;
|
|
935
|
-
});
|
|
936
|
-
if (!own) return null;
|
|
937
|
-
if (style === "app") {
|
|
938
|
-
const handlerCode = findStaticHandlerCode(content, own.index);
|
|
939
|
-
if (handlerCode) return handlerCode;
|
|
940
|
-
}
|
|
941
|
-
markers.sort(function (a, b) {
|
|
942
|
-
return a.index - b.index;
|
|
943
|
-
});
|
|
944
|
-
const pos = markers.indexOf(own);
|
|
945
|
-
const end =
|
|
946
|
-
pos + 1 < markers.length ? markers[pos + 1].index : content.length;
|
|
947
|
-
return content.slice(own.index, end);
|
|
948
|
-
}
|
|
949
|
-
|
|
950
|
-
// The code from one route definition (app.get(...), router.get(...)) up to the next one
|
|
951
|
-
function sliceRouteSegment(content, startIndex, routePatternSource) {
|
|
952
|
-
try {
|
|
953
|
-
const re = new RegExp(routePatternSource, "gi");
|
|
954
|
-
let end = content.length;
|
|
955
|
-
let hit;
|
|
956
|
-
while ((hit = re.exec(content)) !== null) {
|
|
957
|
-
if (hit.index > startIndex) {
|
|
958
|
-
end = hit.index;
|
|
959
|
-
break;
|
|
960
|
-
}
|
|
961
|
-
}
|
|
962
|
-
return content.slice(startIndex, end);
|
|
963
|
-
} catch (e) {
|
|
964
|
-
return "";
|
|
965
|
-
}
|
|
966
|
-
}
|
|
967
|
-
|
|
968
|
-
// For live Express routes: reads query fields from every handler's source code
|
|
969
|
-
function extractQueryFieldsFromHandlers(stack) {
|
|
970
|
-
try {
|
|
971
|
-
const merged = {};
|
|
972
|
-
for (const layer of stack) {
|
|
973
|
-
const fn = layer.handle || layer;
|
|
974
|
-
if (typeof fn !== "function") continue;
|
|
975
|
-
const fields = extractQueryFieldsFromFile(
|
|
976
|
-
Function.prototype.toString.call(fn),
|
|
977
|
-
);
|
|
978
|
-
if (fields) Object.assign(merged, fields.properties);
|
|
979
|
-
}
|
|
980
|
-
return Object.keys(merged).length > 0
|
|
981
|
-
? { type: "object", properties: merged }
|
|
982
|
-
: null;
|
|
983
|
-
} catch (e) {
|
|
984
|
-
return null;
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
|
|
988
|
-
/**
|
|
989
|
-
* Convert Express regexp back to a mount path string
|
|
990
|
-
* Used for nested routers (app.use('/api', router))
|
|
991
|
-
*/
|
|
992
|
-
function regexpToPath(regexp, keys) {
|
|
993
|
-
if (!regexp) return "";
|
|
994
|
-
|
|
995
|
-
// Express 4.x stores the original path string directly
|
|
996
|
-
if (regexp.source === "^\\/?(?=\\/|$)") return "";
|
|
997
|
-
|
|
998
|
-
try {
|
|
999
|
-
var src = regexp.source;
|
|
1000
|
-
|
|
1001
|
-
// Remove anchors and cleanup
|
|
1002
|
-
src = src
|
|
1003
|
-
.replace(/^\^/, "")
|
|
1004
|
-
.replace(/\\\//g, "/")
|
|
1005
|
-
.replace(/\/\?\(\?=\/\|\$\)$/, "")
|
|
1006
|
-
.replace(/\/\?\$?$/, "")
|
|
1007
|
-
.replace(/\(\?:\(\[\^\/\]\+\?\)\)/g, function (_, i) {
|
|
1008
|
-
return keys && keys[i] ? ":" + keys[i].name : ":param";
|
|
1009
|
-
});
|
|
1010
|
-
|
|
1011
|
-
// Clean up any remaining regex artifacts
|
|
1012
|
-
src = src.replace(/\(\?:/g, "").replace(/\)/g, "");
|
|
1013
|
-
|
|
1014
|
-
if (!src || src === "/") return "";
|
|
1015
|
-
if (!src.startsWith("/")) src = "/" + src;
|
|
1016
|
-
|
|
1017
|
-
return src;
|
|
1018
|
-
} catch (e) {
|
|
1019
|
-
return "";
|
|
1020
|
-
}
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
|
-
function scanAllExpressFiles(cwd) {
|
|
1024
|
-
const fs = require("fs");
|
|
1025
|
-
const path = require("path");
|
|
1026
|
-
|
|
1027
|
-
const SKIP_DIRS = [
|
|
1028
|
-
"node_modules",
|
|
1029
|
-
".git",
|
|
1030
|
-
".next",
|
|
1031
|
-
"dist",
|
|
1032
|
-
"build",
|
|
1033
|
-
".cache",
|
|
1034
|
-
"coverage",
|
|
1035
|
-
"out",
|
|
1036
|
-
];
|
|
1037
|
-
|
|
1038
|
-
const routeFiles = [];
|
|
1039
|
-
|
|
1040
|
-
function walk(dir, depth) {
|
|
1041
|
-
if (depth > 4) return;
|
|
1042
|
-
|
|
1043
|
-
let entries;
|
|
1044
|
-
try {
|
|
1045
|
-
entries = fs.readdirSync(dir);
|
|
1046
|
-
} catch {
|
|
1047
|
-
return;
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
|
-
for (const entry of entries) {
|
|
1051
|
-
if (SKIP_DIRS.includes(entry)) continue;
|
|
1052
|
-
|
|
1053
|
-
const fullPath = path.join(dir, entry);
|
|
1054
|
-
let stat;
|
|
1055
|
-
try {
|
|
1056
|
-
stat = fs.statSync(fullPath);
|
|
1057
|
-
} catch {
|
|
1058
|
-
continue;
|
|
1059
|
-
}
|
|
1060
|
-
|
|
1061
|
-
if (stat.isDirectory()) {
|
|
1062
|
-
walk(fullPath, depth + 1);
|
|
1063
|
-
} else if (/\.(js|ts)$/.test(entry)) {
|
|
1064
|
-
try {
|
|
1065
|
-
const content = fs.readFileSync(fullPath, "utf8");
|
|
1066
|
-
// Check if file contains Express route definitions
|
|
1067
|
-
const isExpressFile =
|
|
1068
|
-
content.includes("express()") ||
|
|
1069
|
-
content.includes("express.Router()") ||
|
|
1070
|
-
content.includes("Router()") ||
|
|
1071
|
-
// Match only route-like patterns: app.get('/...) or router.post('/...)
|
|
1072
|
-
/(?:app|router|server)\.(get|post|put|delete|patch|all)\s*\(\s*['"`]\//.test(
|
|
1073
|
-
content,
|
|
1074
|
-
);
|
|
1075
|
-
|
|
1076
|
-
if (isExpressFile) {
|
|
1077
|
-
routeFiles.push(fullPath);
|
|
1078
|
-
}
|
|
1079
|
-
} catch {
|
|
1080
|
-
continue;
|
|
1081
|
-
}
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
}
|
|
1085
|
-
|
|
1086
|
-
walk(cwd, 0);
|
|
1087
|
-
return routeFiles;
|
|
1088
|
-
}
|
|
1089
|
-
|
|
1090
|
-
function buildBodyMap(cwd) {
|
|
1091
|
-
const fs = require("fs");
|
|
1092
|
-
const path = require("path");
|
|
1093
|
-
const bodyMap = {}; // { functionName: { type: "object", properties: {...} } }
|
|
1094
|
-
|
|
1095
|
-
const SKIP_DIRS = [
|
|
1096
|
-
"node_modules",
|
|
1097
|
-
".git",
|
|
1098
|
-
".next",
|
|
1099
|
-
"dist",
|
|
1100
|
-
"build",
|
|
1101
|
-
".cache",
|
|
1102
|
-
"coverage",
|
|
1103
|
-
"out",
|
|
1104
|
-
];
|
|
1105
|
-
|
|
1106
|
-
function walk(dir, depth) {
|
|
1107
|
-
if (depth > 4) return;
|
|
1108
|
-
let entries;
|
|
1109
|
-
try {
|
|
1110
|
-
entries = fs.readdirSync(dir);
|
|
1111
|
-
} catch {
|
|
1112
|
-
return;
|
|
1113
|
-
}
|
|
1114
|
-
|
|
1115
|
-
for (const entry of entries) {
|
|
1116
|
-
if (SKIP_DIRS.includes(entry)) continue;
|
|
1117
|
-
const fullPath = path.join(dir, entry);
|
|
1118
|
-
let stat;
|
|
1119
|
-
try {
|
|
1120
|
-
stat = fs.statSync(fullPath);
|
|
1121
|
-
} catch {
|
|
1122
|
-
continue;
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
if (stat.isDirectory()) {
|
|
1126
|
-
walk(fullPath, depth + 1);
|
|
1127
|
-
continue;
|
|
1128
|
-
}
|
|
1129
|
-
|
|
1130
|
-
if (!/\.(js|ts)$/.test(entry)) continue;
|
|
1131
|
-
|
|
1132
|
-
let content;
|
|
1133
|
-
try {
|
|
1134
|
-
content = fs.readFileSync(fullPath, "utf8");
|
|
1135
|
-
} catch {
|
|
1136
|
-
continue;
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
// Skip files with no req.body at all
|
|
1140
|
-
// Split file into individual function chunks more reliably
|
|
1141
|
-
// by finding each function and extracting a reasonable chunk after it
|
|
1142
|
-
|
|
1143
|
-
const fnPatterns = [
|
|
1144
|
-
// function loginUser(req, res) {
|
|
1145
|
-
/(?:export\s+)?(?:async\s+)?function\s+([a-zA-Z_][a-zA-Z0-9_]*)\s*\([^)]*\)\s*\{/g,
|
|
1146
|
-
// const loginUser = async (req, res) => {
|
|
1147
|
-
/const\s+([a-zA-Z_][a-zA-Z0-9_]*)\s*=\s*(?:async\s*)?\([^)]*\)\s*=>\s*\{/g,
|
|
1148
|
-
// exports.loginUser = async (req, res) => {
|
|
1149
|
-
/exports\.([a-zA-Z_][a-zA-Z0-9_]*)\s*=\s*(?:async\s*)?\([^)]*\)\s*=>\s*\{/g,
|
|
1150
|
-
// export const loginUser = async (req, res) => {
|
|
1151
|
-
/export\s+const\s+([a-zA-Z_][a-zA-Z0-9_]*)\s*=\s*(?:async\s*)?\([^)]*\)\s*=>\s*\{/g,
|
|
1152
|
-
];
|
|
1153
|
-
|
|
1154
|
-
// Map every function name in this file to the whole file's body fields.
|
|
1155
|
-
// Brace-counting is unreliable across JS/TS variations, so we use
|
|
1156
|
-
// file-level field extraction here. Per-function accuracy is handled
|
|
1157
|
-
// at runtime by Strategy 2 (fn.toString()) in extractRoutes.
|
|
1158
|
-
const fileFields = extractBodyFieldsFromFile(content);
|
|
1159
|
-
if (fileFields) {
|
|
1160
|
-
const fnNames = new Set();
|
|
1161
|
-
for (const pattern of fnPatterns) {
|
|
1162
|
-
pattern.lastIndex = 0; // reset regex state before each use
|
|
1163
|
-
let m;
|
|
1164
|
-
while ((m = pattern.exec(content)) !== null) fnNames.add(m[1]);
|
|
1165
|
-
}
|
|
1166
|
-
for (const name of fnNames) {
|
|
1167
|
-
if (!bodyMap[name]) {
|
|
1168
|
-
// don't overwrite a more precise entry
|
|
1169
|
-
bodyMap[name] = fileFields;
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
|
|
1176
|
-
walk(cwd, 0);
|
|
1177
|
-
return bodyMap;
|
|
1178
|
-
}
|
|
1179
|
-
|
|
1180
|
-
function extractHandlerName(layer) {
|
|
1181
|
-
const handlers = layer.route.stack.map((h) => h.handle || h);
|
|
1182
|
-
|
|
1183
|
-
const SKIP_NAMES = new Set([
|
|
1184
|
-
"anonymous",
|
|
1185
|
-
"",
|
|
1186
|
-
"bound dispatch",
|
|
1187
|
-
"middleware",
|
|
1188
|
-
"protect",
|
|
1189
|
-
"admin",
|
|
1190
|
-
"auth",
|
|
1191
|
-
"verify",
|
|
1192
|
-
"validate",
|
|
1193
|
-
"isAuth",
|
|
1194
|
-
"isAdmin",
|
|
1195
|
-
"checkAuth",
|
|
1196
|
-
"authenticate",
|
|
1197
|
-
]);
|
|
1198
|
-
|
|
1199
|
-
// Try from last to first, skip known middleware names
|
|
1200
|
-
for (let i = handlers.length - 1; i >= 0; i--) {
|
|
1201
|
-
const fn = handlers[i];
|
|
1202
|
-
const name = fn.name || "";
|
|
1203
|
-
if (name && !SKIP_NAMES.has(name) && !name.startsWith("bound ")) {
|
|
1204
|
-
return name;
|
|
1205
|
-
}
|
|
1206
|
-
}
|
|
1207
|
-
return null;
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1210
|
-
function convertNextJsSegment(segment) {
|
|
1211
|
-
// Skip catch-all [...slug] and optional [[...slug]]
|
|
1212
|
-
if (/^\[?\[\.\.\./.test(segment)) return null;
|
|
1213
|
-
// Convert [projectId] → :projectId (Next.js / Nuxt / SvelteKit)
|
|
1214
|
-
if (/^\[([^\]]+)\]$/.test(segment))
|
|
1215
|
-
return segment.replace(/^\[([^\]]+)\]$/, ":$1");
|
|
1216
|
-
// Convert $projectId → :projectId (Remix)
|
|
1217
|
-
if (/^\$([a-zA-Z_][a-zA-Z0-9_]*)$/.test(segment))
|
|
1218
|
-
return segment.replace(/^\$/, ":");
|
|
1219
|
-
return segment;
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
|
-
function extractParamPositions(segments) {
|
|
1223
|
-
const paramMap = {};
|
|
1224
|
-
segments.forEach(function (segment, index) {
|
|
1225
|
-
if (segment && segment.startsWith(":")) {
|
|
1226
|
-
const paramName = segment.slice(1);
|
|
1227
|
-
paramMap[paramName] = index;
|
|
1228
|
-
}
|
|
1229
|
-
});
|
|
1230
|
-
return paramMap;
|
|
1231
|
-
}
|
|
1232
|
-
|
|
1233
|
-
function scanConfigBasedRoutes(cwd) {
|
|
1234
|
-
const fs = require("fs");
|
|
1235
|
-
const path = require("path");
|
|
1236
|
-
const patterns = [];
|
|
1237
|
-
const seen = new Set();
|
|
1238
|
-
|
|
1239
|
-
const filesToCheck = [
|
|
1240
|
-
// React Router
|
|
1241
|
-
path.join(cwd, "src", "App.jsx"),
|
|
1242
|
-
path.join(cwd, "src", "App.tsx"),
|
|
1243
|
-
path.join(cwd, "src", "App.js"),
|
|
1244
|
-
path.join(cwd, "src", "router.jsx"),
|
|
1245
|
-
path.join(cwd, "src", "router.tsx"),
|
|
1246
|
-
path.join(cwd, "src", "router.js"),
|
|
1247
|
-
path.join(cwd, "src", "routes.jsx"),
|
|
1248
|
-
path.join(cwd, "src", "routes.tsx"),
|
|
1249
|
-
path.join(cwd, "src", "routes.js"),
|
|
1250
|
-
path.join(cwd, "src", "Router.jsx"),
|
|
1251
|
-
path.join(cwd, "src", "Router.tsx"),
|
|
1252
|
-
// Vue Router
|
|
1253
|
-
path.join(cwd, "src", "router", "index.js"),
|
|
1254
|
-
path.join(cwd, "src", "router", "index.ts"),
|
|
1255
|
-
path.join(cwd, "src", "router.js"),
|
|
1256
|
-
path.join(cwd, "src", "router.ts"),
|
|
1257
|
-
// Angular
|
|
1258
|
-
path.join(cwd, "src", "app", "app-routing.module.ts"),
|
|
1259
|
-
path.join(cwd, "src", "app", "app.routes.ts"),
|
|
1260
|
-
// TanStack Router
|
|
1261
|
-
path.join(cwd, "src", "routes.tsx"),
|
|
1262
|
-
path.join(cwd, "src", "routeTree.gen.ts"),
|
|
1263
|
-
path.join(cwd, "src", "router.tsx"),
|
|
1264
|
-
];
|
|
1265
|
-
|
|
1266
|
-
// Also scan any file named *routes* or *router* anywhere in src/
|
|
1267
|
-
const srcDir = path.join(cwd, "src");
|
|
1268
|
-
if (fs.existsSync(srcDir)) {
|
|
1269
|
-
function findRouteFiles(dir, depth) {
|
|
1270
|
-
if (depth > 3) return;
|
|
1271
|
-
let entries;
|
|
1272
|
-
try {
|
|
1273
|
-
entries = fs.readdirSync(dir);
|
|
1274
|
-
} catch {
|
|
1275
|
-
return;
|
|
1276
|
-
}
|
|
1277
|
-
for (const entry of entries) {
|
|
1278
|
-
if (["node_modules", ".git", "dist", "build"].includes(entry)) continue;
|
|
1279
|
-
const fullPath = path.join(dir, entry);
|
|
1280
|
-
let stat;
|
|
1281
|
-
try {
|
|
1282
|
-
stat = fs.statSync(fullPath);
|
|
1283
|
-
} catch {
|
|
1284
|
-
continue;
|
|
1285
|
-
}
|
|
1286
|
-
if (stat.isDirectory()) {
|
|
1287
|
-
findRouteFiles(fullPath, depth + 1);
|
|
1288
|
-
} else if (
|
|
1289
|
-
/\.(js|ts|jsx|tsx)$/.test(entry) &&
|
|
1290
|
-
/route|router/i.test(entry) &&
|
|
1291
|
-
!filesToCheck.includes(fullPath)
|
|
1292
|
-
) {
|
|
1293
|
-
filesToCheck.push(fullPath);
|
|
1294
|
-
}
|
|
1295
|
-
}
|
|
1296
|
-
}
|
|
1297
|
-
findRouteFiles(srcDir, 0);
|
|
1298
|
-
}
|
|
1299
|
-
|
|
1300
|
-
for (const filePath of filesToCheck) {
|
|
1301
|
-
if (!fs.existsSync(filePath)) continue;
|
|
1302
|
-
|
|
1303
|
-
let content;
|
|
1304
|
-
try {
|
|
1305
|
-
content = fs.readFileSync(filePath, "utf8");
|
|
1306
|
-
} catch {
|
|
1307
|
-
continue;
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
// Pattern 1 — React Router JSX: <Route path="/:projectId/dashboard" />
|
|
1311
|
-
const jsxRouteMatches = content.matchAll(
|
|
1312
|
-
/<Route[^>]+path=["']([^"']+)["']/g,
|
|
1313
|
-
);
|
|
1314
|
-
for (const match of jsxRouteMatches) {
|
|
1315
|
-
addConfigPattern(match[1], seen, patterns);
|
|
1316
|
-
}
|
|
1317
|
-
|
|
1318
|
-
// Pattern 2 — React Router / Vue Router object: { path: '/:projectId/dashboard' }
|
|
1319
|
-
const objectRouteMatches = content.matchAll(/path\s*:\s*["']([^"']+)["']/g);
|
|
1320
|
-
for (const match of objectRouteMatches) {
|
|
1321
|
-
addConfigPattern(match[1], seen, patterns);
|
|
1322
|
-
}
|
|
1323
|
-
|
|
1324
|
-
// Pattern 3 — Angular: { path: ':projectId/dashboard' }
|
|
1325
|
-
const angularRouteMatches = content.matchAll(
|
|
1326
|
-
/\{\s*path\s*:\s*["']([^"']+)["']/g,
|
|
1327
|
-
);
|
|
1328
|
-
for (const match of angularRouteMatches) {
|
|
1329
|
-
addConfigPattern(match[1], seen, patterns);
|
|
1330
|
-
}
|
|
1331
|
-
|
|
1332
|
-
// Pattern 4 — TanStack Router: createRoute({ path: '/dashboard/:id' })
|
|
1333
|
-
const tanstackMatches = content.matchAll(
|
|
1334
|
-
/createRoute\s*\(\s*\{[^}]*path\s*:\s*["']([^"']+)["']/g,
|
|
1335
|
-
);
|
|
1336
|
-
for (const match of tanstackMatches) {
|
|
1337
|
-
addConfigPattern(match[1], seen, patterns);
|
|
1338
|
-
}
|
|
1339
|
-
|
|
1340
|
-
// Pattern 5 — TanStack Router file-based: createFileRoute('/dashboard/$id')
|
|
1341
|
-
const tanstackFileMatches = content.matchAll(
|
|
1342
|
-
/createFileRoute\s*\(\s*["']([^"']+)["']/g,
|
|
1343
|
-
);
|
|
1344
|
-
for (const match of tanstackFileMatches) {
|
|
1345
|
-
// Convert TanStack $param to :param
|
|
1346
|
-
const normalized = match[1].replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g, ":$1");
|
|
1347
|
-
addConfigPattern(normalized, seen, patterns);
|
|
1348
|
-
}
|
|
1349
|
-
|
|
1350
|
-
// Pattern 6 — Vue Router with children
|
|
1351
|
-
const vueChildrenMatches = content.matchAll(
|
|
1352
|
-
/children\s*:\s*\[[^\]]*path\s*:\s*["']([^"']+)["']/g,
|
|
1353
|
-
);
|
|
1354
|
-
for (const match of vueChildrenMatches) {
|
|
1355
|
-
addConfigPattern(match[1], seen, patterns);
|
|
1356
|
-
}
|
|
1357
|
-
}
|
|
1358
|
-
|
|
1359
|
-
return patterns;
|
|
1360
|
-
}
|
|
1361
|
-
|
|
1362
|
-
function addConfigPattern(routePath, seen, patterns) {
|
|
1363
|
-
// Skip empty, wildcard and catch-all routes
|
|
1364
|
-
if (!routePath || routePath === "*" || routePath === "**") return;
|
|
1365
|
-
// Skip routes with no dynamic params
|
|
1366
|
-
if (!routePath.includes(":") && !routePath.includes("$")) return;
|
|
1367
|
-
|
|
1368
|
-
// Normalize — ensure leading slash
|
|
1369
|
-
const normalized = routePath.startsWith("/") ? routePath : "/" + routePath;
|
|
1370
|
-
|
|
1371
|
-
if (seen.has(normalized)) return;
|
|
1372
|
-
seen.add(normalized);
|
|
1373
|
-
|
|
1374
|
-
// Extract params and their positions
|
|
1375
|
-
const segments = normalized.split("/").filter(Boolean);
|
|
1376
|
-
const paramMap = {};
|
|
1377
|
-
segments.forEach(function (segment, index) {
|
|
1378
|
-
if (segment.startsWith(":")) {
|
|
1379
|
-
paramMap[segment.slice(1)] = index;
|
|
1380
|
-
}
|
|
1381
|
-
});
|
|
1382
|
-
|
|
1383
|
-
if (Object.keys(paramMap).length === 0) return;
|
|
1384
|
-
|
|
1385
|
-
patterns.push({ pattern: normalized, params: paramMap });
|
|
1386
|
-
}
|
|
1387
|
-
|
|
1388
|
-
function findAllFrontendDirs(cwd) {
|
|
1389
|
-
const fs = require("fs");
|
|
1390
|
-
const path = require("path");
|
|
1391
|
-
|
|
1392
|
-
const FRONTEND_INDICATORS = [
|
|
1393
|
-
"next.config.js",
|
|
1394
|
-
"next.config.ts",
|
|
1395
|
-
"react-router.config.ts",
|
|
1396
|
-
"react-router.config.js",
|
|
1397
|
-
"vite.config.ts",
|
|
1398
|
-
"vite.config.js",
|
|
1399
|
-
"nuxt.config.ts",
|
|
1400
|
-
"nuxt.config.js",
|
|
1401
|
-
"svelte.config.js",
|
|
1402
|
-
"svelte.config.ts",
|
|
1403
|
-
"remix.config.js",
|
|
1404
|
-
"remix.config.ts",
|
|
1405
|
-
"angular.json",
|
|
1406
|
-
"astro.config.mjs",
|
|
1407
|
-
"astro.config.ts",
|
|
1408
|
-
"astro.config.js",
|
|
1409
|
-
"app.config.ts",
|
|
1410
|
-
"qwik.config.ts",
|
|
1411
|
-
];
|
|
1412
|
-
|
|
1413
|
-
const SKIP_DIRS = new Set([
|
|
1414
|
-
"node_modules",
|
|
1415
|
-
".git",
|
|
1416
|
-
"dist",
|
|
1417
|
-
"build",
|
|
1418
|
-
".next",
|
|
1419
|
-
".nuxt",
|
|
1420
|
-
"coverage",
|
|
1421
|
-
]);
|
|
1422
|
-
|
|
1423
|
-
const found = [];
|
|
1424
|
-
|
|
1425
|
-
function isFrontendDir(dir) {
|
|
1426
|
-
// Check 1 — indicator files (most reliable)
|
|
1427
|
-
const hasIndicator = FRONTEND_INDICATORS.some(function (indicator) {
|
|
1428
|
-
try {
|
|
1429
|
-
return fs.existsSync(path.join(dir, indicator));
|
|
1430
|
-
} catch {
|
|
1431
|
-
return false;
|
|
1432
|
-
}
|
|
1433
|
-
});
|
|
1434
|
-
if (hasIndicator) return true;
|
|
1435
|
-
|
|
1436
|
-
// Check 2 — fallback: check package.json for frontend frameworks
|
|
1437
|
-
try {
|
|
1438
|
-
const pkgPath = path.join(dir, "package.json");
|
|
1439
|
-
if (fs.existsSync(pkgPath)) {
|
|
1440
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
1441
|
-
const deps = Object.assign(
|
|
1442
|
-
{},
|
|
1443
|
-
pkg.dependencies || {},
|
|
1444
|
-
pkg.devDependencies || {},
|
|
1445
|
-
);
|
|
1446
|
-
const frontendPackages = [
|
|
1447
|
-
"react",
|
|
1448
|
-
"vue",
|
|
1449
|
-
"angular",
|
|
1450
|
-
"@angular/core",
|
|
1451
|
-
"svelte",
|
|
1452
|
-
"solid-js",
|
|
1453
|
-
"preact",
|
|
1454
|
-
"nuxt",
|
|
1455
|
-
"@remix-run/react",
|
|
1456
|
-
"next",
|
|
1457
|
-
"@sveltejs/kit",
|
|
1458
|
-
"astro",
|
|
1459
|
-
"gatsby",
|
|
1460
|
-
"@solidjs/start",
|
|
1461
|
-
"@builder.io/qwik",
|
|
1462
|
-
"@builder.io/qwik-city",
|
|
1463
|
-
];
|
|
1464
|
-
if (
|
|
1465
|
-
frontendPackages.some(function (p) {
|
|
1466
|
-
return deps[p];
|
|
1467
|
-
})
|
|
1468
|
-
) {
|
|
1469
|
-
return true;
|
|
1470
|
-
}
|
|
1471
|
-
}
|
|
1472
|
-
} catch {
|
|
1473
|
-
// silent fail
|
|
1474
|
-
}
|
|
1475
|
-
|
|
1476
|
-
return false;
|
|
1477
|
-
}
|
|
1478
|
-
|
|
1479
|
-
// Always check cwd itself first
|
|
1480
|
-
if (isFrontendDir(cwd)) {
|
|
1481
|
-
found.push(cwd);
|
|
1482
|
-
}
|
|
1483
|
-
|
|
1484
|
-
// ── Step 1: Scan subfolders inside cwd ──────────────────────────────
|
|
1485
|
-
let cwdEntries;
|
|
1486
|
-
try {
|
|
1487
|
-
cwdEntries = fs.readdirSync(cwd);
|
|
1488
|
-
} catch {
|
|
1489
|
-
cwdEntries = [];
|
|
1490
|
-
}
|
|
1491
|
-
|
|
1492
|
-
for (const entry of cwdEntries) {
|
|
1493
|
-
if (SKIP_DIRS.has(entry)) continue;
|
|
1494
|
-
|
|
1495
|
-
const sub = path.join(cwd, entry);
|
|
1496
|
-
let stat;
|
|
1497
|
-
try {
|
|
1498
|
-
stat = fs.statSync(sub);
|
|
1499
|
-
} catch {
|
|
1500
|
-
continue;
|
|
1501
|
-
}
|
|
1502
|
-
if (!stat.isDirectory()) continue;
|
|
1503
|
-
|
|
1504
|
-
// Level 1 — direct subfolders of cwd
|
|
1505
|
-
if (isFrontendDir(sub) && !found.includes(sub)) {
|
|
1506
|
-
found.push(sub);
|
|
1507
|
-
}
|
|
1508
|
-
|
|
1509
|
-
// Level 2 — one level deeper (e.g. packages/apps/frontend)
|
|
1510
|
-
let subEntries;
|
|
1511
|
-
try {
|
|
1512
|
-
subEntries = fs.readdirSync(sub);
|
|
1513
|
-
} catch {
|
|
1514
|
-
continue;
|
|
1515
|
-
}
|
|
1516
|
-
|
|
1517
|
-
for (const subEntry of subEntries) {
|
|
1518
|
-
if (SKIP_DIRS.has(subEntry)) continue;
|
|
1519
|
-
const subSub = path.join(sub, subEntry);
|
|
1520
|
-
let subStat;
|
|
1521
|
-
try {
|
|
1522
|
-
subStat = fs.statSync(subSub);
|
|
1523
|
-
} catch {
|
|
1524
|
-
continue;
|
|
1525
|
-
}
|
|
1526
|
-
if (!subStat.isDirectory()) continue;
|
|
1527
|
-
if (isFrontendDir(subSub) && !found.includes(subSub)) {
|
|
1528
|
-
found.push(subSub);
|
|
1529
|
-
}
|
|
1530
|
-
}
|
|
1531
|
-
}
|
|
1532
|
-
|
|
1533
|
-
// Note: we intentionally do NOT walk up to sibling folders (e.g. a
|
|
1534
|
-
// separate frontend/ folder next to backend/) anymore. That only worked
|
|
1535
|
-
// in local dev monorepos where both folders live on the same disk. In
|
|
1536
|
-
// production, frontend and backend are frequently on completely separate
|
|
1537
|
-
// servers, so there is nothing to find outside cwd. If this install has
|
|
1538
|
-
// no frontend, classification (in index.js) reports that to the
|
|
1539
|
-
// dashboard instead of guessing at a folder that may not exist here.
|
|
1540
|
-
|
|
1541
|
-
// If nothing found, fall back to cwd
|
|
1542
|
-
if (found.length === 0) {
|
|
1543
|
-
found.push(cwd);
|
|
1544
|
-
}
|
|
1545
|
-
|
|
1546
|
-
return found;
|
|
1547
|
-
}
|
|
1548
|
-
|
|
1549
|
-
function scanFrontendRoutes(cwd) {
|
|
1550
|
-
const fs = require("fs");
|
|
1551
|
-
const path = require("path");
|
|
1552
|
-
const patterns = [];
|
|
1553
|
-
const seen = new Set();
|
|
1554
|
-
|
|
1555
|
-
const candidateDirs = findAllFrontendDirs(cwd);
|
|
1556
|
-
|
|
1557
|
-
function walkDir(dir, routeSegments) {
|
|
1558
|
-
if (!fs.existsSync(dir)) return;
|
|
1559
|
-
let entries;
|
|
1560
|
-
try {
|
|
1561
|
-
entries = fs.readdirSync(dir);
|
|
1562
|
-
} catch {
|
|
1563
|
-
return;
|
|
1564
|
-
}
|
|
1565
|
-
|
|
1566
|
-
entries.forEach(function (file) {
|
|
1567
|
-
const fullPath = path.join(dir, file);
|
|
1568
|
-
let stat;
|
|
1569
|
-
try {
|
|
1570
|
-
stat = fs.statSync(fullPath);
|
|
1571
|
-
} catch {
|
|
1572
|
-
return;
|
|
1573
|
-
}
|
|
1574
|
-
|
|
1575
|
-
if (stat.isDirectory()) {
|
|
1576
|
-
if (file === "api") return;
|
|
1577
|
-
if (file.startsWith("_")) return;
|
|
1578
|
-
if (/^\(.*\)$/.test(file)) {
|
|
1579
|
-
walkDir(fullPath, routeSegments);
|
|
1580
|
-
return;
|
|
1581
|
-
}
|
|
1582
|
-
const segment = convertNextJsSegment(file);
|
|
1583
|
-
if (!segment) return;
|
|
1584
|
-
walkDir(fullPath, routeSegments.concat(segment));
|
|
1585
|
-
return;
|
|
1586
|
-
}
|
|
1587
|
-
|
|
1588
|
-
if (!/\.(js|ts|jsx|tsx|vue|svelte|astro)$/.test(file)) return;
|
|
1589
|
-
if (file.startsWith("_")) return;
|
|
1590
|
-
|
|
1591
|
-
const routeName = file.replace(/\.(js|ts|jsx|tsx|vue|svelte|astro)$/, "");
|
|
1592
|
-
|
|
1593
|
-
if (
|
|
1594
|
-
["layout", "loading", "error", "template", "not-found"].includes(
|
|
1595
|
-
routeName,
|
|
1596
|
-
)
|
|
1597
|
-
)
|
|
1598
|
-
return;
|
|
1599
|
-
|
|
1600
|
-
if (routeName.startsWith("+") && routeName !== "+page") return;
|
|
1601
|
-
|
|
1602
|
-
const isRemixRoute =
|
|
1603
|
-
routeName.includes(".") && !routeName.startsWith("+");
|
|
1604
|
-
let finalSegments;
|
|
1605
|
-
|
|
1606
|
-
if (isRemixRoute) {
|
|
1607
|
-
const remixSegments = routeName
|
|
1608
|
-
.split(".")
|
|
1609
|
-
.map((s) => convertNextJsSegment(s) || s);
|
|
1610
|
-
finalSegments = routeSegments.concat(remixSegments);
|
|
1611
|
-
} else if (
|
|
1612
|
-
routeName === "index" ||
|
|
1613
|
-
routeName === "page" ||
|
|
1614
|
-
routeName === "+page"
|
|
1615
|
-
) {
|
|
1616
|
-
finalSegments = routeSegments;
|
|
1617
|
-
} else {
|
|
1618
|
-
finalSegments = routeSegments.concat(
|
|
1619
|
-
convertNextJsSegment(routeName) || routeName,
|
|
1620
|
-
);
|
|
1621
|
-
}
|
|
1622
|
-
|
|
1623
|
-
const pattern = "/" + finalSegments.filter(Boolean).join("/");
|
|
1624
|
-
if (seen.has(pattern)) return;
|
|
1625
|
-
seen.add(pattern);
|
|
1626
|
-
|
|
1627
|
-
const paramMap = extractParamPositions(finalSegments);
|
|
1628
|
-
if (Object.keys(paramMap).length === 0) return;
|
|
1629
|
-
|
|
1630
|
-
patterns.push({ pattern, params: paramMap });
|
|
1631
|
-
});
|
|
1632
|
-
}
|
|
1633
|
-
|
|
1634
|
-
for (const candidate of candidateDirs) {
|
|
1635
|
-
const dirsToScan = [
|
|
1636
|
-
// Next.js
|
|
1637
|
-
path.join(candidate, "pages"),
|
|
1638
|
-
path.join(candidate, "src", "pages"),
|
|
1639
|
-
path.join(candidate, "app"),
|
|
1640
|
-
path.join(candidate, "src", "app"),
|
|
1641
|
-
// React Router / Remix
|
|
1642
|
-
path.join(candidate, "src", "routes"),
|
|
1643
|
-
path.join(candidate, "routes"),
|
|
1644
|
-
path.join(candidate, "app", "routes"),
|
|
1645
|
-
// SvelteKit
|
|
1646
|
-
path.join(candidate, "src", "routes"),
|
|
1647
|
-
// Nuxt
|
|
1648
|
-
path.join(candidate, "pages"),
|
|
1649
|
-
path.join(candidate, "src", "pages"),
|
|
1650
|
-
// Astro
|
|
1651
|
-
path.join(candidate, "src", "pages"),
|
|
1652
|
-
];
|
|
1653
|
-
|
|
1654
|
-
dirsToScan.forEach(function (dir) {
|
|
1655
|
-
if (fs.existsSync(dir)) {
|
|
1656
|
-
walkDir(dir, []);
|
|
1657
|
-
}
|
|
1658
|
-
});
|
|
1659
|
-
|
|
1660
|
-
const configPatterns = scanConfigBasedRoutes(candidate);
|
|
1661
|
-
configPatterns.forEach(function (p) {
|
|
1662
|
-
if (!seen.has(p.pattern)) {
|
|
1663
|
-
seen.add(p.pattern);
|
|
1664
|
-
patterns.push(p);
|
|
1665
|
-
}
|
|
1666
|
-
});
|
|
1667
|
-
}
|
|
1668
|
-
|
|
1669
|
-
return patterns;
|
|
1670
|
-
}
|
|
1671
|
-
|
|
1672
|
-
/**
|
|
1673
|
-
* Scans Fastify routes from the codebase statically
|
|
1674
|
-
* Handles:
|
|
1675
|
-
* - fastify.get('/path', handler)
|
|
1676
|
-
* - fastify.post('/path', handler)
|
|
1677
|
-
* - fastify.route({ method: 'GET', url: '/path' })
|
|
1678
|
-
* - fastify.register(plugin, { prefix: '/api' })
|
|
1679
|
-
*/
|
|
1680
|
-
function scanFastifyRoutes(cwd) {
|
|
1681
|
-
const fs = require("fs");
|
|
1682
|
-
const path = require("path");
|
|
1683
|
-
const endpoints = [];
|
|
1684
|
-
const seen = new Set();
|
|
1685
|
-
|
|
1686
|
-
const SKIP_DIRS = [
|
|
1687
|
-
"node_modules",
|
|
1688
|
-
".git",
|
|
1689
|
-
".next",
|
|
1690
|
-
"dist",
|
|
1691
|
-
"build",
|
|
1692
|
-
".cache",
|
|
1693
|
-
"coverage",
|
|
1694
|
-
"out",
|
|
1695
|
-
];
|
|
1696
|
-
|
|
1697
|
-
// Build body map from all files upfront
|
|
1698
|
-
const bodyMap = cwd ? buildBodyMap(cwd) : {};
|
|
1699
|
-
|
|
1700
|
-
function walk(dir, depth) {
|
|
1701
|
-
if (depth > 4) return;
|
|
1702
|
-
let entries;
|
|
1703
|
-
try {
|
|
1704
|
-
entries = fs.readdirSync(dir);
|
|
1705
|
-
} catch {
|
|
1706
|
-
return;
|
|
1707
|
-
}
|
|
1708
|
-
|
|
1709
|
-
for (const entry of entries) {
|
|
1710
|
-
if (SKIP_DIRS.includes(entry)) continue;
|
|
1711
|
-
const fullPath = path.join(dir, entry);
|
|
1712
|
-
let stat;
|
|
1713
|
-
try {
|
|
1714
|
-
stat = fs.statSync(fullPath);
|
|
1715
|
-
} catch {
|
|
1716
|
-
continue;
|
|
1717
|
-
}
|
|
1718
|
-
|
|
1719
|
-
if (stat.isDirectory()) {
|
|
1720
|
-
walk(fullPath, depth + 1);
|
|
1721
|
-
continue;
|
|
1722
|
-
}
|
|
1723
|
-
|
|
1724
|
-
if (!/\.(js|ts)$/.test(entry)) continue;
|
|
1725
|
-
|
|
1726
|
-
let content;
|
|
1727
|
-
try {
|
|
1728
|
-
content = fs.readFileSync(fullPath, "utf8");
|
|
1729
|
-
} catch {
|
|
1730
|
-
continue;
|
|
1731
|
-
}
|
|
1732
|
-
|
|
1733
|
-
// Only process files that look like Fastify route files
|
|
1734
|
-
const isFastifyFile =
|
|
1735
|
-
content.includes("fastify") ||
|
|
1736
|
-
content.includes("Fastify") ||
|
|
1737
|
-
/\.(get|post|put|delete|patch|route)\s*\(/.test(content);
|
|
1738
|
-
|
|
1739
|
-
if (!isFastifyFile) continue;
|
|
1740
|
-
|
|
1741
|
-
// Pattern 1 — fastify.get('/path', handler)
|
|
1742
|
-
// Pattern 2 — fastify.post('/path', handler)
|
|
1743
|
-
const shorthandPattern =
|
|
1744
|
-
/(?:fastify|app|server|router)\.(get|post|put|delete|patch)\s*\(\s*['"`]([^'"`]+)['"`]/gi;
|
|
1745
|
-
|
|
1746
|
-
let match;
|
|
1747
|
-
while ((match = shorthandPattern.exec(content)) !== null) {
|
|
1748
|
-
const method = match[1].toUpperCase();
|
|
1749
|
-
const routePath = match[2];
|
|
1750
|
-
if (routePath.includes("*")) continue;
|
|
1751
|
-
|
|
1752
|
-
const key = method + ":" + routePath;
|
|
1753
|
-
if (seen.has(key)) continue;
|
|
1754
|
-
seen.add(key);
|
|
1755
|
-
|
|
1756
|
-
const needsBody = ["POST", "PUT", "PATCH"].includes(method);
|
|
1757
|
-
const bodyFields = needsBody
|
|
1758
|
-
? extractBodyFieldsFromFile(content)
|
|
1759
|
-
: null;
|
|
1760
|
-
const routeParamMap = buildRouteParamMap(routePath, []);
|
|
1761
|
-
|
|
1762
|
-
endpoints.push({
|
|
1763
|
-
method,
|
|
1764
|
-
path: routePath,
|
|
1765
|
-
description: "",
|
|
1766
|
-
requestBody: mergeBodyWithMultipart(
|
|
1767
|
-
bodyFields,
|
|
1768
|
-
needsBody
|
|
1769
|
-
? extractMultipartFieldsFromFile(
|
|
1770
|
-
sliceRouteSegment(content, match.index, FASTIFY_ROUTE_START),
|
|
1771
|
-
)
|
|
1772
|
-
: null,
|
|
1773
|
-
),
|
|
1774
|
-
routeParamMap,
|
|
1775
|
-
detectedBy: "static-scan-fastify",
|
|
1776
|
-
});
|
|
1777
|
-
}
|
|
1778
|
-
|
|
1779
|
-
// Pattern 3 — fastify.route({ method: 'GET', url: '/path' })
|
|
1780
|
-
const routeObjectPattern =
|
|
1781
|
-
/\.route\s*\(\s*\{[^}]*method\s*:\s*['"`]([^'"`]+)['"`][^}]*url\s*:\s*['"`]([^'"`]+)['"`]/gi;
|
|
1782
|
-
|
|
1783
|
-
while ((match = routeObjectPattern.exec(content)) !== null) {
|
|
1784
|
-
const method = match[1].toUpperCase();
|
|
1785
|
-
const routePath = match[2];
|
|
1786
|
-
if (routePath.includes("*")) continue;
|
|
1787
|
-
|
|
1788
|
-
const key = method + ":" + routePath;
|
|
1789
|
-
if (seen.has(key)) continue;
|
|
1790
|
-
seen.add(key);
|
|
1791
|
-
|
|
1792
|
-
const needsBody = ["POST", "PUT", "PATCH"].includes(method);
|
|
1793
|
-
const bodyFields = needsBody
|
|
1794
|
-
? extractBodyFieldsFromFile(content)
|
|
1795
|
-
: null;
|
|
1796
|
-
const routeParamMap = buildRouteParamMap(routePath, []);
|
|
1797
|
-
|
|
1798
|
-
endpoints.push({
|
|
1799
|
-
method,
|
|
1800
|
-
path: routePath,
|
|
1801
|
-
description: "",
|
|
1802
|
-
requestBody: mergeBodyWithMultipart(
|
|
1803
|
-
bodyFields,
|
|
1804
|
-
needsBody
|
|
1805
|
-
? extractMultipartFieldsFromFile(
|
|
1806
|
-
sliceRouteSegment(content, match.index, FASTIFY_ROUTE_START),
|
|
1807
|
-
)
|
|
1808
|
-
: null,
|
|
1809
|
-
),
|
|
1810
|
-
routeParamMap,
|
|
1811
|
-
detectedBy: "static-scan-fastify",
|
|
1812
|
-
});
|
|
1813
|
-
}
|
|
1814
|
-
|
|
1815
|
-
// Pattern 4 — fastify.route({ method: ['GET', 'POST'], url: '/path' })
|
|
1816
|
-
// handles array of methods
|
|
1817
|
-
const routeArrayPattern =
|
|
1818
|
-
/\.route\s*\(\s*\{[^}]*method\s*:\s*\[([^\]]+)\][^}]*url\s*:\s*['"`]([^'"`]+)['"`]/gi;
|
|
1819
|
-
|
|
1820
|
-
while ((match = routeArrayPattern.exec(content)) !== null) {
|
|
1821
|
-
const methodsRaw = match[1];
|
|
1822
|
-
const routePath = match[2];
|
|
1823
|
-
if (routePath.includes("*")) continue;
|
|
1824
|
-
|
|
1825
|
-
const methods = methodsRaw
|
|
1826
|
-
.split(",")
|
|
1827
|
-
.map((m) => m.trim().replace(/['"`]/g, "").toUpperCase())
|
|
1828
|
-
.filter(Boolean);
|
|
1829
|
-
|
|
1830
|
-
for (const method of methods) {
|
|
1831
|
-
const key = method + ":" + routePath;
|
|
1832
|
-
if (seen.has(key)) continue;
|
|
1833
|
-
seen.add(key);
|
|
1834
|
-
|
|
1835
|
-
const needsBody = ["POST", "PUT", "PATCH"].includes(method);
|
|
1836
|
-
const bodyFields = needsBody
|
|
1837
|
-
? extractBodyFieldsFromFile(content)
|
|
1838
|
-
: null;
|
|
1839
|
-
const routeParamMap = buildRouteParamMap(routePath, []);
|
|
1840
|
-
|
|
1841
|
-
endpoints.push({
|
|
1842
|
-
method,
|
|
1843
|
-
path: routePath,
|
|
1844
|
-
description: "",
|
|
1845
|
-
requestBody: mergeBodyWithMultipart(
|
|
1846
|
-
bodyFields,
|
|
1847
|
-
needsBody
|
|
1848
|
-
? extractMultipartFieldsFromFile(
|
|
1849
|
-
sliceRouteSegment(
|
|
1850
|
-
content,
|
|
1851
|
-
match.index,
|
|
1852
|
-
FASTIFY_ROUTE_START,
|
|
1853
|
-
),
|
|
1854
|
-
)
|
|
1855
|
-
: null,
|
|
1856
|
-
),
|
|
1857
|
-
routeParamMap,
|
|
1858
|
-
detectedBy: "static-scan-fastify",
|
|
1859
|
-
});
|
|
1860
|
-
}
|
|
1861
|
-
}
|
|
1862
|
-
}
|
|
1863
|
-
}
|
|
1864
|
-
|
|
1865
|
-
walk(cwd, 0);
|
|
1866
|
-
return endpoints;
|
|
1867
|
-
}
|
|
1868
|
-
|
|
1869
|
-
/**
|
|
1870
|
-
* Scans NestJS routes from the codebase statically
|
|
1871
|
-
* Handles:
|
|
1872
|
-
* - @Controller('/users')
|
|
1873
|
-
* - @Get('/path')
|
|
1874
|
-
* - @Post('/path')
|
|
1875
|
-
* - @Put('/path')
|
|
1876
|
-
* - @Delete('/path')
|
|
1877
|
-
* - @Patch('/path')
|
|
1878
|
-
*/
|
|
1879
|
-
function scanNestJsRoutes(cwd) {
|
|
1880
|
-
const fs = require("fs");
|
|
1881
|
-
const path = require("path");
|
|
1882
|
-
const endpoints = [];
|
|
1883
|
-
const seen = new Set();
|
|
1884
|
-
|
|
1885
|
-
const SKIP_DIRS = [
|
|
1886
|
-
"node_modules",
|
|
1887
|
-
".git",
|
|
1888
|
-
".next",
|
|
1889
|
-
"dist",
|
|
1890
|
-
"build",
|
|
1891
|
-
".cache",
|
|
1892
|
-
"coverage",
|
|
1893
|
-
"out",
|
|
1894
|
-
];
|
|
1895
|
-
|
|
1896
|
-
function walk(dir, depth) {
|
|
1897
|
-
if (depth > 4) return;
|
|
1898
|
-
let entries;
|
|
1899
|
-
try {
|
|
1900
|
-
entries = fs.readdirSync(dir);
|
|
1901
|
-
} catch {
|
|
1902
|
-
return;
|
|
1903
|
-
}
|
|
1904
|
-
|
|
1905
|
-
for (const entry of entries) {
|
|
1906
|
-
if (SKIP_DIRS.includes(entry)) continue;
|
|
1907
|
-
const fullPath = path.join(dir, entry);
|
|
1908
|
-
let stat;
|
|
1909
|
-
try {
|
|
1910
|
-
stat = fs.statSync(fullPath);
|
|
1911
|
-
} catch {
|
|
1912
|
-
continue;
|
|
1913
|
-
}
|
|
1914
|
-
|
|
1915
|
-
if (stat.isDirectory()) {
|
|
1916
|
-
walk(fullPath, depth + 1);
|
|
1917
|
-
continue;
|
|
1918
|
-
}
|
|
1919
|
-
|
|
1920
|
-
if (!/\.(ts|js)$/.test(entry)) continue;
|
|
1921
|
-
|
|
1922
|
-
let content;
|
|
1923
|
-
try {
|
|
1924
|
-
content = fs.readFileSync(fullPath, "utf8");
|
|
1925
|
-
} catch {
|
|
1926
|
-
continue;
|
|
1927
|
-
}
|
|
1928
|
-
|
|
1929
|
-
// Only process files that look like NestJS controller files
|
|
1930
|
-
const isNestFile =
|
|
1931
|
-
content.includes("@Controller") ||
|
|
1932
|
-
content.includes("@Get(") ||
|
|
1933
|
-
content.includes("@Post(") ||
|
|
1934
|
-
content.includes("@Put(") ||
|
|
1935
|
-
content.includes("@Delete(") ||
|
|
1936
|
-
content.includes("@Patch(");
|
|
1937
|
-
|
|
1938
|
-
if (!isNestFile) continue;
|
|
1939
|
-
|
|
1940
|
-
// Extract controller prefix — @Controller('/users') or @Controller('users')
|
|
1941
|
-
let controllerPrefix = "";
|
|
1942
|
-
const controllerMatch = content.match(
|
|
1943
|
-
/@Controller\s*\(\s*['"`]([^'"`]*)['"`]\s*\)/,
|
|
1944
|
-
);
|
|
1945
|
-
if (controllerMatch) {
|
|
1946
|
-
controllerPrefix = controllerMatch[1].startsWith("/")
|
|
1947
|
-
? controllerMatch[1]
|
|
1948
|
-
: "/" + controllerMatch[1];
|
|
1949
|
-
}
|
|
1950
|
-
|
|
1951
|
-
// Extract all method decorators
|
|
1952
|
-
const methodPattern =
|
|
1953
|
-
/@(Get|Post|Put|Delete|Patch)\s*\(\s*['"`]?([^'"`\s\)]*?)['"`]?\s*\)/gi;
|
|
1954
|
-
|
|
1955
|
-
let match;
|
|
1956
|
-
while ((match = methodPattern.exec(content)) !== null) {
|
|
1957
|
-
const method = match[1].toUpperCase();
|
|
1958
|
-
const methodPath = match[2] || "";
|
|
1959
|
-
|
|
1960
|
-
const routeFull =
|
|
1961
|
-
controllerPrefix +
|
|
1962
|
-
(methodPath
|
|
1963
|
-
? methodPath.startsWith("/")
|
|
1964
|
-
? methodPath
|
|
1965
|
-
: "/" + methodPath
|
|
1966
|
-
: "");
|
|
1967
|
-
|
|
1968
|
-
const normalizedPath = routeFull.replace(
|
|
1969
|
-
/:([a-zA-Z_][a-zA-Z0-9_]*)/g,
|
|
1970
|
-
":$1",
|
|
1971
|
-
);
|
|
1972
|
-
|
|
1973
|
-
const key = method + ":" + normalizedPath;
|
|
1974
|
-
if (seen.has(key)) continue;
|
|
1975
|
-
seen.add(key);
|
|
1976
|
-
|
|
1977
|
-
const needsBody = ["POST", "PUT", "PATCH"].includes(method);
|
|
1978
|
-
const bodyFields = needsBody
|
|
1979
|
-
? extractBodyFieldsFromFile(content)
|
|
1980
|
-
: null;
|
|
1981
|
-
const routeParamMap = buildRouteParamMap(normalizedPath, []);
|
|
1982
|
-
|
|
1983
|
-
endpoints.push({
|
|
1984
|
-
method,
|
|
1985
|
-
path: normalizedPath,
|
|
1986
|
-
description: "",
|
|
1987
|
-
requestBody: mergeBodyWithMultipart(
|
|
1988
|
-
bodyFields,
|
|
1989
|
-
needsBody
|
|
1990
|
-
? extractMultipartFieldsFromFile(
|
|
1991
|
-
sliceRouteSegment(content, match.index, methodPattern.source),
|
|
1992
|
-
)
|
|
1993
|
-
: null,
|
|
1994
|
-
),
|
|
1995
|
-
routeParamMap,
|
|
1996
|
-
detectedBy: "static-scan-nestjs",
|
|
1997
|
-
});
|
|
1998
|
-
}
|
|
1999
|
-
}
|
|
2000
|
-
}
|
|
2001
|
-
|
|
2002
|
-
walk(cwd, 0);
|
|
2003
|
-
return endpoints;
|
|
2004
|
-
}
|
|
2005
|
-
|
|
2006
|
-
/**
|
|
2007
|
-
* Scans Koa routes from the codebase statically
|
|
2008
|
-
* Handles:
|
|
2009
|
-
* - router.get('/path', handler)
|
|
2010
|
-
* - router.post('/path', handler)
|
|
2011
|
-
* - router.put('/path', handler)
|
|
2012
|
-
* - router.delete('/path', handler)
|
|
2013
|
-
* - router.patch('/path', handler)
|
|
2014
|
-
*/
|
|
2015
|
-
function scanKoaRoutes(cwd) {
|
|
2016
|
-
const fs = require("fs");
|
|
2017
|
-
const path = require("path");
|
|
2018
|
-
const endpoints = [];
|
|
2019
|
-
const seen = new Set();
|
|
2020
|
-
|
|
2021
|
-
const SKIP_DIRS = [
|
|
2022
|
-
"node_modules",
|
|
2023
|
-
".git",
|
|
2024
|
-
".next",
|
|
2025
|
-
"dist",
|
|
2026
|
-
"build",
|
|
2027
|
-
".cache",
|
|
2028
|
-
"coverage",
|
|
2029
|
-
"out",
|
|
2030
|
-
];
|
|
2031
|
-
|
|
2032
|
-
function walk(dir, depth) {
|
|
2033
|
-
if (depth > 4) return;
|
|
2034
|
-
let entries;
|
|
2035
|
-
try {
|
|
2036
|
-
entries = fs.readdirSync(dir);
|
|
2037
|
-
} catch {
|
|
2038
|
-
return;
|
|
2039
|
-
}
|
|
2040
|
-
|
|
2041
|
-
for (const entry of entries) {
|
|
2042
|
-
if (SKIP_DIRS.includes(entry)) continue;
|
|
2043
|
-
const fullPath = path.join(dir, entry);
|
|
2044
|
-
let stat;
|
|
2045
|
-
try {
|
|
2046
|
-
stat = fs.statSync(fullPath);
|
|
2047
|
-
} catch {
|
|
2048
|
-
continue;
|
|
2049
|
-
}
|
|
2050
|
-
|
|
2051
|
-
if (stat.isDirectory()) {
|
|
2052
|
-
walk(fullPath, depth + 1);
|
|
2053
|
-
continue;
|
|
2054
|
-
}
|
|
2055
|
-
|
|
2056
|
-
if (!/\.(js|ts)$/.test(entry)) continue;
|
|
2057
|
-
|
|
2058
|
-
let content;
|
|
2059
|
-
try {
|
|
2060
|
-
content = fs.readFileSync(fullPath, "utf8");
|
|
2061
|
-
} catch {
|
|
2062
|
-
continue;
|
|
2063
|
-
}
|
|
2064
|
-
|
|
2065
|
-
// Only process files that look like Koa route files
|
|
2066
|
-
const isKoaFile =
|
|
2067
|
-
content.includes("koa-router") ||
|
|
2068
|
-
content.includes("@koa/router") ||
|
|
2069
|
-
content.includes("new Router()") ||
|
|
2070
|
-
/router\.(get|post|put|delete|patch)\s*\(/.test(content);
|
|
2071
|
-
|
|
2072
|
-
if (!isKoaFile) continue;
|
|
2073
|
-
|
|
2074
|
-
const routePattern =
|
|
2075
|
-
/router\.(get|post|put|delete|patch)\s*\(\s*['"`]([^'"`]+)['"`]/gi;
|
|
2076
|
-
|
|
2077
|
-
let match;
|
|
2078
|
-
while ((match = routePattern.exec(content)) !== null) {
|
|
2079
|
-
const method = match[1].toUpperCase();
|
|
2080
|
-
const routePath = match[2];
|
|
2081
|
-
if (routePath.includes("*")) continue;
|
|
2082
|
-
|
|
2083
|
-
const key = method + ":" + routePath;
|
|
2084
|
-
if (seen.has(key)) continue;
|
|
2085
|
-
seen.add(key);
|
|
2086
|
-
|
|
2087
|
-
const needsBody = ["POST", "PUT", "PATCH"].includes(method);
|
|
2088
|
-
const bodyFields = needsBody
|
|
2089
|
-
? extractBodyFieldsFromFile(content)
|
|
2090
|
-
: null;
|
|
2091
|
-
const routeParamMap = buildRouteParamMap(routePath, []);
|
|
2092
|
-
|
|
2093
|
-
endpoints.push({
|
|
2094
|
-
method,
|
|
2095
|
-
path: routePath,
|
|
2096
|
-
description: "",
|
|
2097
|
-
requestBody: mergeBodyWithMultipart(
|
|
2098
|
-
bodyFields,
|
|
2099
|
-
needsBody
|
|
2100
|
-
? extractMultipartFieldsFromFile(
|
|
2101
|
-
sliceRouteSegment(content, match.index, routePattern.source),
|
|
2102
|
-
)
|
|
2103
|
-
: null,
|
|
2104
|
-
),
|
|
2105
|
-
routeParamMap,
|
|
2106
|
-
detectedBy: "static-scan-koa",
|
|
2107
|
-
});
|
|
2108
|
-
}
|
|
2109
|
-
}
|
|
2110
|
-
}
|
|
2111
|
-
|
|
2112
|
-
walk(cwd, 0);
|
|
2113
|
-
return endpoints;
|
|
2114
|
-
}
|
|
2115
|
-
|
|
2116
|
-
/**
|
|
2117
|
-
* Scans Hapi routes from the codebase statically
|
|
2118
|
-
* Handles:
|
|
2119
|
-
* - server.route({ method: 'GET', path: '/path', handler })
|
|
2120
|
-
* - server.route([{ method: 'POST', path: '/path', handler }])
|
|
2121
|
-
*/
|
|
2122
|
-
function scanHapiRoutes(cwd) {
|
|
2123
|
-
const fs = require("fs");
|
|
2124
|
-
const path = require("path");
|
|
2125
|
-
const endpoints = [];
|
|
2126
|
-
const seen = new Set();
|
|
2127
|
-
|
|
2128
|
-
const SKIP_DIRS = [
|
|
2129
|
-
"node_modules",
|
|
2130
|
-
".git",
|
|
2131
|
-
".next",
|
|
2132
|
-
"dist",
|
|
2133
|
-
"build",
|
|
2134
|
-
".cache",
|
|
2135
|
-
"coverage",
|
|
2136
|
-
"out",
|
|
2137
|
-
];
|
|
2138
|
-
|
|
2139
|
-
function walk(dir, depth) {
|
|
2140
|
-
if (depth > 4) return;
|
|
2141
|
-
let entries;
|
|
2142
|
-
try {
|
|
2143
|
-
entries = fs.readdirSync(dir);
|
|
2144
|
-
} catch {
|
|
2145
|
-
return;
|
|
2146
|
-
}
|
|
2147
|
-
|
|
2148
|
-
for (const entry of entries) {
|
|
2149
|
-
if (SKIP_DIRS.includes(entry)) continue;
|
|
2150
|
-
const fullPath = path.join(dir, entry);
|
|
2151
|
-
let stat;
|
|
2152
|
-
try {
|
|
2153
|
-
stat = fs.statSync(fullPath);
|
|
2154
|
-
} catch {
|
|
2155
|
-
continue;
|
|
2156
|
-
}
|
|
2157
|
-
|
|
2158
|
-
if (stat.isDirectory()) {
|
|
2159
|
-
walk(fullPath, depth + 1);
|
|
2160
|
-
continue;
|
|
2161
|
-
}
|
|
2162
|
-
|
|
2163
|
-
if (!/\.(js|ts)$/.test(entry)) continue;
|
|
2164
|
-
|
|
2165
|
-
let content;
|
|
2166
|
-
try {
|
|
2167
|
-
content = fs.readFileSync(fullPath, "utf8");
|
|
2168
|
-
} catch {
|
|
2169
|
-
continue;
|
|
2170
|
-
}
|
|
2171
|
-
|
|
2172
|
-
const isHapiFile =
|
|
2173
|
-
content.includes("@hapi/hapi") ||
|
|
2174
|
-
content.includes("require('hapi')") ||
|
|
2175
|
-
content.includes('require("hapi")') ||
|
|
2176
|
-
content.includes("server.route(");
|
|
2177
|
-
|
|
2178
|
-
if (!isHapiFile) continue;
|
|
2179
|
-
|
|
2180
|
-
// Pattern — method and path can be in any order inside the object
|
|
2181
|
-
const routePattern =
|
|
2182
|
-
/server\.route\s*\(\s*\{[^}]*method\s*:\s*['"`]([^'"`]+)['"`][^}]*path\s*:\s*['"`]([^'"`]+)['"`]/gi;
|
|
2183
|
-
|
|
2184
|
-
let match;
|
|
2185
|
-
while ((match = routePattern.exec(content)) !== null) {
|
|
2186
|
-
const method = match[1].toUpperCase();
|
|
2187
|
-
const routePath = match[2];
|
|
2188
|
-
if (routePath.includes("*")) continue;
|
|
2189
|
-
|
|
2190
|
-
const key = method + ":" + routePath;
|
|
2191
|
-
if (seen.has(key)) continue;
|
|
2192
|
-
seen.add(key);
|
|
2193
|
-
|
|
2194
|
-
const needsBody = ["POST", "PUT", "PATCH"].includes(method);
|
|
2195
|
-
const bodyFields = needsBody
|
|
2196
|
-
? extractBodyFieldsFromFile(content)
|
|
2197
|
-
: null;
|
|
2198
|
-
const routeParamMap = buildRouteParamMap(routePath, []);
|
|
2199
|
-
|
|
2200
|
-
endpoints.push({
|
|
2201
|
-
method,
|
|
2202
|
-
path: routePath,
|
|
2203
|
-
description: "",
|
|
2204
|
-
requestBody: mergeBodyWithMultipart(
|
|
2205
|
-
bodyFields,
|
|
2206
|
-
needsBody
|
|
2207
|
-
? extractMultipartFieldsFromFile(
|
|
2208
|
-
sliceRouteSegment(content, match.index, routePattern.source),
|
|
2209
|
-
)
|
|
2210
|
-
: null,
|
|
2211
|
-
),
|
|
2212
|
-
routeParamMap,
|
|
2213
|
-
detectedBy: "static-scan-hapi",
|
|
2214
|
-
});
|
|
2215
|
-
}
|
|
2216
|
-
}
|
|
2217
|
-
}
|
|
2218
|
-
|
|
2219
|
-
walk(cwd, 0);
|
|
2220
|
-
return endpoints;
|
|
2221
|
-
}
|
|
2222
|
-
|
|
2223
|
-
/**
|
|
2224
|
-
* Scans AdonisJS routes from the codebase statically
|
|
2225
|
-
* Handles:
|
|
2226
|
-
* - Route.get('/path', handler)
|
|
2227
|
-
* - Route.post('/path', handler)
|
|
2228
|
-
* - router.get('/path', handler)
|
|
2229
|
-
* - router.post('/path', handler)
|
|
2230
|
-
*/
|
|
2231
|
-
function scanAdonisRoutes(cwd) {
|
|
2232
|
-
const fs = require("fs");
|
|
2233
|
-
const path = require("path");
|
|
2234
|
-
const endpoints = [];
|
|
2235
|
-
const seen = new Set();
|
|
2236
|
-
|
|
2237
|
-
const SKIP_DIRS = [
|
|
2238
|
-
"node_modules",
|
|
2239
|
-
".git",
|
|
2240
|
-
".next",
|
|
2241
|
-
"dist",
|
|
2242
|
-
"build",
|
|
2243
|
-
".cache",
|
|
2244
|
-
"coverage",
|
|
2245
|
-
"out",
|
|
2246
|
-
];
|
|
2247
|
-
|
|
2248
|
-
function walk(dir, depth) {
|
|
2249
|
-
if (depth > 4) return;
|
|
2250
|
-
let entries;
|
|
2251
|
-
try {
|
|
2252
|
-
entries = fs.readdirSync(dir);
|
|
2253
|
-
} catch {
|
|
2254
|
-
return;
|
|
2255
|
-
}
|
|
2256
|
-
|
|
2257
|
-
for (const entry of entries) {
|
|
2258
|
-
if (SKIP_DIRS.includes(entry)) continue;
|
|
2259
|
-
const fullPath = path.join(dir, entry);
|
|
2260
|
-
let stat;
|
|
2261
|
-
try {
|
|
2262
|
-
stat = fs.statSync(fullPath);
|
|
2263
|
-
} catch {
|
|
2264
|
-
continue;
|
|
2265
|
-
}
|
|
2266
|
-
|
|
2267
|
-
if (stat.isDirectory()) {
|
|
2268
|
-
walk(fullPath, depth + 1);
|
|
2269
|
-
continue;
|
|
2270
|
-
}
|
|
2271
|
-
|
|
2272
|
-
if (!/\.(js|ts)$/.test(entry)) continue;
|
|
2273
|
-
|
|
2274
|
-
let content;
|
|
2275
|
-
try {
|
|
2276
|
-
content = fs.readFileSync(fullPath, "utf8");
|
|
2277
|
-
} catch {
|
|
2278
|
-
continue;
|
|
2279
|
-
}
|
|
2280
|
-
|
|
2281
|
-
const isAdonisFile =
|
|
2282
|
-
content.includes("@adonisjs") ||
|
|
2283
|
-
content.includes("Route.get") ||
|
|
2284
|
-
content.includes("Route.post") ||
|
|
2285
|
-
/(?:Route|router)\.(get|post|put|delete|patch)\s*\(/.test(content);
|
|
2286
|
-
|
|
2287
|
-
if (!isAdonisFile) continue;
|
|
2288
|
-
|
|
2289
|
-
const routePattern =
|
|
2290
|
-
/(?:Route|router)\.(get|post|put|delete|patch)\s*\(\s*['"`]([^'"`]+)['"`]/gi;
|
|
2291
|
-
|
|
2292
|
-
let match;
|
|
2293
|
-
while ((match = routePattern.exec(content)) !== null) {
|
|
2294
|
-
const method = match[1].toUpperCase();
|
|
2295
|
-
const routePath = match[2];
|
|
2296
|
-
if (routePath.includes("*")) continue;
|
|
2297
|
-
|
|
2298
|
-
const key = method + ":" + routePath;
|
|
2299
|
-
if (seen.has(key)) continue;
|
|
2300
|
-
seen.add(key);
|
|
2301
|
-
|
|
2302
|
-
const needsBody = ["POST", "PUT", "PATCH"].includes(method);
|
|
2303
|
-
const bodyFields = needsBody
|
|
2304
|
-
? extractBodyFieldsFromFile(content)
|
|
2305
|
-
: null;
|
|
2306
|
-
const routeParamMap = buildRouteParamMap(routePath, []);
|
|
2307
|
-
|
|
2308
|
-
endpoints.push({
|
|
2309
|
-
method,
|
|
2310
|
-
path: routePath,
|
|
2311
|
-
description: "",
|
|
2312
|
-
requestBody: mergeBodyWithMultipart(
|
|
2313
|
-
bodyFields,
|
|
2314
|
-
needsBody
|
|
2315
|
-
? extractMultipartFieldsFromFile(
|
|
2316
|
-
sliceRouteSegment(content, match.index, routePattern.source),
|
|
2317
|
-
)
|
|
2318
|
-
: null,
|
|
2319
|
-
),
|
|
2320
|
-
routeParamMap,
|
|
2321
|
-
detectedBy: "static-scan-adonis",
|
|
2322
|
-
});
|
|
2323
|
-
}
|
|
2324
|
-
}
|
|
2325
|
-
}
|
|
2326
|
-
|
|
2327
|
-
walk(cwd, 0);
|
|
2328
|
-
return endpoints;
|
|
2329
|
-
}
|
|
2330
|
-
|
|
2331
|
-
/**
|
|
2332
|
-
* Scans Nuxt server API routes
|
|
2333
|
-
* Handles file-based routing in server/api/ folder
|
|
2334
|
-
* e.g. server/api/users.get.ts → GET /api/users
|
|
2335
|
-
* e.g. server/api/users/[id].delete.ts → DELETE /api/users/:id
|
|
2336
|
-
*/
|
|
2337
|
-
function scanNuxtServerRoutes(cwd) {
|
|
2338
|
-
const fs = require("fs");
|
|
2339
|
-
const path = require("path");
|
|
2340
|
-
const endpoints = [];
|
|
2341
|
-
const seen = new Set();
|
|
2342
|
-
|
|
2343
|
-
const possibleDirs = [
|
|
2344
|
-
path.join(cwd, "server", "api"),
|
|
2345
|
-
path.join(cwd, "src", "server", "api"),
|
|
2346
|
-
];
|
|
2347
|
-
|
|
2348
|
-
function walkDir(dir, routePath) {
|
|
2349
|
-
if (!fs.existsSync(dir)) return;
|
|
2350
|
-
let entries;
|
|
2351
|
-
try {
|
|
2352
|
-
entries = fs.readdirSync(dir);
|
|
2353
|
-
} catch {
|
|
2354
|
-
return;
|
|
2355
|
-
}
|
|
2356
|
-
|
|
2357
|
-
entries.forEach(function (file) {
|
|
2358
|
-
const fullPath = path.join(dir, file);
|
|
2359
|
-
let stat;
|
|
2360
|
-
try {
|
|
2361
|
-
stat = fs.statSync(fullPath);
|
|
2362
|
-
} catch {
|
|
2363
|
-
return;
|
|
2364
|
-
}
|
|
2365
|
-
|
|
2366
|
-
if (stat.isDirectory()) {
|
|
2367
|
-
const segment = file.replace(/\[([^\]]+)\]/g, ":$1");
|
|
2368
|
-
walkDir(fullPath, routePath + "/" + segment);
|
|
2369
|
-
return;
|
|
2370
|
-
}
|
|
2371
|
-
|
|
2372
|
-
if (!/\.(js|ts)$/.test(file)) return;
|
|
2373
|
-
|
|
2374
|
-
// Nuxt convention: users.get.ts or users.post.ts or just users.ts
|
|
2375
|
-
// Strip extension first
|
|
2376
|
-
let fileName = file.replace(/\.(js|ts)$/, "");
|
|
2377
|
-
|
|
2378
|
-
// Check if method is embedded in filename like users.get or [id].delete
|
|
2379
|
-
const methodMatch = fileName.match(/\.?(get|post|put|delete|patch)$/i);
|
|
2380
|
-
let method = null;
|
|
2381
|
-
if (methodMatch) {
|
|
2382
|
-
method = methodMatch[1].toUpperCase();
|
|
2383
|
-
fileName = fileName.replace(/\.?(get|post|put|delete|patch)$/i, "");
|
|
2384
|
-
}
|
|
2385
|
-
|
|
2386
|
-
// Convert [id] to :id
|
|
2387
|
-
fileName = fileName.replace(/\[([^\]]+)\]/g, ":$1");
|
|
2388
|
-
|
|
2389
|
-
const finalPath =
|
|
2390
|
-
fileName === "index" ? routePath : routePath + "/" + fileName;
|
|
2391
|
-
|
|
2392
|
-
const methods = method ? [method] : ["GET"];
|
|
2393
|
-
|
|
2394
|
-
methods.forEach(function (m) {
|
|
2395
|
-
const key = m + ":" + finalPath;
|
|
2396
|
-
if (seen.has(key)) return;
|
|
2397
|
-
seen.add(key);
|
|
2398
|
-
|
|
2399
|
-
const routeParamMap = buildRouteParamMap(finalPath, []);
|
|
2400
|
-
|
|
2401
|
-
endpoints.push({
|
|
2402
|
-
method: m,
|
|
2403
|
-
path: finalPath,
|
|
2404
|
-
description: "",
|
|
2405
|
-
requestBody:
|
|
2406
|
-
m !== "GET" && m !== "DELETE"
|
|
2407
|
-
? (function () {
|
|
2408
|
-
try {
|
|
2409
|
-
return extractMultipartFieldsFromFile(
|
|
2410
|
-
fs.readFileSync(fullPath, "utf8"),
|
|
2411
|
-
);
|
|
2412
|
-
} catch (e) {
|
|
2413
|
-
return null;
|
|
2414
|
-
}
|
|
2415
|
-
})()
|
|
2416
|
-
: null,
|
|
2417
|
-
routeParamMap,
|
|
2418
|
-
detectedBy: "static-scan-nuxt",
|
|
2419
|
-
});
|
|
2420
|
-
});
|
|
2421
|
-
});
|
|
2422
|
-
}
|
|
2423
|
-
|
|
2424
|
-
for (const dir of possibleDirs) {
|
|
2425
|
-
walkDir(dir, "/api");
|
|
2426
|
-
}
|
|
2427
|
-
|
|
2428
|
-
return endpoints;
|
|
2429
|
-
}
|
|
2430
|
-
|
|
2431
|
-
/**
|
|
2432
|
-
* Scans SvelteKit server routes
|
|
2433
|
-
* Handles +server.js / +server.ts files in src/routes/
|
|
2434
|
-
* e.g. src/routes/api/users/+server.ts with export function GET() → GET /api/users
|
|
2435
|
-
*/
|
|
2436
|
-
function scanSvelteKitServerRoutes(cwd) {
|
|
2437
|
-
const fs = require("fs");
|
|
2438
|
-
const path = require("path");
|
|
2439
|
-
const endpoints = [];
|
|
2440
|
-
const seen = new Set();
|
|
2441
|
-
|
|
2442
|
-
const possibleDirs = [
|
|
2443
|
-
path.join(cwd, "src", "routes"),
|
|
2444
|
-
path.join(cwd, "routes"),
|
|
2445
|
-
];
|
|
2446
|
-
|
|
2447
|
-
function walkDir(dir, routePath) {
|
|
2448
|
-
if (!fs.existsSync(dir)) return;
|
|
2449
|
-
let entries;
|
|
2450
|
-
try {
|
|
2451
|
-
entries = fs.readdirSync(dir);
|
|
2452
|
-
} catch {
|
|
2453
|
-
return;
|
|
2454
|
-
}
|
|
2455
|
-
|
|
2456
|
-
entries.forEach(function (file) {
|
|
2457
|
-
const fullPath = path.join(dir, file);
|
|
2458
|
-
let stat;
|
|
2459
|
-
try {
|
|
2460
|
-
stat = fs.statSync(fullPath);
|
|
2461
|
-
} catch {
|
|
2462
|
-
return;
|
|
2463
|
-
}
|
|
2464
|
-
|
|
2465
|
-
if (stat.isDirectory()) {
|
|
2466
|
-
// Convert (group) folders — these are layout groups, not route segments
|
|
2467
|
-
if (/^\(.*\)$/.test(file)) {
|
|
2468
|
-
walkDir(fullPath, routePath);
|
|
2469
|
-
return;
|
|
2470
|
-
}
|
|
2471
|
-
// Convert [param] to :param
|
|
2472
|
-
const segment = file.replace(/\[([^\]]+)\]/g, ":$1");
|
|
2473
|
-
walkDir(fullPath, routePath + "/" + segment);
|
|
2474
|
-
return;
|
|
2475
|
-
}
|
|
2476
|
-
|
|
2477
|
-
// Only process +server.js or +server.ts files
|
|
2478
|
-
if (!/^\+server\.(js|ts)$/.test(file)) return;
|
|
2479
|
-
|
|
2480
|
-
let content;
|
|
2481
|
-
try {
|
|
2482
|
-
content = fs.readFileSync(fullPath, "utf8");
|
|
2483
|
-
} catch {
|
|
2484
|
-
return;
|
|
2485
|
-
}
|
|
2486
|
-
|
|
2487
|
-
// Detect exported HTTP methods
|
|
2488
|
-
const methods = detectAppRouterMethods(content);
|
|
2489
|
-
|
|
2490
|
-
methods.forEach(function (method) {
|
|
2491
|
-
const key = method + ":" + routePath;
|
|
2492
|
-
if (seen.has(key)) return;
|
|
2493
|
-
seen.add(key);
|
|
2494
|
-
|
|
2495
|
-
const needsBody = ["POST", "PUT", "PATCH"].includes(method);
|
|
2496
|
-
const bodyFields = needsBody
|
|
2497
|
-
? extractBodyFieldsFromFile(content)
|
|
2498
|
-
: null;
|
|
2499
|
-
const routeParamMap = buildRouteParamMap(routePath, []);
|
|
2500
|
-
|
|
2501
|
-
endpoints.push({
|
|
2502
|
-
method,
|
|
2503
|
-
path: routePath || "/",
|
|
2504
|
-
description: "",
|
|
2505
|
-
requestBody: mergeBodyWithMultipart(
|
|
2506
|
-
bodyFields,
|
|
2507
|
-
needsBody
|
|
2508
|
-
? extractMultipartFieldsFromFile(
|
|
2509
|
-
getMethodSegment(content, method, methods, "app") || content,
|
|
2510
|
-
)
|
|
2511
|
-
: null,
|
|
2512
|
-
),
|
|
2513
|
-
routeParamMap,
|
|
2514
|
-
detectedBy: "static-scan-sveltekit",
|
|
2515
|
-
});
|
|
2516
|
-
});
|
|
2517
|
-
});
|
|
2518
|
-
}
|
|
2519
|
-
|
|
2520
|
-
for (const dir of possibleDirs) {
|
|
2521
|
-
walkDir(dir, "");
|
|
2522
|
-
}
|
|
2523
|
-
|
|
2524
|
-
return endpoints;
|
|
2525
|
-
}
|
|
2526
|
-
|
|
2527
|
-
/**
|
|
2528
|
-
* Scans Remix server routes
|
|
2529
|
-
* Handles loader (GET) and action (POST/PUT/DELETE/PATCH) exports
|
|
2530
|
-
* in app/routes/ folder
|
|
2531
|
-
* e.g. app/routes/projects.$id.tsx with export async function loader() → GET /projects/:id
|
|
2532
|
-
*/
|
|
2533
|
-
function scanRemixServerRoutes(cwd) {
|
|
2534
|
-
const fs = require("fs");
|
|
2535
|
-
const path = require("path");
|
|
2536
|
-
const endpoints = [];
|
|
2537
|
-
const seen = new Set();
|
|
2538
|
-
|
|
2539
|
-
const possibleDirs = [
|
|
2540
|
-
path.join(cwd, "app", "routes"),
|
|
2541
|
-
path.join(cwd, "routes"),
|
|
2542
|
-
];
|
|
2543
|
-
|
|
2544
|
-
function walkDir(dir, prefix) {
|
|
2545
|
-
if (!fs.existsSync(dir)) return;
|
|
2546
|
-
let entries;
|
|
2547
|
-
try {
|
|
2548
|
-
entries = fs.readdirSync(dir);
|
|
2549
|
-
} catch {
|
|
2550
|
-
return;
|
|
2551
|
-
}
|
|
2552
|
-
|
|
2553
|
-
entries.forEach(function (file) {
|
|
2554
|
-
const fullPath = path.join(dir, file);
|
|
2555
|
-
let stat;
|
|
2556
|
-
try {
|
|
2557
|
-
stat = fs.statSync(fullPath);
|
|
2558
|
-
} catch {
|
|
2559
|
-
return;
|
|
2560
|
-
}
|
|
2561
|
-
|
|
2562
|
-
if (stat.isDirectory()) {
|
|
2563
|
-
walkDir(fullPath, prefix + "/" + file);
|
|
2564
|
-
return;
|
|
2565
|
-
}
|
|
2566
|
-
|
|
2567
|
-
if (!/\.(js|ts|jsx|tsx)$/.test(file)) return;
|
|
2568
|
-
|
|
2569
|
-
let content;
|
|
2570
|
-
try {
|
|
2571
|
-
content = fs.readFileSync(fullPath, "utf8");
|
|
2572
|
-
} catch {
|
|
2573
|
-
return;
|
|
2574
|
-
}
|
|
2575
|
-
|
|
2576
|
-
// Only process files that have loader or action exports
|
|
2577
|
-
const hasLoader = /export\s+(?:async\s+)?function\s+loader\b/.test(
|
|
2578
|
-
content,
|
|
2579
|
-
);
|
|
2580
|
-
const hasAction = /export\s+(?:async\s+)?function\s+action\b/.test(
|
|
2581
|
-
content,
|
|
2582
|
-
);
|
|
2583
|
-
|
|
2584
|
-
if (!hasLoader && !hasAction) return;
|
|
2585
|
-
|
|
2586
|
-
// Convert Remix filename convention to route path
|
|
2587
|
-
// projects.$id.tsx → /projects/:id
|
|
2588
|
-
// _index.tsx → /
|
|
2589
|
-
let fileName = file.replace(/\.(js|ts|jsx|tsx)$/, "");
|
|
2590
|
-
if (fileName === "_index") fileName = "";
|
|
2591
|
-
|
|
2592
|
-
const routePath =
|
|
2593
|
-
(prefix + "/" + fileName)
|
|
2594
|
-
.replace(/\.\$/g, "/:") // .$param → /:param
|
|
2595
|
-
.replace(/\./g, "/") // remaining dots → slashes
|
|
2596
|
-
.replace(/\/+/g, "/") // clean double slashes
|
|
2597
|
-
.replace(/\/$/, "") || "/";
|
|
2598
|
-
|
|
2599
|
-
if (hasLoader) {
|
|
2600
|
-
const key = "GET:" + routePath;
|
|
2601
|
-
if (!seen.has(key)) {
|
|
2602
|
-
seen.add(key);
|
|
2603
|
-
endpoints.push({
|
|
2604
|
-
method: "GET",
|
|
2605
|
-
path: routePath,
|
|
2606
|
-
description: "",
|
|
2607
|
-
requestBody: null,
|
|
2608
|
-
routeParamMap: buildRouteParamMap(routePath, []),
|
|
2609
|
-
detectedBy: "static-scan-remix",
|
|
2610
|
-
});
|
|
2611
|
-
}
|
|
2612
|
-
}
|
|
2613
|
-
|
|
2614
|
-
if (hasAction) {
|
|
2615
|
-
// action handles POST/PUT/DELETE/PATCH — default to POST
|
|
2616
|
-
// try to detect specific method from content
|
|
2617
|
-
const actionMethods = ["POST", "PUT", "DELETE", "PATCH"].filter((m) =>
|
|
2618
|
-
new RegExp(`request\\.method\\s*===?\\s*['"]${m}['"]`).test(content),
|
|
2619
|
-
);
|
|
2620
|
-
|
|
2621
|
-
const methodsToAdd =
|
|
2622
|
-
actionMethods.length > 0 ? actionMethods : ["POST"];
|
|
2623
|
-
|
|
2624
|
-
methodsToAdd.forEach(function (method) {
|
|
2625
|
-
const key = method + ":" + routePath;
|
|
2626
|
-
if (seen.has(key)) return;
|
|
2627
|
-
seen.add(key);
|
|
2628
|
-
|
|
2629
|
-
const bodyFields = mergeBodyWithMultipart(
|
|
2630
|
-
extractBodyFieldsFromFile(content),
|
|
2631
|
-
extractMultipartFieldsFromFile(content),
|
|
2632
|
-
);
|
|
2633
|
-
endpoints.push({
|
|
2634
|
-
method,
|
|
2635
|
-
path: routePath,
|
|
2636
|
-
description: "",
|
|
2637
|
-
requestBody: bodyFields,
|
|
2638
|
-
routeParamMap: buildRouteParamMap(routePath, []),
|
|
2639
|
-
detectedBy: "static-scan-remix",
|
|
2640
|
-
});
|
|
2641
|
-
});
|
|
2642
|
-
}
|
|
2643
|
-
});
|
|
2644
|
-
}
|
|
2645
|
-
|
|
2646
|
-
for (const dir of possibleDirs) {
|
|
2647
|
-
walkDir(dir, "");
|
|
2648
|
-
}
|
|
2649
|
-
|
|
2650
|
-
return endpoints;
|
|
2651
|
-
}
|
|
2652
|
-
|
|
2653
|
-
// ─── Static response-shape guessing ───────────────────────────────────────────
|
|
2654
|
-
// Best-effort: reads field names from reply objects written out directly in the code
|
|
2655
|
-
// (e.g. res.json({ id, name })). Replies built from variables are left empty on purpose;
|
|
2656
|
-
// real runtime replies fill those in later and replace any guess made here.
|
|
2657
|
-
const MAX_STATIC_RESPONSE_FIELDS = 50;
|
|
2658
|
-
const MAX_STATIC_LITERAL_LENGTH = 6000;
|
|
2659
|
-
|
|
2660
|
-
const STATIC_REPLY_PATTERN =
|
|
2661
|
-
/\b(?:res|resp|response|reply|NextResponse|Response)\s*(?:\.\s*(?:status|code)\s*\(\s*(\d{3})\s*\))?\s*\.\s*(?:json|send)\s*\(\s*\{|\bctx\.body\s*=\s*\{|\bh\.response\s*\(\s*\{/g;
|
|
2662
|
-
|
|
2663
|
-
// Returns the index of the closing quote of the string starting at "start" (-1 if not found)
|
|
2664
|
-
function skipStaticString(text, start, limit) {
|
|
2665
|
-
const quote = text[start];
|
|
2666
|
-
for (let i = start + 1; i < limit; i++) {
|
|
2667
|
-
const ch = text[i];
|
|
2668
|
-
if (ch === "\\") {
|
|
2669
|
-
i++;
|
|
2670
|
-
continue;
|
|
2671
|
-
}
|
|
2672
|
-
if (ch === quote) return i;
|
|
2673
|
-
if (quote === "`" && ch === "$" && text[i + 1] === "{") {
|
|
2674
|
-
let depth = 1;
|
|
2675
|
-
i += 2;
|
|
2676
|
-
for (; i < limit && depth > 0; i++) {
|
|
2677
|
-
const c = text[i];
|
|
2678
|
-
if (c === '"' || c === "'" || c === "`") {
|
|
2679
|
-
i = skipStaticString(text, i, limit);
|
|
2680
|
-
if (i === -1) return -1;
|
|
2681
|
-
continue;
|
|
2682
|
-
}
|
|
2683
|
-
if (c === "{") depth++;
|
|
2684
|
-
else if (c === "}") depth--;
|
|
2685
|
-
}
|
|
2686
|
-
i--;
|
|
2687
|
-
continue;
|
|
2688
|
-
}
|
|
2689
|
-
if (quote !== "`" && ch === "\n") return -1;
|
|
2690
|
-
}
|
|
2691
|
-
return -1;
|
|
2692
|
-
}
|
|
2693
|
-
|
|
2694
|
-
// Returns the index of the "}" that closes the "{" at openIndex (null if it cannot be matched safely)
|
|
2695
|
-
function findStaticClosingBrace(text, openIndex) {
|
|
2696
|
-
let depth = 0;
|
|
2697
|
-
const limit = Math.min(text.length, openIndex + MAX_STATIC_LITERAL_LENGTH);
|
|
2698
|
-
for (let i = openIndex; i < limit; i++) {
|
|
2699
|
-
const ch = text[i];
|
|
2700
|
-
const next = text[i + 1];
|
|
2701
|
-
if (ch === "/" && next === "/") {
|
|
2702
|
-
const nl = text.indexOf("\n", i);
|
|
2703
|
-
if (nl === -1) return null;
|
|
2704
|
-
i = nl;
|
|
2705
|
-
continue;
|
|
2706
|
-
}
|
|
2707
|
-
if (ch === "/" && next === "*") {
|
|
2708
|
-
const end = text.indexOf("*/", i + 2);
|
|
2709
|
-
if (end === -1) return null;
|
|
2710
|
-
i = end + 1;
|
|
2711
|
-
continue;
|
|
2712
|
-
}
|
|
2713
|
-
if (ch === '"' || ch === "'" || ch === "`") {
|
|
2714
|
-
i = skipStaticString(text, i, limit);
|
|
2715
|
-
if (i === -1) return null;
|
|
2716
|
-
continue;
|
|
2717
|
-
}
|
|
2718
|
-
if (ch === "{" || ch === "[" || ch === "(") depth++;
|
|
2719
|
-
else if (ch === "}" || ch === "]" || ch === ")") {
|
|
2720
|
-
depth--;
|
|
2721
|
-
if (depth === 0) return ch === "}" ? i : null;
|
|
2722
|
-
if (depth < 0) return null;
|
|
2723
|
-
}
|
|
2724
|
-
}
|
|
2725
|
-
return null;
|
|
2726
|
-
}
|
|
2727
|
-
|
|
2728
|
-
// Splits the inside of an object literal on top-level commas (comments removed)
|
|
2729
|
-
function splitStaticEntries(inner) {
|
|
2730
|
-
const entries = [];
|
|
2731
|
-
let current = "";
|
|
2732
|
-
let depth = 0;
|
|
2733
|
-
for (let i = 0; i < inner.length; i++) {
|
|
2734
|
-
const ch = inner[i];
|
|
2735
|
-
const next = inner[i + 1];
|
|
2736
|
-
if (ch === "/" && next === "/") {
|
|
2737
|
-
const nl = inner.indexOf("\n", i);
|
|
2738
|
-
if (nl === -1) break;
|
|
2739
|
-
i = nl;
|
|
2740
|
-
continue;
|
|
2741
|
-
}
|
|
2742
|
-
if (ch === "/" && next === "*") {
|
|
2743
|
-
const end = inner.indexOf("*/", i + 2);
|
|
2744
|
-
if (end === -1) break;
|
|
2745
|
-
i = end + 1;
|
|
2746
|
-
continue;
|
|
2747
|
-
}
|
|
2748
|
-
if (ch === '"' || ch === "'" || ch === "`") {
|
|
2749
|
-
const end = skipStaticString(inner, i, inner.length);
|
|
2750
|
-
if (end === -1) return null;
|
|
2751
|
-
current += inner.slice(i, end + 1);
|
|
2752
|
-
i = end;
|
|
2753
|
-
continue;
|
|
2754
|
-
}
|
|
2755
|
-
if (ch === "{" || ch === "[" || ch === "(") depth++;
|
|
2756
|
-
else if (ch === "}" || ch === "]" || ch === ")") depth--;
|
|
2757
|
-
if (ch === "," && depth === 0) {
|
|
2758
|
-
entries.push(current.trim());
|
|
2759
|
-
current = "";
|
|
2760
|
-
continue;
|
|
2761
|
-
}
|
|
2762
|
-
current += ch;
|
|
2763
|
-
}
|
|
2764
|
-
if (current.trim()) entries.push(current.trim());
|
|
2765
|
-
return entries;
|
|
2766
|
-
}
|
|
2767
|
-
|
|
2768
|
-
// Reads one "key: value" or shorthand "key" entry; spreads, computed keys and methods are skipped
|
|
2769
|
-
function parseStaticEntry(entry) {
|
|
2770
|
-
if (!entry || entry.startsWith("...") || entry.startsWith("[")) return null;
|
|
2771
|
-
let m = entry.match(
|
|
2772
|
-
/^(?:"([^"]+)"|'([^']+)'|([A-Za-z_$][\w$]*))\s*:\s*([\s\S]+)$/,
|
|
2773
|
-
);
|
|
2774
|
-
if (m) return { key: m[1] || m[2] || m[3], value: m[4] };
|
|
2775
|
-
m = entry.match(/^([A-Za-z_$][\w$]*)$/);
|
|
2776
|
-
if (m) return { key: m[1], value: null };
|
|
2777
|
-
return null;
|
|
2778
|
-
}
|
|
2779
|
-
|
|
2780
|
-
// Only literal values reveal their type; anything computed is marked "unknown" instead of guessed
|
|
2781
|
-
function guessStaticValueType(valueExpr) {
|
|
2782
|
-
const v = String(valueExpr || "").trim();
|
|
2783
|
-
if (/^["'`]/.test(v)) return { type: "string" };
|
|
2784
|
-
if (/^-?\d+(\.\d+)?$/.test(v)) return { type: "number" };
|
|
2785
|
-
if (/^(true|false)$/.test(v)) return { type: "boolean" };
|
|
2786
|
-
if (/^\[/.test(v)) return { type: "array", items: { type: "unknown" } };
|
|
2787
|
-
if (/^\{/.test(v)) return { type: "object" };
|
|
2788
|
-
return { type: "unknown" };
|
|
2789
|
-
}
|
|
2790
|
-
|
|
2791
|
-
function parseStaticObjectFields(inner) {
|
|
2792
|
-
const entries = splitStaticEntries(inner);
|
|
2793
|
-
if (!entries) return null;
|
|
2794
|
-
const properties = {};
|
|
2795
|
-
let count = 0;
|
|
2796
|
-
for (const entry of entries) {
|
|
2797
|
-
if (count >= MAX_STATIC_RESPONSE_FIELDS) break;
|
|
2798
|
-
const parsed = parseStaticEntry(entry);
|
|
2799
|
-
if (!parsed) continue;
|
|
2800
|
-
properties[parsed.key] =
|
|
2801
|
-
parsed.value === null
|
|
2802
|
-
? { type: "unknown" }
|
|
2803
|
-
: guessStaticValueType(parsed.value);
|
|
2804
|
-
count++;
|
|
2805
|
-
}
|
|
2806
|
-
const keys = Object.keys(properties);
|
|
2807
|
-
if (keys.length === 0) return null;
|
|
2808
|
-
if (keys.length === 1 && keys[0] === "error") return null; // looks like an error reply
|
|
2809
|
-
// "_source" lets the server replace this guess with a real runtime reply later
|
|
2810
|
-
return { type: "object", properties, _source: "static" };
|
|
2811
|
-
}
|
|
2812
|
-
|
|
2813
|
-
function extractResponseFieldsFromSegment(segment) {
|
|
2814
|
-
try {
|
|
2815
|
-
if (!segment || typeof segment !== "string") return null;
|
|
2816
|
-
const pattern = new RegExp(STATIC_REPLY_PATTERN.source, "g");
|
|
2817
|
-
let m;
|
|
2818
|
-
while ((m = pattern.exec(segment)) !== null) {
|
|
2819
|
-
const status = m[1] ? parseInt(m[1], 10) : 200;
|
|
2820
|
-
if (status >= 400) continue;
|
|
2821
|
-
const open = m.index + m[0].length - 1;
|
|
2822
|
-
const close = findStaticClosingBrace(segment, open);
|
|
2823
|
-
if (close === null) continue;
|
|
2824
|
-
const after = segment.slice(close + 1, close + 120);
|
|
2825
|
-
const afterStatus = after.match(/^\s*,\s*\{[^}]*\bstatus\s*:\s*(\d{3})/);
|
|
2826
|
-
if (afterStatus && parseInt(afterStatus[1], 10) >= 400) continue;
|
|
2827
|
-
// a status that is not a plain number (variable/expression) cannot be known to be a success
|
|
2828
|
-
if (!afterStatus && /^\s*,\s*\{[^}]*\bstatus\b/.test(after)) continue;
|
|
2829
|
-
const fields = parseStaticObjectFields(segment.slice(open + 1, close));
|
|
2830
|
-
if (fields) return fields;
|
|
2831
|
-
}
|
|
2832
|
-
} catch (e) {}
|
|
2833
|
-
return null;
|
|
2834
|
-
}
|
|
2835
|
-
|
|
2836
|
-
// Marker that starts one method's code inside a file
|
|
2837
|
-
function staticMethodMarker(style, method) {
|
|
2838
|
-
if (style === "app") {
|
|
2839
|
-
return new RegExp(
|
|
2840
|
-
"export\\s+(?:async\\s+)?function\\s+" +
|
|
2841
|
-
method +
|
|
2842
|
-
"\\b|export\\s+(?:const|let)\\s+" +
|
|
2843
|
-
method +
|
|
2844
|
-
"\\s*=",
|
|
2845
|
-
);
|
|
2846
|
-
}
|
|
2847
|
-
// handles any variable that holds the request method, not just req.method
|
|
2848
|
-
return new RegExp(
|
|
2849
|
-
"(?:" +
|
|
2850
|
-
METHOD_REF +
|
|
2851
|
-
"\\s*===?\\s*['\"]" +
|
|
2852
|
-
method +
|
|
2853
|
-
"['\"]|case\\s*['\"]" +
|
|
2854
|
-
method +
|
|
2855
|
-
"['\"])",
|
|
2856
|
-
"i",
|
|
2857
|
-
);
|
|
2858
|
-
}
|
|
2859
|
-
|
|
2860
|
-
// Finds where one HTTP method's code starts in a file (-1 if it cannot be told apart).
|
|
2861
|
-
// Reads the same method checks that detectMethodsFromFile reads, including the early-exit
|
|
2862
|
-
// guard "if (req.method !== 'X') return ..." (code after that guard belongs to X).
|
|
2863
|
-
function findStaticMethodMarkerIndex(content, style, method) {
|
|
2864
|
-
const direct = staticMethodMarker(style, method).exec(content);
|
|
2865
|
-
if (direct) return direct.index;
|
|
2866
|
-
if (style === "app") return -1;
|
|
2867
|
-
|
|
2868
|
-
// handles any variable that holds the request method, not just req.method
|
|
2869
|
-
const guardRe = new RegExp(
|
|
2870
|
-
METHOD_REF + "\\s*!==?\\s*['\"]" + method + "['\"]",
|
|
2871
|
-
"gi",
|
|
2872
|
-
);
|
|
2873
|
-
let hit;
|
|
2874
|
-
while ((hit = guardRe.exec(content)) !== null) {
|
|
2875
|
-
// A guard listing several allowed methods is not specific to one method, so skip it
|
|
2876
|
-
const before = content.slice(Math.max(0, hit.index - 60), hit.index);
|
|
2877
|
-
const afterStart = hit.index + hit[0].length;
|
|
2878
|
-
const after = content.slice(afterStart, afterStart + 60);
|
|
2879
|
-
const listsOtherMethods =
|
|
2880
|
-
/[\w$.?]*method[\w$]*\s*!==?\s*['"][A-Za-z]+['"]\s*&&\s*$/i.test(
|
|
2881
|
-
before,
|
|
2882
|
-
) ||
|
|
2883
|
-
/^\s*&&\s*[\w$.?]*method[\w$]*\s*!==?\s*['"][A-Za-z]+['"]/i.test(after);
|
|
2884
|
-
if (!listsOtherMethods) return hit.index;
|
|
2885
|
-
}
|
|
2886
|
-
return -1;
|
|
2887
|
-
}
|
|
2888
|
-
|
|
2889
|
-
// For "export const GET = wrapper(handlerName)", returns the code of handlerName when it is
|
|
2890
|
-
// declared at the top level of the same file (null when it cannot be found, e.g. imported from elsewhere).
|
|
2891
|
-
function findStaticHandlerCode(content, markerIndex) {
|
|
2892
|
-
const ref =
|
|
2893
|
-
/^export\s+(?:const|let|var)\s+[A-Za-z_$][\w$]*\s*(?::[^=]+)?=\s*(?:[A-Za-z_$][\w$.]*\s*\(\s*)*([A-Za-z_$][\w$]*)\s*(?:[,);]|\n|$)/.exec(
|
|
2894
|
-
content.slice(markerIndex, markerIndex + 300),
|
|
2895
|
-
);
|
|
2896
|
-
if (!ref) return null;
|
|
2897
|
-
const name = ref[1];
|
|
2898
|
-
if (name === "async" || name === "function" || name === "await") return null;
|
|
2899
|
-
const safe = name.replace(/[$]/g, "\\$&");
|
|
2900
|
-
const declRe = new RegExp(
|
|
2901
|
-
"(?:^|\\n)(?:export\\s+)?(?:async\\s+)?function\\s+" +
|
|
2902
|
-
safe +
|
|
2903
|
-
"\\s*[(<]|(?:^|\\n)(?:export\\s+)?(?:const|let|var)\\s+" +
|
|
2904
|
-
safe +
|
|
2905
|
-
"\\b[^=\\n]*=",
|
|
2906
|
-
);
|
|
2907
|
-
const decl = declRe.exec(content);
|
|
2908
|
-
if (!decl) return null;
|
|
2909
|
-
const bodyStart = decl.index + decl[0].length;
|
|
2910
|
-
// the handler's code runs until the next top-level statement
|
|
2911
|
-
const next =
|
|
2912
|
-
/\n(?:export\s|async\s+function\s|function\s|const\s|let\s|var\s|class\s|interface\s|type\s)/.exec(
|
|
2913
|
-
content.slice(bodyStart),
|
|
2914
|
-
);
|
|
2915
|
-
const end = next ? bodyStart + next.index : content.length;
|
|
2916
|
-
return content.slice(decl.index, end);
|
|
2917
|
-
}
|
|
2918
|
-
|
|
2919
|
-
// For files that handle several HTTP methods: returns only the code that belongs to one method,
|
|
2920
|
-
// or null when it cannot be told apart safely (so no guess is made)
|
|
2921
|
-
function extractResponseFieldsForMethod(content, method, allMethods, style) {
|
|
2922
|
-
try {
|
|
2923
|
-
let segment = content;
|
|
2924
|
-
if (allMethods && allMethods.length > 1) {
|
|
2925
|
-
const markers = [];
|
|
2926
|
-
allMethods.forEach(function (m) {
|
|
2927
|
-
// Uses the same method checks as method detection, so the file is split consistently
|
|
2928
|
-
const index = findStaticMethodMarkerIndex(content, style, m);
|
|
2929
|
-
if (index !== -1) markers.push({ method: m, index: index });
|
|
2930
|
-
});
|
|
2931
|
-
const own = markers.find(function (x) {
|
|
2932
|
-
return x.method === method;
|
|
2933
|
-
});
|
|
2934
|
-
if (!own) return null;
|
|
2935
|
-
// handler declared elsewhere in the same file and exported through a wrapper
|
|
2936
|
-
if (style === "app") {
|
|
2937
|
-
const handlerCode = findStaticHandlerCode(content, own.index);
|
|
2938
|
-
if (handlerCode) return extractResponseFieldsFromSegment(handlerCode);
|
|
2939
|
-
}
|
|
2940
|
-
markers.sort(function (a, b) {
|
|
2941
|
-
return a.index - b.index;
|
|
2942
|
-
});
|
|
2943
|
-
const pos = markers.indexOf(own);
|
|
2944
|
-
const end =
|
|
2945
|
-
pos + 1 < markers.length ? markers[pos + 1].index : content.length;
|
|
2946
|
-
segment = content.slice(own.index, end);
|
|
2947
|
-
}
|
|
2948
|
-
return extractResponseFieldsFromSegment(segment);
|
|
2949
|
-
} catch (e) {
|
|
2950
|
-
return null;
|
|
2951
|
-
}
|
|
2952
|
-
}
|
|
2953
|
-
|
|
2954
|
-
// For route definitions in one file (app.get(...), router.post(...)): the code from this route
|
|
2955
|
-
// definition up to the next one
|
|
2956
|
-
function extractResponseFieldsForRoute(
|
|
2957
|
-
content,
|
|
2958
|
-
startIndex,
|
|
2959
|
-
routePatternSource,
|
|
2960
|
-
) {
|
|
2961
|
-
try {
|
|
2962
|
-
const re = new RegExp(routePatternSource, "gi");
|
|
2963
|
-
let end = content.length;
|
|
2964
|
-
let hit;
|
|
2965
|
-
while ((hit = re.exec(content)) !== null) {
|
|
2966
|
-
if (hit.index > startIndex) {
|
|
2967
|
-
end = hit.index;
|
|
2968
|
-
break;
|
|
2969
|
-
}
|
|
2970
|
-
}
|
|
2971
|
-
return extractResponseFieldsFromSegment(content.slice(startIndex, end));
|
|
2972
|
-
} catch (e) {
|
|
2973
|
-
return null;
|
|
2974
|
-
}
|
|
2975
|
-
}
|
|
2976
|
-
|
|
2977
|
-
// For live Express route handlers: reads the handler source, last handler first
|
|
2978
|
-
function extractResponseFieldsFromHandlers(stack, method) {
|
|
2979
|
-
try {
|
|
2980
|
-
for (let i = stack.length - 1; i >= 0; i--) {
|
|
2981
|
-
const layer = stack[i];
|
|
2982
|
-
if (layer.method && String(layer.method).toUpperCase() !== method)
|
|
2983
|
-
continue;
|
|
2984
|
-
const fn = layer.handle || layer;
|
|
2985
|
-
if (typeof fn !== "function") continue;
|
|
2986
|
-
const src = Function.prototype.toString.call(fn);
|
|
2987
|
-
const fields = extractResponseFieldsFromSegment(src);
|
|
2988
|
-
if (fields) return fields;
|
|
2989
|
-
}
|
|
2990
|
-
} catch (e) {}
|
|
2991
|
-
return null;
|
|
2992
|
-
}
|
|
2993
|
-
|
|
2994
|
-
module.exports = {
|
|
2995
|
-
scanExpressRoutes,
|
|
2996
|
-
scanNextJsRoutes,
|
|
2997
|
-
scanNextJsAppRoutes,
|
|
2998
|
-
extractPathParams,
|
|
2999
|
-
scanFrontendRoutes,
|
|
3000
|
-
scanFastifyRoutes,
|
|
3001
|
-
scanNestJsRoutes,
|
|
3002
|
-
scanKoaRoutes,
|
|
3003
|
-
scanHapiRoutes,
|
|
3004
|
-
scanAdonisRoutes,
|
|
3005
|
-
scanNuxtServerRoutes,
|
|
3006
|
-
scanSvelteKitServerRoutes,
|
|
3007
|
-
scanRemixServerRoutes,
|
|
3008
|
-
};
|