1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-18 05:14:21 -05:00

fix(node): update list of builtin node modules, add missing export to _http_common (#27294)

Fixes https://github.com/denoland/deno/issues/27289

We exported these but forgot to add them to the list of builtins used by
the resolver, so we weren't resolving bare imports of some modules (e.g.
`"_http_common"`)

Also adds a missing export of `HTTPParser` from `_http_common`
This commit is contained in:
Nathan Whitaker 2024-12-09 13:01:09 -08:00 committed by GitHub
parent 883abfa1bf
commit 44d76975d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 21 additions and 3 deletions

View file

@ -743,13 +743,16 @@ fn get_node_completions(
} }
let items = SUPPORTED_BUILTIN_NODE_MODULES let items = SUPPORTED_BUILTIN_NODE_MODULES
.iter() .iter()
.map(|name| { .filter_map(|name| {
if name.starts_with('_') {
return None;
}
let specifier = format!("node:{}", name); let specifier = format!("node:{}", name);
let text_edit = Some(lsp::CompletionTextEdit::Edit(lsp::TextEdit { let text_edit = Some(lsp::CompletionTextEdit::Edit(lsp::TextEdit {
range: *range, range: *range,
new_text: specifier.clone(), new_text: specifier.clone(),
})); }));
lsp::CompletionItem { Some(lsp::CompletionItem {
label: specifier, label: specifier,
kind: Some(lsp::CompletionItemKind::FILE), kind: Some(lsp::CompletionItemKind::FILE),
detail: Some("(node)".to_string()), detail: Some("(node)".to_string()),
@ -758,7 +761,7 @@ fn get_node_completions(
IMPORT_COMMIT_CHARS.iter().map(|&c| c.into()).collect(), IMPORT_COMMIT_CHARS.iter().map(|&c| c.into()).collect(),
), ),
..Default::default() ..Default::default()
} })
}) })
.collect(); .collect();
Some(CompletionList { Some(CompletionList {

View file

@ -25,6 +25,17 @@ macro_rules! generate_builtin_node_module_lists {
// NOTE(bartlomieju): keep this list in sync with `ext/node/polyfills/01_require.js` // NOTE(bartlomieju): keep this list in sync with `ext/node/polyfills/01_require.js`
generate_builtin_node_module_lists! { generate_builtin_node_module_lists! {
"_http_agent",
"_http_common",
"_http_outgoing",
"_http_server",
"_stream_duplex",
"_stream_passthrough",
"_stream_readable",
"_stream_transform",
"_stream_writable",
"_tls_common",
"_tls_wrap",
"assert", "assert",
"assert/strict", "assert/strict",
"async_hooks", "async_hooks",

View file

@ -7,6 +7,7 @@ const {
SafeRegExp, SafeRegExp,
Symbol, Symbol,
} = primordials; } = primordials;
import { HTTPParser } from "ext:deno_node/internal_binding/http_parser.ts";
export const CRLF = "\r\n"; export const CRLF = "\r\n";
export const kIncomingMessage = Symbol("IncomingMessage"); export const kIncomingMessage = Symbol("IncomingMessage");
@ -79,6 +80,8 @@ export {
checkIsHttpToken as _checkIsHttpToken, checkIsHttpToken as _checkIsHttpToken,
}; };
export { HTTPParser };
export default { export default {
_checkInvalidHeaderChar: checkInvalidHeaderChar, _checkInvalidHeaderChar: checkInvalidHeaderChar,
_checkIsHttpToken: checkIsHttpToken, _checkIsHttpToken: checkIsHttpToken,
@ -87,4 +90,5 @@ export default {
continueExpression, continueExpression,
kIncomingMessage, kIncomingMessage,
methods, methods,
HTTPParser,
}; };