keep-a-changelog 0.10.3 → 2.0.1

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 (92) hide show
  1. package/CHANGELOG.md +13 -185
  2. package/LICENSE +1 -1
  3. package/README.md +93 -63
  4. package/esm/_dnt.shims.js +62 -0
  5. package/esm/bin.js +114 -0
  6. package/esm/deps/deno_land/std_0.120.0/_util/assert.js +13 -0
  7. package/esm/deps/deno_land/std_0.120.0/_util/os.js +15 -0
  8. package/esm/deps/deno_land/std_0.120.0/flags/mod.js +255 -0
  9. package/esm/deps/deno_land/std_0.120.0/path/_constants.js +45 -0
  10. package/esm/deps/deno_land/std_0.120.0/path/_interface.js +3 -0
  11. package/esm/deps/deno_land/std_0.120.0/path/_util.js +114 -0
  12. package/esm/deps/deno_land/std_0.120.0/path/common.js +36 -0
  13. package/esm/deps/deno_land/std_0.120.0/path/glob.js +361 -0
  14. package/esm/deps/deno_land/std_0.120.0/path/mod.js +14 -0
  15. package/esm/deps/deno_land/std_0.120.0/path/posix.js +493 -0
  16. package/esm/deps/deno_land/std_0.120.0/path/separator.js +5 -0
  17. package/esm/deps/deno_land/std_0.120.0/path/win32.js +963 -0
  18. package/esm/deps/deno_land/std_0.51.0/fs/eol.js +29 -0
  19. package/esm/deps/deno_land/x/ini_v2.1.0/ini.js +226 -0
  20. package/esm/deps/deno_land/x/ini_v2.1.0/mod.js +1 -0
  21. package/esm/deps/deno_land/x/semver_v1.4.0/mod.js +1527 -0
  22. package/esm/mod.js +5 -0
  23. package/esm/package.json +3 -0
  24. package/esm/src/Change.js +48 -0
  25. package/esm/src/Changelog.js +137 -0
  26. package/esm/src/Release.js +204 -0
  27. package/esm/src/deps.js +1 -0
  28. package/esm/src/parser.js +159 -0
  29. package/esm/test/changelog.custom.type.md +24 -0
  30. package/esm/test/changelog.expected.md +169 -0
  31. package/esm/test/changelog.md +200 -0
  32. package/esm/test/empty.expected.md +6 -0
  33. package/package.json +26 -24
  34. package/types/_dnt.shims.d.ts +9 -0
  35. package/types/bin.d.ts +2 -0
  36. package/types/deps/deno_land/std_0.120.0/_util/assert.d.ts +5 -0
  37. package/types/deps/deno_land/std_0.120.0/_util/os.d.ts +3 -0
  38. package/types/deps/deno_land/std_0.120.0/flags/mod.d.ts +50 -0
  39. package/types/deps/deno_land/std_0.120.0/path/_constants.d.ts +39 -0
  40. package/types/deps/deno_land/std_0.120.0/path/_interface.d.ts +26 -0
  41. package/types/deps/deno_land/std_0.120.0/path/_util.d.ts +8 -0
  42. package/types/deps/deno_land/std_0.120.0/path/common.d.ts +13 -0
  43. package/types/deps/deno_land/std_0.120.0/path/glob.d.ts +78 -0
  44. package/types/deps/deno_land/std_0.120.0/path/mod.d.ts +9 -0
  45. package/types/deps/deno_land/std_0.120.0/path/posix.d.ts +80 -0
  46. package/types/deps/deno_land/std_0.120.0/path/separator.d.ts +2 -0
  47. package/types/deps/deno_land/std_0.120.0/path/win32.d.ts +87 -0
  48. package/types/deps/deno_land/std_0.51.0/fs/eol.d.ts +12 -0
  49. package/types/deps/deno_land/x/ini_v2.1.0/ini.d.ts +53 -0
  50. package/types/deps/deno_land/x/ini_v2.1.0/mod.d.ts +1 -0
  51. package/types/deps/deno_land/x/semver_v1.4.0/mod.d.ts +116 -0
  52. package/types/mod.d.ts +5 -0
  53. package/types/src/Change.d.ts +8 -0
  54. package/types/src/Changelog.d.ts +18 -0
  55. package/types/src/Release.d.ts +25 -0
  56. package/types/src/deps.d.ts +1 -0
  57. package/types/src/parser.d.ts +11 -0
  58. package/umd/_dnt.shims.js +76 -0
  59. package/umd/bin.js +145 -0
  60. package/umd/deps/deno_land/std_0.120.0/_util/assert.js +28 -0
  61. package/umd/deps/deno_land/std_0.120.0/_util/os.js +47 -0
  62. package/umd/deps/deno_land/std_0.120.0/flags/mod.js +269 -0
  63. package/umd/deps/deno_land/std_0.120.0/path/_constants.js +58 -0
  64. package/umd/deps/deno_land/std_0.120.0/path/_interface.js +14 -0
  65. package/umd/deps/deno_land/std_0.120.0/path/_util.js +134 -0
  66. package/umd/deps/deno_land/std_0.120.0/path/common.js +50 -0
  67. package/umd/deps/deno_land/std_0.120.0/path/glob.js +397 -0
  68. package/umd/deps/deno_land/std_0.120.0/path/mod.js +51 -0
  69. package/umd/deps/deno_land/std_0.120.0/path/posix.js +538 -0
  70. package/umd/deps/deno_land/std_0.120.0/path/separator.js +18 -0
  71. package/umd/deps/deno_land/std_0.120.0/path/win32.js +1008 -0
  72. package/umd/deps/deno_land/std_0.51.0/fs/eol.js +44 -0
  73. package/umd/deps/deno_land/x/ini_v2.1.0/ini.js +262 -0
  74. package/umd/deps/deno_land/x/ini_v2.1.0/mod.js +23 -0
  75. package/umd/deps/deno_land/x/semver_v1.4.0/mod.js +1578 -0
  76. package/umd/mod.js +24 -0
  77. package/umd/package.json +3 -0
  78. package/umd/src/Change.js +61 -0
  79. package/umd/src/Changelog.js +150 -0
  80. package/umd/src/Release.js +220 -0
  81. package/umd/src/deps.js +19 -0
  82. package/umd/src/parser.js +175 -0
  83. package/umd/test/changelog.custom.type.md +24 -0
  84. package/umd/test/changelog.expected.md +169 -0
  85. package/umd/test/changelog.md +200 -0
  86. package/umd/test/empty.expected.md +6 -0
  87. package/bin.js +0 -114
  88. package/src/Change.js +0 -40
  89. package/src/Changelog.js +0 -121
  90. package/src/Release.js +0 -220
  91. package/src/index.js +0 -6
  92. package/src/parser.js +0 -182
@@ -0,0 +1,493 @@
1
+ import * as dntShim from "../../../../_dnt.shims.js";
2
+ import { CHAR_DOT, CHAR_FORWARD_SLASH } from "./_constants.js";
3
+ import { _format, assertPath, encodeWhitespace, isPosixPathSeparator, normalizeString, } from "./_util.js";
4
+ export const sep = "/";
5
+ export const delimiter = ":";
6
+ // path.resolve([from ...], to)
7
+ /**
8
+ * Resolves `pathSegments` into an absolute path.
9
+ * @param pathSegments an array of path segments
10
+ */
11
+ export function resolve(...pathSegments) {
12
+ let resolvedPath = "";
13
+ let resolvedAbsolute = false;
14
+ for (let i = pathSegments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
15
+ let path;
16
+ if (i >= 0)
17
+ path = pathSegments[i];
18
+ else {
19
+ // deno-lint-ignore no-explicit-any
20
+ const { Deno } = dntShim.dntGlobalThis;
21
+ if (typeof Deno?.cwd !== "function") {
22
+ throw new TypeError("Resolved a relative path without a CWD.");
23
+ }
24
+ path = Deno.cwd();
25
+ }
26
+ assertPath(path);
27
+ // Skip empty entries
28
+ if (path.length === 0) {
29
+ continue;
30
+ }
31
+ resolvedPath = `${path}/${resolvedPath}`;
32
+ resolvedAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH;
33
+ }
34
+ // At this point the path should be resolved to a full absolute path, but
35
+ // handle relative paths to be safe (might happen when process.cwd() fails)
36
+ // Normalize the path
37
+ resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute, "/", isPosixPathSeparator);
38
+ if (resolvedAbsolute) {
39
+ if (resolvedPath.length > 0)
40
+ return `/${resolvedPath}`;
41
+ else
42
+ return "/";
43
+ }
44
+ else if (resolvedPath.length > 0)
45
+ return resolvedPath;
46
+ else
47
+ return ".";
48
+ }
49
+ /**
50
+ * Normalize the `path`, resolving `'..'` and `'.'` segments.
51
+ * @param path to be normalized
52
+ */
53
+ export function normalize(path) {
54
+ assertPath(path);
55
+ if (path.length === 0)
56
+ return ".";
57
+ const isAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH;
58
+ const trailingSeparator = path.charCodeAt(path.length - 1) === CHAR_FORWARD_SLASH;
59
+ // Normalize the path
60
+ path = normalizeString(path, !isAbsolute, "/", isPosixPathSeparator);
61
+ if (path.length === 0 && !isAbsolute)
62
+ path = ".";
63
+ if (path.length > 0 && trailingSeparator)
64
+ path += "/";
65
+ if (isAbsolute)
66
+ return `/${path}`;
67
+ return path;
68
+ }
69
+ /**
70
+ * Verifies whether provided path is absolute
71
+ * @param path to be verified as absolute
72
+ */
73
+ export function isAbsolute(path) {
74
+ assertPath(path);
75
+ return path.length > 0 && path.charCodeAt(0) === CHAR_FORWARD_SLASH;
76
+ }
77
+ /**
78
+ * Join all given a sequence of `paths`,then normalizes the resulting path.
79
+ * @param paths to be joined and normalized
80
+ */
81
+ export function join(...paths) {
82
+ if (paths.length === 0)
83
+ return ".";
84
+ let joined;
85
+ for (let i = 0, len = paths.length; i < len; ++i) {
86
+ const path = paths[i];
87
+ assertPath(path);
88
+ if (path.length > 0) {
89
+ if (!joined)
90
+ joined = path;
91
+ else
92
+ joined += `/${path}`;
93
+ }
94
+ }
95
+ if (!joined)
96
+ return ".";
97
+ return normalize(joined);
98
+ }
99
+ /**
100
+ * Return the relative path from `from` to `to` based on current working directory.
101
+ * @param from path in current working directory
102
+ * @param to path in current working directory
103
+ */
104
+ export function relative(from, to) {
105
+ assertPath(from);
106
+ assertPath(to);
107
+ if (from === to)
108
+ return "";
109
+ from = resolve(from);
110
+ to = resolve(to);
111
+ if (from === to)
112
+ return "";
113
+ // Trim any leading backslashes
114
+ let fromStart = 1;
115
+ const fromEnd = from.length;
116
+ for (; fromStart < fromEnd; ++fromStart) {
117
+ if (from.charCodeAt(fromStart) !== CHAR_FORWARD_SLASH)
118
+ break;
119
+ }
120
+ const fromLen = fromEnd - fromStart;
121
+ // Trim any leading backslashes
122
+ let toStart = 1;
123
+ const toEnd = to.length;
124
+ for (; toStart < toEnd; ++toStart) {
125
+ if (to.charCodeAt(toStart) !== CHAR_FORWARD_SLASH)
126
+ break;
127
+ }
128
+ const toLen = toEnd - toStart;
129
+ // Compare paths to find the longest common path from root
130
+ const length = fromLen < toLen ? fromLen : toLen;
131
+ let lastCommonSep = -1;
132
+ let i = 0;
133
+ for (; i <= length; ++i) {
134
+ if (i === length) {
135
+ if (toLen > length) {
136
+ if (to.charCodeAt(toStart + i) === CHAR_FORWARD_SLASH) {
137
+ // We get here if `from` is the exact base path for `to`.
138
+ // For example: from='/foo/bar'; to='/foo/bar/baz'
139
+ return to.slice(toStart + i + 1);
140
+ }
141
+ else if (i === 0) {
142
+ // We get here if `from` is the root
143
+ // For example: from='/'; to='/foo'
144
+ return to.slice(toStart + i);
145
+ }
146
+ }
147
+ else if (fromLen > length) {
148
+ if (from.charCodeAt(fromStart + i) === CHAR_FORWARD_SLASH) {
149
+ // We get here if `to` is the exact base path for `from`.
150
+ // For example: from='/foo/bar/baz'; to='/foo/bar'
151
+ lastCommonSep = i;
152
+ }
153
+ else if (i === 0) {
154
+ // We get here if `to` is the root.
155
+ // For example: from='/foo'; to='/'
156
+ lastCommonSep = 0;
157
+ }
158
+ }
159
+ break;
160
+ }
161
+ const fromCode = from.charCodeAt(fromStart + i);
162
+ const toCode = to.charCodeAt(toStart + i);
163
+ if (fromCode !== toCode)
164
+ break;
165
+ else if (fromCode === CHAR_FORWARD_SLASH)
166
+ lastCommonSep = i;
167
+ }
168
+ let out = "";
169
+ // Generate the relative path based on the path difference between `to`
170
+ // and `from`
171
+ for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
172
+ if (i === fromEnd || from.charCodeAt(i) === CHAR_FORWARD_SLASH) {
173
+ if (out.length === 0)
174
+ out += "..";
175
+ else
176
+ out += "/..";
177
+ }
178
+ }
179
+ // Lastly, append the rest of the destination (`to`) path that comes after
180
+ // the common path parts
181
+ if (out.length > 0)
182
+ return out + to.slice(toStart + lastCommonSep);
183
+ else {
184
+ toStart += lastCommonSep;
185
+ if (to.charCodeAt(toStart) === CHAR_FORWARD_SLASH)
186
+ ++toStart;
187
+ return to.slice(toStart);
188
+ }
189
+ }
190
+ /**
191
+ * Resolves path to a namespace path
192
+ * @param path to resolve to namespace
193
+ */
194
+ export function toNamespacedPath(path) {
195
+ // Non-op on posix systems
196
+ return path;
197
+ }
198
+ /**
199
+ * Return the directory name of a `path`.
200
+ * @param path to determine name for
201
+ */
202
+ export function dirname(path) {
203
+ assertPath(path);
204
+ if (path.length === 0)
205
+ return ".";
206
+ const hasRoot = path.charCodeAt(0) === CHAR_FORWARD_SLASH;
207
+ let end = -1;
208
+ let matchedSlash = true;
209
+ for (let i = path.length - 1; i >= 1; --i) {
210
+ if (path.charCodeAt(i) === CHAR_FORWARD_SLASH) {
211
+ if (!matchedSlash) {
212
+ end = i;
213
+ break;
214
+ }
215
+ }
216
+ else {
217
+ // We saw the first non-path separator
218
+ matchedSlash = false;
219
+ }
220
+ }
221
+ if (end === -1)
222
+ return hasRoot ? "/" : ".";
223
+ if (hasRoot && end === 1)
224
+ return "//";
225
+ return path.slice(0, end);
226
+ }
227
+ /**
228
+ * Return the last portion of a `path`. Trailing directory separators are ignored.
229
+ * @param path to process
230
+ * @param ext of path directory
231
+ */
232
+ export function basename(path, ext = "") {
233
+ if (ext !== undefined && typeof ext !== "string") {
234
+ throw new TypeError('"ext" argument must be a string');
235
+ }
236
+ assertPath(path);
237
+ let start = 0;
238
+ let end = -1;
239
+ let matchedSlash = true;
240
+ let i;
241
+ if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {
242
+ if (ext.length === path.length && ext === path)
243
+ return "";
244
+ let extIdx = ext.length - 1;
245
+ let firstNonSlashEnd = -1;
246
+ for (i = path.length - 1; i >= 0; --i) {
247
+ const code = path.charCodeAt(i);
248
+ if (code === CHAR_FORWARD_SLASH) {
249
+ // If we reached a path separator that was not part of a set of path
250
+ // separators at the end of the string, stop now
251
+ if (!matchedSlash) {
252
+ start = i + 1;
253
+ break;
254
+ }
255
+ }
256
+ else {
257
+ if (firstNonSlashEnd === -1) {
258
+ // We saw the first non-path separator, remember this index in case
259
+ // we need it if the extension ends up not matching
260
+ matchedSlash = false;
261
+ firstNonSlashEnd = i + 1;
262
+ }
263
+ if (extIdx >= 0) {
264
+ // Try to match the explicit extension
265
+ if (code === ext.charCodeAt(extIdx)) {
266
+ if (--extIdx === -1) {
267
+ // We matched the extension, so mark this as the end of our path
268
+ // component
269
+ end = i;
270
+ }
271
+ }
272
+ else {
273
+ // Extension does not match, so our result is the entire path
274
+ // component
275
+ extIdx = -1;
276
+ end = firstNonSlashEnd;
277
+ }
278
+ }
279
+ }
280
+ }
281
+ if (start === end)
282
+ end = firstNonSlashEnd;
283
+ else if (end === -1)
284
+ end = path.length;
285
+ return path.slice(start, end);
286
+ }
287
+ else {
288
+ for (i = path.length - 1; i >= 0; --i) {
289
+ if (path.charCodeAt(i) === CHAR_FORWARD_SLASH) {
290
+ // If we reached a path separator that was not part of a set of path
291
+ // separators at the end of the string, stop now
292
+ if (!matchedSlash) {
293
+ start = i + 1;
294
+ break;
295
+ }
296
+ }
297
+ else if (end === -1) {
298
+ // We saw the first non-path separator, mark this as the end of our
299
+ // path component
300
+ matchedSlash = false;
301
+ end = i + 1;
302
+ }
303
+ }
304
+ if (end === -1)
305
+ return "";
306
+ return path.slice(start, end);
307
+ }
308
+ }
309
+ /**
310
+ * Return the extension of the `path`.
311
+ * @param path with extension
312
+ */
313
+ export function extname(path) {
314
+ assertPath(path);
315
+ let startDot = -1;
316
+ let startPart = 0;
317
+ let end = -1;
318
+ let matchedSlash = true;
319
+ // Track the state of characters (if any) we see before our first dot and
320
+ // after any path separator we find
321
+ let preDotState = 0;
322
+ for (let i = path.length - 1; i >= 0; --i) {
323
+ const code = path.charCodeAt(i);
324
+ if (code === CHAR_FORWARD_SLASH) {
325
+ // If we reached a path separator that was not part of a set of path
326
+ // separators at the end of the string, stop now
327
+ if (!matchedSlash) {
328
+ startPart = i + 1;
329
+ break;
330
+ }
331
+ continue;
332
+ }
333
+ if (end === -1) {
334
+ // We saw the first non-path separator, mark this as the end of our
335
+ // extension
336
+ matchedSlash = false;
337
+ end = i + 1;
338
+ }
339
+ if (code === CHAR_DOT) {
340
+ // If this is our first dot, mark it as the start of our extension
341
+ if (startDot === -1)
342
+ startDot = i;
343
+ else if (preDotState !== 1)
344
+ preDotState = 1;
345
+ }
346
+ else if (startDot !== -1) {
347
+ // We saw a non-dot and non-path separator before our dot, so we should
348
+ // have a good chance at having a non-empty extension
349
+ preDotState = -1;
350
+ }
351
+ }
352
+ if (startDot === -1 ||
353
+ end === -1 ||
354
+ // We saw a non-dot character immediately before the dot
355
+ preDotState === 0 ||
356
+ // The (right-most) trimmed path component is exactly '..'
357
+ (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)) {
358
+ return "";
359
+ }
360
+ return path.slice(startDot, end);
361
+ }
362
+ /**
363
+ * Generate a path from `FormatInputPathObject` object.
364
+ * @param pathObject with path
365
+ */
366
+ export function format(pathObject) {
367
+ if (pathObject === null || typeof pathObject !== "object") {
368
+ throw new TypeError(`The "pathObject" argument must be of type Object. Received type ${typeof pathObject}`);
369
+ }
370
+ return _format("/", pathObject);
371
+ }
372
+ /**
373
+ * Return a `ParsedPath` object of the `path`.
374
+ * @param path to process
375
+ */
376
+ export function parse(path) {
377
+ assertPath(path);
378
+ const ret = { root: "", dir: "", base: "", ext: "", name: "" };
379
+ if (path.length === 0)
380
+ return ret;
381
+ const isAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH;
382
+ let start;
383
+ if (isAbsolute) {
384
+ ret.root = "/";
385
+ start = 1;
386
+ }
387
+ else {
388
+ start = 0;
389
+ }
390
+ let startDot = -1;
391
+ let startPart = 0;
392
+ let end = -1;
393
+ let matchedSlash = true;
394
+ let i = path.length - 1;
395
+ // Track the state of characters (if any) we see before our first dot and
396
+ // after any path separator we find
397
+ let preDotState = 0;
398
+ // Get non-dir info
399
+ for (; i >= start; --i) {
400
+ const code = path.charCodeAt(i);
401
+ if (code === CHAR_FORWARD_SLASH) {
402
+ // If we reached a path separator that was not part of a set of path
403
+ // separators at the end of the string, stop now
404
+ if (!matchedSlash) {
405
+ startPart = i + 1;
406
+ break;
407
+ }
408
+ continue;
409
+ }
410
+ if (end === -1) {
411
+ // We saw the first non-path separator, mark this as the end of our
412
+ // extension
413
+ matchedSlash = false;
414
+ end = i + 1;
415
+ }
416
+ if (code === CHAR_DOT) {
417
+ // If this is our first dot, mark it as the start of our extension
418
+ if (startDot === -1)
419
+ startDot = i;
420
+ else if (preDotState !== 1)
421
+ preDotState = 1;
422
+ }
423
+ else if (startDot !== -1) {
424
+ // We saw a non-dot and non-path separator before our dot, so we should
425
+ // have a good chance at having a non-empty extension
426
+ preDotState = -1;
427
+ }
428
+ }
429
+ if (startDot === -1 ||
430
+ end === -1 ||
431
+ // We saw a non-dot character immediately before the dot
432
+ preDotState === 0 ||
433
+ // The (right-most) trimmed path component is exactly '..'
434
+ (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)) {
435
+ if (end !== -1) {
436
+ if (startPart === 0 && isAbsolute) {
437
+ ret.base = ret.name = path.slice(1, end);
438
+ }
439
+ else {
440
+ ret.base = ret.name = path.slice(startPart, end);
441
+ }
442
+ }
443
+ }
444
+ else {
445
+ if (startPart === 0 && isAbsolute) {
446
+ ret.name = path.slice(1, startDot);
447
+ ret.base = path.slice(1, end);
448
+ }
449
+ else {
450
+ ret.name = path.slice(startPart, startDot);
451
+ ret.base = path.slice(startPart, end);
452
+ }
453
+ ret.ext = path.slice(startDot, end);
454
+ }
455
+ if (startPart > 0)
456
+ ret.dir = path.slice(0, startPart - 1);
457
+ else if (isAbsolute)
458
+ ret.dir = "/";
459
+ return ret;
460
+ }
461
+ /**
462
+ * Converts a file URL to a path string.
463
+ *
464
+ * ```ts
465
+ * import { fromFileUrl } from "./posix.ts";
466
+ * fromFileUrl("file:///home/foo"); // "/home/foo"
467
+ * ```
468
+ * @param url of a file URL
469
+ */
470
+ export function fromFileUrl(url) {
471
+ url = url instanceof URL ? url : new URL(url);
472
+ if (url.protocol != "file:") {
473
+ throw new TypeError("Must be a file URL.");
474
+ }
475
+ return decodeURIComponent(url.pathname.replace(/%(?![0-9A-Fa-f]{2})/g, "%25"));
476
+ }
477
+ /**
478
+ * Converts a path string to a file URL.
479
+ *
480
+ * ```ts
481
+ * import { toFileUrl } from "./posix.ts";
482
+ * toFileUrl("/home/foo"); // new URL("file:///home/foo")
483
+ * ```
484
+ * @param path to convert to file URL
485
+ */
486
+ export function toFileUrl(path) {
487
+ if (!isAbsolute(path)) {
488
+ throw new TypeError("Must be an absolute path.");
489
+ }
490
+ const url = new URL("file:///");
491
+ url.pathname = encodeWhitespace(path.replace(/%/g, "%25").replace(/\\/g, "%5C"));
492
+ return url;
493
+ }
@@ -0,0 +1,5 @@
1
+ // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
2
+ // This module is browser compatible.
3
+ import { isWindows } from "../_util/os.js";
4
+ export const SEP = isWindows ? "\\" : "/";
5
+ export const SEP_PATTERN = isWindows ? /[\\/]+/ : /\/+/;