How to use the sys function from typescript

Find comprehensive JavaScript typescript.sys code examples handpicked from public code repositorys.

49
50
51
52
53
54
55
56
57
58
    },
    getCurrentDirectory: () => process.cwd(),
    getCompilationSettings: () => compilerOptions,
    getDefaultLibFileName: (options) => ts.getDefaultLibFilePath(options),
    fileExists: ts.sys.fileExists,
    readFile: ts.sys.readFile,
    readDirectory: ts.sys.readDirectory,
  };
}

fork icon174
star icon755
watch icon34

+ 2 other calls in file

989
990
991
992
993
994
995
996
997
998
999
        // p = bazel-out/darwin_arm64-fastbuild/bin/0.params
        // currentDir =  bazel-out/darwin_arm64-fastbuild/bin
        p = path.resolve('..', '..', '..', p.slice(1));
    }
    const args = fs.readFileSync(p).toString().trim().split('\n');
    ts.sys.args = process.argv = [process.argv0, process.argv[1], ...args];
    execute(ts.sys, ts.noop, args);
}


module.exports.__do_not_use_test_only__ = { createFilesystemTree: createFilesystemTree, emit: emit, workers: workers };
fork icon26
star icon48
watch icon4

+ 2847 other calls in file

23
24
25
26
27
28
29
30
31
32
    };
};
function compile(fileName, options) {
    const program = (0, typescript_1.createProgram)([fileName], options);
    const emitResult = program.emit(undefined, (fileName, content) => {
        typescript_1.sys.writeFile(fileName, `${typescript_1.sys.newLine}${content}`);
    }, undefined, undefined, {
        before: [(ctx) => pathsTransformer(ctx, options)],
    });
    return !emitResult.emitSkipped;
fork icon0
star icon24
watch icon10

115
116
117
118
119
120
121
122
123
124
    }
    return projectFiles;
}
normalizePath(...paths) {
    const project = this, resolvedPath = project.resolvedPath;
    let path = typescript_1.sys.resolvePath(path_1.default.join(...paths));
    // .replace(/(?:\.d)?\.[jt]sx?$/, '');
    if (path_1.default.isAbsolute(path)) {
        path = path_1.default.relative(resolvedPath, path);
    }
fork icon2
star icon4
watch icon15

34
35
36
37
38
39
40
41
42
43
},
getCurrentDirectory() {
  return '';
},
getDefaultLibFileName: () => 'lib.d.ts',
getNewLine: () => ts.sys.newLine,
getSourceFile(filename, languageVersion) {
  let source;
  const libRegex = /lib\.(.+\.)?d\.ts$/;
  const jestRegex = /jest\.d\.ts/;
fork icon0
star icon0
watch icon1

+ 3 other calls in file

6
7
8
9
10
11
12
13
14
15
16
module.exports = (configPath) => {
  // Parse the tsconfig.json file and resolve every file name & compiler options
  const { errors, ...configOptions } = ts.getParsedCommandLineOfConfigFile(
    configPath,
    undefined,
    ts.sys
  );


  // If there are errors in the tsconfig.json
  // file, report them and exit early
fork icon0
star icon0
watch icon1

+ 598 other calls in file

39
40
41
42
43
44
45
46
47
48
    if (fileName === FILE_NAME) {
        text = currentTextDocument.getText();
    }
}
else {
    text = ts.sys.readFile(fileName) || '';
}
return {
    getText: function (start, end) { return text.substring(start, end); },
    getLength: function () { return text.length; },
fork icon0
star icon0
watch icon1

+ 182 other calls in file

6
7
8
9
10
11
12
13
14
15
const hasError = diagnostics.some(diag => diag.category === ts.DiagnosticCategory.Error);
if (hasError) {
    // Throw only if we're in strict mode, otherwise return original content.
    if (strict) {
        const errorMessages = ts.formatDiagnostics(diagnostics, {
            getCurrentDirectory: () => ts.sys.getCurrentDirectory(),
            getNewLine: () => ts.sys.newLine,
            getCanonicalFileName: (f) => f,
        });
        throw new Error(`
fork icon0
star icon0
watch icon1

+ 3 other calls in file

Other functions in typescript

Sorted by popularity

function icon

typescript.SyntaxKind is the most popular function in typescript (82777 examples)