1 | "use strict";
|
2 | var __importStar = (this && this.__importStar) || function (mod) {
|
3 | if (mod && mod.__esModule) return mod;
|
4 | var result = {};
|
5 | if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
6 | result["default"] = mod;
|
7 | return result;
|
8 | };
|
9 | Object.defineProperty(exports, "__esModule", { value: true });
|
10 | var fs = __importStar(require("fs"));
|
11 | function fileExistsSync(filePath) {
|
12 | try {
|
13 | fs.statSync(filePath);
|
14 | }
|
15 | catch (err) {
|
16 | if (err.code === 'ENOENT') {
|
17 | return false;
|
18 | }
|
19 | else {
|
20 | throw err;
|
21 | }
|
22 | }
|
23 | return true;
|
24 | }
|
25 | exports.fileExistsSync = fileExistsSync;
|
26 |
|
27 | function throwIfIsInvalidSourceFileError(filepath, error) {
|
28 | if (fileExistsSync(filepath) &&
|
29 |
|
30 | !(error instanceof Error) &&
|
31 | !(error.constructor.name === 'FatalError') &&
|
32 | !(error.message && error.message.trim().startsWith('Invalid source file'))) {
|
33 |
|
34 | throw error;
|
35 | }
|
36 | }
|
37 | exports.throwIfIsInvalidSourceFileError = throwIfIsInvalidSourceFileError;
|
38 |
|
\ | No newline at end of file |