|
55 | 55 | // Limit dependencies to core Node modules. This means the code in this file has to be very low-level and unattractive,
|
56 | 56 | // but simplifies things for the consumer of this module.
|
57 | 57 | __webpack_require__(2);
|
58 |
| - var http = __webpack_require__(3); |
59 |
| - var path = __webpack_require__(4); |
60 |
| - var ArgsUtil_1 = __webpack_require__(5); |
61 |
| - var ExitWhenParentExits_1 = __webpack_require__(6); |
| 58 | + __webpack_require__(4); |
| 59 | + var http = __webpack_require__(5); |
| 60 | + var path = __webpack_require__(3); |
| 61 | + var ArgsUtil_1 = __webpack_require__(6); |
| 62 | + var ExitWhenParentExits_1 = __webpack_require__(7); |
62 | 63 | // Webpack doesn't support dynamic requires for files not present at compile time, so grab a direct
|
63 | 64 | // reference to Node's runtime 'require' function.
|
64 | 65 | var dynamicRequire = eval('require');
|
|
142 | 143 |
|
143 | 144 | /***/ },
|
144 | 145 | /* 2 */
|
| 146 | +/***/ function(module, exports, __webpack_require__) { |
| 147 | + |
| 148 | + "use strict"; |
| 149 | + var path = __webpack_require__(3); |
| 150 | + var startsWith = function (str, prefix) { return str.substring(0, prefix.length) === prefix; }; |
| 151 | + var appRootDir = process.cwd(); |
| 152 | + function patchedLStat(pathToStatLong) { |
| 153 | + try { |
| 154 | + // If the lstat completes without errors, we don't modify its behavior at all |
| 155 | + return origLStat.apply(this, arguments); |
| 156 | + } |
| 157 | + catch (ex) { |
| 158 | + var shouldOverrideError = startsWith(ex.message, 'EPERM') // It's a permissions error |
| 159 | + && typeof appRootDirLong === 'string' |
| 160 | + && startsWith(appRootDirLong, pathToStatLong) // ... for an ancestor directory |
| 161 | + && ex.stack.indexOf('Object.realpathSync ') >= 0; // ... during symlink resolution |
| 162 | + if (shouldOverrideError) { |
| 163 | + // Fake the result to give the same result as an 'lstat' on the app root dir. |
| 164 | + // This stops Node failing to load modules just because it doesn't know whether |
| 165 | + // ancestor directories are symlinks or not. If there's a genuine file |
| 166 | + // permissions issue, it will still surface later when Node actually |
| 167 | + // tries to read the file. |
| 168 | + return origLStat.call(this, appRootDir); |
| 169 | + } |
| 170 | + else { |
| 171 | + // In any other case, preserve the original error |
| 172 | + throw ex; |
| 173 | + } |
| 174 | + } |
| 175 | + } |
| 176 | + ; |
| 177 | + // It's only necessary to apply this workaround on Windows |
| 178 | + var appRootDirLong = null; |
| 179 | + var origLStat = null; |
| 180 | + if (/^win/.test(process.platform)) { |
| 181 | + try { |
| 182 | + // Get the app's root dir in Node's internal "long" format (e.g., \\?\C:\dir\subdir) |
| 183 | + appRootDirLong = path._makeLong(appRootDir); |
| 184 | + // Actually apply the patch, being as defensive as possible |
| 185 | + var bindingFs = process.binding('fs'); |
| 186 | + origLStat = bindingFs.lstat; |
| 187 | + if (typeof origLStat === 'function') { |
| 188 | + bindingFs.lstat = patchedLStat; |
| 189 | + } |
| 190 | + } |
| 191 | + catch (ex) { |
| 192 | + } |
| 193 | + } |
| 194 | + |
| 195 | + |
| 196 | +/***/ }, |
| 197 | +/* 3 */ |
| 198 | +/***/ function(module, exports) { |
| 199 | + |
| 200 | + module.exports = require("path"); |
| 201 | + |
| 202 | +/***/ }, |
| 203 | +/* 4 */ |
145 | 204 | /***/ function(module, exports) {
|
146 | 205 |
|
147 | 206 | // When Node writes to stdout/strerr, we capture that and convert the lines into calls on the
|
|
182 | 241 |
|
183 | 242 |
|
184 | 243 | /***/ },
|
185 |
| -/* 3 */ |
| 244 | +/* 5 */ |
186 | 245 | /***/ function(module, exports) {
|
187 | 246 |
|
188 | 247 | module.exports = require("http");
|
189 | 248 |
|
190 | 249 | /***/ },
|
191 |
| -/* 4 */ |
192 |
| -/***/ function(module, exports) { |
193 |
| - |
194 |
| - module.exports = require("path"); |
195 |
| - |
196 |
| -/***/ }, |
197 |
| -/* 5 */ |
| 250 | +/* 6 */ |
198 | 251 | /***/ function(module, exports) {
|
199 | 252 |
|
200 | 253 | "use strict";
|
|
220 | 273 |
|
221 | 274 |
|
222 | 275 | /***/ },
|
223 |
| -/* 6 */ |
| 276 | +/* 7 */ |
224 | 277 | /***/ function(module, exports) {
|
225 | 278 |
|
226 | 279 | /*
|
|
0 commit comments