MCPcopy Index your code
hub / github.com/nodejs/node / getNodeSystem

Function getNodeSystem

test/fixtures/snapshot/typescript.js:6935–7507  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6933 // not actually work.
6934 var byteOrderMarkIndicator = "\uFEFF";
6935 function getNodeSystem() {
6936 var _a;
6937 var nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[a-zA-Z0-9_\s]+(\.js)?$)/;
6938 var _fs = require("fs");
6939 var _path = require("path");
6940 var _os = require("os");
6941 // crypto can be absent on reduced node installations
6942 var _crypto;
6943 try {
6944 _crypto = require("crypto");
6945 }
6946 catch (_b) {
6947 _crypto = undefined;
6948 }
6949 var activeSession;
6950 var profilePath = "./profile.cpuprofile";
6951 var hitSystemWatcherLimit = false;
6952 var Buffer = require("buffer").Buffer;
6953 var nodeVersion = getNodeMajorVersion();
6954 var isNode4OrLater = nodeVersion >= 4;
6955 var isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
6956 var platform = _os.platform();
6957 var useCaseSensitiveFileNames = isFileSystemCaseSensitive();
6958 var realpathSync = (_a = _fs.realpathSync.native) !== null && _a !== void 0 ? _a : _fs.realpathSync;
6959 var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
6960 var getCurrentDirectory = ts.memoize(function () { return process.cwd(); });
6961 var _c = createSystemWatchFunctions({
6962 pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames),
6963 getModifiedTime: getModifiedTime,
6964 setTimeout: setTimeout,
6965 clearTimeout: clearTimeout,
6966 fsWatch: fsWatch,
6967 useCaseSensitiveFileNames: useCaseSensitiveFileNames,
6968 getCurrentDirectory: getCurrentDirectory,
6969 fileExists: fileExists,
6970 // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
6971 // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
6972 fsSupportsRecursiveFsWatch: fsSupportsRecursiveFsWatch,
6973 directoryExists: directoryExists,
6974 getAccessibleSortedChildDirectories: function (path) { return getAccessibleFileSystemEntries(path).directories; },
6975 realpath: realpath,
6976 tscWatchFile: process.env.TSC_WATCHFILE,
6977 useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER,
6978 tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
6979 defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); },
6980 }), watchFile = _c.watchFile, watchDirectory = _c.watchDirectory;
6981 var nodeSystem = {
6982 args: process.argv.slice(2),
6983 newLine: _os.EOL,
6984 useCaseSensitiveFileNames: useCaseSensitiveFileNames,
6985 write: function (s) {
6986 process.stdout.write(s);
6987 },
6988 getWidthOfTerminal: function () {
6989 return process.stdout.columns;
6990 },
6991 writeOutputIsTTY: function () {
6992 return process.stdout.isTTY;

Callers 1

typescript.jsFile · 0.85

Calls 15

getNodeMajorVersionFunction · 0.85
disableCPUProfilerFunction · 0.85
bufferFromFunction · 0.85
someMethod · 0.80
statSyncFunction · 0.70
sliceMethod · 0.65
requireFunction · 0.50
platformMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…