@netlify/edge-bundler 8.7.0 → 8.8.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.
- package/deno/lib/common.ts +3 -3
- package/deno/lib/stage2.ts +2 -2
- package/deno/vendor/deno.land/std@0.178.0/_util/asserts.ts +25 -0
- package/deno/vendor/deno.land/{std@0.127.0 → std@0.178.0}/_util/os.ts +4 -3
- package/deno/vendor/deno.land/{std@0.127.0 → std@0.178.0}/path/_constants.ts +1 -1
- package/deno/vendor/deno.land/{std@0.127.0 → std@0.178.0}/path/_interface.ts +1 -1
- package/deno/vendor/deno.land/{std@0.127.0 → std@0.178.0}/path/_util.ts +63 -2
- package/deno/vendor/deno.land/{std@0.127.0 → std@0.178.0}/path/common.ts +1 -1
- package/deno/vendor/deno.land/{std@0.127.0 → std@0.178.0}/path/glob.ts +10 -5
- package/deno/vendor/deno.land/{std@0.127.0 → std@0.178.0}/path/mod.ts +20 -2
- package/deno/vendor/deno.land/{std@0.127.0 → std@0.178.0}/path/posix.ts +76 -105
- package/deno/vendor/deno.land/{std@0.127.0 → std@0.178.0}/path/separator.ts +1 -1
- package/deno/vendor/deno.land/{std@0.127.0 → std@0.178.0}/path/win32.ts +36 -82
- package/deno/vendor/deno.land/x/{eszip@v0.28.0 → eszip@v0.37.0}/eszip_wasm.generated.js +350 -114
- package/deno/vendor/deno.land/x/eszip@v0.37.0/eszip_wasm_bg.wasm +0 -0
- package/deno/vendor/deno.land/x/{eszip@v0.28.0 → eszip@v0.37.0}/loader.ts +1 -1
- package/deno/vendor/deno.land/x/{eszip@v0.28.0 → eszip@v0.37.0}/mod.ts +4 -2
- package/dist/node/formats/javascript.js +1 -1
- package/dist/test/util.js +1 -1
- package/package.json +1 -1
- package/deno/vendor/deno.land/std@0.127.0/_util/assert.ts +0 -15
- package/deno/vendor/deno.land/x/eszip@v0.28.0/eszip_wasm_bg.wasm +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright 2018-
|
|
1
|
+
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
2
2
|
// Copyright the Browserify authors. MIT License.
|
|
3
3
|
// Ported from https://github.com/browserify/path-browserify/
|
|
4
4
|
// This module is browser compatible.
|
|
@@ -16,10 +16,14 @@ import {
|
|
|
16
16
|
assertPath,
|
|
17
17
|
encodeWhitespace,
|
|
18
18
|
isPathSeparator,
|
|
19
|
+
isPosixPathSeparator,
|
|
19
20
|
isWindowsDeviceRoot,
|
|
21
|
+
lastPathSegment,
|
|
20
22
|
normalizeString,
|
|
23
|
+
stripSuffix,
|
|
24
|
+
stripTrailingSeparators,
|
|
21
25
|
} from "./_util.ts";
|
|
22
|
-
import { assert } from "../_util/
|
|
26
|
+
import { assert } from "../_util/asserts.ts";
|
|
23
27
|
|
|
24
28
|
export const sep = "\\";
|
|
25
29
|
export const delimiter = ";";
|
|
@@ -535,8 +539,8 @@ export function toNamespacedPath(path: string): string {
|
|
|
535
539
|
}
|
|
536
540
|
|
|
537
541
|
/**
|
|
538
|
-
* Return the directory
|
|
539
|
-
* @param path to
|
|
542
|
+
* Return the directory path of a `path`.
|
|
543
|
+
* @param path - path to extract the directory from.
|
|
540
544
|
*/
|
|
541
545
|
export function dirname(path: string): string {
|
|
542
546
|
assertPath(path);
|
|
@@ -623,29 +627,31 @@ export function dirname(path: string): string {
|
|
|
623
627
|
if (rootEnd === -1) return ".";
|
|
624
628
|
else end = rootEnd;
|
|
625
629
|
}
|
|
626
|
-
return path.slice(0, end);
|
|
630
|
+
return stripTrailingSeparators(path.slice(0, end), isPosixPathSeparator);
|
|
627
631
|
}
|
|
628
632
|
|
|
629
633
|
/**
|
|
630
|
-
* Return the last portion of a `path`.
|
|
631
|
-
*
|
|
632
|
-
*
|
|
634
|
+
* Return the last portion of a `path`.
|
|
635
|
+
* Trailing directory separators are ignored, and optional suffix is removed.
|
|
636
|
+
*
|
|
637
|
+
* @param path - path to extract name from.
|
|
638
|
+
* @param [suffix] - suffix to remove from extracted name.
|
|
633
639
|
*/
|
|
634
|
-
export function basename(path: string,
|
|
635
|
-
if (ext !== undefined && typeof ext !== "string") {
|
|
636
|
-
throw new TypeError('"ext" argument must be a string');
|
|
637
|
-
}
|
|
638
|
-
|
|
640
|
+
export function basename(path: string, suffix = ""): string {
|
|
639
641
|
assertPath(path);
|
|
640
642
|
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
643
|
+
if (path.length === 0) return path;
|
|
644
|
+
|
|
645
|
+
if (typeof suffix !== "string") {
|
|
646
|
+
throw new TypeError(
|
|
647
|
+
`Suffix must be a string. Received ${JSON.stringify(suffix)}`,
|
|
648
|
+
);
|
|
649
|
+
}
|
|
645
650
|
|
|
646
651
|
// Check for a drive letter prefix so as not to mistake the following
|
|
647
652
|
// path separator as an extra separator at the end of the path that can be
|
|
648
653
|
// disregarded
|
|
654
|
+
let start = 0;
|
|
649
655
|
if (path.length >= 2) {
|
|
650
656
|
const drive = path.charCodeAt(0);
|
|
651
657
|
if (isWindowsDeviceRoot(drive)) {
|
|
@@ -653,72 +659,15 @@ export function basename(path: string, ext = ""): string {
|
|
|
653
659
|
}
|
|
654
660
|
}
|
|
655
661
|
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
let firstNonSlashEnd = -1;
|
|
660
|
-
for (i = path.length - 1; i >= start; --i) {
|
|
661
|
-
const code = path.charCodeAt(i);
|
|
662
|
-
if (isPathSeparator(code)) {
|
|
663
|
-
// If we reached a path separator that was not part of a set of path
|
|
664
|
-
// separators at the end of the string, stop now
|
|
665
|
-
if (!matchedSlash) {
|
|
666
|
-
start = i + 1;
|
|
667
|
-
break;
|
|
668
|
-
}
|
|
669
|
-
} else {
|
|
670
|
-
if (firstNonSlashEnd === -1) {
|
|
671
|
-
// We saw the first non-path separator, remember this index in case
|
|
672
|
-
// we need it if the extension ends up not matching
|
|
673
|
-
matchedSlash = false;
|
|
674
|
-
firstNonSlashEnd = i + 1;
|
|
675
|
-
}
|
|
676
|
-
if (extIdx >= 0) {
|
|
677
|
-
// Try to match the explicit extension
|
|
678
|
-
if (code === ext.charCodeAt(extIdx)) {
|
|
679
|
-
if (--extIdx === -1) {
|
|
680
|
-
// We matched the extension, so mark this as the end of our path
|
|
681
|
-
// component
|
|
682
|
-
end = i;
|
|
683
|
-
}
|
|
684
|
-
} else {
|
|
685
|
-
// Extension does not match, so our result is the entire path
|
|
686
|
-
// component
|
|
687
|
-
extIdx = -1;
|
|
688
|
-
end = firstNonSlashEnd;
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
if (start === end) end = firstNonSlashEnd;
|
|
695
|
-
else if (end === -1) end = path.length;
|
|
696
|
-
return path.slice(start, end);
|
|
697
|
-
} else {
|
|
698
|
-
for (i = path.length - 1; i >= start; --i) {
|
|
699
|
-
if (isPathSeparator(path.charCodeAt(i))) {
|
|
700
|
-
// If we reached a path separator that was not part of a set of path
|
|
701
|
-
// separators at the end of the string, stop now
|
|
702
|
-
if (!matchedSlash) {
|
|
703
|
-
start = i + 1;
|
|
704
|
-
break;
|
|
705
|
-
}
|
|
706
|
-
} else if (end === -1) {
|
|
707
|
-
// We saw the first non-path separator, mark this as the end of our
|
|
708
|
-
// path component
|
|
709
|
-
matchedSlash = false;
|
|
710
|
-
end = i + 1;
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
if (end === -1) return "";
|
|
715
|
-
return path.slice(start, end);
|
|
716
|
-
}
|
|
662
|
+
const lastSegment = lastPathSegment(path, isPathSeparator, start);
|
|
663
|
+
const strippedSegment = stripTrailingSeparators(lastSegment, isPathSeparator);
|
|
664
|
+
return suffix ? stripSuffix(strippedSegment, suffix) : strippedSegment;
|
|
717
665
|
}
|
|
718
666
|
|
|
719
667
|
/**
|
|
720
|
-
* Return the extension of the `path
|
|
668
|
+
* Return the extension of the `path` with leading period.
|
|
721
669
|
* @param path with extension
|
|
670
|
+
* @returns extension (ex. for `file.ts` returns `.ts`)
|
|
722
671
|
*/
|
|
723
672
|
export function extname(path: string): string {
|
|
724
673
|
assertPath(path);
|
|
@@ -863,12 +812,13 @@ export function parse(path: string): ParsedPath {
|
|
|
863
812
|
// `path` contains just a drive root, exit early to avoid
|
|
864
813
|
// unnecessary work
|
|
865
814
|
ret.root = ret.dir = path;
|
|
815
|
+
ret.base = "\\";
|
|
866
816
|
return ret;
|
|
867
817
|
}
|
|
868
818
|
rootEnd = 3;
|
|
869
819
|
}
|
|
870
820
|
} else {
|
|
871
|
-
// `path` contains just a drive root, exit early to avoid
|
|
821
|
+
// `path` contains just a relative drive root, exit early to avoid
|
|
872
822
|
// unnecessary work
|
|
873
823
|
ret.root = ret.dir = path;
|
|
874
824
|
return ret;
|
|
@@ -879,6 +829,7 @@ export function parse(path: string): ParsedPath {
|
|
|
879
829
|
// `path` contains just a path separator, exit early to avoid
|
|
880
830
|
// unnecessary work
|
|
881
831
|
ret.root = ret.dir = path;
|
|
832
|
+
ret.base = "\\";
|
|
882
833
|
return ret;
|
|
883
834
|
}
|
|
884
835
|
|
|
@@ -940,6 +891,9 @@ export function parse(path: string): ParsedPath {
|
|
|
940
891
|
ret.ext = path.slice(startDot, end);
|
|
941
892
|
}
|
|
942
893
|
|
|
894
|
+
// Fallback to '\' in case there is no basename
|
|
895
|
+
ret.base = ret.base || "\\";
|
|
896
|
+
|
|
943
897
|
// If the directory is the root, use the entire root as the `dir` including
|
|
944
898
|
// the trailing slash if any (`C:\abc` -> `C:\`). Otherwise, strip out the
|
|
945
899
|
// trailing slash (`C:\abc\def` -> `C:\abc`).
|
|
@@ -954,7 +908,7 @@ export function parse(path: string): ParsedPath {
|
|
|
954
908
|
* Converts a file URL to a path string.
|
|
955
909
|
*
|
|
956
910
|
* ```ts
|
|
957
|
-
* import { fromFileUrl } from "
|
|
911
|
+
* import { fromFileUrl } from "https://deno.land/std@$STD_VERSION/path/win32.ts";
|
|
958
912
|
* fromFileUrl("file:///home/foo"); // "\\home\\foo"
|
|
959
913
|
* fromFileUrl("file:///C:/Users/foo"); // "C:\\Users\\foo"
|
|
960
914
|
* fromFileUrl("file://localhost/home/foo"); // "\\\\localhost\\home\\foo"
|
|
@@ -982,7 +936,7 @@ export function fromFileUrl(url: string | URL): string {
|
|
|
982
936
|
* Converts a path string to a file URL.
|
|
983
937
|
*
|
|
984
938
|
* ```ts
|
|
985
|
-
* import { toFileUrl } from "
|
|
939
|
+
* import { toFileUrl } from "https://deno.land/std@$STD_VERSION/path/win32.ts";
|
|
986
940
|
* toFileUrl("\\home\\foo"); // new URL("file:///home/foo")
|
|
987
941
|
* toFileUrl("C:\\Users\\foo"); // new URL("file:///C:/Users/foo")
|
|
988
942
|
* toFileUrl("\\\\127.0.0.1\\home\\foo"); // new URL("file://127.0.0.1/home/foo")
|