keep-a-changelog 2.0.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +5 -2
  3. package/esm/_dnt.polyfills.js +15 -0
  4. package/esm/bin.js +5 -4
  5. package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.120.0}/_util/assert.js +0 -0
  6. package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.120.0}/_util/os.js +2 -0
  7. package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.120.0}/flags/mod.js +0 -0
  8. package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.120.0}/path/_constants.js +0 -0
  9. package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.120.0}/path/_interface.js +0 -0
  10. package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.120.0}/path/_util.js +0 -0
  11. package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.120.0}/path/common.js +0 -0
  12. package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.120.0}/path/glob.js +0 -0
  13. package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.120.0}/path/mod.js +0 -0
  14. package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.120.0}/path/posix.js +3 -0
  15. package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.120.0}/path/separator.js +0 -0
  16. package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.120.0}/path/win32.js +3 -0
  17. package/esm/deps/{deno_land/std_0.51.0 → deno.land/std@0.51.0}/fs/eol.js +0 -0
  18. package/esm/deps/{deno_land/x/ini_v2.1.0 → deno.land/x/ini@v2.1.0}/ini.js +1 -1
  19. package/esm/deps/{deno_land/x/ini_v2.1.0 → deno.land/x/ini@v2.1.0}/mod.js +0 -0
  20. package/esm/deps/{deno_land/x/semver_v1.4.0 → deno.land/x/semver@v1.4.0}/mod.js +0 -0
  21. package/esm/mod.js +1 -0
  22. package/esm/src/Release.js +11 -4
  23. package/esm/src/deps.js +1 -1
  24. package/esm/src/parser.js +5 -2
  25. package/esm/test/changelog.expected.md +3 -3
  26. package/esm/test/changelog.md +3 -3
  27. package/package.json +6 -6
  28. package/script/_dnt.polyfills.js +16 -0
  29. package/script/_dnt.shims.js +66 -0
  30. package/script/bin.js +140 -0
  31. package/script/deps/deno.land/std@0.120.0/_util/assert.js +18 -0
  32. package/script/deps/deno.land/std@0.120.0/_util/os.js +43 -0
  33. package/script/deps/deno.land/std@0.120.0/flags/mod.js +259 -0
  34. package/script/deps/deno.land/std@0.120.0/path/_constants.js +48 -0
  35. package/script/deps/deno.land/std@0.120.0/path/_interface.js +4 -0
  36. package/script/deps/deno.land/std@0.120.0/path/_util.js +124 -0
  37. package/script/deps/deno.land/std@0.120.0/path/common.js +40 -0
  38. package/script/deps/deno.land/std@0.120.0/path/glob.js +391 -0
  39. package/script/deps/deno.land/std@0.120.0/path/mod.js +45 -0
  40. package/script/deps/deno.land/std@0.120.0/path/posix.js +535 -0
  41. package/script/deps/deno.land/std@0.120.0/path/separator.js +8 -0
  42. package/script/deps/deno.land/std@0.120.0/path/win32.js +1005 -0
  43. package/script/deps/deno.land/std@0.51.0/fs/eol.js +34 -0
  44. package/script/deps/deno.land/x/ini@v2.1.0/ini.js +256 -0
  45. package/script/deps/deno.land/x/ini@v2.1.0/mod.js +17 -0
  46. package/script/deps/deno.land/x/semver@v1.4.0/mod.js +1568 -0
  47. package/script/mod.js +15 -0
  48. package/{umd → script}/package.json +0 -0
  49. package/script/src/Change.js +51 -0
  50. package/script/src/Changelog.js +140 -0
  51. package/script/src/Release.js +217 -0
  52. package/script/src/deps.js +9 -0
  53. package/script/src/parser.js +168 -0
  54. package/{umd → script}/test/changelog.custom.type.md +0 -0
  55. package/{umd → script}/test/changelog.expected.md +3 -3
  56. package/{umd → script}/test/changelog.md +3 -3
  57. package/{umd → script}/test/empty.expected.md +0 -0
  58. package/types/_dnt.polyfills.d.ts +11 -0
  59. package/types/_dnt.shims.d.ts +0 -4
  60. package/types/bin.d.ts +1 -1
  61. package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.120.0}/_util/assert.d.ts +0 -0
  62. package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.120.0}/_util/os.d.ts +0 -0
  63. package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.120.0}/flags/mod.d.ts +0 -0
  64. package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.120.0}/path/_constants.d.ts +0 -0
  65. package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.120.0}/path/_interface.d.ts +0 -0
  66. package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.120.0}/path/_util.d.ts +0 -0
  67. package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.120.0}/path/common.d.ts +0 -0
  68. package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.120.0}/path/glob.d.ts +0 -0
  69. package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.120.0}/path/mod.d.ts +0 -0
  70. package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.120.0}/path/posix.d.ts +0 -0
  71. package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.120.0}/path/separator.d.ts +0 -0
  72. package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.120.0}/path/win32.d.ts +0 -0
  73. package/types/deps/{deno_land/std_0.51.0 → deno.land/std@0.51.0}/fs/eol.d.ts +0 -0
  74. package/types/deps/{deno_land/x/ini_v2.1.0 → deno.land/x/ini@v2.1.0}/ini.d.ts +0 -0
  75. package/types/deps/{deno_land/x/ini_v2.1.0 → deno.land/x/ini@v2.1.0}/mod.d.ts +0 -0
  76. package/types/deps/{deno_land/x/semver_v1.4.0 → deno.land/x/semver@v1.4.0}/mod.d.ts +0 -0
  77. package/types/mod.d.ts +1 -0
  78. package/types/src/Release.d.ts +1 -0
  79. package/types/src/deps.d.ts +1 -1
  80. package/umd/_dnt.shims.js +0 -76
  81. package/umd/bin.js +0 -145
  82. package/umd/deps/deno_land/std_0.120.0/_util/assert.js +0 -28
  83. package/umd/deps/deno_land/std_0.120.0/_util/os.js +0 -47
  84. package/umd/deps/deno_land/std_0.120.0/flags/mod.js +0 -269
  85. package/umd/deps/deno_land/std_0.120.0/path/_constants.js +0 -58
  86. package/umd/deps/deno_land/std_0.120.0/path/_interface.js +0 -14
  87. package/umd/deps/deno_land/std_0.120.0/path/_util.js +0 -134
  88. package/umd/deps/deno_land/std_0.120.0/path/common.js +0 -50
  89. package/umd/deps/deno_land/std_0.120.0/path/glob.js +0 -397
  90. package/umd/deps/deno_land/std_0.120.0/path/mod.js +0 -51
  91. package/umd/deps/deno_land/std_0.120.0/path/posix.js +0 -538
  92. package/umd/deps/deno_land/std_0.120.0/path/separator.js +0 -18
  93. package/umd/deps/deno_land/std_0.120.0/path/win32.js +0 -1008
  94. package/umd/deps/deno_land/std_0.51.0/fs/eol.js +0 -44
  95. package/umd/deps/deno_land/x/ini_v2.1.0/ini.js +0 -262
  96. package/umd/deps/deno_land/x/ini_v2.1.0/mod.js +0 -23
  97. package/umd/deps/deno_land/x/semver_v1.4.0/mod.js +0 -1578
  98. package/umd/mod.js +0 -24
  99. package/umd/src/Change.js +0 -61
  100. package/umd/src/Changelog.js +0 -150
  101. package/umd/src/Release.js +0 -220
  102. package/umd/src/deps.js +0 -19
  103. package/umd/src/parser.js +0 -175
@@ -0,0 +1,1005 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.toFileUrl = exports.fromFileUrl = exports.parse = exports.format = exports.extname = exports.basename = exports.dirname = exports.toNamespacedPath = exports.relative = exports.join = exports.isAbsolute = exports.normalize = exports.resolve = exports.delimiter = exports.sep = void 0;
27
+ // Copyright the Browserify authors. MIT License.
28
+ // Ported from https://github.com/browserify/path-browserify/
29
+ // This module is browser compatible.
30
+ const dntShim = __importStar(require("../../../../_dnt.shims.js"));
31
+ const _constants_js_1 = require("./_constants.js");
32
+ const _util_js_1 = require("./_util.js");
33
+ const assert_js_1 = require("../_util/assert.js");
34
+ exports.sep = "\\";
35
+ exports.delimiter = ";";
36
+ /**
37
+ * Resolves path segments into a `path`
38
+ * @param pathSegments to process to path
39
+ */
40
+ function resolve(...pathSegments) {
41
+ let resolvedDevice = "";
42
+ let resolvedTail = "";
43
+ let resolvedAbsolute = false;
44
+ for (let i = pathSegments.length - 1; i >= -1; i--) {
45
+ let path;
46
+ // deno-lint-ignore no-explicit-any
47
+ const { Deno } = dntShim.dntGlobalThis;
48
+ if (i >= 0) {
49
+ path = pathSegments[i];
50
+ }
51
+ else if (!resolvedDevice) {
52
+ if (typeof Deno?.cwd !== "function") {
53
+ throw new TypeError("Resolved a drive-letter-less path without a CWD.");
54
+ }
55
+ path = Deno.cwd();
56
+ }
57
+ else {
58
+ if (typeof Deno?.env?.get !== "function" || typeof Deno?.cwd !== "function") {
59
+ throw new TypeError("Resolved a relative path without a CWD.");
60
+ }
61
+ path = Deno.cwd();
62
+ // Verify that a cwd was found and that it actually points
63
+ // to our drive. If not, default to the drive's root.
64
+ if (path === undefined ||
65
+ path.slice(0, 3).toLowerCase() !== `${resolvedDevice.toLowerCase()}\\`) {
66
+ path = `${resolvedDevice}\\`;
67
+ }
68
+ }
69
+ (0, _util_js_1.assertPath)(path);
70
+ const len = path.length;
71
+ // Skip empty entries
72
+ if (len === 0)
73
+ continue;
74
+ let rootEnd = 0;
75
+ let device = "";
76
+ let isAbsolute = false;
77
+ const code = path.charCodeAt(0);
78
+ // Try to match a root
79
+ if (len > 1) {
80
+ if ((0, _util_js_1.isPathSeparator)(code)) {
81
+ // Possible UNC root
82
+ // If we started with a separator, we know we at least have an
83
+ // absolute path of some kind (UNC or otherwise)
84
+ isAbsolute = true;
85
+ if ((0, _util_js_1.isPathSeparator)(path.charCodeAt(1))) {
86
+ // Matched double path separator at beginning
87
+ let j = 2;
88
+ let last = j;
89
+ // Match 1 or more non-path separators
90
+ for (; j < len; ++j) {
91
+ if ((0, _util_js_1.isPathSeparator)(path.charCodeAt(j)))
92
+ break;
93
+ }
94
+ if (j < len && j !== last) {
95
+ const firstPart = path.slice(last, j);
96
+ // Matched!
97
+ last = j;
98
+ // Match 1 or more path separators
99
+ for (; j < len; ++j) {
100
+ if (!(0, _util_js_1.isPathSeparator)(path.charCodeAt(j)))
101
+ break;
102
+ }
103
+ if (j < len && j !== last) {
104
+ // Matched!
105
+ last = j;
106
+ // Match 1 or more non-path separators
107
+ for (; j < len; ++j) {
108
+ if ((0, _util_js_1.isPathSeparator)(path.charCodeAt(j)))
109
+ break;
110
+ }
111
+ if (j === len) {
112
+ // We matched a UNC root only
113
+ device = `\\\\${firstPart}\\${path.slice(last)}`;
114
+ rootEnd = j;
115
+ }
116
+ else if (j !== last) {
117
+ // We matched a UNC root with leftovers
118
+ device = `\\\\${firstPart}\\${path.slice(last, j)}`;
119
+ rootEnd = j;
120
+ }
121
+ }
122
+ }
123
+ }
124
+ else {
125
+ rootEnd = 1;
126
+ }
127
+ }
128
+ else if ((0, _util_js_1.isWindowsDeviceRoot)(code)) {
129
+ // Possible device root
130
+ if (path.charCodeAt(1) === _constants_js_1.CHAR_COLON) {
131
+ device = path.slice(0, 2);
132
+ rootEnd = 2;
133
+ if (len > 2) {
134
+ if ((0, _util_js_1.isPathSeparator)(path.charCodeAt(2))) {
135
+ // Treat separator following drive name as an absolute path
136
+ // indicator
137
+ isAbsolute = true;
138
+ rootEnd = 3;
139
+ }
140
+ }
141
+ }
142
+ }
143
+ }
144
+ else if ((0, _util_js_1.isPathSeparator)(code)) {
145
+ // `path` contains just a path separator
146
+ rootEnd = 1;
147
+ isAbsolute = true;
148
+ }
149
+ if (device.length > 0 &&
150
+ resolvedDevice.length > 0 &&
151
+ device.toLowerCase() !== resolvedDevice.toLowerCase()) {
152
+ // This path points to another device so it is not applicable
153
+ continue;
154
+ }
155
+ if (resolvedDevice.length === 0 && device.length > 0) {
156
+ resolvedDevice = device;
157
+ }
158
+ if (!resolvedAbsolute) {
159
+ resolvedTail = `${path.slice(rootEnd)}\\${resolvedTail}`;
160
+ resolvedAbsolute = isAbsolute;
161
+ }
162
+ if (resolvedAbsolute && resolvedDevice.length > 0)
163
+ break;
164
+ }
165
+ // At this point the path should be resolved to a full absolute path,
166
+ // but handle relative paths to be safe (might happen when process.cwd()
167
+ // fails)
168
+ // Normalize the tail path
169
+ resolvedTail = (0, _util_js_1.normalizeString)(resolvedTail, !resolvedAbsolute, "\\", _util_js_1.isPathSeparator);
170
+ return resolvedDevice + (resolvedAbsolute ? "\\" : "") + resolvedTail || ".";
171
+ }
172
+ exports.resolve = resolve;
173
+ /**
174
+ * Normalizes a `path`
175
+ * @param path to normalize
176
+ */
177
+ function normalize(path) {
178
+ (0, _util_js_1.assertPath)(path);
179
+ const len = path.length;
180
+ if (len === 0)
181
+ return ".";
182
+ let rootEnd = 0;
183
+ let device;
184
+ let isAbsolute = false;
185
+ const code = path.charCodeAt(0);
186
+ // Try to match a root
187
+ if (len > 1) {
188
+ if ((0, _util_js_1.isPathSeparator)(code)) {
189
+ // Possible UNC root
190
+ // If we started with a separator, we know we at least have an absolute
191
+ // path of some kind (UNC or otherwise)
192
+ isAbsolute = true;
193
+ if ((0, _util_js_1.isPathSeparator)(path.charCodeAt(1))) {
194
+ // Matched double path separator at beginning
195
+ let j = 2;
196
+ let last = j;
197
+ // Match 1 or more non-path separators
198
+ for (; j < len; ++j) {
199
+ if ((0, _util_js_1.isPathSeparator)(path.charCodeAt(j)))
200
+ break;
201
+ }
202
+ if (j < len && j !== last) {
203
+ const firstPart = path.slice(last, j);
204
+ // Matched!
205
+ last = j;
206
+ // Match 1 or more path separators
207
+ for (; j < len; ++j) {
208
+ if (!(0, _util_js_1.isPathSeparator)(path.charCodeAt(j)))
209
+ break;
210
+ }
211
+ if (j < len && j !== last) {
212
+ // Matched!
213
+ last = j;
214
+ // Match 1 or more non-path separators
215
+ for (; j < len; ++j) {
216
+ if ((0, _util_js_1.isPathSeparator)(path.charCodeAt(j)))
217
+ break;
218
+ }
219
+ if (j === len) {
220
+ // We matched a UNC root only
221
+ // Return the normalized version of the UNC root since there
222
+ // is nothing left to process
223
+ return `\\\\${firstPart}\\${path.slice(last)}\\`;
224
+ }
225
+ else if (j !== last) {
226
+ // We matched a UNC root with leftovers
227
+ device = `\\\\${firstPart}\\${path.slice(last, j)}`;
228
+ rootEnd = j;
229
+ }
230
+ }
231
+ }
232
+ }
233
+ else {
234
+ rootEnd = 1;
235
+ }
236
+ }
237
+ else if ((0, _util_js_1.isWindowsDeviceRoot)(code)) {
238
+ // Possible device root
239
+ if (path.charCodeAt(1) === _constants_js_1.CHAR_COLON) {
240
+ device = path.slice(0, 2);
241
+ rootEnd = 2;
242
+ if (len > 2) {
243
+ if ((0, _util_js_1.isPathSeparator)(path.charCodeAt(2))) {
244
+ // Treat separator following drive name as an absolute path
245
+ // indicator
246
+ isAbsolute = true;
247
+ rootEnd = 3;
248
+ }
249
+ }
250
+ }
251
+ }
252
+ }
253
+ else if ((0, _util_js_1.isPathSeparator)(code)) {
254
+ // `path` contains just a path separator, exit early to avoid unnecessary
255
+ // work
256
+ return "\\";
257
+ }
258
+ let tail;
259
+ if (rootEnd < len) {
260
+ tail = (0, _util_js_1.normalizeString)(path.slice(rootEnd), !isAbsolute, "\\", _util_js_1.isPathSeparator);
261
+ }
262
+ else {
263
+ tail = "";
264
+ }
265
+ if (tail.length === 0 && !isAbsolute)
266
+ tail = ".";
267
+ if (tail.length > 0 && (0, _util_js_1.isPathSeparator)(path.charCodeAt(len - 1))) {
268
+ tail += "\\";
269
+ }
270
+ if (device === undefined) {
271
+ if (isAbsolute) {
272
+ if (tail.length > 0)
273
+ return `\\${tail}`;
274
+ else
275
+ return "\\";
276
+ }
277
+ else if (tail.length > 0) {
278
+ return tail;
279
+ }
280
+ else {
281
+ return "";
282
+ }
283
+ }
284
+ else if (isAbsolute) {
285
+ if (tail.length > 0)
286
+ return `${device}\\${tail}`;
287
+ else
288
+ return `${device}\\`;
289
+ }
290
+ else if (tail.length > 0) {
291
+ return device + tail;
292
+ }
293
+ else {
294
+ return device;
295
+ }
296
+ }
297
+ exports.normalize = normalize;
298
+ /**
299
+ * Verifies whether path is absolute
300
+ * @param path to verify
301
+ */
302
+ function isAbsolute(path) {
303
+ (0, _util_js_1.assertPath)(path);
304
+ const len = path.length;
305
+ if (len === 0)
306
+ return false;
307
+ const code = path.charCodeAt(0);
308
+ if ((0, _util_js_1.isPathSeparator)(code)) {
309
+ return true;
310
+ }
311
+ else if ((0, _util_js_1.isWindowsDeviceRoot)(code)) {
312
+ // Possible device root
313
+ if (len > 2 && path.charCodeAt(1) === _constants_js_1.CHAR_COLON) {
314
+ if ((0, _util_js_1.isPathSeparator)(path.charCodeAt(2)))
315
+ return true;
316
+ }
317
+ }
318
+ return false;
319
+ }
320
+ exports.isAbsolute = isAbsolute;
321
+ /**
322
+ * Join all given a sequence of `paths`,then normalizes the resulting path.
323
+ * @param paths to be joined and normalized
324
+ */
325
+ function join(...paths) {
326
+ const pathsCount = paths.length;
327
+ if (pathsCount === 0)
328
+ return ".";
329
+ let joined;
330
+ let firstPart = null;
331
+ for (let i = 0; i < pathsCount; ++i) {
332
+ const path = paths[i];
333
+ (0, _util_js_1.assertPath)(path);
334
+ if (path.length > 0) {
335
+ if (joined === undefined)
336
+ joined = firstPart = path;
337
+ else
338
+ joined += `\\${path}`;
339
+ }
340
+ }
341
+ if (joined === undefined)
342
+ return ".";
343
+ // Make sure that the joined path doesn't start with two slashes, because
344
+ // normalize() will mistake it for an UNC path then.
345
+ //
346
+ // This step is skipped when it is very clear that the user actually
347
+ // intended to point at an UNC path. This is assumed when the first
348
+ // non-empty string arguments starts with exactly two slashes followed by
349
+ // at least one more non-slash character.
350
+ //
351
+ // Note that for normalize() to treat a path as an UNC path it needs to
352
+ // have at least 2 components, so we don't filter for that here.
353
+ // This means that the user can use join to construct UNC paths from
354
+ // a server name and a share name; for example:
355
+ // path.join('//server', 'share') -> '\\\\server\\share\\')
356
+ let needsReplace = true;
357
+ let slashCount = 0;
358
+ (0, assert_js_1.assert)(firstPart != null);
359
+ if ((0, _util_js_1.isPathSeparator)(firstPart.charCodeAt(0))) {
360
+ ++slashCount;
361
+ const firstLen = firstPart.length;
362
+ if (firstLen > 1) {
363
+ if ((0, _util_js_1.isPathSeparator)(firstPart.charCodeAt(1))) {
364
+ ++slashCount;
365
+ if (firstLen > 2) {
366
+ if ((0, _util_js_1.isPathSeparator)(firstPart.charCodeAt(2)))
367
+ ++slashCount;
368
+ else {
369
+ // We matched a UNC path in the first part
370
+ needsReplace = false;
371
+ }
372
+ }
373
+ }
374
+ }
375
+ }
376
+ if (needsReplace) {
377
+ // Find any more consecutive slashes we need to replace
378
+ for (; slashCount < joined.length; ++slashCount) {
379
+ if (!(0, _util_js_1.isPathSeparator)(joined.charCodeAt(slashCount)))
380
+ break;
381
+ }
382
+ // Replace the slashes if needed
383
+ if (slashCount >= 2)
384
+ joined = `\\${joined.slice(slashCount)}`;
385
+ }
386
+ return normalize(joined);
387
+ }
388
+ exports.join = join;
389
+ /**
390
+ * It will solve the relative path from `from` to `to`, for instance:
391
+ * from = 'C:\\orandea\\test\\aaa'
392
+ * to = 'C:\\orandea\\impl\\bbb'
393
+ * The output of the function should be: '..\\..\\impl\\bbb'
394
+ * @param from relative path
395
+ * @param to relative path
396
+ */
397
+ function relative(from, to) {
398
+ (0, _util_js_1.assertPath)(from);
399
+ (0, _util_js_1.assertPath)(to);
400
+ if (from === to)
401
+ return "";
402
+ const fromOrig = resolve(from);
403
+ const toOrig = resolve(to);
404
+ if (fromOrig === toOrig)
405
+ return "";
406
+ from = fromOrig.toLowerCase();
407
+ to = toOrig.toLowerCase();
408
+ if (from === to)
409
+ return "";
410
+ // Trim any leading backslashes
411
+ let fromStart = 0;
412
+ let fromEnd = from.length;
413
+ for (; fromStart < fromEnd; ++fromStart) {
414
+ if (from.charCodeAt(fromStart) !== _constants_js_1.CHAR_BACKWARD_SLASH)
415
+ break;
416
+ }
417
+ // Trim trailing backslashes (applicable to UNC paths only)
418
+ for (; fromEnd - 1 > fromStart; --fromEnd) {
419
+ if (from.charCodeAt(fromEnd - 1) !== _constants_js_1.CHAR_BACKWARD_SLASH)
420
+ break;
421
+ }
422
+ const fromLen = fromEnd - fromStart;
423
+ // Trim any leading backslashes
424
+ let toStart = 0;
425
+ let toEnd = to.length;
426
+ for (; toStart < toEnd; ++toStart) {
427
+ if (to.charCodeAt(toStart) !== _constants_js_1.CHAR_BACKWARD_SLASH)
428
+ break;
429
+ }
430
+ // Trim trailing backslashes (applicable to UNC paths only)
431
+ for (; toEnd - 1 > toStart; --toEnd) {
432
+ if (to.charCodeAt(toEnd - 1) !== _constants_js_1.CHAR_BACKWARD_SLASH)
433
+ break;
434
+ }
435
+ const toLen = toEnd - toStart;
436
+ // Compare paths to find the longest common path from root
437
+ const length = fromLen < toLen ? fromLen : toLen;
438
+ let lastCommonSep = -1;
439
+ let i = 0;
440
+ for (; i <= length; ++i) {
441
+ if (i === length) {
442
+ if (toLen > length) {
443
+ if (to.charCodeAt(toStart + i) === _constants_js_1.CHAR_BACKWARD_SLASH) {
444
+ // We get here if `from` is the exact base path for `to`.
445
+ // For example: from='C:\\foo\\bar'; to='C:\\foo\\bar\\baz'
446
+ return toOrig.slice(toStart + i + 1);
447
+ }
448
+ else if (i === 2) {
449
+ // We get here if `from` is the device root.
450
+ // For example: from='C:\\'; to='C:\\foo'
451
+ return toOrig.slice(toStart + i);
452
+ }
453
+ }
454
+ if (fromLen > length) {
455
+ if (from.charCodeAt(fromStart + i) === _constants_js_1.CHAR_BACKWARD_SLASH) {
456
+ // We get here if `to` is the exact base path for `from`.
457
+ // For example: from='C:\\foo\\bar'; to='C:\\foo'
458
+ lastCommonSep = i;
459
+ }
460
+ else if (i === 2) {
461
+ // We get here if `to` is the device root.
462
+ // For example: from='C:\\foo\\bar'; to='C:\\'
463
+ lastCommonSep = 3;
464
+ }
465
+ }
466
+ break;
467
+ }
468
+ const fromCode = from.charCodeAt(fromStart + i);
469
+ const toCode = to.charCodeAt(toStart + i);
470
+ if (fromCode !== toCode)
471
+ break;
472
+ else if (fromCode === _constants_js_1.CHAR_BACKWARD_SLASH)
473
+ lastCommonSep = i;
474
+ }
475
+ // We found a mismatch before the first common path separator was seen, so
476
+ // return the original `to`.
477
+ if (i !== length && lastCommonSep === -1) {
478
+ return toOrig;
479
+ }
480
+ let out = "";
481
+ if (lastCommonSep === -1)
482
+ lastCommonSep = 0;
483
+ // Generate the relative path based on the path difference between `to` and
484
+ // `from`
485
+ for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
486
+ if (i === fromEnd || from.charCodeAt(i) === _constants_js_1.CHAR_BACKWARD_SLASH) {
487
+ if (out.length === 0)
488
+ out += "..";
489
+ else
490
+ out += "\\..";
491
+ }
492
+ }
493
+ // Lastly, append the rest of the destination (`to`) path that comes after
494
+ // the common path parts
495
+ if (out.length > 0) {
496
+ return out + toOrig.slice(toStart + lastCommonSep, toEnd);
497
+ }
498
+ else {
499
+ toStart += lastCommonSep;
500
+ if (toOrig.charCodeAt(toStart) === _constants_js_1.CHAR_BACKWARD_SLASH)
501
+ ++toStart;
502
+ return toOrig.slice(toStart, toEnd);
503
+ }
504
+ }
505
+ exports.relative = relative;
506
+ /**
507
+ * Resolves path to a namespace path
508
+ * @param path to resolve to namespace
509
+ */
510
+ function toNamespacedPath(path) {
511
+ // Note: this will *probably* throw somewhere.
512
+ if (typeof path !== "string")
513
+ return path;
514
+ if (path.length === 0)
515
+ return "";
516
+ const resolvedPath = resolve(path);
517
+ if (resolvedPath.length >= 3) {
518
+ if (resolvedPath.charCodeAt(0) === _constants_js_1.CHAR_BACKWARD_SLASH) {
519
+ // Possible UNC root
520
+ if (resolvedPath.charCodeAt(1) === _constants_js_1.CHAR_BACKWARD_SLASH) {
521
+ const code = resolvedPath.charCodeAt(2);
522
+ if (code !== _constants_js_1.CHAR_QUESTION_MARK && code !== _constants_js_1.CHAR_DOT) {
523
+ // Matched non-long UNC root, convert the path to a long UNC path
524
+ return `\\\\?\\UNC\\${resolvedPath.slice(2)}`;
525
+ }
526
+ }
527
+ }
528
+ else if ((0, _util_js_1.isWindowsDeviceRoot)(resolvedPath.charCodeAt(0))) {
529
+ // Possible device root
530
+ if (resolvedPath.charCodeAt(1) === _constants_js_1.CHAR_COLON &&
531
+ resolvedPath.charCodeAt(2) === _constants_js_1.CHAR_BACKWARD_SLASH) {
532
+ // Matched device root, convert the path to a long UNC path
533
+ return `\\\\?\\${resolvedPath}`;
534
+ }
535
+ }
536
+ }
537
+ return path;
538
+ }
539
+ exports.toNamespacedPath = toNamespacedPath;
540
+ /**
541
+ * Return the directory name of a `path`.
542
+ * @param path to determine name for
543
+ */
544
+ function dirname(path) {
545
+ (0, _util_js_1.assertPath)(path);
546
+ const len = path.length;
547
+ if (len === 0)
548
+ return ".";
549
+ let rootEnd = -1;
550
+ let end = -1;
551
+ let matchedSlash = true;
552
+ let offset = 0;
553
+ const code = path.charCodeAt(0);
554
+ // Try to match a root
555
+ if (len > 1) {
556
+ if ((0, _util_js_1.isPathSeparator)(code)) {
557
+ // Possible UNC root
558
+ rootEnd = offset = 1;
559
+ if ((0, _util_js_1.isPathSeparator)(path.charCodeAt(1))) {
560
+ // Matched double path separator at beginning
561
+ let j = 2;
562
+ let last = j;
563
+ // Match 1 or more non-path separators
564
+ for (; j < len; ++j) {
565
+ if ((0, _util_js_1.isPathSeparator)(path.charCodeAt(j)))
566
+ break;
567
+ }
568
+ if (j < len && j !== last) {
569
+ // Matched!
570
+ last = j;
571
+ // Match 1 or more path separators
572
+ for (; j < len; ++j) {
573
+ if (!(0, _util_js_1.isPathSeparator)(path.charCodeAt(j)))
574
+ break;
575
+ }
576
+ if (j < len && j !== last) {
577
+ // Matched!
578
+ last = j;
579
+ // Match 1 or more non-path separators
580
+ for (; j < len; ++j) {
581
+ if ((0, _util_js_1.isPathSeparator)(path.charCodeAt(j)))
582
+ break;
583
+ }
584
+ if (j === len) {
585
+ // We matched a UNC root only
586
+ return path;
587
+ }
588
+ if (j !== last) {
589
+ // We matched a UNC root with leftovers
590
+ // Offset by 1 to include the separator after the UNC root to
591
+ // treat it as a "normal root" on top of a (UNC) root
592
+ rootEnd = offset = j + 1;
593
+ }
594
+ }
595
+ }
596
+ }
597
+ }
598
+ else if ((0, _util_js_1.isWindowsDeviceRoot)(code)) {
599
+ // Possible device root
600
+ if (path.charCodeAt(1) === _constants_js_1.CHAR_COLON) {
601
+ rootEnd = offset = 2;
602
+ if (len > 2) {
603
+ if ((0, _util_js_1.isPathSeparator)(path.charCodeAt(2)))
604
+ rootEnd = offset = 3;
605
+ }
606
+ }
607
+ }
608
+ }
609
+ else if ((0, _util_js_1.isPathSeparator)(code)) {
610
+ // `path` contains just a path separator, exit early to avoid
611
+ // unnecessary work
612
+ return path;
613
+ }
614
+ for (let i = len - 1; i >= offset; --i) {
615
+ if ((0, _util_js_1.isPathSeparator)(path.charCodeAt(i))) {
616
+ if (!matchedSlash) {
617
+ end = i;
618
+ break;
619
+ }
620
+ }
621
+ else {
622
+ // We saw the first non-path separator
623
+ matchedSlash = false;
624
+ }
625
+ }
626
+ if (end === -1) {
627
+ if (rootEnd === -1)
628
+ return ".";
629
+ else
630
+ end = rootEnd;
631
+ }
632
+ return path.slice(0, end);
633
+ }
634
+ exports.dirname = dirname;
635
+ /**
636
+ * Return the last portion of a `path`. Trailing directory separators are ignored.
637
+ * @param path to process
638
+ * @param ext of path directory
639
+ */
640
+ function basename(path, ext = "") {
641
+ if (ext !== undefined && typeof ext !== "string") {
642
+ throw new TypeError('"ext" argument must be a string');
643
+ }
644
+ (0, _util_js_1.assertPath)(path);
645
+ let start = 0;
646
+ let end = -1;
647
+ let matchedSlash = true;
648
+ let i;
649
+ // Check for a drive letter prefix so as not to mistake the following
650
+ // path separator as an extra separator at the end of the path that can be
651
+ // disregarded
652
+ if (path.length >= 2) {
653
+ const drive = path.charCodeAt(0);
654
+ if ((0, _util_js_1.isWindowsDeviceRoot)(drive)) {
655
+ if (path.charCodeAt(1) === _constants_js_1.CHAR_COLON)
656
+ start = 2;
657
+ }
658
+ }
659
+ if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {
660
+ if (ext.length === path.length && ext === path)
661
+ return "";
662
+ let extIdx = ext.length - 1;
663
+ let firstNonSlashEnd = -1;
664
+ for (i = path.length - 1; i >= start; --i) {
665
+ const code = path.charCodeAt(i);
666
+ if ((0, _util_js_1.isPathSeparator)(code)) {
667
+ // If we reached a path separator that was not part of a set of path
668
+ // separators at the end of the string, stop now
669
+ if (!matchedSlash) {
670
+ start = i + 1;
671
+ break;
672
+ }
673
+ }
674
+ else {
675
+ if (firstNonSlashEnd === -1) {
676
+ // We saw the first non-path separator, remember this index in case
677
+ // we need it if the extension ends up not matching
678
+ matchedSlash = false;
679
+ firstNonSlashEnd = i + 1;
680
+ }
681
+ if (extIdx >= 0) {
682
+ // Try to match the explicit extension
683
+ if (code === ext.charCodeAt(extIdx)) {
684
+ if (--extIdx === -1) {
685
+ // We matched the extension, so mark this as the end of our path
686
+ // component
687
+ end = i;
688
+ }
689
+ }
690
+ else {
691
+ // Extension does not match, so our result is the entire path
692
+ // component
693
+ extIdx = -1;
694
+ end = firstNonSlashEnd;
695
+ }
696
+ }
697
+ }
698
+ }
699
+ if (start === end)
700
+ end = firstNonSlashEnd;
701
+ else if (end === -1)
702
+ end = path.length;
703
+ return path.slice(start, end);
704
+ }
705
+ else {
706
+ for (i = path.length - 1; i >= start; --i) {
707
+ if ((0, _util_js_1.isPathSeparator)(path.charCodeAt(i))) {
708
+ // If we reached a path separator that was not part of a set of path
709
+ // separators at the end of the string, stop now
710
+ if (!matchedSlash) {
711
+ start = i + 1;
712
+ break;
713
+ }
714
+ }
715
+ else if (end === -1) {
716
+ // We saw the first non-path separator, mark this as the end of our
717
+ // path component
718
+ matchedSlash = false;
719
+ end = i + 1;
720
+ }
721
+ }
722
+ if (end === -1)
723
+ return "";
724
+ return path.slice(start, end);
725
+ }
726
+ }
727
+ exports.basename = basename;
728
+ /**
729
+ * Return the extension of the `path`.
730
+ * @param path with extension
731
+ */
732
+ function extname(path) {
733
+ (0, _util_js_1.assertPath)(path);
734
+ let start = 0;
735
+ let startDot = -1;
736
+ let startPart = 0;
737
+ let end = -1;
738
+ let matchedSlash = true;
739
+ // Track the state of characters (if any) we see before our first dot and
740
+ // after any path separator we find
741
+ let preDotState = 0;
742
+ // Check for a drive letter prefix so as not to mistake the following
743
+ // path separator as an extra separator at the end of the path that can be
744
+ // disregarded
745
+ if (path.length >= 2 &&
746
+ path.charCodeAt(1) === _constants_js_1.CHAR_COLON &&
747
+ (0, _util_js_1.isWindowsDeviceRoot)(path.charCodeAt(0))) {
748
+ start = startPart = 2;
749
+ }
750
+ for (let i = path.length - 1; i >= start; --i) {
751
+ const code = path.charCodeAt(i);
752
+ if ((0, _util_js_1.isPathSeparator)(code)) {
753
+ // If we reached a path separator that was not part of a set of path
754
+ // separators at the end of the string, stop now
755
+ if (!matchedSlash) {
756
+ startPart = i + 1;
757
+ break;
758
+ }
759
+ continue;
760
+ }
761
+ if (end === -1) {
762
+ // We saw the first non-path separator, mark this as the end of our
763
+ // extension
764
+ matchedSlash = false;
765
+ end = i + 1;
766
+ }
767
+ if (code === _constants_js_1.CHAR_DOT) {
768
+ // If this is our first dot, mark it as the start of our extension
769
+ if (startDot === -1)
770
+ startDot = i;
771
+ else if (preDotState !== 1)
772
+ preDotState = 1;
773
+ }
774
+ else if (startDot !== -1) {
775
+ // We saw a non-dot and non-path separator before our dot, so we should
776
+ // have a good chance at having a non-empty extension
777
+ preDotState = -1;
778
+ }
779
+ }
780
+ if (startDot === -1 ||
781
+ end === -1 ||
782
+ // We saw a non-dot character immediately before the dot
783
+ preDotState === 0 ||
784
+ // The (right-most) trimmed path component is exactly '..'
785
+ (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)) {
786
+ return "";
787
+ }
788
+ return path.slice(startDot, end);
789
+ }
790
+ exports.extname = extname;
791
+ /**
792
+ * Generate a path from `FormatInputPathObject` object.
793
+ * @param pathObject with path
794
+ */
795
+ function format(pathObject) {
796
+ if (pathObject === null || typeof pathObject !== "object") {
797
+ throw new TypeError(`The "pathObject" argument must be of type Object. Received type ${typeof pathObject}`);
798
+ }
799
+ return (0, _util_js_1._format)("\\", pathObject);
800
+ }
801
+ exports.format = format;
802
+ /**
803
+ * Return a `ParsedPath` object of the `path`.
804
+ * @param path to process
805
+ */
806
+ function parse(path) {
807
+ (0, _util_js_1.assertPath)(path);
808
+ const ret = { root: "", dir: "", base: "", ext: "", name: "" };
809
+ const len = path.length;
810
+ if (len === 0)
811
+ return ret;
812
+ let rootEnd = 0;
813
+ let code = path.charCodeAt(0);
814
+ // Try to match a root
815
+ if (len > 1) {
816
+ if ((0, _util_js_1.isPathSeparator)(code)) {
817
+ // Possible UNC root
818
+ rootEnd = 1;
819
+ if ((0, _util_js_1.isPathSeparator)(path.charCodeAt(1))) {
820
+ // Matched double path separator at beginning
821
+ let j = 2;
822
+ let last = j;
823
+ // Match 1 or more non-path separators
824
+ for (; j < len; ++j) {
825
+ if ((0, _util_js_1.isPathSeparator)(path.charCodeAt(j)))
826
+ break;
827
+ }
828
+ if (j < len && j !== last) {
829
+ // Matched!
830
+ last = j;
831
+ // Match 1 or more path separators
832
+ for (; j < len; ++j) {
833
+ if (!(0, _util_js_1.isPathSeparator)(path.charCodeAt(j)))
834
+ break;
835
+ }
836
+ if (j < len && j !== last) {
837
+ // Matched!
838
+ last = j;
839
+ // Match 1 or more non-path separators
840
+ for (; j < len; ++j) {
841
+ if ((0, _util_js_1.isPathSeparator)(path.charCodeAt(j)))
842
+ break;
843
+ }
844
+ if (j === len) {
845
+ // We matched a UNC root only
846
+ rootEnd = j;
847
+ }
848
+ else if (j !== last) {
849
+ // We matched a UNC root with leftovers
850
+ rootEnd = j + 1;
851
+ }
852
+ }
853
+ }
854
+ }
855
+ }
856
+ else if ((0, _util_js_1.isWindowsDeviceRoot)(code)) {
857
+ // Possible device root
858
+ if (path.charCodeAt(1) === _constants_js_1.CHAR_COLON) {
859
+ rootEnd = 2;
860
+ if (len > 2) {
861
+ if ((0, _util_js_1.isPathSeparator)(path.charCodeAt(2))) {
862
+ if (len === 3) {
863
+ // `path` contains just a drive root, exit early to avoid
864
+ // unnecessary work
865
+ ret.root = ret.dir = path;
866
+ return ret;
867
+ }
868
+ rootEnd = 3;
869
+ }
870
+ }
871
+ else {
872
+ // `path` contains just a drive root, exit early to avoid
873
+ // unnecessary work
874
+ ret.root = ret.dir = path;
875
+ return ret;
876
+ }
877
+ }
878
+ }
879
+ }
880
+ else if ((0, _util_js_1.isPathSeparator)(code)) {
881
+ // `path` contains just a path separator, exit early to avoid
882
+ // unnecessary work
883
+ ret.root = ret.dir = path;
884
+ return ret;
885
+ }
886
+ if (rootEnd > 0)
887
+ ret.root = path.slice(0, rootEnd);
888
+ let startDot = -1;
889
+ let startPart = rootEnd;
890
+ let end = -1;
891
+ let matchedSlash = true;
892
+ let i = path.length - 1;
893
+ // Track the state of characters (if any) we see before our first dot and
894
+ // after any path separator we find
895
+ let preDotState = 0;
896
+ // Get non-dir info
897
+ for (; i >= rootEnd; --i) {
898
+ code = path.charCodeAt(i);
899
+ if ((0, _util_js_1.isPathSeparator)(code)) {
900
+ // If we reached a path separator that was not part of a set of path
901
+ // separators at the end of the string, stop now
902
+ if (!matchedSlash) {
903
+ startPart = i + 1;
904
+ break;
905
+ }
906
+ continue;
907
+ }
908
+ if (end === -1) {
909
+ // We saw the first non-path separator, mark this as the end of our
910
+ // extension
911
+ matchedSlash = false;
912
+ end = i + 1;
913
+ }
914
+ if (code === _constants_js_1.CHAR_DOT) {
915
+ // If this is our first dot, mark it as the start of our extension
916
+ if (startDot === -1)
917
+ startDot = i;
918
+ else if (preDotState !== 1)
919
+ preDotState = 1;
920
+ }
921
+ else if (startDot !== -1) {
922
+ // We saw a non-dot and non-path separator before our dot, so we should
923
+ // have a good chance at having a non-empty extension
924
+ preDotState = -1;
925
+ }
926
+ }
927
+ if (startDot === -1 ||
928
+ end === -1 ||
929
+ // We saw a non-dot character immediately before the dot
930
+ preDotState === 0 ||
931
+ // The (right-most) trimmed path component is exactly '..'
932
+ (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)) {
933
+ if (end !== -1) {
934
+ ret.base = ret.name = path.slice(startPart, end);
935
+ }
936
+ }
937
+ else {
938
+ ret.name = path.slice(startPart, startDot);
939
+ ret.base = path.slice(startPart, end);
940
+ ret.ext = path.slice(startDot, end);
941
+ }
942
+ // If the directory is the root, use the entire root as the `dir` including
943
+ // the trailing slash if any (`C:\abc` -> `C:\`). Otherwise, strip out the
944
+ // trailing slash (`C:\abc\def` -> `C:\abc`).
945
+ if (startPart > 0 && startPart !== rootEnd) {
946
+ ret.dir = path.slice(0, startPart - 1);
947
+ }
948
+ else
949
+ ret.dir = ret.root;
950
+ return ret;
951
+ }
952
+ exports.parse = parse;
953
+ /**
954
+ * Converts a file URL to a path string.
955
+ *
956
+ * ```ts
957
+ * import { fromFileUrl } from "./win32.ts";
958
+ * fromFileUrl("file:///home/foo"); // "\\home\\foo"
959
+ * fromFileUrl("file:///C:/Users/foo"); // "C:\\Users\\foo"
960
+ * fromFileUrl("file://localhost/home/foo"); // "\\\\localhost\\home\\foo"
961
+ * ```
962
+ * @param url of a file URL
963
+ */
964
+ function fromFileUrl(url) {
965
+ url = url instanceof URL ? url : new URL(url);
966
+ if (url.protocol != "file:") {
967
+ throw new TypeError("Must be a file URL.");
968
+ }
969
+ let path = decodeURIComponent(url.pathname.replace(/\//g, "\\").replace(/%(?![0-9A-Fa-f]{2})/g, "%25")).replace(/^\\*([A-Za-z]:)(\\|$)/, "$1\\");
970
+ if (url.hostname != "") {
971
+ // Note: The `URL` implementation guarantees that the drive letter and
972
+ // hostname are mutually exclusive. Otherwise it would not have been valid
973
+ // to append the hostname and path like this.
974
+ path = `\\\\${url.hostname}${path}`;
975
+ }
976
+ return path;
977
+ }
978
+ exports.fromFileUrl = fromFileUrl;
979
+ /**
980
+ * Converts a path string to a file URL.
981
+ *
982
+ * ```ts
983
+ * import { toFileUrl } from "./win32.ts";
984
+ * toFileUrl("\\home\\foo"); // new URL("file:///home/foo")
985
+ * toFileUrl("C:\\Users\\foo"); // new URL("file:///C:/Users/foo")
986
+ * toFileUrl("\\\\127.0.0.1\\home\\foo"); // new URL("file://127.0.0.1/home/foo")
987
+ * ```
988
+ * @param path to convert to file URL
989
+ */
990
+ function toFileUrl(path) {
991
+ if (!isAbsolute(path)) {
992
+ throw new TypeError("Must be an absolute path.");
993
+ }
994
+ const [, hostname, pathname] = path.match(/^(?:[/\\]{2}([^/\\]+)(?=[/\\](?:[^/\\]|$)))?(.*)/);
995
+ const url = new URL("file:///");
996
+ url.pathname = (0, _util_js_1.encodeWhitespace)(pathname.replace(/%/g, "%25"));
997
+ if (hostname != null && hostname != "localhost") {
998
+ url.hostname = hostname;
999
+ if (!url.hostname) {
1000
+ throw new TypeError("Invalid hostname.");
1001
+ }
1002
+ }
1003
+ return url;
1004
+ }
1005
+ exports.toFileUrl = toFileUrl;