From 8d651f40a699bd9afb6298b21eb0352e85ea7ff4 Mon Sep 17 00:00:00 2001 From: Abdul Kaium Date: Sat, 18 Jul 2026 18:45:28 +0600 Subject: [PATCH 1/2] fix: fix dynamic require collision with new keyword --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/_tools/repl-txt/rules/doctest/lib/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/_tools/repl-txt/rules/doctest/lib/main.js b/lib/node_modules/@stdlib/_tools/repl-txt/rules/doctest/lib/main.js index 6bff7e991427..d1af26399e07 100644 --- a/lib/node_modules/@stdlib/_tools/repl-txt/rules/doctest/lib/main.js +++ b/lib/node_modules/@stdlib/_tools/repl-txt/rules/doctest/lib/main.js @@ -165,7 +165,7 @@ function main( context ) { return format( 'require(\'%s\')', pkg ); } // If an alias does not exist in the global namespace, dynamically `require` a package so that the desired expression can be executed: - return format( 'require(\'%s\')', pkg ); + return format( '(require(\'%s\'))', pkg ); } alias = alias.split( '.' ); len = alias.length; From 2be88836a6639934100b6c78c98fb46b3ef5cf81 Mon Sep 17 00:00:00 2001 From: Abdul Kaium Date: Sat, 18 Jul 2026 21:54:07 +0600 Subject: [PATCH 2/2] fix: wrap dynamic require in parentheses --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- lib/node_modules/@stdlib/repl/help/scripts/build.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/repl/help/scripts/build.js b/lib/node_modules/@stdlib/repl/help/scripts/build.js index 59bf5460c6ae..88c330d14e92 100644 --- a/lib/node_modules/@stdlib/repl/help/scripts/build.js +++ b/lib/node_modules/@stdlib/repl/help/scripts/build.js @@ -184,7 +184,7 @@ function main() { continue; } // If an alias does not exist in the global namespace, dynamically `require` a package so that the desired expression can be executed in example code: - file = replace( file, tmp[ j ], format( 'require(\'%s\')', p ) ); // WARNING: this assumes that `{{alias:}}` placeholders are in examples. If unresolved package identifiers are used in descriptions, this substitution is NOT appropriate. The use of such placeholders in description prose is uncommon, but not unheard of. However, given its relatively rare occurrence, we can likely be confident that this substitution is okay. Ideally, identifiers would be added to the database, so that this workaround is not necessary. + file = replace( file, tmp[ j ], format( '(require(\'%s\'))', p ) ); // WARNING: this assumes that `{{alias:}}` placeholders are in examples. If unresolved package identifiers are used in descriptions, this substitution is NOT appropriate. The use of such placeholders in description prose is uncommon, but not unheard of. However, given its relatively rare occurrence, we can likely be confident that this substitution is okay. Ideally, identifiers would be added to the database, so that this workaround is not necessary. debug( 'Inserted a `require` expression for `%s`.', p ); } else { file = replace( file, tmp[ j ], a );