1 | "use strict";
|
---|
2 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
---|
3 | if (k2 === undefined) k2 = k;
|
---|
4 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
---|
5 | }) : (function(o, m, k, k2) {
|
---|
6 | if (k2 === undefined) k2 = k;
|
---|
7 | o[k2] = m[k];
|
---|
8 | }));
|
---|
9 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
---|
10 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
---|
11 | }) : function(o, v) {
|
---|
12 | o["default"] = v;
|
---|
13 | });
|
---|
14 | var __importStar = (this && this.__importStar) || function (mod) {
|
---|
15 | if (mod && mod.__esModule) return mod;
|
---|
16 | var result = {};
|
---|
17 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
---|
18 | __setModuleDefault(result, mod);
|
---|
19 | return result;
|
---|
20 | };
|
---|
21 | var __read = (this && this.__read) || function (o, n) {
|
---|
22 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
---|
23 | if (!m) return o;
|
---|
24 | var i = m.call(o), r, ar = [], e;
|
---|
25 | try {
|
---|
26 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
---|
27 | }
|
---|
28 | catch (error) { e = { error: error }; }
|
---|
29 | finally {
|
---|
30 | try {
|
---|
31 | if (r && !r.done && (m = i["return"])) m.call(i);
|
---|
32 | }
|
---|
33 | finally { if (e) throw e.error; }
|
---|
34 | }
|
---|
35 | return ar;
|
---|
36 | };
|
---|
37 | var __spread = (this && this.__spread) || function () {
|
---|
38 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
---|
39 | return ar;
|
---|
40 | };
|
---|
41 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
42 | exports.WebpackFileSystem = void 0;
|
---|
43 | var path = __importStar(require("path"));
|
---|
44 | var WebpackFileSystem = /** @class */ (function () {
|
---|
45 | function WebpackFileSystem(fs) {
|
---|
46 | this.fs = fs;
|
---|
47 | this.pathSeparator = path.sep;
|
---|
48 | }
|
---|
49 | WebpackFileSystem.prototype.isFileInDirectory = function (filename, directory) {
|
---|
50 | var normalizedFile = this.resolvePath(filename);
|
---|
51 | var normalizedDirectory = this.resolvePath(directory);
|
---|
52 | return (!this.isDirectory(normalizedFile) &&
|
---|
53 | normalizedFile.indexOf(normalizedDirectory) === 0);
|
---|
54 | };
|
---|
55 | WebpackFileSystem.prototype.pathExists = function (filename) {
|
---|
56 | try {
|
---|
57 | this.fs.statSync(filename);
|
---|
58 | return true;
|
---|
59 | }
|
---|
60 | catch (e) {
|
---|
61 | return false;
|
---|
62 | }
|
---|
63 | };
|
---|
64 | WebpackFileSystem.prototype.readFileAsUtf8 = function (filename) {
|
---|
65 | return this.fs.readFileSync(filename).toString('utf8');
|
---|
66 | };
|
---|
67 | WebpackFileSystem.prototype.join = function () {
|
---|
68 | var paths = [];
|
---|
69 | for (var _i = 0; _i < arguments.length; _i++) {
|
---|
70 | paths[_i] = arguments[_i];
|
---|
71 | }
|
---|
72 | return path.join.apply(path, __spread(paths));
|
---|
73 | };
|
---|
74 | WebpackFileSystem.prototype.resolvePath = function (pathInput) {
|
---|
75 | return path.resolve(pathInput);
|
---|
76 | };
|
---|
77 | WebpackFileSystem.prototype.listPaths = function (dir) {
|
---|
78 | return this.fs.readdirSync(dir);
|
---|
79 | };
|
---|
80 | WebpackFileSystem.prototype.isDirectory = function (dir) {
|
---|
81 | var isDir = false;
|
---|
82 | try {
|
---|
83 | isDir = this.fs.statSync(dir).isDirectory();
|
---|
84 | }
|
---|
85 | catch (e) { }
|
---|
86 | return isDir;
|
---|
87 | };
|
---|
88 | return WebpackFileSystem;
|
---|
89 | }());
|
---|
90 | exports.WebpackFileSystem = WebpackFileSystem;
|
---|