@js-recon/js-recon 1.4.3 → 2.0.1-alpha.1
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/.claude-sync/sync.sh +1 -1
- package/.github/workflows/build-and-prettify.yaml +55 -25
- package/.github/workflows/codeql.yml +33 -0
- package/.github/workflows/exploit-smoke-test.yaml +160 -0
- package/.github/workflows/framework-detection-smoke-test.yaml +135 -0
- package/.github/workflows/plumber.yml +20 -0
- package/.github/workflows/promote-js-recon.yml +5 -3
- package/.github/workflows/publish-js-recon.yml +6 -1
- package/.github/workflows/rules-smoke-test.yaml +15 -7
- package/.nvmrc +1 -0
- package/.plumber.yaml +151 -0
- package/CHANGELOG.md +54 -0
- package/CONTRIBUTING.md +32 -0
- package/Dockerfile +1 -0
- package/README.md +55 -2
- package/SECURITY.md +1 -1
- package/build/analyze/engine/astEngine.js +10 -9
- package/build/analyze/engine/astEngine.js.map +1 -1
- package/build/analyze/engine/csMastSEngine.js +6 -6
- package/build/analyze/engine/csMastSEngine.js.map +1 -1
- package/build/analyze/engine/index.js +1 -1
- package/build/analyze/engine/index.js.map +1 -1
- package/build/analyze/engine/requestEngine.js +6 -6
- package/build/analyze/engine/requestEngine.js.map +1 -1
- package/build/analyze/helpers/determineCompatibleVersion.js +70 -0
- package/build/analyze/helpers/determineCompatibleVersion.js.map +1 -0
- package/build/analyze/helpers/engineHelpers/findMemberExpressionAssignment.js +9 -3
- package/build/analyze/helpers/engineHelpers/findMemberExpressionAssignment.js.map +1 -1
- package/build/analyze/helpers/initRules.js +42 -24
- package/build/analyze/helpers/initRules.js.map +1 -1
- package/build/analyze/helpers/outputHelper.js +3 -3
- package/build/analyze/helpers/outputHelper.js.map +1 -1
- package/build/analyze/helpers/schemas.js +1 -0
- package/build/analyze/helpers/schemas.js.map +1 -1
- package/build/analyze/helpers/validate.js +9 -5
- package/build/analyze/helpers/validate.js.map +1 -1
- package/build/analyze/index.js +26 -16
- package/build/analyze/index.js.map +1 -1
- package/build/cliProgram.js +710 -0
- package/build/cliProgram.js.map +1 -0
- package/build/completion/index.js +245 -339
- package/build/completion/index.js.map +1 -1
- package/build/completion/introspect.js +17 -0
- package/build/completion/introspect.js.map +1 -0
- package/build/config/applicationConfig.js +494 -0
- package/build/config/applicationConfig.js.map +1 -0
- package/build/cs_mast/index.js +18 -17
- package/build/cs_mast/index.js.map +1 -1
- package/build/endpoints/gen_report/gen_json.js +2 -2
- package/build/endpoints/gen_report/gen_json.js.map +1 -1
- package/build/endpoints/gen_report/utility/iterate_n_store.js +1 -1
- package/build/endpoints/gen_report/utility/iterate_n_store.js.map +1 -1
- package/build/endpoints/index.js +12 -12
- package/build/endpoints/index.js.map +1 -1
- package/build/endpoints/next_js/client_jsFilesHref.js +3 -3
- package/build/endpoints/next_js/client_jsFilesHref.js.map +1 -1
- package/build/endpoints/next_js/client_jsonParse.js +4 -4
- package/build/endpoints/next_js/client_jsonParse.js.map +1 -1
- package/build/endpoints/next_js/client_mappedJsonFile.js +6 -6
- package/build/endpoints/next_js/client_mappedJsonFile.js.map +1 -1
- package/build/endpoints/next_js/client_subsequentRequests.js +5 -5
- package/build/endpoints/next_js/client_subsequentRequests.js.map +1 -1
- package/build/exploit/angular/cve-2026-68945.js +61 -0
- package/build/exploit/angular/cve-2026-68945.js.map +1 -0
- package/build/exploit/index.js +60 -0
- package/build/exploit/index.js.map +1 -0
- package/build/exploit/next/cve-2025-29927.js +65 -0
- package/build/exploit/next/cve-2025-29927.js.map +1 -0
- package/build/exploit/next/cve-2026-64645.js +51 -0
- package/build/exploit/next/cve-2026-64645.js.map +1 -0
- package/build/exploit/nuxt/cve-2026-71315.js +47 -0
- package/build/exploit/nuxt/cve-2026-71315.js.map +1 -0
- package/build/exploit/nuxt/cve-2026-71320.js +114 -0
- package/build/exploit/nuxt/cve-2026-71320.js.map +1 -0
- package/build/exploit/react/cve-2025-55182.js +116 -0
- package/build/exploit/react/cve-2025-55182.js.map +1 -0
- package/build/exploit/registry/cveRegistry.js +115 -0
- package/build/exploit/registry/cveRegistry.js.map +1 -0
- package/build/exploit/types.js +2 -0
- package/build/exploit/types.js.map +1 -0
- package/build/exploit/utility/compareResponses.js +29 -0
- package/build/exploit/utility/compareResponses.js.map +1 -0
- package/build/exploit/utility/outputHelper.js +22 -0
- package/build/exploit/utility/outputHelper.js.map +1 -0
- package/build/exploit/utility/rawRequest.js +54 -0
- package/build/exploit/utility/rawRequest.js.map +1 -0
- package/build/exploit/utility/sandboxRce.js +49 -0
- package/build/exploit/utility/sandboxRce.js.map +1 -0
- package/build/exploit/utility/toEngineOutput.js +28 -0
- package/build/exploit/utility/toEngineOutput.js.map +1 -0
- package/build/exploit/utility/wsClient.js +78 -0
- package/build/exploit/utility/wsClient.js.map +1 -0
- package/build/exploit/vite/cve-2025-30208.js +44 -0
- package/build/exploit/vite/cve-2025-30208.js.map +1 -0
- package/build/exploit/vite/cve-2026-39363.js +60 -0
- package/build/exploit/vite/cve-2026-39363.js.map +1 -0
- package/build/fingerprint/index.js +11 -21
- package/build/fingerprint/index.js.map +1 -1
- package/build/globalConfig.js +2 -2
- package/build/globalConfig.js.map +1 -1
- package/build/index.js +16 -555
- package/build/index.js.map +1 -1
- package/build/lazyLoad/angular/angular_getFromPageSource.js +3 -3
- package/build/lazyLoad/angular/angular_getFromPageSource.js.map +1 -1
- package/build/lazyLoad/downloadFilesUtil.js +51 -40
- package/build/lazyLoad/downloadFilesUtil.js.map +1 -1
- package/build/lazyLoad/downloadQueue.js +154 -50
- package/build/lazyLoad/downloadQueue.js.map +1 -1
- package/build/lazyLoad/downloadResponse.js +113 -0
- package/build/lazyLoad/downloadResponse.js.map +1 -0
- package/build/lazyLoad/generic/generic_crawlPages.js +186 -0
- package/build/lazyLoad/generic/generic_crawlPages.js.map +1 -0
- package/build/lazyLoad/generic/generic_downloadFiles.js +81 -0
- package/build/lazyLoad/generic/generic_downloadFiles.js.map +1 -0
- package/build/lazyLoad/generic/generic_extractLinks.js +79 -0
- package/build/lazyLoad/generic/generic_extractLinks.js.map +1 -0
- package/build/lazyLoad/generic/generic_getScriptTags.js +152 -0
- package/build/lazyLoad/generic/generic_getScriptTags.js.map +1 -0
- package/build/lazyLoad/generic/generic_importMapDiscovery.js +87 -0
- package/build/lazyLoad/generic/generic_importMapDiscovery.js.map +1 -0
- package/build/lazyLoad/generic/generic_resolveScope.js +61 -0
- package/build/lazyLoad/generic/generic_resolveScope.js.map +1 -0
- package/build/lazyLoad/generic/generic_scanAttributesForJs.js +122 -0
- package/build/lazyLoad/generic/generic_scanAttributesForJs.js.map +1 -0
- package/build/lazyLoad/generic/generic_stringsDiscovery.js +103 -0
- package/build/lazyLoad/generic/generic_stringsDiscovery.js.map +1 -0
- package/build/lazyLoad/generic/generic_webpackChunkPaths.js +56 -0
- package/build/lazyLoad/generic/generic_webpackChunkPaths.js.map +1 -0
- package/build/lazyLoad/globals.js +35 -0
- package/build/lazyLoad/globals.js.map +1 -1
- package/build/lazyLoad/index.js +311 -175
- package/build/lazyLoad/index.js.map +1 -1
- package/build/lazyLoad/methodFilter.js +2 -0
- package/build/lazyLoad/methodFilter.js.map +1 -1
- package/build/lazyLoad/next_js/NextJsCrawler.js +39 -14
- package/build/lazyLoad/next_js/NextJsCrawler.js.map +1 -1
- package/build/lazyLoad/next_js/next_GetJSScript.js +3 -3
- package/build/lazyLoad/next_js/next_GetJSScript.js.map +1 -1
- package/build/lazyLoad/next_js/next_GetLazyResourcesBuildManifestJs.js +4 -4
- package/build/lazyLoad/next_js/next_GetLazyResourcesBuildManifestJs.js.map +1 -1
- package/build/lazyLoad/next_js/next_GetLazyResourcesWebpackJs.js +21 -20
- package/build/lazyLoad/next_js/next_GetLazyResourcesWebpackJs.js.map +1 -1
- package/build/lazyLoad/next_js/next_SubsequentRequests.js +100 -99
- package/build/lazyLoad/next_js/next_SubsequentRequests.js.map +1 -1
- package/build/lazyLoad/next_js/next_bruteForceJsFiles.js +1 -1
- package/build/lazyLoad/next_js/next_bruteForceJsFiles.js.map +1 -1
- package/build/lazyLoad/next_js/next_buildId.js +2 -2
- package/build/lazyLoad/next_js/next_buildId.js.map +1 -1
- package/build/lazyLoad/next_js/next_getClientSidePaths.js +2 -2
- package/build/lazyLoad/next_js/next_getClientSidePaths.js.map +1 -1
- package/build/lazyLoad/next_js/next_parseLayoutJs.js +6 -6
- package/build/lazyLoad/next_js/next_parseLayoutJs.js.map +1 -1
- package/build/lazyLoad/next_js/next_promiseResolve.js +1 -1
- package/build/lazyLoad/next_js/next_promiseResolve.js.map +1 -1
- package/build/lazyLoad/next_js/next_routerStateForge.js +341 -0
- package/build/lazyLoad/next_js/next_routerStateForge.js.map +1 -0
- package/build/lazyLoad/next_js/next_scriptTagsSubsequentRequests.js +1 -1
- package/build/lazyLoad/next_js/next_scriptTagsSubsequentRequests.js.map +1 -1
- package/build/lazyLoad/next_js/next_serverActionIdScan.js +77 -0
- package/build/lazyLoad/next_js/next_serverActionIdScan.js.map +1 -0
- package/build/lazyLoad/nuxt_js/nuxt_astParse.js +15 -13
- package/build/lazyLoad/nuxt_js/nuxt_astParse.js.map +1 -1
- package/build/lazyLoad/nuxt_js/nuxt_getBuildsManifest.js +2 -2
- package/build/lazyLoad/nuxt_js/nuxt_getBuildsManifest.js.map +1 -1
- package/build/lazyLoad/nuxt_js/nuxt_getFromPageSource.js +3 -3
- package/build/lazyLoad/nuxt_js/nuxt_getFromPageSource.js.map +1 -1
- package/build/lazyLoad/nuxt_js/nuxt_stringAnalysisJSFiles.js +2 -2
- package/build/lazyLoad/nuxt_js/nuxt_stringAnalysisJSFiles.js.map +1 -1
- package/build/lazyLoad/outputPath.js +92 -0
- package/build/lazyLoad/outputPath.js.map +1 -0
- package/build/lazyLoad/react/react_followImports.js +15 -5
- package/build/lazyLoad/react/react_followImports.js.map +1 -1
- package/build/lazyLoad/react/react_getScriptTags.js +11 -6
- package/build/lazyLoad/react/react_getScriptTags.js.map +1 -1
- package/build/lazyLoad/react/react_sourcemapUrls.js +3 -2
- package/build/lazyLoad/react/react_sourcemapUrls.js.map +1 -1
- package/build/lazyLoad/react/react_webpackChunkPaths.js +12 -203
- package/build/lazyLoad/react/react_webpackChunkPaths.js.map +1 -1
- package/build/lazyLoad/researchUtils.js +15 -0
- package/build/lazyLoad/researchUtils.js.map +1 -0
- package/build/lazyLoad/shared/webpackChunkParsers.js +218 -0
- package/build/lazyLoad/shared/webpackChunkParsers.js.map +1 -0
- package/build/lazyLoad/stagnation/stagnationMonitor.js +63 -0
- package/build/lazyLoad/stagnation/stagnationMonitor.js.map +1 -0
- package/build/lazyLoad/svelte/svelte_discoverPagesFromJs.js +1 -0
- package/build/lazyLoad/svelte/svelte_discoverPagesFromJs.js.map +1 -1
- package/build/lazyLoad/svelte/svelte_getFromPageSource.js +5 -5
- package/build/lazyLoad/svelte/svelte_getFromPageSource.js.map +1 -1
- package/build/lazyLoad/svelte/svelte_getVersionJson.js +2 -2
- package/build/lazyLoad/svelte/svelte_getVersionJson.js.map +1 -1
- package/build/lazyLoad/svelte/svelte_recursivePageCrawl.js +6 -6
- package/build/lazyLoad/svelte/svelte_recursivePageCrawl.js.map +1 -1
- package/build/lazyLoad/svelte/svelte_stringAnalysisJSFiles.js +2 -2
- package/build/lazyLoad/svelte/svelte_stringAnalysisJSFiles.js.map +1 -1
- package/build/lazyLoad/techDetect/checkAngularJS.js +1 -1
- package/build/lazyLoad/techDetect/checkAngularJS.js.map +1 -1
- package/build/lazyLoad/techDetect/checkNuxtJS.js +3 -3
- package/build/lazyLoad/techDetect/checkNuxtJS.js.map +1 -1
- package/build/lazyLoad/techDetect/checkSvelte.js +0 -1
- package/build/lazyLoad/techDetect/checkSvelte.js.map +1 -1
- package/build/lazyLoad/techDetect/checkVueJS.js +6 -6
- package/build/lazyLoad/techDetect/checkVueJS.js.map +1 -1
- package/build/lazyLoad/techDetect/index.js +106 -60
- package/build/lazyLoad/techDetect/index.js.map +1 -1
- package/build/lazyLoad/vue/vue_RuntimeJs.js +20 -15
- package/build/lazyLoad/vue/vue_RuntimeJs.js.map +1 -1
- package/build/lazyLoad/vue/vue_SingleJsFileOnHome.js +10 -5
- package/build/lazyLoad/vue/vue_SingleJsFileOnHome.js.map +1 -1
- package/build/lazyLoad/vue/vue_discoverJsFiles.js +20 -17
- package/build/lazyLoad/vue/vue_discoverJsFiles.js.map +1 -1
- package/build/lazyLoad/vue/vue_getClientSidePaths.js +70 -46
- package/build/lazyLoad/vue/vue_getClientSidePaths.js.map +1 -1
- package/build/lazyLoad/vue/vue_jsImports.js +3 -2
- package/build/lazyLoad/vue/vue_jsImports.js.map +1 -1
- package/build/lazyLoad/vue/vue_pageSrc.js +3 -2
- package/build/lazyLoad/vue/vue_pageSrc.js.map +1 -1
- package/build/lazyLoad/vue/vue_reconstructSourceMaps.js +6 -5
- package/build/lazyLoad/vue/vue_reconstructSourceMaps.js.map +1 -1
- package/build/lazyLoad/vue/vue_recursiveClientSidePathDownload.js +10 -21
- package/build/lazyLoad/vue/vue_recursiveClientSidePathDownload.js.map +1 -1
- package/build/lazyLoad/vue/vue_severalJsFilesHome.js +5 -4
- package/build/lazyLoad/vue/vue_severalJsFilesHome.js.map +1 -1
- package/build/lazyLoad/vue/vue_stringJsFiles.js +28 -25
- package/build/lazyLoad/vue/vue_stringJsFiles.js.map +1 -1
- package/build/lazyLoad/vue/vue_viteMapDeps.js +8 -2
- package/build/lazyLoad/vue/vue_viteMapDeps.js.map +1 -1
- package/build/load/index.js +8 -7
- package/build/load/index.js.map +1 -1
- package/build/map/angular_js/getAngularConnections.js +6 -6
- package/build/map/angular_js/getAngularConnections.js.map +1 -1
- package/build/map/graphql/resolveGraphql.js +6 -6
- package/build/map/graphql/resolveGraphql.js.map +1 -1
- package/build/map/index.js +17 -17
- package/build/map/index.js.map +1 -1
- package/build/map/interactive-mode/commandHandler.js +278 -0
- package/build/map/interactive-mode/commandHandler.js.map +1 -0
- package/build/map/interactive-mode/commandHelpers.js +189 -0
- package/build/map/interactive-mode/commandHelpers.js.map +1 -0
- package/build/map/interactive-mode/esqueryGen.js.map +1 -0
- package/build/map/interactive-mode/helpMenu.js +11 -0
- package/build/map/interactive-mode/helpMenu.js.map +1 -0
- package/build/map/interactive-mode/inputPatch.js.map +1 -0
- package/build/map/interactive-mode/interactive.js +71 -0
- package/build/map/interactive-mode/interactive.js.map +1 -0
- package/build/map/interactive-mode/keybindings.js.map +1 -0
- package/build/map/interactive-mode/printer.js.map +1 -0
- package/build/map/interactive-mode/ui.js.map +1 -0
- package/build/map/next_js/getAxiosInstances.js +5 -5
- package/build/map/next_js/getAxiosInstances.js.map +1 -1
- package/build/map/next_js/getExports.js +4 -4
- package/build/map/next_js/getExports.js.map +1 -1
- package/build/map/next_js/getFetchInstances.js +10 -10
- package/build/map/next_js/getFetchInstances.js.map +1 -1
- package/build/map/next_js/getTurbopackConnections.js +8 -8
- package/build/map/next_js/getTurbopackConnections.js.map +1 -1
- package/build/map/next_js/getWebpackConnections.js +27 -16
- package/build/map/next_js/getWebpackConnections.js.map +1 -1
- package/build/map/next_js/interactive.js +3 -65
- package/build/map/next_js/interactive.js.map +1 -1
- package/build/map/next_js/interactive_helpers/commandHandler.js +38 -290
- package/build/map/next_js/interactive_helpers/commandHandler.js.map +1 -1
- package/build/map/next_js/interactive_helpers/commandHelpers.js +0 -184
- package/build/map/next_js/interactive_helpers/commandHelpers.js.map +1 -1
- package/build/map/next_js/interactive_helpers/helpMenu.js +2 -10
- package/build/map/next_js/interactive_helpers/helpMenu.js.map +1 -1
- package/build/map/next_js/resolveAxios.js +6 -6
- package/build/map/next_js/resolveAxios.js.map +1 -1
- package/build/map/next_js/resolveAxiosHelpers/findAxiosClients.js +4 -4
- package/build/map/next_js/resolveAxiosHelpers/findAxiosClients.js.map +1 -1
- package/build/map/next_js/resolveAxiosHelpers/findAxiosInstance.js +2 -2
- package/build/map/next_js/resolveAxiosHelpers/findAxiosInstance.js.map +1 -1
- package/build/map/next_js/resolveAxiosHelpers/findCrossChunkParams.js +5 -5
- package/build/map/next_js/resolveAxiosHelpers/findCrossChunkParams.js.map +1 -1
- package/build/map/next_js/resolveAxiosHelpers/handleAxiosCreate.js +10 -10
- package/build/map/next_js/resolveAxiosHelpers/handleAxiosCreate.js.map +1 -1
- package/build/map/next_js/resolveAxiosHelpers/handleZDotCreate.js +13 -9
- package/build/map/next_js/resolveAxiosHelpers/handleZDotCreate.js.map +1 -1
- package/build/map/next_js/resolveAxiosHelpers/processAxiosCall.js +12 -8
- package/build/map/next_js/resolveAxiosHelpers/processAxiosCall.js.map +1 -1
- package/build/map/next_js/resolveAxiosHelpers/processDirectAxiosCall.js +12 -8
- package/build/map/next_js/resolveAxiosHelpers/processDirectAxiosCall.js.map +1 -1
- package/build/map/next_js/resolveAxiosHelpers/processExportedEndpoints.js +11 -11
- package/build/map/next_js/resolveAxiosHelpers/processExportedEndpoints.js.map +1 -1
- package/build/map/next_js/resolveAxiosHelpers/traceAxiosInstanceExports.js +16 -16
- package/build/map/next_js/resolveAxiosHelpers/traceAxiosInstanceExports.js.map +1 -1
- package/build/map/next_js/resolveFetch.js +23 -23
- package/build/map/next_js/resolveFetch.js.map +1 -1
- package/build/map/next_js/resolveNewRequest.js +10 -10
- package/build/map/next_js/resolveNewRequest.js.map +1 -1
- package/build/map/next_js/resolveServerActions.js +4 -4
- package/build/map/next_js/resolveServerActions.js.map +1 -1
- package/build/map/next_js/utils.js +8 -2
- package/build/map/next_js/utils.js.map +1 -1
- package/build/map/react_js/getReactConnections.js +21 -14
- package/build/map/react_js/getReactConnections.js.map +1 -1
- package/build/map/svelte_js/interactive.js +3 -54
- package/build/map/svelte_js/interactive.js.map +1 -1
- package/build/map/vue_js/getViteConnections.js +23 -16
- package/build/map/vue_js/getViteConnections.js.map +1 -1
- package/build/map/vue_js/interactive.js +3 -63
- package/build/map/vue_js/interactive.js.map +1 -1
- package/build/map/vue_js/interactive_helpers/commandHandler.js +34 -283
- package/build/map/vue_js/interactive_helpers/commandHandler.js.map +1 -1
- package/build/map/vue_js/interactive_helpers/helpMenu.js +2 -10
- package/build/map/vue_js/interactive_helpers/helpMenu.js.map +1 -1
- package/build/map/vue_js/taint_utils.js +1 -1
- package/build/map/vue_js/taint_utils.js.map +1 -1
- package/build/map/vue_js/vue_resolveFetch.js +12 -12
- package/build/map/vue_js/vue_resolveFetch.js.map +1 -1
- package/build/map/vue_js/vue_resolveHttpClient.js +18 -18
- package/build/map/vue_js/vue_resolveHttpClient.js.map +1 -1
- package/build/map/vue_js/vue_resolveXhr.js +11 -11
- package/build/map/vue_js/vue_resolveXhr.js.map +1 -1
- package/build/mcp/chatOneShot.js +7 -7
- package/build/mcp/chatOneShot.js.map +1 -1
- package/build/mcp/claudeCodeCreds.js +5 -5
- package/build/mcp/claudeCodeCreds.js.map +1 -1
- package/build/mcp/cli.js +36 -35
- package/build/mcp/cli.js.map +1 -1
- package/build/mcp/config.js +4 -4
- package/build/mcp/config.js.map +1 -1
- package/build/mcp/index.js +7 -7
- package/build/mcp/index.js.map +1 -1
- package/build/mcp/mcpServer.js +3 -2
- package/build/mcp/mcpServer.js.map +1 -1
- package/build/mcp/skills.js +1 -0
- package/build/mcp/skills.js.map +1 -1
- package/build/mcp/tools.js +5 -4
- package/build/mcp/tools.js.map +1 -1
- package/build/proxy/checkFeasibility.js +8 -4
- package/build/proxy/checkFeasibility.js.map +1 -1
- package/build/proxy/checkFireWallBlocking.js +23 -13
- package/build/proxy/checkFireWallBlocking.js.map +1 -1
- package/build/proxy/detectBlockedResponse.js +205 -0
- package/build/proxy/detectBlockedResponse.js.map +1 -0
- package/build/proxy/genReq.js +434 -127
- package/build/proxy/genReq.js.map +1 -1
- package/build/proxy/index.js +3 -3
- package/build/proxy/index.js.map +1 -1
- package/build/proxy/oxylabsFallback.js +110 -0
- package/build/proxy/oxylabsFallback.js.map +1 -0
- package/build/proxy/proxyFeasibilityRequest.js +11 -9
- package/build/proxy/proxyFeasibilityRequest.js.map +1 -1
- package/build/refactor/index.js +83 -79
- package/build/refactor/index.js.map +1 -1
- package/build/refactor/next/index.js +69 -26
- package/build/refactor/next/index.js.map +1 -1
- package/build/refactor/next/transform.js +11 -4
- package/build/refactor/next/transform.js.map +1 -1
- package/build/refactor/next/validator.js +7 -7
- package/build/refactor/next/validator.js.map +1 -1
- package/build/refactor/react/index.js +13 -13
- package/build/refactor/react/index.js.map +1 -1
- package/build/refactor/react/validator.js +7 -7
- package/build/refactor/react/validator.js.map +1 -1
- package/build/refactor/react-vite/index.js +3 -3
- package/build/refactor/react-vite/index.js.map +1 -1
- package/build/refactor/remote/hf-client.js +1 -0
- package/build/refactor/remote/hf-client.js.map +1 -1
- package/build/refactor/remote/version-detect.js +12 -12
- package/build/refactor/remote/version-detect.js.map +1 -1
- package/build/refactor/vue/index.js +6 -6
- package/build/refactor/vue/index.js.map +1 -1
- package/build/refactor/vue/vite.js +6 -6
- package/build/refactor/vue/vite.js.map +1 -1
- package/build/report/index.js +30 -8
- package/build/report/index.js.map +1 -1
- package/build/report/swaggerJacker.js +63 -0
- package/build/report/swaggerJacker.js.map +1 -0
- package/build/report/utility/genHtml.js +7 -7
- package/build/report/utility/genHtml.js.map +1 -1
- package/build/report/utility/populateDb/populateAnalysisFindings.js +2 -2
- package/build/report/utility/populateDb/populateAnalysisFindings.js.map +1 -1
- package/build/report/utility/populateDb/populateEndpoints.js +3 -3
- package/build/report/utility/populateDb/populateEndpoints.js.map +1 -1
- package/build/report/utility/populateDb/populateMappedJson.js +2 -2
- package/build/report/utility/populateDb/populateMappedJson.js.map +1 -1
- package/build/report/utility/populateDb/populateMappedOpenapi.js +3 -3
- package/build/report/utility/populateDb/populateMappedOpenapi.js.map +1 -1
- package/build/run/bundler-detect.js +45 -9
- package/build/run/bundler-detect.js.map +1 -1
- package/build/run/cancellableStep.js +27 -0
- package/build/run/cancellableStep.js.map +1 -0
- package/build/run/dashboard/dashboardHtml.js +150 -0
- package/build/run/dashboard/dashboardHtml.js.map +1 -0
- package/build/run/dashboard/fsBrowser.js +43 -0
- package/build/run/dashboard/fsBrowser.js.map +1 -0
- package/build/run/dashboard/server.js +123 -0
- package/build/run/dashboard/server.js.map +1 -0
- package/build/run/dashboard/state.js +97 -0
- package/build/run/dashboard/state.js.map +1 -0
- package/build/run/index.js +239 -204
- package/build/run/index.js.map +1 -1
- package/build/run/interruptHandler.js +18 -0
- package/build/run/interruptHandler.js.map +1 -1
- package/build/run/outputDirectory.js +377 -0
- package/build/run/outputDirectory.js.map +1 -0
- package/build/sourcemaps/index.js +116 -29
- package/build/sourcemaps/index.js.map +1 -1
- package/build/strings/index.js +38 -28
- package/build/strings/index.js.map +1 -1
- package/build/strings/openapi.js +4 -4
- package/build/strings/openapi.js.map +1 -1
- package/build/strings/permutate.js +4 -4
- package/build/strings/permutate.js.map +1 -1
- package/build/strings/secrets.js +1 -0
- package/build/strings/secrets.js.map +1 -1
- package/build/strings/trufflehog.js +66 -19
- package/build/strings/trufflehog.js.map +1 -1
- package/build/strings/trufflehogConfig.js +36 -0
- package/build/strings/trufflehogConfig.js.map +1 -0
- package/build/strings/trufflehogDownload.js +115 -0
- package/build/strings/trufflehogDownload.js.map +1 -0
- package/build/utility/ai.js +33 -4
- package/build/utility/ai.js.map +1 -1
- package/build/utility/banner.js +4 -3
- package/build/utility/banner.js.map +1 -1
- package/build/utility/configureSandbox.js +2 -2
- package/build/utility/configureSandbox.js.map +1 -1
- package/build/utility/downloadProgress.js +99 -0
- package/build/utility/downloadProgress.js.map +1 -0
- package/build/utility/globals.js +19 -11
- package/build/utility/globals.js.map +1 -1
- package/build/utility/heap.js +2 -1
- package/build/utility/heap.js.map +1 -1
- package/build/utility/makeReq.js +490 -257
- package/build/utility/makeReq.js.map +1 -1
- package/build/utility/openapiGenerator.js +2 -2
- package/build/utility/openapiGenerator.js.map +1 -1
- package/build/utility/printMsg.js +53 -0
- package/build/utility/printMsg.js.map +1 -0
- package/build/utility/progressLog.js +68 -7
- package/build/utility/progressLog.js.map +1 -1
- package/build/utility/resolvePath.js +2 -1
- package/build/utility/resolvePath.js.map +1 -1
- package/build/utility/ruleVersionMap.js +73 -0
- package/build/utility/ruleVersionMap.js.map +1 -0
- package/build/utility/targetInputs.js +177 -0
- package/build/utility/targetInputs.js.map +1 -0
- package/build/utility/urlUtils.js +37 -1
- package/build/utility/urlUtils.js.map +1 -1
- package/config.dist.yaml +251 -0
- package/contributing/testing.md +106 -0
- package/eslint.config.js +24 -0
- package/package.json +22 -5
- package/scripts/exploit-smoke-test.js +82 -0
- package/scripts/framework-detect-smoke-test.js +64 -0
- package/scripts/postinstall-completion.mjs +40 -0
- package/scripts/smoke-test.js +12 -0
- package/build/lazyLoad/downloadLoadedJsUtil.js +0 -98
- package/build/lazyLoad/downloadLoadedJsUtil.js.map +0 -1
- package/build/map/next_js/interactive_helpers/esqueryGen.js.map +0 -1
- package/build/map/next_js/interactive_helpers/inputPatch.js.map +0 -1
- package/build/map/next_js/interactive_helpers/keybindings.js.map +0 -1
- package/build/map/next_js/interactive_helpers/printer.js.map +0 -1
- package/build/map/next_js/interactive_helpers/ui.js.map +0 -1
- /package/build/map/{next_js/interactive_helpers → interactive-mode}/esqueryGen.js +0 -0
- /package/build/map/{next_js/interactive_helpers → interactive-mode}/inputPatch.js +0 -0
- /package/build/map/{next_js/interactive_helpers → interactive-mode}/keybindings.js +0 -0
- /package/build/map/{next_js/interactive_helpers → interactive-mode}/printer.js +0 -0
- /package/build/map/{next_js/interactive_helpers → interactive-mode}/ui.js +0 -0
package/build/refactor/index.js
CHANGED
|
@@ -7,11 +7,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import chalk from "chalk";
|
|
11
10
|
import fs from "fs";
|
|
12
11
|
import path from "path";
|
|
13
12
|
import { execSync } from "child_process";
|
|
14
13
|
import prettier from "prettier";
|
|
14
|
+
import { printMsg, MSG } from "../utility/printMsg.js";
|
|
15
15
|
// Next.js
|
|
16
16
|
import refactorNext, { refactorNextWebpack } from "./next/index.js";
|
|
17
17
|
// React
|
|
@@ -66,6 +66,7 @@ const BASELINE_SCAT_DIR = {
|
|
|
66
66
|
"react-webpack": "lit-decl-loop-cond",
|
|
67
67
|
"react-vite": "lit-decl-loop-cond",
|
|
68
68
|
"next-webpack": "lit-decl-loop-cond",
|
|
69
|
+
"next-turbopack": "lit-decl-loop-cond",
|
|
69
70
|
};
|
|
70
71
|
// Canonical ordering of scat categories (matches ALL_SCAT_CATEGORIES in csmast.mjs).
|
|
71
72
|
// Used when converting a user-supplied --scat list to a bucket directory name.
|
|
@@ -168,34 +169,34 @@ const loadRemoteLibSigs = (tech, opts) => __awaiter(void 0, void 0, void 0, func
|
|
|
168
169
|
const config = loadRefactorConfig();
|
|
169
170
|
const configWarnings = validateRefactorConfig(config);
|
|
170
171
|
for (const w of configWarnings) {
|
|
171
|
-
|
|
172
|
+
printMsg(MSG.Warn, `[!] Refactor config warning: ${w}`);
|
|
172
173
|
}
|
|
173
174
|
// Validate cache files.
|
|
174
175
|
const cacheWarnings = validateCaches();
|
|
175
176
|
for (const w of cacheWarnings) {
|
|
176
|
-
|
|
177
|
+
printMsg(MSG.Warn, `[!] Cache validation warning: ${w} (will refresh)`);
|
|
177
178
|
}
|
|
178
179
|
if (opts.remoteCollisions) {
|
|
179
180
|
// User-supplied path: validate it exists in the HF bucket.
|
|
180
|
-
|
|
181
|
+
printMsg(MSG.Header, `[i] Validating remote dataset path "${branch}"...`);
|
|
181
182
|
const pathExists = yield validateRemotePath(branch);
|
|
182
183
|
if (!pathExists) {
|
|
183
|
-
|
|
184
|
+
printMsg(MSG.Err, `[!] Remote dataset path "${branch}" not found in the shriyanss/cs-mast-s-dataset bucket.`);
|
|
184
185
|
process.exit(25);
|
|
185
186
|
}
|
|
186
187
|
}
|
|
187
188
|
else {
|
|
188
189
|
// Auto-detected branch: validate metadata files exist.
|
|
189
|
-
|
|
190
|
+
printMsg(MSG.Header, `[i] Validating remote bucket prefix "${branch}"...`);
|
|
190
191
|
const branchOk = yield validateRemoteBranch(branch);
|
|
191
192
|
if (!branchOk) {
|
|
192
|
-
|
|
193
|
+
printMsg(MSG.Err, `[!] Remote bucket prefix "${branch}" is missing required metadata (sample_size / technology). Skipping remote signatures.`);
|
|
193
194
|
return null;
|
|
194
195
|
}
|
|
195
196
|
// Verify the bucket prefix technology matches.
|
|
196
197
|
const remoteTech = yield getTechnology(branch);
|
|
197
198
|
if (remoteTech !== tech) {
|
|
198
|
-
|
|
199
|
+
printMsg(MSG.Err, `[!] Remote bucket prefix "${branch}" is for technology "${remoteTech}", not "${tech}". Skipping remote signatures.`);
|
|
199
200
|
return null;
|
|
200
201
|
}
|
|
201
202
|
}
|
|
@@ -219,23 +220,23 @@ const loadRemoteLibSigs = (tech, opts) => __awaiter(void 0, void 0, void 0, func
|
|
|
219
220
|
let listCache = cacheWarnings.length > 0 ? null : loadListCache();
|
|
220
221
|
const branchMissingFromCache = !(listCache === null || listCache === void 0 ? void 0 : listCache.branches[branch]);
|
|
221
222
|
if (shouldRefreshListCache(listCache, opts) || branchMissingFromCache) {
|
|
222
|
-
|
|
223
|
+
printMsg(MSG.Header, `[i] Refreshing remote file list cache for bucket prefix "${branch}"...`);
|
|
223
224
|
const paths = yield listCollisionsFiles(branch, scatDir);
|
|
224
225
|
const now = Date.now();
|
|
225
226
|
const branches = (_b = listCache === null || listCache === void 0 ? void 0 : listCache.branches) !== null && _b !== void 0 ? _b : {};
|
|
226
227
|
branches[branch] = paths;
|
|
227
228
|
listCache = { generatedAt: now, branches };
|
|
228
229
|
saveListCache(listCache);
|
|
229
|
-
|
|
230
|
+
printMsg(MSG.Header, `[i] File list cache updated: ${paths.length} files found`);
|
|
230
231
|
}
|
|
231
232
|
const filePaths = (_c = listCache === null || listCache === void 0 ? void 0 : listCache.branches[branch]) !== null && _c !== void 0 ? _c : [];
|
|
232
233
|
// Filter to only paths that match <something>/<scatDir>/collisions.json
|
|
233
234
|
const matchingPaths = filePaths.filter((p) => p.endsWith(`/${scatDir}/collisions.json`));
|
|
234
235
|
if (matchingPaths.length === 0) {
|
|
235
|
-
|
|
236
|
+
printMsg(MSG.Warn, `[!] No remote collisions files found for scat "${scatDir}" in branch "${branch}"`);
|
|
236
237
|
return null;
|
|
237
238
|
}
|
|
238
|
-
|
|
239
|
+
printMsg(MSG.Header, `[i] Loading ${matchingPaths.length} remote signature files (quality threshold: ${opts.signatureQuality}%)...`);
|
|
239
240
|
// Content-based cache validation: fetch the upstream tree's per-file hashes once per
|
|
240
241
|
// branch so each cache entry below can be checked against current dataset content
|
|
241
242
|
// instead of trusting its local age alone. Skipped entirely under --skip-cache-checks.
|
|
@@ -248,7 +249,7 @@ const loadRemoteLibSigs = (tech, opts) => __awaiter(void 0, void 0, void 0, func
|
|
|
248
249
|
remoteHashes = yield listCollisionsFileHashes(branch, scatDir);
|
|
249
250
|
}
|
|
250
251
|
catch (e) {
|
|
251
|
-
|
|
252
|
+
printMsg(MSG.Warn, `[!] Could not fetch upstream content hashes for cache validation (${e.message}) — falling back to age-based cache checks.`);
|
|
252
253
|
}
|
|
253
254
|
}
|
|
254
255
|
let intersection = null;
|
|
@@ -271,7 +272,7 @@ const loadRemoteLibSigs = (tech, opts) => __awaiter(void 0, void 0, void 0, func
|
|
|
271
272
|
// For auto-detected branches, invalidate the list cache so a stale
|
|
272
273
|
// entry (e.g. a deleted file) is not tried again on the next run.
|
|
273
274
|
if (!opts.remoteCollisions && !opts.skipCacheChecks) {
|
|
274
|
-
|
|
275
|
+
printMsg(MSG.Warn, `[!] Could not fetch ${relPath} (404 or error) — refreshing list cache`);
|
|
275
276
|
const freshPaths = yield listCollisionsFiles(branch, scatDir);
|
|
276
277
|
const updatedBranches = (_e = listCache === null || listCache === void 0 ? void 0 : listCache.branches) !== null && _e !== void 0 ? _e : {};
|
|
277
278
|
updatedBranches[branch] = freshPaths;
|
|
@@ -279,7 +280,7 @@ const loadRemoteLibSigs = (tech, opts) => __awaiter(void 0, void 0, void 0, func
|
|
|
279
280
|
listCache = { generatedAt: Date.now(), branches: updatedBranches };
|
|
280
281
|
}
|
|
281
282
|
else {
|
|
282
|
-
|
|
283
|
+
printMsg(MSG.Warn, `[!] Could not fetch ${relPath} — skipping`);
|
|
283
284
|
}
|
|
284
285
|
continue;
|
|
285
286
|
}
|
|
@@ -307,12 +308,12 @@ const loadRemoteLibSigs = (tech, opts) => __awaiter(void 0, void 0, void 0, func
|
|
|
307
308
|
loadedCount++;
|
|
308
309
|
}
|
|
309
310
|
if (!intersection || intersection.size === 0) {
|
|
310
|
-
|
|
311
|
+
printMsg(MSG.Err, `[!] Remote signatures loaded but intersection is empty — library stripping will find nothing to skip ` +
|
|
311
312
|
`(quality threshold may be too high, or every dataset entry fetched 0 records). ` +
|
|
312
|
-
`If this is unexpected, purge ~/.js-recon/refactor/{signature_cache,cs-mast-s-list-cache.json} and retry.`)
|
|
313
|
+
`If this is unexpected, purge ~/.js-recon/refactor/{signature_cache,cs-mast-s-list-cache.json} and retry.`);
|
|
313
314
|
return null;
|
|
314
315
|
}
|
|
315
|
-
|
|
316
|
+
printMsg(MSG.Header, `[i] Loaded ${intersection.size} library signatures from remote (${loadedCount} files, bucket prefix: ${branch})`);
|
|
316
317
|
return { sigs: intersection, desc: `remote:${branch} (${loadedCount} files, quality>=${opts.signatureQuality}%)` };
|
|
317
318
|
});
|
|
318
319
|
const availableTechs = {
|
|
@@ -346,7 +347,7 @@ function runBuildCheck(outputDir, writtenFiles, detectedVersion) {
|
|
|
346
347
|
}
|
|
347
348
|
})) !== null && _a !== void 0 ? _a : writtenFiles[0];
|
|
348
349
|
const entryRelative = `./${path.basename(entryFile)}`;
|
|
349
|
-
|
|
350
|
+
printMsg(MSG.Header, `[i] Setting up webpack build check in ${outputDir}/ (entry: ${entryRelative})`);
|
|
350
351
|
// Use detected React version when available, fall back to React 18.
|
|
351
352
|
const reactVersion = detectedVersion ? `^${detectedVersion.reactNpm}` : "^18.3.1";
|
|
352
353
|
const reactDomVersion = (detectedVersion === null || detectedVersion === void 0 ? void 0 : detectedVersion.reactDomNpm)
|
|
@@ -355,7 +356,7 @@ function runBuildCheck(outputDir, writtenFiles, detectedVersion) {
|
|
|
355
356
|
? undefined // pre-0.14: no react-dom
|
|
356
357
|
: "^18.3.1";
|
|
357
358
|
if (detectedVersion) {
|
|
358
|
-
|
|
359
|
+
printMsg(MSG.Header, `[i] Using detected React version ${detectedVersion.versionKey} in package.json (react@${reactVersion})`);
|
|
359
360
|
}
|
|
360
361
|
const dependencies = Object.assign(Object.assign({ react: reactVersion }, (reactDomVersion ? { "react-dom": reactDomVersion } : {})), { "react-router-dom": "^6.27.0" });
|
|
361
362
|
// package.json — no "type": "module" so webpack.config.js can use CommonJS require
|
|
@@ -410,21 +411,21 @@ module.exports = {
|
|
|
410
411
|
</html>
|
|
411
412
|
`;
|
|
412
413
|
fs.writeFileSync(path.join(outputDir, "index.html"), indexHtml);
|
|
413
|
-
|
|
414
|
+
printMsg(MSG.Header, "[i] Installing dependencies...");
|
|
414
415
|
try {
|
|
415
416
|
execSync("npm install", { cwd: outputDir, stdio: "inherit" });
|
|
416
417
|
}
|
|
417
418
|
catch (_b) {
|
|
418
|
-
|
|
419
|
+
printMsg(MSG.Err, "[!] npm install failed — skipping build check");
|
|
419
420
|
return;
|
|
420
421
|
}
|
|
421
|
-
|
|
422
|
+
printMsg(MSG.Header, "[i] Running build check...");
|
|
422
423
|
try {
|
|
423
424
|
execSync("npm run build", { cwd: outputDir, stdio: "inherit" });
|
|
424
|
-
|
|
425
|
+
printMsg(MSG.Run, "[✓] Build check passed");
|
|
425
426
|
}
|
|
426
427
|
catch (_c) {
|
|
427
|
-
|
|
428
|
+
printMsg(MSG.Err, "[!] Build check failed — review output above");
|
|
428
429
|
}
|
|
429
430
|
}
|
|
430
431
|
/**
|
|
@@ -471,7 +472,7 @@ function runViteBuildCheck(outputDir, writtenFiles, detectedVersion) {
|
|
|
471
472
|
}
|
|
472
473
|
})) !== null && _a !== void 0 ? _a : jsxFiles[0];
|
|
473
474
|
const entryRelative = `./${path.basename(entryFile)}`;
|
|
474
|
-
|
|
475
|
+
printMsg(MSG.Header, `[i] Setting up Vite build check in ${outputDir}/ (entry: ${entryRelative})`);
|
|
475
476
|
// Use detected React version when available, fall back to React 18.
|
|
476
477
|
const reactVersion = detectedVersion ? `^${detectedVersion.reactNpm}` : "^18.3.1";
|
|
477
478
|
const reactDomVersion = (detectedVersion === null || detectedVersion === void 0 ? void 0 : detectedVersion.reactDomNpm)
|
|
@@ -480,7 +481,7 @@ function runViteBuildCheck(outputDir, writtenFiles, detectedVersion) {
|
|
|
480
481
|
? undefined
|
|
481
482
|
: "^18.3.1";
|
|
482
483
|
if (detectedVersion) {
|
|
483
|
-
|
|
484
|
+
printMsg(MSG.Header, `[i] Using detected React version ${detectedVersion.versionKey} in package.json (react@${reactVersion})`);
|
|
484
485
|
}
|
|
485
486
|
const dependencies = Object.assign(Object.assign({ react: reactVersion }, (reactDomVersion ? { "react-dom": reactDomVersion } : {})), { "react-router-dom": "^6.27.0" });
|
|
486
487
|
const pkg = {
|
|
@@ -513,21 +514,21 @@ export default defineConfig({
|
|
|
513
514
|
</html>
|
|
514
515
|
`;
|
|
515
516
|
fs.writeFileSync(path.join(outputDir, "index.html"), indexHtml);
|
|
516
|
-
|
|
517
|
+
printMsg(MSG.Header, "[i] Installing dependencies...");
|
|
517
518
|
try {
|
|
518
519
|
execSync("npm install", { cwd: outputDir, stdio: "inherit" });
|
|
519
520
|
}
|
|
520
521
|
catch (_b) {
|
|
521
|
-
|
|
522
|
+
printMsg(MSG.Err, "[!] npm install failed — skipping build check");
|
|
522
523
|
return;
|
|
523
524
|
}
|
|
524
|
-
|
|
525
|
+
printMsg(MSG.Header, "[i] Running Vite build check...");
|
|
525
526
|
try {
|
|
526
527
|
execSync("npm run build", { cwd: outputDir, stdio: "inherit" });
|
|
527
|
-
|
|
528
|
+
printMsg(MSG.Run, "[✓] Vite build check passed");
|
|
528
529
|
}
|
|
529
530
|
catch (_c) {
|
|
530
|
-
|
|
531
|
+
printMsg(MSG.Err, "[!] Vite build check failed — review output above");
|
|
531
532
|
}
|
|
532
533
|
}
|
|
533
534
|
/**
|
|
@@ -549,12 +550,12 @@ function resolveVersionDetectionScatDirs(bundler, opts) {
|
|
|
549
550
|
const detectConfig = (_a = opts.detectVersionConfig) !== null && _a !== void 0 ? _a : "dynamic";
|
|
550
551
|
if (detectConfig === "dynamic") {
|
|
551
552
|
if (opts.detectVersionDynamicConfPurge) {
|
|
552
|
-
|
|
553
|
+
printMsg(MSG.Header, "[i] Version detection: purging cached dynamic scat config...");
|
|
553
554
|
purgeDynamicVersionDetectionScatConfig();
|
|
554
555
|
}
|
|
555
556
|
const cfg = loadRefactorConfig();
|
|
556
557
|
if (cfg.dynamicVersionDetectionScatConfig && cfg.dynamicVersionDetectionScatConfig.length > 0) {
|
|
557
|
-
|
|
558
|
+
printMsg(MSG.Header, `[i] Version detection: using cached dynamic scat config (${cfg.dynamicVersionDetectionScatConfig.join(", ")})`);
|
|
558
559
|
return cfg.dynamicVersionDetectionScatConfig;
|
|
559
560
|
}
|
|
560
561
|
// No cached config — discover versions and run dynamic selection.
|
|
@@ -563,11 +564,11 @@ function resolveVersionDetectionScatDirs(bundler, opts) {
|
|
|
563
564
|
versions = yield listAvailableVersions(bundler);
|
|
564
565
|
}
|
|
565
566
|
catch (e) {
|
|
566
|
-
|
|
567
|
+
printMsg(MSG.Warn, `[!] Version detection: could not list versions (${String(e)})`);
|
|
567
568
|
return [];
|
|
568
569
|
}
|
|
569
570
|
if (versions.length === 0) {
|
|
570
|
-
|
|
571
|
+
printMsg(MSG.Warn, `[!] Version detection: no version data found for ${bundler}`);
|
|
571
572
|
return [];
|
|
572
573
|
}
|
|
573
574
|
const threshold = Math.max(1, (_b = opts.detectVersionDynamicThreshold) !== null && _b !== void 0 ? _b : 3);
|
|
@@ -576,7 +577,7 @@ function resolveVersionDetectionScatDirs(bundler, opts) {
|
|
|
576
577
|
saveDynamicVersionDetectionScatConfig(selected);
|
|
577
578
|
}
|
|
578
579
|
else {
|
|
579
|
-
|
|
580
|
+
printMsg(MSG.Warn, `[!] Version detection: dynamic selection found no valid scat configs`);
|
|
580
581
|
}
|
|
581
582
|
return selected;
|
|
582
583
|
}
|
|
@@ -587,7 +588,7 @@ function resolveVersionDetectionScatDirs(bundler, opts) {
|
|
|
587
588
|
.filter(Boolean);
|
|
588
589
|
const scatDir = scatToDir(categories);
|
|
589
590
|
if (!scatDir) {
|
|
590
|
-
|
|
591
|
+
printMsg(MSG.Err, `[!] --detect-version-config "${detectConfig}" produced an empty scat dir; check category names`);
|
|
591
592
|
process.exit(26);
|
|
592
593
|
}
|
|
593
594
|
// Validate by checking that reliable_signatures.json is non-empty for all versions.
|
|
@@ -596,12 +597,12 @@ function resolveVersionDetectionScatDirs(bundler, opts) {
|
|
|
596
597
|
versions = yield listAvailableVersions(bundler);
|
|
597
598
|
}
|
|
598
599
|
catch (e) {
|
|
599
|
-
|
|
600
|
+
printMsg(MSG.Warn, `[!] Version detection: could not list versions to validate static config (${String(e)})`);
|
|
600
601
|
return [];
|
|
601
602
|
}
|
|
602
603
|
const valid = yield validateStaticScatConfig(bundler, versions, scatDir);
|
|
603
604
|
if (!valid) {
|
|
604
|
-
|
|
605
|
+
printMsg(MSG.Err, `[!] --detect-version-config "${detectConfig}" (scat dir: "${scatDir}") has empty reliable_signatures.json for one or more versions. Cannot use for version detection.`);
|
|
605
606
|
process.exit(26);
|
|
606
607
|
}
|
|
607
608
|
return [scatDir];
|
|
@@ -625,27 +626,27 @@ function resolveVersionDetectionScatDirs(bundler, opts) {
|
|
|
625
626
|
*/
|
|
626
627
|
const refactor = (mappedJson, outputDir, tech, list, collisionsFile, remoteOpts, assetsDir) => __awaiter(void 0, void 0, void 0, function* () {
|
|
627
628
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
628
|
-
|
|
629
|
+
printMsg(MSG.Header, "[i] Loading refactor module...");
|
|
629
630
|
if (list) {
|
|
630
|
-
|
|
631
|
+
printMsg(MSG.Header, "[i] Listing available technologies");
|
|
631
632
|
for (const key of Object.keys(availableTechs)) {
|
|
632
|
-
|
|
633
|
+
printMsg(MSG.Run, `- ${key}: ${availableTechs[key]}`);
|
|
633
634
|
}
|
|
634
635
|
return;
|
|
635
636
|
}
|
|
636
637
|
// check if the file exists
|
|
637
638
|
if (!fs.existsSync(mappedJson)) {
|
|
638
|
-
|
|
639
|
+
printMsg(MSG.Err, "[!] Mapped JSON file does not exist");
|
|
639
640
|
process.exit(7);
|
|
640
641
|
}
|
|
641
642
|
// verify if the tech provided is valid
|
|
642
643
|
if (!Object.keys(availableTechs).includes(tech)) {
|
|
643
|
-
|
|
644
|
+
printMsg(MSG.Err, "[!] Invalid technology provided");
|
|
644
645
|
process.exit(8);
|
|
645
646
|
}
|
|
646
647
|
// check if the output directory already exists
|
|
647
648
|
if (fs.existsSync(outputDir)) {
|
|
648
|
-
|
|
649
|
+
printMsg(MSG.Err, "[!] Output directory already exists");
|
|
649
650
|
process.exit(9);
|
|
650
651
|
}
|
|
651
652
|
else {
|
|
@@ -661,21 +662,21 @@ const refactor = (mappedJson, outputDir, tech, list, collisionsFile, remoteOpts,
|
|
|
661
662
|
// Explicit local path — use existing resolver unchanged.
|
|
662
663
|
const result = buildLibSigs(collisionsFile, tech, remoteOpts === null || remoteOpts === void 0 ? void 0 : remoteOpts.scat);
|
|
663
664
|
if (!result) {
|
|
664
|
-
|
|
665
|
+
printMsg(MSG.Err, `[!] Could not resolve library signatures from: ${collisionsFile}`);
|
|
665
666
|
const scat = BASELINE_SCAT_DIR[tech];
|
|
666
667
|
if (scat) {
|
|
667
|
-
|
|
668
|
+
printMsg(MSG.Err, ` accepted layouts:\n` +
|
|
668
669
|
` <file> (direct collisions.json)\n` +
|
|
669
670
|
` <dir>/baselines/${tech}/${scat}/collisions.json\n` +
|
|
670
671
|
` <dir>/${tech}/${scat}/collisions.json\n` +
|
|
671
672
|
` <dir>/${scat}/collisions.json\n` +
|
|
672
673
|
` <dir>/collisions.json\n` +
|
|
673
|
-
` <dir>/<feature>/${scat}/collisions.json (per-feature results dir)`)
|
|
674
|
+
` <dir>/<feature>/${scat}/collisions.json (per-feature results dir)`);
|
|
674
675
|
}
|
|
675
676
|
process.exit(10);
|
|
676
677
|
}
|
|
677
678
|
libSigs = result.sigs;
|
|
678
|
-
|
|
679
|
+
printMsg(MSG.Header, `[i] Loaded ${libSigs.size} library signatures from ${result.desc}`);
|
|
679
680
|
}
|
|
680
681
|
else if ((remoteOpts === null || remoteOpts === void 0 ? void 0 : remoteOpts.remoteCollisions) || (!(remoteOpts === null || remoteOpts === void 0 ? void 0 : remoteOpts.noRemote) && TECH_TO_BRANCH[tech])) {
|
|
681
682
|
// Load from remote HuggingFace dataset.
|
|
@@ -692,7 +693,7 @@ const refactor = (mappedJson, outputDir, tech, list, collisionsFile, remoteOpts,
|
|
|
692
693
|
libSigs = result.sigs;
|
|
693
694
|
}
|
|
694
695
|
else {
|
|
695
|
-
|
|
696
|
+
printMsg(MSG.Warn, `[~] Remote signatures unavailable — proceeding without library stripping`);
|
|
696
697
|
const branch = (_e = (_d = opts.remoteCollisions) !== null && _d !== void 0 ? _d : TECH_TO_BRANCH[tech]) !== null && _e !== void 0 ? _e : "unknown";
|
|
697
698
|
const scatDir = opts.scat ? scatToDir(opts.scat) : ((_f = BASELINE_SCAT_DIR[tech]) !== null && _f !== void 0 ? _f : "unknown");
|
|
698
699
|
libStrippingSkipped = { tech, scat: scatDir, branch };
|
|
@@ -700,8 +701,11 @@ const refactor = (mappedJson, outputDir, tech, list, collisionsFile, remoteOpts,
|
|
|
700
701
|
}
|
|
701
702
|
// iterate through the chunks
|
|
702
703
|
if (tech === "next-turbopack") {
|
|
704
|
+
if (remoteOpts === null || remoteOpts === void 0 ? void 0 : remoteOpts.scat) {
|
|
705
|
+
printMsg(MSG.Header, `[i] Using custom scat config: ${remoteOpts.scat.join(",")}`);
|
|
706
|
+
}
|
|
703
707
|
for (const [, value] of Object.entries(chunks)) {
|
|
704
|
-
const moduleFiles = yield refactorNext(value);
|
|
708
|
+
const moduleFiles = yield refactorNext(value, libSigs, remoteOpts === null || remoteOpts === void 0 ? void 0 : remoteOpts.scat);
|
|
705
709
|
for (const [moduleId, rawCode] of Object.entries(moduleFiles)) {
|
|
706
710
|
const formatted = yield prettier.format(rawCode, {
|
|
707
711
|
parser: "babel",
|
|
@@ -710,18 +714,18 @@ const refactor = (mappedJson, outputDir, tech, list, collisionsFile, remoteOpts,
|
|
|
710
714
|
});
|
|
711
715
|
// Skip writing empty files
|
|
712
716
|
if (formatted.trim().length === 0) {
|
|
713
|
-
|
|
717
|
+
printMsg(MSG.Info, `[~] Module ${moduleId} is empty after stripping — skipping`);
|
|
714
718
|
continue;
|
|
715
719
|
}
|
|
716
720
|
const filePath = `${outputDir}/${moduleId}.js`;
|
|
717
721
|
fs.writeFileSync(filePath, formatted);
|
|
718
|
-
|
|
722
|
+
printMsg(MSG.Run, `[✓] Module ${moduleId} written to ${filePath}`);
|
|
719
723
|
}
|
|
720
724
|
}
|
|
721
725
|
}
|
|
722
726
|
else if (tech === "next-webpack") {
|
|
723
727
|
if (remoteOpts === null || remoteOpts === void 0 ? void 0 : remoteOpts.scat) {
|
|
724
|
-
|
|
728
|
+
printMsg(MSG.Header, `[i] Using custom scat config: ${remoteOpts.scat.join(",")}`);
|
|
725
729
|
}
|
|
726
730
|
for (const [, value] of Object.entries(chunks)) {
|
|
727
731
|
const moduleFiles = yield refactorNextWebpack(value, libSigs, remoteOpts === null || remoteOpts === void 0 ? void 0 : remoteOpts.scat);
|
|
@@ -738,12 +742,12 @@ const refactor = (mappedJson, outputDir, tech, list, collisionsFile, remoteOpts,
|
|
|
738
742
|
formatted = rawCode;
|
|
739
743
|
}
|
|
740
744
|
if (formatted.trim().length === 0) {
|
|
741
|
-
|
|
745
|
+
printMsg(MSG.Info, `[~] Module ${moduleId} is empty after stripping — skipping`);
|
|
742
746
|
continue;
|
|
743
747
|
}
|
|
744
748
|
const filePath = `${outputDir}/${moduleId}.js`;
|
|
745
749
|
fs.writeFileSync(filePath, formatted);
|
|
746
|
-
|
|
750
|
+
printMsg(MSG.Run, `[✓] Module ${moduleId} written to ${filePath}`);
|
|
747
751
|
}
|
|
748
752
|
}
|
|
749
753
|
}
|
|
@@ -770,7 +774,7 @@ const refactor = (mappedJson, outputDir, tech, list, collisionsFile, remoteOpts,
|
|
|
770
774
|
if (preScanAssetsDir) {
|
|
771
775
|
const vendorFiles = findVendorChunkFiles(chunks, preScanAssetsDir);
|
|
772
776
|
for (const vendorFile of vendorFiles) {
|
|
773
|
-
|
|
777
|
+
printMsg(MSG.Header, `[i] Pre-scanning vendor chunk: ${path.basename(vendorFile)}`);
|
|
774
778
|
const vendorCode = fs.readFileSync(vendorFile, "utf8");
|
|
775
779
|
const vendorChunk = {
|
|
776
780
|
id: path.basename(vendorFile, ".js"),
|
|
@@ -787,12 +791,12 @@ const refactor = (mappedJson, outputDir, tech, list, collisionsFile, remoteOpts,
|
|
|
787
791
|
const vendorResult = yield refactorReact(vendorChunk, undefined, undefined, true);
|
|
788
792
|
for (const [id, info] of vendorResult.libModuleMap) {
|
|
789
793
|
accLibModuleMap.set(id, info);
|
|
790
|
-
|
|
794
|
+
printMsg(MSG.Info, ` [-] Vendor module ${id} → ${info.type} (${info.exportMap.size} exports)`);
|
|
791
795
|
}
|
|
792
796
|
}
|
|
793
797
|
}
|
|
794
798
|
if (remoteOpts === null || remoteOpts === void 0 ? void 0 : remoteOpts.scat) {
|
|
795
|
-
|
|
799
|
+
printMsg(MSG.Header, `[i] Using custom scat config: ${remoteOpts.scat.join(",")}`);
|
|
796
800
|
}
|
|
797
801
|
const writtenFiles = [];
|
|
798
802
|
for (const [, value] of sortedEntries) {
|
|
@@ -809,13 +813,13 @@ const refactor = (mappedJson, outputDir, tech, list, collisionsFile, remoteOpts,
|
|
|
809
813
|
});
|
|
810
814
|
// Skip writing empty files (e.g. index.js after webpack runtime stripping).
|
|
811
815
|
if (formatted.trim().length === 0) {
|
|
812
|
-
|
|
816
|
+
printMsg(MSG.Info, `[~] Module ${moduleId} is empty after stripping — skipping`);
|
|
813
817
|
continue;
|
|
814
818
|
}
|
|
815
819
|
const filePath = `${outputDir}/${moduleId}.js`;
|
|
816
820
|
fs.writeFileSync(filePath, formatted);
|
|
817
821
|
writtenFiles.push(filePath);
|
|
818
|
-
|
|
822
|
+
printMsg(MSG.Run, `[✓] Module ${moduleId} written to ${outputDir}/${moduleId}.js`);
|
|
819
823
|
}
|
|
820
824
|
}
|
|
821
825
|
// Version detection — run before build check so the detected version can be
|
|
@@ -843,11 +847,11 @@ const refactor = (mappedJson, outputDir, tech, list, collisionsFile, remoteOpts,
|
|
|
843
847
|
}
|
|
844
848
|
const vResult = yield detectReactVersion(chunks, tech, vScatDirs, vendorCodes.length > 0 ? vendorCodes : undefined);
|
|
845
849
|
if (vResult) {
|
|
846
|
-
|
|
850
|
+
printMsg(MSG.Run, `[✓] Detected React version: ${vResult.versionKey} (${vResult.matchCount} signature matches)`);
|
|
847
851
|
detectedVersion = vResult;
|
|
848
852
|
}
|
|
849
853
|
else {
|
|
850
|
-
|
|
854
|
+
printMsg(MSG.Warn, `[!] Version detection: no matching version found`);
|
|
851
855
|
}
|
|
852
856
|
}
|
|
853
857
|
}
|
|
@@ -867,7 +871,7 @@ const refactor = (mappedJson, outputDir, tech, list, collisionsFile, remoteOpts,
|
|
|
867
871
|
const basename = path.basename(vendorFile);
|
|
868
872
|
if (!/vendor[-_]react/i.test(basename) && !/rolldown[-_]runtime/i.test(basename))
|
|
869
873
|
continue;
|
|
870
|
-
|
|
874
|
+
printMsg(MSG.Header, `[i] Including missing vendor chunk: ${basename}`);
|
|
871
875
|
const key = basename.replace(/\.js$/, "");
|
|
872
876
|
chunks[key] = {
|
|
873
877
|
id: basename,
|
|
@@ -927,7 +931,7 @@ const refactor = (mappedJson, outputDir, tech, list, collisionsFile, remoteOpts,
|
|
|
927
931
|
formatted = combined;
|
|
928
932
|
}
|
|
929
933
|
if (formatted.trim().length === 0) {
|
|
930
|
-
|
|
934
|
+
printMsg(MSG.Info, `[~] Chunk ${keys.join("+")} is empty after refactoring — skipping`);
|
|
931
935
|
continue;
|
|
932
936
|
}
|
|
933
937
|
fs.writeFileSync(filePath, formatted);
|
|
@@ -936,7 +940,7 @@ const refactor = (mappedJson, outputDir, tech, list, collisionsFile, remoteOpts,
|
|
|
936
940
|
// to attempt renaming the same path twice (ENOENT on the second try).
|
|
937
941
|
writtenFiles.push(filePath);
|
|
938
942
|
for (const key of keys) {
|
|
939
|
-
|
|
943
|
+
printMsg(MSG.Run, `[✓] Chunk ${key} written to ${filePath}`);
|
|
940
944
|
}
|
|
941
945
|
}
|
|
942
946
|
// Version detection — run before build check so the detected version can be
|
|
@@ -948,11 +952,11 @@ const refactor = (mappedJson, outputDir, tech, list, collisionsFile, remoteOpts,
|
|
|
948
952
|
if (vScatDirs.length > 0) {
|
|
949
953
|
const vResult = yield detectReactVersion(chunks, tech, vScatDirs);
|
|
950
954
|
if (vResult) {
|
|
951
|
-
|
|
955
|
+
printMsg(MSG.Run, `[✓] Detected React version: ${vResult.versionKey} (${vResult.matchCount} signature matches)`);
|
|
952
956
|
viteDetectedVersion = vResult;
|
|
953
957
|
}
|
|
954
958
|
else {
|
|
955
|
-
|
|
959
|
+
printMsg(MSG.Warn, `[!] Version detection: no matching version found`);
|
|
956
960
|
}
|
|
957
961
|
}
|
|
958
962
|
}
|
|
@@ -975,12 +979,12 @@ const refactor = (mappedJson, outputDir, tech, list, collisionsFile, remoteOpts,
|
|
|
975
979
|
formatted = rawCode;
|
|
976
980
|
}
|
|
977
981
|
if (formatted.trim().length === 0) {
|
|
978
|
-
|
|
982
|
+
printMsg(MSG.Info, `[~] Module ${moduleId} is empty after stripping — skipping`);
|
|
979
983
|
continue;
|
|
980
984
|
}
|
|
981
985
|
const filePath = `${outputDir}/${moduleId}.js`;
|
|
982
986
|
fs.writeFileSync(filePath, formatted);
|
|
983
|
-
|
|
987
|
+
printMsg(MSG.Run, `[✓] Module ${moduleId} written to ${filePath}`);
|
|
984
988
|
}
|
|
985
989
|
}
|
|
986
990
|
}
|
|
@@ -1005,22 +1009,22 @@ const refactor = (mappedJson, outputDir, tech, list, collisionsFile, remoteOpts,
|
|
|
1005
1009
|
formatted = rawCode;
|
|
1006
1010
|
}
|
|
1007
1011
|
if (formatted.trim().length === 0) {
|
|
1008
|
-
|
|
1012
|
+
printMsg(MSG.Info, `[~] Chunk ${chunkKey} is empty after refactoring — skipping`);
|
|
1009
1013
|
continue;
|
|
1010
1014
|
}
|
|
1011
1015
|
fs.writeFileSync(filePath, formatted);
|
|
1012
|
-
|
|
1016
|
+
printMsg(MSG.Run, `[✓] Chunk ${chunkKey} written to ${filePath}`);
|
|
1013
1017
|
}
|
|
1014
1018
|
}
|
|
1015
1019
|
if (libStrippingSkipped) {
|
|
1016
1020
|
const { tech: skippedTech, scat, branch } = libStrippingSkipped;
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1021
|
+
printMsg(MSG.Warn, "=".repeat(60));
|
|
1022
|
+
printMsg(MSG.Warn, "[!] LIBRARY STRIPPING WAS SKIPPED FOR THIS RUN");
|
|
1023
|
+
printMsg(MSG.Warn, ` tech: ${skippedTech} scat: ${scat} branch: ${branch}`);
|
|
1024
|
+
printMsg(MSG.Warn, " No remote collisions data available — output includes library code.");
|
|
1025
|
+
printMsg(MSG.Warn, "=".repeat(60));
|
|
1022
1026
|
}
|
|
1023
|
-
|
|
1027
|
+
printMsg(MSG.Run, "[✓] Refactoring complete.");
|
|
1024
1028
|
});
|
|
1025
1029
|
export default refactor;
|
|
1026
1030
|
//# sourceMappingURL=index.js.map
|