1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const fs = require("fs");
|
4 | function fileExistsSync(filePath) {
|
5 | try {
|
6 | fs.statSync(filePath);
|
7 | }
|
8 | catch (err) {
|
9 | if (err.code === 'ENOENT') {
|
10 | return false;
|
11 | }
|
12 | else {
|
13 | throw err;
|
14 | }
|
15 | }
|
16 | return true;
|
17 | }
|
18 | exports.fileExistsSync = fileExistsSync;
|
19 | function throwIfIsInvalidSourceFileError(filepath, error) {
|
20 | if (fileExistsSync(filepath) &&
|
21 |
|
22 | !(error instanceof Error) &&
|
23 | !(error.constructor.name === 'FatalError') &&
|
24 | !(error.message && error.message.trim().startsWith('Invalid source file'))) {
|
25 |
|
26 | throw error;
|
27 | }
|
28 | }
|
29 | exports.throwIfIsInvalidSourceFileError = throwIfIsInvalidSourceFileError;
|
30 |
|
\ | No newline at end of file |