Files
node/src/path.h
T
Aditi 94422e8a40 src: add an option to make compile cache portable
Adds an option (NODE_COMPILE_CACHE_PORTABLE) for
the built-in compile cache to encode the hashes with
relative file paths. On enabling the option,
the source directory along with cache directory can be
bundled and moved, and the cache continues to work.

When enabled, paths encoded in hash are relative to
compile cache directory.

PR-URL: https://github.com/nodejs/node/pull/58797
Fixes: https://github.com/nodejs/node/issues/58755
Refs: https://github.com/nodejs/node/issues/52696
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-09-12 11:00:39 +00:00

37 lines
1.0 KiB
C++

#ifndef SRC_PATH_H_
#define SRC_PATH_H_
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
#include <string>
#include <vector>
#include "node_options-inl.h"
#include "util-inl.h"
namespace node {
constexpr bool IsPathSeparator(const char c) noexcept;
std::string NormalizeString(const std::string_view path,
bool allowAboveRoot,
const std::string_view separator);
std::string PathResolve(Environment* env,
const std::vector<std::string_view>& paths);
std::string NormalizeFileURLOrPath(Environment* env, std::string_view path);
bool IsAbsoluteFilePath(std::string_view path);
#ifdef _WIN32
constexpr bool IsWindowsDeviceRoot(const char c) noexcept;
constexpr bool IsWindowsDriveLetter(const std::string_view path) noexcept;
#endif // _WIN32
void ToNamespacedPath(Environment* env, BufferValue* path);
void FromNamespacedPath(std::string* path);
} // namespace node
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
#endif // SRC_PATH_H_