Download next.js/turbopack/crates/turbopack-ecmascript/src/runtime_functions.rs from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 7.05 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/turbopack/crates/turbopack-ecmascript/src/runtime_functions.rs
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/turbopack/crates/turbopack-ecmascript/src/runtime_functions.rs
-
curl -L -o runtime_functions.rs https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/turbopack/crates/turbopack-ecmascript/src/runtime_functions.rs
7.05 kB
| use std::fmt::{Display, Formatter}; | |
| use swc_core::ecma::ast::{Expr, MemberExpr, MemberProp}; | |
| use turbopack_core::compile_time_info::FreeVarReference; | |
| pub struct TurbopackRuntimeFunctionShortcut { | |
| pub shortcut: &'static str, | |
| pub full: &'static str, | |
| } | |
| impl TurbopackRuntimeFunctionShortcut { | |
| pub const fn new(full: &'static str, shortcut: &'static str) -> Self { | |
| Self { full, shortcut } | |
| } | |
| pub fn bound(&self) -> String { | |
| format!( | |
| "__turbopack_context__.{}.bind(__turbopack_context__)", | |
| self.shortcut | |
| ) | |
| } | |
| } | |
| impl Display for TurbopackRuntimeFunctionShortcut { | |
| fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { | |
| f.write_str(self.full) | |
| } | |
| } | |
| impl From<&TurbopackRuntimeFunctionShortcut> for FreeVarReference { | |
| fn from(val: &TurbopackRuntimeFunctionShortcut) -> Self { | |
| FreeVarReference::Member("__turbopack_context__".into(), val.shortcut.into()) | |
| } | |
| } | |
| impl From<&TurbopackRuntimeFunctionShortcut> for Expr { | |
| fn from(val: &TurbopackRuntimeFunctionShortcut) -> Self { | |
| Expr::Member(MemberExpr { | |
| obj: Box::new(Expr::Ident("__turbopack_context__".into())), | |
| prop: MemberProp::Ident(val.shortcut.into()), | |
| ..Default::default() | |
| }) | |
| } | |
| } | |
| impl<'l> From<&'l TurbopackRuntimeFunctionShortcut> for &'l str { | |
| fn from(val: &TurbopackRuntimeFunctionShortcut) -> Self { | |
| val.full | |
| } | |
| } | |
| pub const TURBOPACK_EXPORTS: &TurbopackRuntimeFunctionShortcut = | |
| &TurbopackRuntimeFunctionShortcut::new("__turbopack_context__.e", "e"); | |
| pub const TURBOPACK_MODULE: &TurbopackRuntimeFunctionShortcut = | |
| &TurbopackRuntimeFunctionShortcut::new("__turbopack_context__.m", "m"); | |
| pub const TURBOPACK_REQUIRE: &TurbopackRuntimeFunctionShortcut = | |
| &TurbopackRuntimeFunctionShortcut::new("__turbopack_context__.r", "r"); | |
| pub const TURBOPACK_ASYNC_LOADER: &TurbopackRuntimeFunctionShortcut = | |
| &TurbopackRuntimeFunctionShortcut::new("__turbopack_context__.A", "A"); | |
| pub const TURBOPACK_MODULE_CONTEXT: &TurbopackRuntimeFunctionShortcut = | |
| &TurbopackRuntimeFunctionShortcut::new("__turbopack_context__.f", "f"); | |
| pub const TURBOPACK_IMPORT: &TurbopackRuntimeFunctionShortcut = | |
| &TurbopackRuntimeFunctionShortcut::new("__turbopack_context__.i", "i"); | |
| pub const TURBOPACK_ESM: &TurbopackRuntimeFunctionShortcut = | |
| &TurbopackRuntimeFunctionShortcut::new("__turbopack_context__.s", "s"); | |
| pub const TURBOPACK_EXPORT_VALUE: &TurbopackRuntimeFunctionShortcut = | |
| &TurbopackRuntimeFunctionShortcut::new("__turbopack_context__.v", "v"); | |
| pub const TURBOPACK_EXPORT_NAMESPACE: &TurbopackRuntimeFunctionShortcut = | |
| &TurbopackRuntimeFunctionShortcut::new("__turbopack_context__.n", "n"); | |
| pub const TURBOPACK_CACHE: &TurbopackRuntimeFunctionShortcut = | |
| &TurbopackRuntimeFunctionShortcut::new("__turbopack_context__.c", "c"); | |
| pub const TURBOPACK_MODULES: &TurbopackRuntimeFunctionShortcut = | |
| &TurbopackRuntimeFunctionShortcut::new("__turbopack_context__.M", "M"); | |
| pub const TURBOPACK_LOAD: &TurbopackRuntimeFunctionShortcut = | |
| &TurbopackRuntimeFunctionShortcut::new("__turbopack_context__.l", "l"); | |
| pub const TURBOPACK_LOAD_BY_URL: &TurbopackRuntimeFunctionShortcut = | |
| &TurbopackRuntimeFunctionShortcut::new("__turbopack_context__.L", "L"); | |
| pub const TURBOPACK_CLEAR_CHUNK_CACHE: &TurbopackRuntimeFunctionShortcut = | |
| &TurbopackRuntimeFunctionShortcut::new("__turbopack_context__.C", "C"); | |
| pub const TURBOPACK_DYNAMIC: &TurbopackRuntimeFunctionShortcut = | |
| &TurbopackRuntimeFunctionShortcut::new("__turbopack_context__.j", "j"); | |
| pub const TURBOPACK_RESOLVE_ABSOLUTE_PATH: &TurbopackRuntimeFunctionShortcut = | |
| &TurbopackRuntimeFunctionShortcut::new("__turbopack_context__.P", "P"); | |
| pub const TURBOPACK_RELATIVE_URL: &TurbopackRuntimeFunctionShortcut = | |
| &TurbopackRuntimeFunctionShortcut::new("__turbopack_context__.U", "U"); | |
| pub const TURBOPACK_RESOLVE_MODULE_ID_PATH: &TurbopackRuntimeFunctionShortcut = | |
| &TurbopackRuntimeFunctionShortcut::new("__turbopack_context__.R", "R"); | |
| pub const TURBOPACK_WORKER_BLOB_URL: &TurbopackRuntimeFunctionShortcut = | |
| &TurbopackRuntimeFunctionShortcut::new("__turbopack_context__.b", "b"); | |
| pub const TURBOPACK_ASYNC_MODULE: &TurbopackRuntimeFunctionShortcut = | |
| &TurbopackRuntimeFunctionShortcut::new("__turbopack_context__.a", "a"); | |
| pub const TURBOPACK_EXTERNAL_REQUIRE: &TurbopackRuntimeFunctionShortcut = | |
| &TurbopackRuntimeFunctionShortcut::new("__turbopack_context__.x", "x"); | |
| pub const TURBOPACK_EXTERNAL_IMPORT: &TurbopackRuntimeFunctionShortcut = | |
| &TurbopackRuntimeFunctionShortcut::new("__turbopack_context__.y", "y"); | |
| pub const TURBOPACK_REFRESH: &TurbopackRuntimeFunctionShortcut = | |
| &TurbopackRuntimeFunctionShortcut::new("__turbopack_context__.k", "k"); | |
| pub const TURBOPACK_REQUIRE_STUB: &TurbopackRuntimeFunctionShortcut = | |
| &TurbopackRuntimeFunctionShortcut::new("__turbopack_context__.z", "z"); | |
| pub const TURBOPACK_REQUIRE_REAL: &TurbopackRuntimeFunctionShortcut = | |
| &TurbopackRuntimeFunctionShortcut::new("__turbopack_context__.t", "t"); | |
| pub const TURBOPACK_WASM: &TurbopackRuntimeFunctionShortcut = | |
| &TurbopackRuntimeFunctionShortcut::new("__turbopack_context__.w", "w"); | |
| pub const TURBOPACK_WASM_MODULE: &TurbopackRuntimeFunctionShortcut = | |
| &TurbopackRuntimeFunctionShortcut::new("__turbopack_context__.u", "u"); | |
| /// Adding an entry to this list will automatically ensure that `__turbopack_XXX__` can be called | |
| /// from user code (by inserting a replacement into free_var_references) | |
| pub const TURBOPACK_RUNTIME_FUNCTION_SHORTCUTS: [(&str, &TurbopackRuntimeFunctionShortcut); 23] = [ | |
| ("__turbopack_require__", TURBOPACK_REQUIRE), | |
| ("__turbopack_module_context__", TURBOPACK_MODULE_CONTEXT), | |
| ("__turbopack_import__", TURBOPACK_IMPORT), | |
| ("__turbopack_esm__", TURBOPACK_ESM), | |
| ("__turbopack_export_value__", TURBOPACK_EXPORT_VALUE), | |
| ("__turbopack_export_namespace__", TURBOPACK_EXPORT_NAMESPACE), | |
| ("__turbopack_cache__", TURBOPACK_CACHE), | |
| ("__turbopack_modules__", TURBOPACK_MODULES), | |
| ("__turbopack_load__", TURBOPACK_LOAD), | |
| ("__turbopack_load_by_url__", TURBOPACK_LOAD_BY_URL), | |
| ("__turbopack_dynamic__", TURBOPACK_DYNAMIC), | |
| ( | |
| "__turbopack_resolve_absolute_path__", | |
| TURBOPACK_RESOLVE_ABSOLUTE_PATH, | |
| ), | |
| ("__turbopack_relative_url__", TURBOPACK_RELATIVE_URL), | |
| ( | |
| "__turbopack_resolve_module_id_path__", | |
| TURBOPACK_RESOLVE_MODULE_ID_PATH, | |
| ), | |
| ("__turbopack_worker_blob_url__", TURBOPACK_WORKER_BLOB_URL), | |
| ("__turbopack_external_require__", TURBOPACK_EXTERNAL_REQUIRE), | |
| ("__turbopack_external_import__", TURBOPACK_EXTERNAL_IMPORT), | |
| ("__turbopack_refresh__", TURBOPACK_REFRESH), | |
| ("__turbopack_require_stub__", TURBOPACK_REQUIRE_STUB), | |
| ("__turbopack_require_real__", TURBOPACK_REQUIRE_REAL), | |
| ( | |
| "__turbopack_clear_chunk_cache__", | |
| TURBOPACK_CLEAR_CHUNK_CACHE, | |
| ), | |
| ("__turbopack_wasm__", TURBOPACK_WASM), | |
| ("__turbopack_wasm_module__", TURBOPACK_WASM_MODULE), | |
| ]; | |