1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- const url_1 = require("url");
- function urlToRequire(url) {
- const returnValue = `"${url}"`;
-
- const firstChar = url.charAt(0);
- if (firstChar === '.' || firstChar === '~' || firstChar === '@') {
- if (firstChar === '~') {
- const secondChar = url.charAt(1);
- url = url.slice(secondChar === '/' ? 2 : 1);
- }
- const uriParts = parseUriParts(url);
- if (!uriParts.hash) {
- return `require("${url}")`;
- }
- else {
-
-
-
-
- return `require("${uriParts.path}") + "${uriParts.hash}"`;
- }
- }
- return returnValue;
- }
- exports.urlToRequire = urlToRequire;
- function parseUriParts(urlString) {
-
- const returnValue = url_1.parse('');
- if (urlString) {
-
-
- if ('string' === typeof urlString) {
-
- return url_1.parse(urlString);
- }
- }
- return returnValue;
- }
|