ventojs 0.8.0 → 0.9.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 (136) hide show
  1. package/README.md +7 -61
  2. package/esm/deps/deno.land/std@0.201.0/html/entities.d.ts +38 -0
  3. package/esm/deps/deno.land/std@0.201.0/html/entities.js +76 -0
  4. package/esm/deps/deno.land/std@0.201.0/html/mod.d.ts +6 -0
  5. package/esm/deps/deno.land/std@0.201.0/html/mod.js +8 -0
  6. package/esm/deps.d.ts +1 -0
  7. package/esm/deps.js +1 -0
  8. package/esm/mod.d.ts +1 -0
  9. package/esm/mod.js +1 -0
  10. package/esm/plugins/escape.js +2 -12
  11. package/esm/plugins/export.js +5 -4
  12. package/esm/plugins/import.js +4 -11
  13. package/esm/plugins/include.js +3 -2
  14. package/esm/plugins/layout.js +4 -3
  15. package/esm/plugins/set.js +5 -4
  16. package/esm/plugins/unescape.js +2 -12
  17. package/esm/src/environment.d.ts +1 -0
  18. package/esm/src/environment.js +9 -12
  19. package/package.json +4 -2
  20. package/script/_dnt.shims.d.ts +5 -0
  21. package/script/_dnt.shims.js +65 -0
  22. package/script/deps/deno.land/std@0.201.0/assert/assert.d.ts +2 -0
  23. package/script/deps/deno.land/std@0.201.0/assert/assert.js +12 -0
  24. package/script/deps/deno.land/std@0.201.0/assert/assertion_error.d.ts +4 -0
  25. package/script/deps/deno.land/std@0.201.0/assert/assertion_error.js +11 -0
  26. package/script/deps/deno.land/std@0.201.0/html/entities.d.ts +38 -0
  27. package/script/deps/deno.land/std@0.201.0/html/entities.js +81 -0
  28. package/script/deps/deno.land/std@0.201.0/html/mod.d.ts +6 -0
  29. package/script/deps/deno.land/std@0.201.0/html/mod.js +24 -0
  30. package/script/deps/deno.land/std@0.201.0/path/_basename.d.ts +16 -0
  31. package/script/deps/deno.land/std@0.201.0/path/_basename.js +83 -0
  32. package/script/deps/deno.land/std@0.201.0/path/_constants.d.ts +39 -0
  33. package/script/deps/deno.land/std@0.201.0/path/_constants.js +49 -0
  34. package/script/deps/deno.land/std@0.201.0/path/_dirname.d.ts +10 -0
  35. package/script/deps/deno.land/std@0.201.0/path/_dirname.js +137 -0
  36. package/script/deps/deno.land/std@0.201.0/path/_extname.d.ts +12 -0
  37. package/script/deps/deno.land/std@0.201.0/path/_extname.js +126 -0
  38. package/script/deps/deno.land/std@0.201.0/path/_format.d.ts +11 -0
  39. package/script/deps/deno.land/std@0.201.0/path/_format.js +40 -0
  40. package/script/deps/deno.land/std@0.201.0/path/_from_file_url.d.ts +25 -0
  41. package/script/deps/deno.land/std@0.201.0/path/_from_file_url.js +51 -0
  42. package/script/deps/deno.land/std@0.201.0/path/_interface.d.ts +26 -0
  43. package/script/deps/deno.land/std@0.201.0/path/_interface.js +4 -0
  44. package/script/deps/deno.land/std@0.201.0/path/_is_absolute.d.ts +10 -0
  45. package/script/deps/deno.land/std@0.201.0/path/_is_absolute.js +39 -0
  46. package/script/deps/deno.land/std@0.201.0/path/_join.d.ts +10 -0
  47. package/script/deps/deno.land/std@0.201.0/path/_join.js +98 -0
  48. package/script/deps/deno.land/std@0.201.0/path/_normalize.d.ts +14 -0
  49. package/script/deps/deno.land/std@0.201.0/path/_normalize.js +158 -0
  50. package/script/deps/deno.land/std@0.201.0/path/_os.d.ts +4 -0
  51. package/script/deps/deno.land/std@0.201.0/path/_os.js +44 -0
  52. package/script/deps/deno.land/std@0.201.0/path/_parse.d.ts +11 -0
  53. package/script/deps/deno.land/std@0.201.0/path/_parse.js +255 -0
  54. package/script/deps/deno.land/std@0.201.0/path/_relative.d.ts +19 -0
  55. package/script/deps/deno.land/std@0.201.0/path/_relative.js +221 -0
  56. package/script/deps/deno.land/std@0.201.0/path/_resolve.d.ts +10 -0
  57. package/script/deps/deno.land/std@0.201.0/path/_resolve.js +211 -0
  58. package/script/deps/deno.land/std@0.201.0/path/_to_file_url.d.ts +25 -0
  59. package/script/deps/deno.land/std@0.201.0/path/_to_file_url.js +66 -0
  60. package/script/deps/deno.land/std@0.201.0/path/_to_namespaced_path.d.ts +10 -0
  61. package/script/deps/deno.land/std@0.201.0/path/_to_namespaced_path.js +51 -0
  62. package/script/deps/deno.land/std@0.201.0/path/_util.d.ts +6 -0
  63. package/script/deps/deno.land/std@0.201.0/path/_util.js +116 -0
  64. package/script/deps/deno.land/std@0.201.0/path/basename.d.ts +8 -0
  65. package/script/deps/deno.land/std@0.201.0/path/basename.js +20 -0
  66. package/script/deps/deno.land/std@0.201.0/path/common.d.ts +13 -0
  67. package/script/deps/deno.land/std@0.201.0/path/common.js +40 -0
  68. package/script/deps/deno.land/std@0.201.0/path/dirname.d.ts +5 -0
  69. package/script/deps/deno.land/std@0.201.0/path/dirname.js +15 -0
  70. package/script/deps/deno.land/std@0.201.0/path/extname.d.ts +6 -0
  71. package/script/deps/deno.land/std@0.201.0/path/extname.js +16 -0
  72. package/script/deps/deno.land/std@0.201.0/path/format.d.ts +6 -0
  73. package/script/deps/deno.land/std@0.201.0/path/format.js +15 -0
  74. package/script/deps/deno.land/std@0.201.0/path/from_file_url.d.ts +18 -0
  75. package/script/deps/deno.land/std@0.201.0/path/from_file_url.js +27 -0
  76. package/script/deps/deno.land/std@0.201.0/path/glob.d.ts +83 -0
  77. package/script/deps/deno.land/std@0.201.0/path/glob.js +391 -0
  78. package/script/deps/deno.land/std@0.201.0/path/is_absolute.d.ts +5 -0
  79. package/script/deps/deno.land/std@0.201.0/path/is_absolute.js +15 -0
  80. package/script/deps/deno.land/std@0.201.0/path/join.d.ts +5 -0
  81. package/script/deps/deno.land/std@0.201.0/path/join.js +15 -0
  82. package/script/deps/deno.land/std@0.201.0/path/mod.d.ts +22 -0
  83. package/script/deps/deno.land/std@0.201.0/path/mod.js +74 -0
  84. package/script/deps/deno.land/std@0.201.0/path/normalize.d.ts +7 -0
  85. package/script/deps/deno.land/std@0.201.0/path/normalize.js +17 -0
  86. package/script/deps/deno.land/std@0.201.0/path/parse.d.ts +6 -0
  87. package/script/deps/deno.land/std@0.201.0/path/parse.js +15 -0
  88. package/script/deps/deno.land/std@0.201.0/path/posix.d.ts +15 -0
  89. package/script/deps/deno.land/std@0.201.0/path/posix.js +35 -0
  90. package/script/deps/deno.land/std@0.201.0/path/relative.d.ts +12 -0
  91. package/script/deps/deno.land/std@0.201.0/path/relative.js +22 -0
  92. package/script/deps/deno.land/std@0.201.0/path/resolve.d.ts +5 -0
  93. package/script/deps/deno.land/std@0.201.0/path/resolve.js +17 -0
  94. package/script/deps/deno.land/std@0.201.0/path/separator.d.ts +2 -0
  95. package/script/deps/deno.land/std@0.201.0/path/separator.js +8 -0
  96. package/script/deps/deno.land/std@0.201.0/path/to_file_url.d.ts +18 -0
  97. package/script/deps/deno.land/std@0.201.0/path/to_file_url.js +27 -0
  98. package/script/deps/deno.land/std@0.201.0/path/to_namespaced_path.d.ts +5 -0
  99. package/script/deps/deno.land/std@0.201.0/path/to_namespaced_path.js +17 -0
  100. package/script/deps/deno.land/std@0.201.0/path/win32.d.ts +15 -0
  101. package/script/deps/deno.land/std@0.201.0/path/win32.js +35 -0
  102. package/script/deps.d.ts +2 -0
  103. package/script/deps.js +28 -0
  104. package/script/mod.d.ts +9 -0
  105. package/script/mod.js +69 -0
  106. package/script/package.json +3 -0
  107. package/script/plugins/echo.d.ts +2 -0
  108. package/script/plugins/echo.js +16 -0
  109. package/script/plugins/escape.d.ts +2 -0
  110. package/script/plugins/escape.js +9 -0
  111. package/script/plugins/export.d.ts +2 -0
  112. package/script/plugins/export.js +50 -0
  113. package/script/plugins/for.d.ts +2 -0
  114. package/script/plugins/for.js +51 -0
  115. package/script/plugins/function.d.ts +2 -0
  116. package/script/plugins/function.js +40 -0
  117. package/script/plugins/if.d.ts +2 -0
  118. package/script/plugins/if.js +35 -0
  119. package/script/plugins/import.d.ts +2 -0
  120. package/script/plugins/import.js +20 -0
  121. package/script/plugins/include.d.ts +2 -0
  122. package/script/plugins/include.js +26 -0
  123. package/script/plugins/js.d.ts +2 -0
  124. package/script/plugins/js.js +14 -0
  125. package/script/plugins/layout.d.ts +2 -0
  126. package/script/plugins/layout.js +37 -0
  127. package/script/plugins/set.d.ts +2 -0
  128. package/script/plugins/set.js +48 -0
  129. package/script/plugins/unescape.d.ts +2 -0
  130. package/script/plugins/unescape.js +9 -0
  131. package/script/src/environment.d.ts +42 -0
  132. package/script/src/environment.js +176 -0
  133. package/script/src/loader.d.ts +14 -0
  134. package/script/src/loader.js +46 -0
  135. package/script/src/tokenizer.d.ts +8 -0
  136. package/script/src/tokenizer.js +190 -0
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
3
+ // This module is browser compatible.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.windowsFromFileUrl = exports.posixFromFileUrl = void 0;
6
+ function assertArg(url) {
7
+ url = url instanceof URL ? url : new URL(url);
8
+ if (url.protocol !== "file:") {
9
+ throw new TypeError("Must be a file URL.");
10
+ }
11
+ return url;
12
+ }
13
+ /**
14
+ * Converts a file URL to a path string.
15
+ *
16
+ * ```ts
17
+ * import { fromFileUrl } from "https://deno.land/std@$STD_VERSION/path/posix.ts";
18
+ *
19
+ * fromFileUrl("file:///home/foo"); // "/home/foo"
20
+ * ```
21
+ * @param url of a file URL
22
+ */
23
+ function posixFromFileUrl(url) {
24
+ url = assertArg(url);
25
+ return decodeURIComponent(url.pathname.replace(/%(?![0-9A-Fa-f]{2})/g, "%25"));
26
+ }
27
+ exports.posixFromFileUrl = posixFromFileUrl;
28
+ /**
29
+ * Converts a file URL to a path string.
30
+ *
31
+ * ```ts
32
+ * import { fromFileUrl } from "https://deno.land/std@$STD_VERSION/path/win32.ts";
33
+ *
34
+ * fromFileUrl("file:///home/foo"); // "\\home\\foo"
35
+ * fromFileUrl("file:///C:/Users/foo"); // "C:\\Users\\foo"
36
+ * fromFileUrl("file://localhost/home/foo"); // "\\\\localhost\\home\\foo"
37
+ * ```
38
+ * @param url of a file URL
39
+ */
40
+ function windowsFromFileUrl(url) {
41
+ url = assertArg(url);
42
+ let path = decodeURIComponent(url.pathname.replace(/\//g, "\\").replace(/%(?![0-9A-Fa-f]{2})/g, "%25")).replace(/^\\*([A-Za-z]:)(\\|$)/, "$1\\");
43
+ if (url.hostname !== "") {
44
+ // Note: The `URL` implementation guarantees that the drive letter and
45
+ // hostname are mutually exclusive. Otherwise it would not have been valid
46
+ // to append the hostname and path like this.
47
+ path = `\\\\${url.hostname}${path}`;
48
+ }
49
+ return path;
50
+ }
51
+ exports.windowsFromFileUrl = windowsFromFileUrl;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * A parsed path object generated by path.parse() or consumed by path.format().
3
+ */
4
+ export interface ParsedPath {
5
+ /**
6
+ * The root of the path such as '/' or 'c:\'
7
+ */
8
+ root: string;
9
+ /**
10
+ * The full directory path such as '/home/user/dir' or 'c:\path\dir'
11
+ */
12
+ dir: string;
13
+ /**
14
+ * The file name including extension (if any) such as 'index.html'
15
+ */
16
+ base: string;
17
+ /**
18
+ * The file extension (if any) such as '.html'
19
+ */
20
+ ext: string;
21
+ /**
22
+ * The file name without extension (if any) such as 'index'
23
+ */
24
+ name: string;
25
+ }
26
+ export type FormatInputPathObject = Partial<ParsedPath>;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
3
+ // This module is browser compatible.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Verifies whether provided path is absolute
3
+ * @param path to be verified as absolute
4
+ */
5
+ export declare function windowsIsAbsolute(path: string): boolean;
6
+ /**
7
+ * Verifies whether provided path is absolute
8
+ * @param path to be verified as absolute
9
+ */
10
+ export declare function posixIsAbsolute(path: string): boolean;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
3
+ // This module is browser compatible.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.posixIsAbsolute = exports.windowsIsAbsolute = void 0;
6
+ const _constants_js_1 = require("./_constants.js");
7
+ const _util_js_1 = require("./_util.js");
8
+ /**
9
+ * Verifies whether provided path is absolute
10
+ * @param path to be verified as absolute
11
+ */
12
+ function windowsIsAbsolute(path) {
13
+ (0, _util_js_1.assertPath)(path);
14
+ const len = path.length;
15
+ if (len === 0)
16
+ return false;
17
+ const code = path.charCodeAt(0);
18
+ if ((0, _util_js_1.isPathSeparator)(code)) {
19
+ return true;
20
+ }
21
+ else if ((0, _util_js_1.isWindowsDeviceRoot)(code)) {
22
+ // Possible device root
23
+ if (len > 2 && path.charCodeAt(1) === _constants_js_1.CHAR_COLON) {
24
+ if ((0, _util_js_1.isPathSeparator)(path.charCodeAt(2)))
25
+ return true;
26
+ }
27
+ }
28
+ return false;
29
+ }
30
+ exports.windowsIsAbsolute = windowsIsAbsolute;
31
+ /**
32
+ * Verifies whether provided path is absolute
33
+ * @param path to be verified as absolute
34
+ */
35
+ function posixIsAbsolute(path) {
36
+ (0, _util_js_1.assertPath)(path);
37
+ return path.length > 0 && (0, _util_js_1.isPosixPathSeparator)(path.charCodeAt(0));
38
+ }
39
+ exports.posixIsAbsolute = posixIsAbsolute;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Join all given a sequence of `paths`,then normalizes the resulting path.
3
+ * @param paths to be joined and normalized
4
+ */
5
+ export declare function posixJoin(...paths: string[]): string;
6
+ /**
7
+ * Join all given a sequence of `paths`,then normalizes the resulting path.
8
+ * @param paths to be joined and normalized
9
+ */
10
+ export declare function windowsJoin(...paths: string[]): string;
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
3
+ // This module is browser compatible.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.windowsJoin = exports.posixJoin = void 0;
6
+ const assert_js_1 = require("../assert/assert.js");
7
+ const _util_js_1 = require("./_util.js");
8
+ const _normalize_js_1 = require("./_normalize.js");
9
+ /**
10
+ * Join all given a sequence of `paths`,then normalizes the resulting path.
11
+ * @param paths to be joined and normalized
12
+ */
13
+ function posixJoin(...paths) {
14
+ if (paths.length === 0)
15
+ return ".";
16
+ let joined;
17
+ for (let i = 0, len = paths.length; i < len; ++i) {
18
+ const path = paths[i];
19
+ (0, _util_js_1.assertPath)(path);
20
+ if (path.length > 0) {
21
+ if (!joined)
22
+ joined = path;
23
+ else
24
+ joined += `/${path}`;
25
+ }
26
+ }
27
+ if (!joined)
28
+ return ".";
29
+ return (0, _normalize_js_1.posixNormalize)(joined);
30
+ }
31
+ exports.posixJoin = posixJoin;
32
+ /**
33
+ * Join all given a sequence of `paths`,then normalizes the resulting path.
34
+ * @param paths to be joined and normalized
35
+ */
36
+ function windowsJoin(...paths) {
37
+ if (paths.length === 0)
38
+ return ".";
39
+ let joined;
40
+ let firstPart = null;
41
+ for (let i = 0; i < paths.length; ++i) {
42
+ const path = paths[i];
43
+ (0, _util_js_1.assertPath)(path);
44
+ if (path.length > 0) {
45
+ if (joined === undefined)
46
+ joined = firstPart = path;
47
+ else
48
+ joined += `\\${path}`;
49
+ }
50
+ }
51
+ if (joined === undefined)
52
+ return ".";
53
+ // Make sure that the joined path doesn't start with two slashes, because
54
+ // normalize() will mistake it for an UNC path then.
55
+ //
56
+ // This step is skipped when it is very clear that the user actually
57
+ // intended to point at an UNC path. This is assumed when the first
58
+ // non-empty string arguments starts with exactly two slashes followed by
59
+ // at least one more non-slash character.
60
+ //
61
+ // Note that for normalize() to treat a path as an UNC path it needs to
62
+ // have at least 2 components, so we don't filter for that here.
63
+ // This means that the user can use join to construct UNC paths from
64
+ // a server name and a share name; for example:
65
+ // path.join('//server', 'share') -> '\\\\server\\share\\')
66
+ let needsReplace = true;
67
+ let slashCount = 0;
68
+ (0, assert_js_1.assert)(firstPart !== null);
69
+ if ((0, _util_js_1.isPathSeparator)(firstPart.charCodeAt(0))) {
70
+ ++slashCount;
71
+ const firstLen = firstPart.length;
72
+ if (firstLen > 1) {
73
+ if ((0, _util_js_1.isPathSeparator)(firstPart.charCodeAt(1))) {
74
+ ++slashCount;
75
+ if (firstLen > 2) {
76
+ if ((0, _util_js_1.isPathSeparator)(firstPart.charCodeAt(2)))
77
+ ++slashCount;
78
+ else {
79
+ // We matched a UNC path in the first part
80
+ needsReplace = false;
81
+ }
82
+ }
83
+ }
84
+ }
85
+ }
86
+ if (needsReplace) {
87
+ // Find any more consecutive slashes we need to replace
88
+ for (; slashCount < joined.length; ++slashCount) {
89
+ if (!(0, _util_js_1.isPathSeparator)(joined.charCodeAt(slashCount)))
90
+ break;
91
+ }
92
+ // Replace the slashes if needed
93
+ if (slashCount >= 2)
94
+ joined = `\\${joined.slice(slashCount)}`;
95
+ }
96
+ return (0, _normalize_js_1.windowsNormalize)(joined);
97
+ }
98
+ exports.windowsJoin = windowsJoin;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Normalize the `path`, resolving `'..'` and `'.'` segments.
3
+ * Note that resolving these segments does not necessarily mean that all will be eliminated.
4
+ * A `'..'` at the top-level will be preserved, and an empty path is canonically `'.'`.
5
+ * @param path to be normalized
6
+ */
7
+ export declare function posixNormalize(path: string): string;
8
+ /**
9
+ * Normalize the `path`, resolving `'..'` and `'.'` segments.
10
+ * Note that resolving these segments does not necessarily mean that all will be eliminated.
11
+ * A `'..'` at the top-level will be preserved, and an empty path is canonically `'.'`.
12
+ * @param path to be normalized
13
+ */
14
+ export declare function windowsNormalize(path: string): string;
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
3
+ // This module is browser compatible.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.windowsNormalize = exports.posixNormalize = void 0;
6
+ const _constants_js_1 = require("./_constants.js");
7
+ const _util_js_1 = require("./_util.js");
8
+ function assertArg(path) {
9
+ (0, _util_js_1.assertPath)(path);
10
+ if (path.length === 0)
11
+ return ".";
12
+ }
13
+ /**
14
+ * Normalize the `path`, resolving `'..'` and `'.'` segments.
15
+ * Note that resolving these segments does not necessarily mean that all will be eliminated.
16
+ * A `'..'` at the top-level will be preserved, and an empty path is canonically `'.'`.
17
+ * @param path to be normalized
18
+ */
19
+ function posixNormalize(path) {
20
+ assertArg(path);
21
+ const isAbsolute = (0, _util_js_1.isPosixPathSeparator)(path.charCodeAt(0));
22
+ const trailingSeparator = (0, _util_js_1.isPosixPathSeparator)(path.charCodeAt(path.length - 1));
23
+ // Normalize the path
24
+ path = (0, _util_js_1.normalizeString)(path, !isAbsolute, "/", _util_js_1.isPosixPathSeparator);
25
+ if (path.length === 0 && !isAbsolute)
26
+ path = ".";
27
+ if (path.length > 0 && trailingSeparator)
28
+ path += "/";
29
+ if (isAbsolute)
30
+ return `/${path}`;
31
+ return path;
32
+ }
33
+ exports.posixNormalize = posixNormalize;
34
+ /**
35
+ * Normalize the `path`, resolving `'..'` and `'.'` segments.
36
+ * Note that resolving these segments does not necessarily mean that all will be eliminated.
37
+ * A `'..'` at the top-level will be preserved, and an empty path is canonically `'.'`.
38
+ * @param path to be normalized
39
+ */
40
+ function windowsNormalize(path) {
41
+ assertArg(path);
42
+ const len = path.length;
43
+ let rootEnd = 0;
44
+ let device;
45
+ let isAbsolute = false;
46
+ const code = path.charCodeAt(0);
47
+ // Try to match a root
48
+ if (len > 1) {
49
+ if ((0, _util_js_1.isPathSeparator)(code)) {
50
+ // Possible UNC root
51
+ // If we started with a separator, we know we at least have an absolute
52
+ // path of some kind (UNC or otherwise)
53
+ isAbsolute = true;
54
+ if ((0, _util_js_1.isPathSeparator)(path.charCodeAt(1))) {
55
+ // Matched double path separator at beginning
56
+ let j = 2;
57
+ let last = j;
58
+ // Match 1 or more non-path separators
59
+ for (; j < len; ++j) {
60
+ if ((0, _util_js_1.isPathSeparator)(path.charCodeAt(j)))
61
+ break;
62
+ }
63
+ if (j < len && j !== last) {
64
+ const firstPart = path.slice(last, j);
65
+ // Matched!
66
+ last = j;
67
+ // Match 1 or more path separators
68
+ for (; j < len; ++j) {
69
+ if (!(0, _util_js_1.isPathSeparator)(path.charCodeAt(j)))
70
+ break;
71
+ }
72
+ if (j < len && j !== last) {
73
+ // Matched!
74
+ last = j;
75
+ // Match 1 or more non-path separators
76
+ for (; j < len; ++j) {
77
+ if ((0, _util_js_1.isPathSeparator)(path.charCodeAt(j)))
78
+ break;
79
+ }
80
+ if (j === len) {
81
+ // We matched a UNC root only
82
+ // Return the normalized version of the UNC root since there
83
+ // is nothing left to process
84
+ return `\\\\${firstPart}\\${path.slice(last)}\\`;
85
+ }
86
+ else if (j !== last) {
87
+ // We matched a UNC root with leftovers
88
+ device = `\\\\${firstPart}\\${path.slice(last, j)}`;
89
+ rootEnd = j;
90
+ }
91
+ }
92
+ }
93
+ }
94
+ else {
95
+ rootEnd = 1;
96
+ }
97
+ }
98
+ else if ((0, _util_js_1.isWindowsDeviceRoot)(code)) {
99
+ // Possible device root
100
+ if (path.charCodeAt(1) === _constants_js_1.CHAR_COLON) {
101
+ device = path.slice(0, 2);
102
+ rootEnd = 2;
103
+ if (len > 2) {
104
+ if ((0, _util_js_1.isPathSeparator)(path.charCodeAt(2))) {
105
+ // Treat separator following drive name as an absolute path
106
+ // indicator
107
+ isAbsolute = true;
108
+ rootEnd = 3;
109
+ }
110
+ }
111
+ }
112
+ }
113
+ }
114
+ else if ((0, _util_js_1.isPathSeparator)(code)) {
115
+ // `path` contains just a path separator, exit early to avoid unnecessary
116
+ // work
117
+ return "\\";
118
+ }
119
+ let tail;
120
+ if (rootEnd < len) {
121
+ tail = (0, _util_js_1.normalizeString)(path.slice(rootEnd), !isAbsolute, "\\", _util_js_1.isPathSeparator);
122
+ }
123
+ else {
124
+ tail = "";
125
+ }
126
+ if (tail.length === 0 && !isAbsolute)
127
+ tail = ".";
128
+ if (tail.length > 0 && (0, _util_js_1.isPathSeparator)(path.charCodeAt(len - 1))) {
129
+ tail += "\\";
130
+ }
131
+ if (device === undefined) {
132
+ if (isAbsolute) {
133
+ if (tail.length > 0)
134
+ return `\\${tail}`;
135
+ else
136
+ return "\\";
137
+ }
138
+ else if (tail.length > 0) {
139
+ return tail;
140
+ }
141
+ else {
142
+ return "";
143
+ }
144
+ }
145
+ else if (isAbsolute) {
146
+ if (tail.length > 0)
147
+ return `${device}\\${tail}`;
148
+ else
149
+ return `${device}\\`;
150
+ }
151
+ else if (tail.length > 0) {
152
+ return device + tail;
153
+ }
154
+ else {
155
+ return device;
156
+ }
157
+ }
158
+ exports.windowsNormalize = windowsNormalize;
@@ -0,0 +1,4 @@
1
+ export type OSType = "windows" | "linux" | "darwin" | "freebsd";
2
+ export declare const osType: OSType;
3
+ export declare const isWindows: boolean;
4
+ export declare const isLinux: boolean;
@@ -0,0 +1,44 @@
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.isLinux = exports.isWindows = exports.osType = void 0;
27
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
28
+ // This module is browser compatible.
29
+ const dntShim = __importStar(require("../../../../_dnt.shims.js"));
30
+ exports.osType = (() => {
31
+ // deno-lint-ignore no-explicit-any
32
+ const { Deno } = dntShim.dntGlobalThis;
33
+ if (typeof Deno?.build?.os === "string") {
34
+ return Deno.build.os;
35
+ }
36
+ // deno-lint-ignore no-explicit-any
37
+ const { navigator } = dntShim.dntGlobalThis;
38
+ if (navigator?.appVersion?.includes?.("Win")) {
39
+ return "windows";
40
+ }
41
+ return "linux";
42
+ })();
43
+ exports.isWindows = exports.osType === "windows";
44
+ exports.isLinux = exports.osType === "linux";
@@ -0,0 +1,11 @@
1
+ import { ParsedPath } from "./_interface.js";
2
+ /**
3
+ * Return a `ParsedPath` object of the `path`.
4
+ * @param path to process
5
+ */
6
+ export declare function posixParse(path: string): ParsedPath;
7
+ /**
8
+ * Return a `ParsedPath` object of the `path`.
9
+ * @param path to process
10
+ */
11
+ export declare function windowsParse(path: string): ParsedPath;