ventojs 0.7.1 → 0.7.2
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.
- package/esm/_dnt.shims.js +0 -1
- package/esm/deps/deno.land/std@0.201.0/assert/assert.d.ts +2 -0
- package/esm/deps/deno.land/std@0.201.0/assert/assert.js +8 -0
- package/esm/deps/deno.land/std@0.201.0/assert/assertion_error.d.ts +4 -0
- package/esm/deps/deno.land/std@0.201.0/assert/assertion_error.js +7 -0
- package/esm/deps/deno.land/std@0.201.0/path/_basename.d.ts +16 -0
- package/esm/deps/deno.land/std@0.201.0/path/_basename.js +78 -0
- package/esm/deps/deno.land/std@0.201.0/path/_dirname.d.ts +10 -0
- package/esm/deps/deno.land/std@0.201.0/path/_dirname.js +132 -0
- package/esm/deps/deno.land/std@0.201.0/path/_extname.d.ts +12 -0
- package/esm/deps/deno.land/std@0.201.0/path/_extname.js +121 -0
- package/esm/deps/deno.land/std@0.201.0/path/_format.d.ts +11 -0
- package/esm/deps/deno.land/std@0.201.0/path/_format.js +35 -0
- package/esm/deps/deno.land/std@0.201.0/path/_from_file_url.d.ts +25 -0
- package/esm/deps/deno.land/std@0.201.0/path/_from_file_url.js +46 -0
- package/esm/deps/deno.land/std@0.201.0/path/_is_absolute.d.ts +10 -0
- package/esm/deps/deno.land/std@0.201.0/path/_is_absolute.js +34 -0
- package/esm/deps/deno.land/std@0.201.0/path/_join.d.ts +10 -0
- package/esm/deps/deno.land/std@0.201.0/path/_join.js +93 -0
- package/esm/deps/deno.land/std@0.201.0/path/_normalize.d.ts +14 -0
- package/esm/deps/deno.land/std@0.201.0/path/_normalize.js +153 -0
- package/esm/deps/deno.land/std@0.201.0/path/_parse.d.ts +11 -0
- package/esm/deps/deno.land/std@0.201.0/path/_parse.js +250 -0
- package/esm/deps/deno.land/std@0.201.0/path/_relative.d.ts +19 -0
- package/esm/deps/deno.land/std@0.201.0/path/_relative.js +216 -0
- package/esm/deps/deno.land/std@0.201.0/path/_resolve.d.ts +10 -0
- package/esm/deps/deno.land/std@0.201.0/path/_resolve.js +183 -0
- package/esm/deps/deno.land/std@0.201.0/path/_to_file_url.d.ts +25 -0
- package/esm/deps/deno.land/std@0.201.0/path/_to_file_url.js +61 -0
- package/esm/deps/deno.land/std@0.201.0/path/_to_namespaced_path.d.ts +10 -0
- package/esm/deps/deno.land/std@0.201.0/path/_to_namespaced_path.js +46 -0
- package/esm/deps/deno.land/{std@0.178.0 → std@0.201.0}/path/_util.d.ts +0 -5
- package/esm/deps/deno.land/{std@0.178.0 → std@0.201.0}/path/_util.js +0 -54
- package/esm/deps/deno.land/std@0.201.0/path/basename.d.ts +8 -0
- package/esm/deps/deno.land/std@0.201.0/path/basename.js +16 -0
- package/esm/deps/deno.land/std@0.201.0/path/dirname.d.ts +5 -0
- package/esm/deps/deno.land/std@0.201.0/path/dirname.js +11 -0
- package/esm/deps/deno.land/std@0.201.0/path/extname.d.ts +6 -0
- package/esm/deps/deno.land/std@0.201.0/path/extname.js +12 -0
- package/esm/deps/deno.land/std@0.201.0/path/format.d.ts +6 -0
- package/esm/deps/deno.land/std@0.201.0/path/format.js +11 -0
- package/esm/deps/deno.land/std@0.201.0/path/from_file_url.d.ts +18 -0
- package/esm/deps/deno.land/std@0.201.0/path/from_file_url.js +23 -0
- package/esm/deps/deno.land/{std@0.178.0 → std@0.201.0}/path/glob.d.ts +1 -1
- package/esm/deps/deno.land/{std@0.178.0 → std@0.201.0}/path/glob.js +50 -50
- package/esm/deps/deno.land/std@0.201.0/path/is_absolute.d.ts +5 -0
- package/esm/deps/deno.land/std@0.201.0/path/is_absolute.js +11 -0
- package/esm/deps/deno.land/std@0.201.0/path/join.d.ts +5 -0
- package/esm/deps/deno.land/std@0.201.0/path/join.js +11 -0
- package/esm/deps/deno.land/std@0.201.0/path/mod.d.ts +22 -0
- package/esm/deps/deno.land/{std@0.178.0 → std@0.201.0}/path/mod.js +17 -4
- package/esm/deps/deno.land/std@0.201.0/path/normalize.d.ts +7 -0
- package/esm/deps/deno.land/std@0.201.0/path/normalize.js +13 -0
- package/esm/deps/deno.land/std@0.201.0/path/parse.d.ts +6 -0
- package/esm/deps/deno.land/std@0.201.0/path/parse.js +11 -0
- package/esm/deps/deno.land/std@0.201.0/path/posix.d.ts +15 -0
- package/esm/deps/deno.land/std@0.201.0/path/posix.js +19 -0
- package/esm/deps/deno.land/std@0.201.0/path/relative.d.ts +12 -0
- package/esm/deps/deno.land/std@0.201.0/path/relative.js +18 -0
- package/esm/deps/deno.land/std@0.201.0/path/resolve.d.ts +5 -0
- package/esm/deps/deno.land/std@0.201.0/path/resolve.js +13 -0
- package/esm/deps/deno.land/{std@0.178.0 → std@0.201.0}/path/separator.js +1 -1
- package/esm/deps/deno.land/std@0.201.0/path/to_file_url.d.ts +18 -0
- package/esm/deps/deno.land/std@0.201.0/path/to_file_url.js +23 -0
- package/esm/deps/deno.land/std@0.201.0/path/to_namespaced_path.d.ts +5 -0
- package/esm/deps/deno.land/std@0.201.0/path/to_namespaced_path.js +13 -0
- package/esm/deps/deno.land/std@0.201.0/path/win32.d.ts +15 -0
- package/esm/deps/deno.land/std@0.201.0/path/win32.js +19 -0
- package/esm/deps.d.ts +1 -1
- package/esm/deps.js +1 -1
- package/esm/src/environment.js +3 -1
- package/package.json +1 -1
- package/esm/_dnt.test_polyfills.d.ts +0 -11
- package/esm/_dnt.test_shims.d.ts +0 -5
- package/esm/deps/deno.land/std@0.178.0/_util/asserts.d.ts +0 -10
- package/esm/deps/deno.land/std@0.178.0/_util/asserts.js +0 -21
- package/esm/deps/deno.land/std@0.178.0/path/mod.d.ts +0 -9
- package/esm/deps/deno.land/std@0.178.0/path/posix.d.ts +0 -86
- package/esm/deps/deno.land/std@0.178.0/path/posix.js +0 -442
- package/esm/deps/deno.land/std@0.178.0/path/win32.d.ts +0 -91
- package/esm/deps/deno.land/std@0.178.0/path/win32.js +0 -909
- package/esm/deps/deno.land/std@0.190.0/_util/asserts.d.ts +0 -10
- package/esm/deps/deno.land/std@0.190.0/bytes/copy.d.ts +0 -27
- package/esm/deps/deno.land/std@0.190.0/fmt/colors.d.ts +0 -270
- package/esm/deps/deno.land/std@0.190.0/front_matter/mod.d.ts +0 -78
- package/esm/deps/deno.land/std@0.190.0/front_matter/yaml.d.ts +0 -4
- package/esm/deps/deno.land/std@0.190.0/io/buffer.d.ts +0 -81
- package/esm/deps/deno.land/std@0.190.0/testing/_diff.d.ts +0 -26
- package/esm/deps/deno.land/std@0.190.0/testing/_format.d.ts +0 -1
- package/esm/deps/deno.land/std@0.190.0/testing/asserts.d.ts +0 -284
- package/esm/deps/deno.land/std@0.190.0/yaml/_error.d.ts +0 -6
- package/esm/deps/deno.land/std@0.190.0/yaml/_loader/loader.d.ts +0 -4
- package/esm/deps/deno.land/std@0.190.0/yaml/_loader/loader_state.d.ts +0 -43
- package/esm/deps/deno.land/std@0.190.0/yaml/_mark.d.ts +0 -10
- package/esm/deps/deno.land/std@0.190.0/yaml/_state.d.ts +0 -5
- package/esm/deps/deno.land/std@0.190.0/yaml/_type/binary.d.ts +0 -2
- package/esm/deps/deno.land/std@0.190.0/yaml/_type/bool.d.ts +0 -2
- package/esm/deps/deno.land/std@0.190.0/yaml/_type/float.d.ts +0 -2
- package/esm/deps/deno.land/std@0.190.0/yaml/_type/function.d.ts +0 -2
- package/esm/deps/deno.land/std@0.190.0/yaml/_type/int.d.ts +0 -2
- package/esm/deps/deno.land/std@0.190.0/yaml/_type/map.d.ts +0 -2
- package/esm/deps/deno.land/std@0.190.0/yaml/_type/merge.d.ts +0 -2
- package/esm/deps/deno.land/std@0.190.0/yaml/_type/mod.d.ts +0 -16
- package/esm/deps/deno.land/std@0.190.0/yaml/_type/nil.d.ts +0 -2
- package/esm/deps/deno.land/std@0.190.0/yaml/_type/omap.d.ts +0 -2
- package/esm/deps/deno.land/std@0.190.0/yaml/_type/pairs.d.ts +0 -2
- package/esm/deps/deno.land/std@0.190.0/yaml/_type/regexp.d.ts +0 -2
- package/esm/deps/deno.land/std@0.190.0/yaml/_type/seq.d.ts +0 -2
- package/esm/deps/deno.land/std@0.190.0/yaml/_type/set.d.ts +0 -2
- package/esm/deps/deno.land/std@0.190.0/yaml/_type/str.d.ts +0 -2
- package/esm/deps/deno.land/std@0.190.0/yaml/_type/timestamp.d.ts +0 -2
- package/esm/deps/deno.land/std@0.190.0/yaml/_type/undefined.d.ts +0 -2
- package/esm/deps/deno.land/std@0.190.0/yaml/_utils.d.ts +0 -19
- package/esm/deps/deno.land/std@0.190.0/yaml/parse.d.ts +0 -35
- package/esm/deps/deno.land/std@0.190.0/yaml/schema/core.d.ts +0 -2
- package/esm/deps/deno.land/std@0.190.0/yaml/schema/default.d.ts +0 -2
- package/esm/deps/deno.land/std@0.190.0/yaml/schema/extended.d.ts +0 -30
- package/esm/deps/deno.land/std@0.190.0/yaml/schema/failsafe.d.ts +0 -2
- package/esm/deps/deno.land/std@0.190.0/yaml/schema/json.d.ts +0 -2
- package/esm/deps/deno.land/std@0.190.0/yaml/schema/mod.d.ts +0 -5
- package/esm/deps/deno.land/std@0.190.0/yaml/schema.d.ts +0 -22
- package/esm/deps/deno.land/std@0.190.0/yaml/type.d.ts +0 -28
- package/esm/test/comment.test.d.ts +0 -1
- package/esm/test/escape.test.d.ts +0 -1
- package/esm/test/for.test.d.ts +0 -1
- package/esm/test/function.test.d.ts +0 -1
- package/esm/test/if.test.d.ts +0 -1
- package/esm/test/import.test.d.ts +0 -1
- package/esm/test/include.test.d.ts +0 -1
- package/esm/test/js.test.d.ts +0 -1
- package/esm/test/layout.test.d.ts +0 -1
- package/esm/test/print.test.d.ts +0 -1
- package/esm/test/raw.test.d.ts +0 -1
- package/esm/test/set.test.d.ts +0 -1
- package/esm/test/tokenizer.test.d.ts +0 -1
- package/esm/test/utils.d.ts +0 -24
- /package/esm/deps/deno.land/{std@0.178.0 → std@0.201.0}/path/_constants.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.178.0 → std@0.201.0}/path/_constants.js +0 -0
- /package/esm/deps/deno.land/{std@0.178.0 → std@0.201.0}/path/_interface.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.178.0 → std@0.201.0}/path/_interface.js +0 -0
- /package/esm/deps/deno.land/{std@0.178.0/_util/os.d.ts → std@0.201.0/path/_os.d.ts} +0 -0
- /package/esm/deps/deno.land/{std@0.178.0/_util/os.js → std@0.201.0/path/_os.js} +0 -0
- /package/esm/deps/deno.land/{std@0.178.0 → std@0.201.0}/path/common.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.178.0 → std@0.201.0}/path/common.js +0 -0
- /package/esm/deps/deno.land/{std@0.178.0 → std@0.201.0}/path/separator.d.ts +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const sep = "\\";
|
|
2
|
+
export declare const delimiter = ";";
|
|
3
|
+
export { windowsResolve as resolve } from "./_resolve.js";
|
|
4
|
+
export { windowsNormalize as normalize } from "./_normalize.js";
|
|
5
|
+
export { windowsIsAbsolute as isAbsolute } from "./_is_absolute.js";
|
|
6
|
+
export { windowsJoin as join } from "./_join.js";
|
|
7
|
+
export { windowsRelative as relative } from "./_relative.js";
|
|
8
|
+
export { windowsToNamespacedPath as toNamespacedPath } from "./_to_namespaced_path.js";
|
|
9
|
+
export { windowsDirname as dirname } from "./_dirname.js";
|
|
10
|
+
export { windowsBasename as basename } from "./_basename.js";
|
|
11
|
+
export { windowsExtname as extname } from "./_extname.js";
|
|
12
|
+
export { windowsFormat as format } from "./_format.js";
|
|
13
|
+
export { windowsParse as parse } from "./_parse.js";
|
|
14
|
+
export { windowsFromFileUrl as fromFileUrl } from "./_from_file_url.js";
|
|
15
|
+
export { windowsToFileUrl as toFileUrl } from "./_to_file_url.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
2
|
+
// Copyright the Browserify authors. MIT License.
|
|
3
|
+
// Ported from https://github.com/browserify/path-browserify/
|
|
4
|
+
// This module is browser compatible.
|
|
5
|
+
export const sep = "\\";
|
|
6
|
+
export const delimiter = ";";
|
|
7
|
+
export { windowsResolve as resolve } from "./_resolve.js";
|
|
8
|
+
export { windowsNormalize as normalize } from "./_normalize.js";
|
|
9
|
+
export { windowsIsAbsolute as isAbsolute } from "./_is_absolute.js";
|
|
10
|
+
export { windowsJoin as join } from "./_join.js";
|
|
11
|
+
export { windowsRelative as relative } from "./_relative.js";
|
|
12
|
+
export { windowsToNamespacedPath as toNamespacedPath } from "./_to_namespaced_path.js";
|
|
13
|
+
export { windowsDirname as dirname } from "./_dirname.js";
|
|
14
|
+
export { windowsBasename as basename } from "./_basename.js";
|
|
15
|
+
export { windowsExtname as extname } from "./_extname.js";
|
|
16
|
+
export { windowsFormat as format } from "./_format.js";
|
|
17
|
+
export { windowsParse as parse } from "./_parse.js";
|
|
18
|
+
export { windowsFromFileUrl as fromFileUrl } from "./_from_file_url.js";
|
|
19
|
+
export { windowsToFileUrl as toFileUrl } from "./_to_file_url.js";
|
package/esm/deps.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * as path from "./deps/deno.land/std@0.
|
|
1
|
+
export * as path from "./deps/deno.land/std@0.201.0/path/mod.js";
|
package/esm/deps.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * as path from "./deps/deno.land/std@0.
|
|
1
|
+
export * as path from "./deps/deno.land/std@0.201.0/path/mod.js";
|
package/esm/src/environment.js
CHANGED
|
@@ -82,7 +82,9 @@ export class Environment {
|
|
|
82
82
|
continue;
|
|
83
83
|
}
|
|
84
84
|
if (type === "string" || type === "raw") {
|
|
85
|
-
compiled.push(`${outputVar} += \`${code
|
|
85
|
+
compiled.push(`${outputVar} += \`${code
|
|
86
|
+
.replaceAll("`", "\\`")
|
|
87
|
+
.replaceAll("${", "\\${")}\`;`);
|
|
86
88
|
continue;
|
|
87
89
|
}
|
|
88
90
|
if (type === "tag") {
|
package/package.json
CHANGED
package/esm/_dnt.test_shims.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* All internal non-test code, that is files that do not have `test` or `bench` in the name, must use the assertion functions within `_utils/asserts.ts` and not `testing/asserts.ts`. This is to create a separation of concerns between internal and testing assertions.
|
|
3
|
-
*/
|
|
4
|
-
export declare class DenoStdInternalError extends Error {
|
|
5
|
-
constructor(message: string);
|
|
6
|
-
}
|
|
7
|
-
/** Make an assertion, if not `true`, then throw. */
|
|
8
|
-
export declare function assert(expr: unknown, msg?: string): asserts expr;
|
|
9
|
-
/** Use this to assert unreachable code. */
|
|
10
|
-
export declare function unreachable(): never;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
2
|
-
// This module is browser compatible.
|
|
3
|
-
/**
|
|
4
|
-
* All internal non-test code, that is files that do not have `test` or `bench` in the name, must use the assertion functions within `_utils/asserts.ts` and not `testing/asserts.ts`. This is to create a separation of concerns between internal and testing assertions.
|
|
5
|
-
*/
|
|
6
|
-
export class DenoStdInternalError extends Error {
|
|
7
|
-
constructor(message) {
|
|
8
|
-
super(message);
|
|
9
|
-
this.name = "DenoStdInternalError";
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
/** Make an assertion, if not `true`, then throw. */
|
|
13
|
-
export function assert(expr, msg = "") {
|
|
14
|
-
if (!expr) {
|
|
15
|
-
throw new DenoStdInternalError(msg);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
/** Use this to assert unreachable code. */
|
|
19
|
-
export function unreachable() {
|
|
20
|
-
throw new DenoStdInternalError("unreachable");
|
|
21
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as _win32 from "./win32.js";
|
|
2
|
-
import * as _posix from "./posix.js";
|
|
3
|
-
export declare const win32: typeof _win32;
|
|
4
|
-
export declare const posix: typeof _posix;
|
|
5
|
-
export declare const basename: typeof _posix.basename | typeof _win32.basename, delimiter: string, dirname: typeof _posix.dirname | typeof _win32.dirname, extname: typeof _posix.extname | typeof _win32.extname, format: typeof _posix.format | typeof _win32.format, fromFileUrl: typeof _posix.fromFileUrl | typeof _win32.fromFileUrl, isAbsolute: typeof _win32.isAbsolute | typeof _posix.isAbsolute, join: typeof _posix.join | typeof _win32.join, normalize: typeof _win32.normalize | typeof _posix.normalize, parse: typeof _posix.parse | typeof _win32.parse, relative: typeof _posix.relative | typeof _win32.relative, resolve: typeof _win32.resolve | typeof _posix.resolve, sep: string, toFileUrl: typeof _posix.toFileUrl | typeof _win32.toFileUrl, toNamespacedPath: typeof _posix.toNamespacedPath | typeof _win32.toNamespacedPath;
|
|
6
|
-
export * from "./common.js";
|
|
7
|
-
export { SEP, SEP_PATTERN } from "./separator.js";
|
|
8
|
-
export * from "./_interface.js";
|
|
9
|
-
export * from "./glob.js";
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import type { FormatInputPathObject, ParsedPath } from "./_interface.js";
|
|
3
|
-
export declare const sep = "/";
|
|
4
|
-
export declare const delimiter = ":";
|
|
5
|
-
/**
|
|
6
|
-
* Resolves `pathSegments` into an absolute path.
|
|
7
|
-
* @param pathSegments an array of path segments
|
|
8
|
-
*/
|
|
9
|
-
export declare function resolve(...pathSegments: string[]): string;
|
|
10
|
-
/**
|
|
11
|
-
* Normalize the `path`, resolving `'..'` and `'.'` segments.
|
|
12
|
-
* Note that resolving these segments does not necessarily mean that all will be eliminated.
|
|
13
|
-
* A `'..'` at the top-level will be preserved, and an empty path is canonically `'.'`.
|
|
14
|
-
* @param path to be normalized
|
|
15
|
-
*/
|
|
16
|
-
export declare function normalize(path: string): string;
|
|
17
|
-
/**
|
|
18
|
-
* Verifies whether provided path is absolute
|
|
19
|
-
* @param path to be verified as absolute
|
|
20
|
-
*/
|
|
21
|
-
export declare function isAbsolute(path: string): boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Join all given a sequence of `paths`,then normalizes the resulting path.
|
|
24
|
-
* @param paths to be joined and normalized
|
|
25
|
-
*/
|
|
26
|
-
export declare function join(...paths: string[]): string;
|
|
27
|
-
/**
|
|
28
|
-
* Return the relative path from `from` to `to` based on current working directory.
|
|
29
|
-
* @param from path in current working directory
|
|
30
|
-
* @param to path in current working directory
|
|
31
|
-
*/
|
|
32
|
-
export declare function relative(from: string, to: string): string;
|
|
33
|
-
/**
|
|
34
|
-
* Resolves path to a namespace path
|
|
35
|
-
* @param path to resolve to namespace
|
|
36
|
-
*/
|
|
37
|
-
export declare function toNamespacedPath(path: string): string;
|
|
38
|
-
/**
|
|
39
|
-
* Return the directory path of a `path`.
|
|
40
|
-
* @param path - path to extract the directory from.
|
|
41
|
-
*/
|
|
42
|
-
export declare function dirname(path: string): string;
|
|
43
|
-
/**
|
|
44
|
-
* Return the last portion of a `path`.
|
|
45
|
-
* Trailing directory separators are ignored, and optional suffix is removed.
|
|
46
|
-
*
|
|
47
|
-
* @param path - path to extract the name from.
|
|
48
|
-
* @param [suffix] - suffix to remove from extracted name.
|
|
49
|
-
*/
|
|
50
|
-
export declare function basename(path: string, suffix?: string): string;
|
|
51
|
-
/**
|
|
52
|
-
* Return the extension of the `path` with leading period.
|
|
53
|
-
* @param path with extension
|
|
54
|
-
* @returns extension (ex. for `file.ts` returns `.ts`)
|
|
55
|
-
*/
|
|
56
|
-
export declare function extname(path: string): string;
|
|
57
|
-
/**
|
|
58
|
-
* Generate a path from `FormatInputPathObject` object.
|
|
59
|
-
* @param pathObject with path
|
|
60
|
-
*/
|
|
61
|
-
export declare function format(pathObject: FormatInputPathObject): string;
|
|
62
|
-
/**
|
|
63
|
-
* Return a `ParsedPath` object of the `path`.
|
|
64
|
-
* @param path to process
|
|
65
|
-
*/
|
|
66
|
-
export declare function parse(path: string): ParsedPath;
|
|
67
|
-
/**
|
|
68
|
-
* Converts a file URL to a path string.
|
|
69
|
-
*
|
|
70
|
-
* ```ts
|
|
71
|
-
* import { fromFileUrl } from "https://deno.land/std@$STD_VERSION/path/posix.ts";
|
|
72
|
-
* fromFileUrl("file:///home/foo"); // "/home/foo"
|
|
73
|
-
* ```
|
|
74
|
-
* @param url of a file URL
|
|
75
|
-
*/
|
|
76
|
-
export declare function fromFileUrl(url: string | URL): string;
|
|
77
|
-
/**
|
|
78
|
-
* Converts a path string to a file URL.
|
|
79
|
-
*
|
|
80
|
-
* ```ts
|
|
81
|
-
* import { toFileUrl } from "https://deno.land/std@$STD_VERSION/path/posix.ts";
|
|
82
|
-
* toFileUrl("/home/foo"); // new URL("file:///home/foo")
|
|
83
|
-
* ```
|
|
84
|
-
* @param path to convert to file URL
|
|
85
|
-
*/
|
|
86
|
-
export declare function toFileUrl(path: string): URL;
|
|
@@ -1,442 +0,0 @@
|
|
|
1
|
-
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
2
|
-
// Copyright the Browserify authors. MIT License.
|
|
3
|
-
// Ported from https://github.com/browserify/path-browserify/
|
|
4
|
-
// This module is browser compatible.
|
|
5
|
-
import * as dntShim from "../../../../_dnt.shims.js";
|
|
6
|
-
import { CHAR_DOT } from "./_constants.js";
|
|
7
|
-
import { _format, assertPath, encodeWhitespace, isPosixPathSeparator, lastPathSegment, normalizeString, stripSuffix, stripTrailingSeparators, } from "./_util.js";
|
|
8
|
-
export const sep = "/";
|
|
9
|
-
export const delimiter = ":";
|
|
10
|
-
// path.resolve([from ...], to)
|
|
11
|
-
/**
|
|
12
|
-
* Resolves `pathSegments` into an absolute path.
|
|
13
|
-
* @param pathSegments an array of path segments
|
|
14
|
-
*/
|
|
15
|
-
export function resolve(...pathSegments) {
|
|
16
|
-
let resolvedPath = "";
|
|
17
|
-
let resolvedAbsolute = false;
|
|
18
|
-
for (let i = pathSegments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
19
|
-
let path;
|
|
20
|
-
if (i >= 0)
|
|
21
|
-
path = pathSegments[i];
|
|
22
|
-
else {
|
|
23
|
-
// deno-lint-ignore no-explicit-any
|
|
24
|
-
const { Deno } = dntShim.dntGlobalThis;
|
|
25
|
-
if (typeof Deno?.cwd !== "function") {
|
|
26
|
-
throw new TypeError("Resolved a relative path without a CWD.");
|
|
27
|
-
}
|
|
28
|
-
path = Deno.cwd();
|
|
29
|
-
}
|
|
30
|
-
assertPath(path);
|
|
31
|
-
// Skip empty entries
|
|
32
|
-
if (path.length === 0) {
|
|
33
|
-
continue;
|
|
34
|
-
}
|
|
35
|
-
resolvedPath = `${path}/${resolvedPath}`;
|
|
36
|
-
resolvedAbsolute = isPosixPathSeparator(path.charCodeAt(0));
|
|
37
|
-
}
|
|
38
|
-
// At this point the path should be resolved to a full absolute path, but
|
|
39
|
-
// handle relative paths to be safe (might happen when process.cwd() fails)
|
|
40
|
-
// Normalize the path
|
|
41
|
-
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute, "/", isPosixPathSeparator);
|
|
42
|
-
if (resolvedAbsolute) {
|
|
43
|
-
if (resolvedPath.length > 0)
|
|
44
|
-
return `/${resolvedPath}`;
|
|
45
|
-
else
|
|
46
|
-
return "/";
|
|
47
|
-
}
|
|
48
|
-
else if (resolvedPath.length > 0)
|
|
49
|
-
return resolvedPath;
|
|
50
|
-
else
|
|
51
|
-
return ".";
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Normalize the `path`, resolving `'..'` and `'.'` segments.
|
|
55
|
-
* Note that resolving these segments does not necessarily mean that all will be eliminated.
|
|
56
|
-
* A `'..'` at the top-level will be preserved, and an empty path is canonically `'.'`.
|
|
57
|
-
* @param path to be normalized
|
|
58
|
-
*/
|
|
59
|
-
export function normalize(path) {
|
|
60
|
-
assertPath(path);
|
|
61
|
-
if (path.length === 0)
|
|
62
|
-
return ".";
|
|
63
|
-
const isAbsolute = isPosixPathSeparator(path.charCodeAt(0));
|
|
64
|
-
const trailingSeparator = isPosixPathSeparator(path.charCodeAt(path.length - 1));
|
|
65
|
-
// Normalize the path
|
|
66
|
-
path = normalizeString(path, !isAbsolute, "/", isPosixPathSeparator);
|
|
67
|
-
if (path.length === 0 && !isAbsolute)
|
|
68
|
-
path = ".";
|
|
69
|
-
if (path.length > 0 && trailingSeparator)
|
|
70
|
-
path += "/";
|
|
71
|
-
if (isAbsolute)
|
|
72
|
-
return `/${path}`;
|
|
73
|
-
return path;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Verifies whether provided path is absolute
|
|
77
|
-
* @param path to be verified as absolute
|
|
78
|
-
*/
|
|
79
|
-
export function isAbsolute(path) {
|
|
80
|
-
assertPath(path);
|
|
81
|
-
return path.length > 0 && isPosixPathSeparator(path.charCodeAt(0));
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Join all given a sequence of `paths`,then normalizes the resulting path.
|
|
85
|
-
* @param paths to be joined and normalized
|
|
86
|
-
*/
|
|
87
|
-
export function join(...paths) {
|
|
88
|
-
if (paths.length === 0)
|
|
89
|
-
return ".";
|
|
90
|
-
let joined;
|
|
91
|
-
for (let i = 0, len = paths.length; i < len; ++i) {
|
|
92
|
-
const path = paths[i];
|
|
93
|
-
assertPath(path);
|
|
94
|
-
if (path.length > 0) {
|
|
95
|
-
if (!joined)
|
|
96
|
-
joined = path;
|
|
97
|
-
else
|
|
98
|
-
joined += `/${path}`;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
if (!joined)
|
|
102
|
-
return ".";
|
|
103
|
-
return normalize(joined);
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Return the relative path from `from` to `to` based on current working directory.
|
|
107
|
-
* @param from path in current working directory
|
|
108
|
-
* @param to path in current working directory
|
|
109
|
-
*/
|
|
110
|
-
export function relative(from, to) {
|
|
111
|
-
assertPath(from);
|
|
112
|
-
assertPath(to);
|
|
113
|
-
if (from === to)
|
|
114
|
-
return "";
|
|
115
|
-
from = resolve(from);
|
|
116
|
-
to = resolve(to);
|
|
117
|
-
if (from === to)
|
|
118
|
-
return "";
|
|
119
|
-
// Trim any leading backslashes
|
|
120
|
-
let fromStart = 1;
|
|
121
|
-
const fromEnd = from.length;
|
|
122
|
-
for (; fromStart < fromEnd; ++fromStart) {
|
|
123
|
-
if (!isPosixPathSeparator(from.charCodeAt(fromStart)))
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
const fromLen = fromEnd - fromStart;
|
|
127
|
-
// Trim any leading backslashes
|
|
128
|
-
let toStart = 1;
|
|
129
|
-
const toEnd = to.length;
|
|
130
|
-
for (; toStart < toEnd; ++toStart) {
|
|
131
|
-
if (!isPosixPathSeparator(to.charCodeAt(toStart)))
|
|
132
|
-
break;
|
|
133
|
-
}
|
|
134
|
-
const toLen = toEnd - toStart;
|
|
135
|
-
// Compare paths to find the longest common path from root
|
|
136
|
-
const length = fromLen < toLen ? fromLen : toLen;
|
|
137
|
-
let lastCommonSep = -1;
|
|
138
|
-
let i = 0;
|
|
139
|
-
for (; i <= length; ++i) {
|
|
140
|
-
if (i === length) {
|
|
141
|
-
if (toLen > length) {
|
|
142
|
-
if (isPosixPathSeparator(to.charCodeAt(toStart + i))) {
|
|
143
|
-
// We get here if `from` is the exact base path for `to`.
|
|
144
|
-
// For example: from='/foo/bar'; to='/foo/bar/baz'
|
|
145
|
-
return to.slice(toStart + i + 1);
|
|
146
|
-
}
|
|
147
|
-
else if (i === 0) {
|
|
148
|
-
// We get here if `from` is the root
|
|
149
|
-
// For example: from='/'; to='/foo'
|
|
150
|
-
return to.slice(toStart + i);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
else if (fromLen > length) {
|
|
154
|
-
if (isPosixPathSeparator(from.charCodeAt(fromStart + i))) {
|
|
155
|
-
// We get here if `to` is the exact base path for `from`.
|
|
156
|
-
// For example: from='/foo/bar/baz'; to='/foo/bar'
|
|
157
|
-
lastCommonSep = i;
|
|
158
|
-
}
|
|
159
|
-
else if (i === 0) {
|
|
160
|
-
// We get here if `to` is the root.
|
|
161
|
-
// For example: from='/foo'; to='/'
|
|
162
|
-
lastCommonSep = 0;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
const fromCode = from.charCodeAt(fromStart + i);
|
|
168
|
-
const toCode = to.charCodeAt(toStart + i);
|
|
169
|
-
if (fromCode !== toCode)
|
|
170
|
-
break;
|
|
171
|
-
else if (isPosixPathSeparator(fromCode))
|
|
172
|
-
lastCommonSep = i;
|
|
173
|
-
}
|
|
174
|
-
let out = "";
|
|
175
|
-
// Generate the relative path based on the path difference between `to`
|
|
176
|
-
// and `from`
|
|
177
|
-
for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
|
|
178
|
-
if (i === fromEnd || isPosixPathSeparator(from.charCodeAt(i))) {
|
|
179
|
-
if (out.length === 0)
|
|
180
|
-
out += "..";
|
|
181
|
-
else
|
|
182
|
-
out += "/..";
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
// Lastly, append the rest of the destination (`to`) path that comes after
|
|
186
|
-
// the common path parts
|
|
187
|
-
if (out.length > 0)
|
|
188
|
-
return out + to.slice(toStart + lastCommonSep);
|
|
189
|
-
else {
|
|
190
|
-
toStart += lastCommonSep;
|
|
191
|
-
if (isPosixPathSeparator(to.charCodeAt(toStart)))
|
|
192
|
-
++toStart;
|
|
193
|
-
return to.slice(toStart);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Resolves path to a namespace path
|
|
198
|
-
* @param path to resolve to namespace
|
|
199
|
-
*/
|
|
200
|
-
export function toNamespacedPath(path) {
|
|
201
|
-
// Non-op on posix systems
|
|
202
|
-
return path;
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Return the directory path of a `path`.
|
|
206
|
-
* @param path - path to extract the directory from.
|
|
207
|
-
*/
|
|
208
|
-
export function dirname(path) {
|
|
209
|
-
if (path.length === 0)
|
|
210
|
-
return ".";
|
|
211
|
-
let end = -1;
|
|
212
|
-
let matchedNonSeparator = false;
|
|
213
|
-
for (let i = path.length - 1; i >= 1; --i) {
|
|
214
|
-
if (isPosixPathSeparator(path.charCodeAt(i))) {
|
|
215
|
-
if (matchedNonSeparator) {
|
|
216
|
-
end = i;
|
|
217
|
-
break;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
else {
|
|
221
|
-
matchedNonSeparator = true;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
// No matches. Fallback based on provided path:
|
|
225
|
-
//
|
|
226
|
-
// - leading slashes paths
|
|
227
|
-
// "/foo" => "/"
|
|
228
|
-
// "///foo" => "/"
|
|
229
|
-
// - no slash path
|
|
230
|
-
// "foo" => "."
|
|
231
|
-
if (end === -1) {
|
|
232
|
-
return isPosixPathSeparator(path.charCodeAt(0)) ? "/" : ".";
|
|
233
|
-
}
|
|
234
|
-
return stripTrailingSeparators(path.slice(0, end), isPosixPathSeparator);
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Return the last portion of a `path`.
|
|
238
|
-
* Trailing directory separators are ignored, and optional suffix is removed.
|
|
239
|
-
*
|
|
240
|
-
* @param path - path to extract the name from.
|
|
241
|
-
* @param [suffix] - suffix to remove from extracted name.
|
|
242
|
-
*/
|
|
243
|
-
export function basename(path, suffix = "") {
|
|
244
|
-
assertPath(path);
|
|
245
|
-
if (path.length === 0)
|
|
246
|
-
return path;
|
|
247
|
-
if (typeof suffix !== "string") {
|
|
248
|
-
throw new TypeError(`Suffix must be a string. Received ${JSON.stringify(suffix)}`);
|
|
249
|
-
}
|
|
250
|
-
const lastSegment = lastPathSegment(path, isPosixPathSeparator);
|
|
251
|
-
const strippedSegment = stripTrailingSeparators(lastSegment, isPosixPathSeparator);
|
|
252
|
-
return suffix ? stripSuffix(strippedSegment, suffix) : strippedSegment;
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* Return the extension of the `path` with leading period.
|
|
256
|
-
* @param path with extension
|
|
257
|
-
* @returns extension (ex. for `file.ts` returns `.ts`)
|
|
258
|
-
*/
|
|
259
|
-
export function extname(path) {
|
|
260
|
-
assertPath(path);
|
|
261
|
-
let startDot = -1;
|
|
262
|
-
let startPart = 0;
|
|
263
|
-
let end = -1;
|
|
264
|
-
let matchedSlash = true;
|
|
265
|
-
// Track the state of characters (if any) we see before our first dot and
|
|
266
|
-
// after any path separator we find
|
|
267
|
-
let preDotState = 0;
|
|
268
|
-
for (let i = path.length - 1; i >= 0; --i) {
|
|
269
|
-
const code = path.charCodeAt(i);
|
|
270
|
-
if (isPosixPathSeparator(code)) {
|
|
271
|
-
// If we reached a path separator that was not part of a set of path
|
|
272
|
-
// separators at the end of the string, stop now
|
|
273
|
-
if (!matchedSlash) {
|
|
274
|
-
startPart = i + 1;
|
|
275
|
-
break;
|
|
276
|
-
}
|
|
277
|
-
continue;
|
|
278
|
-
}
|
|
279
|
-
if (end === -1) {
|
|
280
|
-
// We saw the first non-path separator, mark this as the end of our
|
|
281
|
-
// extension
|
|
282
|
-
matchedSlash = false;
|
|
283
|
-
end = i + 1;
|
|
284
|
-
}
|
|
285
|
-
if (code === CHAR_DOT) {
|
|
286
|
-
// If this is our first dot, mark it as the start of our extension
|
|
287
|
-
if (startDot === -1)
|
|
288
|
-
startDot = i;
|
|
289
|
-
else if (preDotState !== 1)
|
|
290
|
-
preDotState = 1;
|
|
291
|
-
}
|
|
292
|
-
else if (startDot !== -1) {
|
|
293
|
-
// We saw a non-dot and non-path separator before our dot, so we should
|
|
294
|
-
// have a good chance at having a non-empty extension
|
|
295
|
-
preDotState = -1;
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
if (startDot === -1 ||
|
|
299
|
-
end === -1 ||
|
|
300
|
-
// We saw a non-dot character immediately before the dot
|
|
301
|
-
preDotState === 0 ||
|
|
302
|
-
// The (right-most) trimmed path component is exactly '..'
|
|
303
|
-
(preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)) {
|
|
304
|
-
return "";
|
|
305
|
-
}
|
|
306
|
-
return path.slice(startDot, end);
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* Generate a path from `FormatInputPathObject` object.
|
|
310
|
-
* @param pathObject with path
|
|
311
|
-
*/
|
|
312
|
-
export function format(pathObject) {
|
|
313
|
-
if (pathObject === null || typeof pathObject !== "object") {
|
|
314
|
-
throw new TypeError(`The "pathObject" argument must be of type Object. Received type ${typeof pathObject}`);
|
|
315
|
-
}
|
|
316
|
-
return _format("/", pathObject);
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* Return a `ParsedPath` object of the `path`.
|
|
320
|
-
* @param path to process
|
|
321
|
-
*/
|
|
322
|
-
export function parse(path) {
|
|
323
|
-
assertPath(path);
|
|
324
|
-
const ret = { root: "", dir: "", base: "", ext: "", name: "" };
|
|
325
|
-
if (path.length === 0)
|
|
326
|
-
return ret;
|
|
327
|
-
const isAbsolute = isPosixPathSeparator(path.charCodeAt(0));
|
|
328
|
-
let start;
|
|
329
|
-
if (isAbsolute) {
|
|
330
|
-
ret.root = "/";
|
|
331
|
-
start = 1;
|
|
332
|
-
}
|
|
333
|
-
else {
|
|
334
|
-
start = 0;
|
|
335
|
-
}
|
|
336
|
-
let startDot = -1;
|
|
337
|
-
let startPart = 0;
|
|
338
|
-
let end = -1;
|
|
339
|
-
let matchedSlash = true;
|
|
340
|
-
let i = path.length - 1;
|
|
341
|
-
// Track the state of characters (if any) we see before our first dot and
|
|
342
|
-
// after any path separator we find
|
|
343
|
-
let preDotState = 0;
|
|
344
|
-
// Get non-dir info
|
|
345
|
-
for (; i >= start; --i) {
|
|
346
|
-
const code = path.charCodeAt(i);
|
|
347
|
-
if (isPosixPathSeparator(code)) {
|
|
348
|
-
// If we reached a path separator that was not part of a set of path
|
|
349
|
-
// separators at the end of the string, stop now
|
|
350
|
-
if (!matchedSlash) {
|
|
351
|
-
startPart = i + 1;
|
|
352
|
-
break;
|
|
353
|
-
}
|
|
354
|
-
continue;
|
|
355
|
-
}
|
|
356
|
-
if (end === -1) {
|
|
357
|
-
// We saw the first non-path separator, mark this as the end of our
|
|
358
|
-
// extension
|
|
359
|
-
matchedSlash = false;
|
|
360
|
-
end = i + 1;
|
|
361
|
-
}
|
|
362
|
-
if (code === CHAR_DOT) {
|
|
363
|
-
// If this is our first dot, mark it as the start of our extension
|
|
364
|
-
if (startDot === -1)
|
|
365
|
-
startDot = i;
|
|
366
|
-
else if (preDotState !== 1)
|
|
367
|
-
preDotState = 1;
|
|
368
|
-
}
|
|
369
|
-
else if (startDot !== -1) {
|
|
370
|
-
// We saw a non-dot and non-path separator before our dot, so we should
|
|
371
|
-
// have a good chance at having a non-empty extension
|
|
372
|
-
preDotState = -1;
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
if (startDot === -1 ||
|
|
376
|
-
end === -1 ||
|
|
377
|
-
// We saw a non-dot character immediately before the dot
|
|
378
|
-
preDotState === 0 ||
|
|
379
|
-
// The (right-most) trimmed path component is exactly '..'
|
|
380
|
-
(preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)) {
|
|
381
|
-
if (end !== -1) {
|
|
382
|
-
if (startPart === 0 && isAbsolute) {
|
|
383
|
-
ret.base = ret.name = path.slice(1, end);
|
|
384
|
-
}
|
|
385
|
-
else {
|
|
386
|
-
ret.base = ret.name = path.slice(startPart, end);
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
// Fallback to '/' in case there is no basename
|
|
390
|
-
ret.base = ret.base || "/";
|
|
391
|
-
}
|
|
392
|
-
else {
|
|
393
|
-
if (startPart === 0 && isAbsolute) {
|
|
394
|
-
ret.name = path.slice(1, startDot);
|
|
395
|
-
ret.base = path.slice(1, end);
|
|
396
|
-
}
|
|
397
|
-
else {
|
|
398
|
-
ret.name = path.slice(startPart, startDot);
|
|
399
|
-
ret.base = path.slice(startPart, end);
|
|
400
|
-
}
|
|
401
|
-
ret.ext = path.slice(startDot, end);
|
|
402
|
-
}
|
|
403
|
-
if (startPart > 0) {
|
|
404
|
-
ret.dir = stripTrailingSeparators(path.slice(0, startPart - 1), isPosixPathSeparator);
|
|
405
|
-
}
|
|
406
|
-
else if (isAbsolute)
|
|
407
|
-
ret.dir = "/";
|
|
408
|
-
return ret;
|
|
409
|
-
}
|
|
410
|
-
/**
|
|
411
|
-
* Converts a file URL to a path string.
|
|
412
|
-
*
|
|
413
|
-
* ```ts
|
|
414
|
-
* import { fromFileUrl } from "https://deno.land/std@$STD_VERSION/path/posix.ts";
|
|
415
|
-
* fromFileUrl("file:///home/foo"); // "/home/foo"
|
|
416
|
-
* ```
|
|
417
|
-
* @param url of a file URL
|
|
418
|
-
*/
|
|
419
|
-
export function fromFileUrl(url) {
|
|
420
|
-
url = url instanceof URL ? url : new URL(url);
|
|
421
|
-
if (url.protocol != "file:") {
|
|
422
|
-
throw new TypeError("Must be a file URL.");
|
|
423
|
-
}
|
|
424
|
-
return decodeURIComponent(url.pathname.replace(/%(?![0-9A-Fa-f]{2})/g, "%25"));
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* Converts a path string to a file URL.
|
|
428
|
-
*
|
|
429
|
-
* ```ts
|
|
430
|
-
* import { toFileUrl } from "https://deno.land/std@$STD_VERSION/path/posix.ts";
|
|
431
|
-
* toFileUrl("/home/foo"); // new URL("file:///home/foo")
|
|
432
|
-
* ```
|
|
433
|
-
* @param path to convert to file URL
|
|
434
|
-
*/
|
|
435
|
-
export function toFileUrl(path) {
|
|
436
|
-
if (!isAbsolute(path)) {
|
|
437
|
-
throw new TypeError("Must be an absolute path.");
|
|
438
|
-
}
|
|
439
|
-
const url = new URL("file:///");
|
|
440
|
-
url.pathname = encodeWhitespace(path.replace(/%/g, "%25").replace(/\\/g, "%5C"));
|
|
441
|
-
return url;
|
|
442
|
-
}
|