@scalar/json-magic 0.6.1 → 0.8.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 (67) hide show
  1. package/.turbo/turbo-build.log +4 -4
  2. package/CHANGELOG.md +26 -0
  3. package/dist/bundle/bundle.d.ts +1 -0
  4. package/dist/bundle/bundle.d.ts.map +1 -1
  5. package/dist/bundle/bundle.js +4 -4
  6. package/dist/bundle/bundle.js.map +2 -2
  7. package/dist/bundle/plugins/fetch-urls/index.d.ts.map +1 -1
  8. package/dist/bundle/plugins/fetch-urls/index.js +2 -1
  9. package/dist/bundle/plugins/fetch-urls/index.js.map +2 -2
  10. package/dist/bundle/plugins/parse-json/index.d.ts.map +1 -1
  11. package/dist/bundle/plugins/parse-json/index.js +7 -6
  12. package/dist/bundle/plugins/parse-json/index.js.map +2 -2
  13. package/dist/bundle/plugins/parse-yaml/index.d.ts.map +1 -1
  14. package/dist/bundle/plugins/parse-yaml/index.js +7 -6
  15. package/dist/bundle/plugins/parse-yaml/index.js.map +2 -2
  16. package/dist/bundle/plugins/read-files/index.d.ts.map +1 -1
  17. package/dist/bundle/plugins/read-files/index.js +2 -1
  18. package/dist/bundle/plugins/read-files/index.js.map +2 -2
  19. package/dist/bundle/value-generator.d.ts +6 -4
  20. package/dist/bundle/value-generator.d.ts.map +1 -1
  21. package/dist/bundle/value-generator.js +2 -5
  22. package/dist/bundle/value-generator.js.map +2 -2
  23. package/dist/diff/diff.d.ts.map +1 -1
  24. package/dist/diff/diff.js.map +2 -2
  25. package/dist/diff/utils.d.ts.map +1 -1
  26. package/dist/diff/utils.js.map +2 -2
  27. package/dist/helpers/generate-hash.d.ts +11 -0
  28. package/dist/helpers/generate-hash.d.ts.map +1 -0
  29. package/dist/helpers/generate-hash.js +16 -0
  30. package/dist/helpers/generate-hash.js.map +7 -0
  31. package/dist/magic-proxy/proxy.d.ts +1 -0
  32. package/dist/magic-proxy/proxy.d.ts.map +1 -1
  33. package/dist/magic-proxy/proxy.js +11 -1
  34. package/dist/magic-proxy/proxy.js.map +2 -2
  35. package/esbuild.ts +1 -0
  36. package/package.json +10 -4
  37. package/src/bundle/bundle.test.ts +293 -274
  38. package/src/bundle/bundle.ts +6 -5
  39. package/src/bundle/plugins/fetch-urls/index.test.ts +21 -24
  40. package/src/bundle/plugins/fetch-urls/index.ts +1 -0
  41. package/src/bundle/plugins/parse-json/index.test.ts +3 -1
  42. package/src/bundle/plugins/parse-json/index.ts +7 -6
  43. package/src/bundle/plugins/parse-yaml/index.test.ts +3 -1
  44. package/src/bundle/plugins/parse-yaml/index.ts +7 -6
  45. package/src/bundle/plugins/read-files/index.test.ts +4 -3
  46. package/src/bundle/plugins/read-files/index.ts +1 -0
  47. package/src/bundle/value-generator.test.ts +7 -8
  48. package/src/bundle/value-generator.ts +11 -15
  49. package/src/dereference/dereference.test.ts +10 -10
  50. package/src/diff/diff.ts +0 -1
  51. package/src/diff/utils.test.ts +2 -2
  52. package/src/diff/utils.ts +0 -2
  53. package/src/helpers/escape-json-pointer.test.ts +1 -1
  54. package/src/helpers/generate-hash.test.ts +74 -0
  55. package/src/helpers/generate-hash.ts +29 -0
  56. package/src/helpers/unescape-json-pointer.test.ts +1 -1
  57. package/src/magic-proxy/proxy.ts +14 -0
  58. package/dist/polyfills/index.d.ts +0 -2
  59. package/dist/polyfills/index.d.ts.map +0 -1
  60. package/dist/polyfills/index.js +0 -25
  61. package/dist/polyfills/index.js.map +0 -7
  62. package/dist/polyfills/path.d.ts +0 -24
  63. package/dist/polyfills/path.d.ts.map +0 -1
  64. package/dist/polyfills/path.js +0 -174
  65. package/dist/polyfills/path.js.map +0 -7
  66. package/src/polyfills/index.ts +0 -12
  67. package/src/polyfills/path.ts +0 -248
@@ -1,24 +0,0 @@
1
- export declare function resolve(...parameters: any[]): string;
2
- export declare function normalize(path: any): string;
3
- export declare function isAbsolute(path: any): boolean;
4
- export declare function join(...paths: string[]): string;
5
- export declare function relative(from: any, to: any): string;
6
- export declare const sep = "/";
7
- export declare const delimiter = ":";
8
- export declare function dirname(path: any): string;
9
- export declare function basename(path: any, ext: any): string;
10
- export declare function extname(path: any): string;
11
- declare const _default: {
12
- extname: typeof extname;
13
- basename: typeof basename;
14
- dirname: typeof dirname;
15
- sep: string;
16
- delimiter: string;
17
- relative: typeof relative;
18
- join: typeof join;
19
- isAbsolute: typeof isAbsolute;
20
- normalize: typeof normalize;
21
- resolve: typeof resolve;
22
- };
23
- export default _default;
24
- //# sourceMappingURL=path.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../src/polyfills/path.ts"],"names":[],"mappings":"AA4DA,wBAAgB,OAAO,CAAC,GAAG,UAAU,OAAA,UA6BpC;AAID,wBAAgB,SAAS,CAAC,IAAI,KAAA,UAkB7B;AAGD,wBAAgB,UAAU,CAAC,IAAI,KAAA,WAE9B;AAGD,wBAAgB,IAAI,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,UAStC;AAID,wBAAgB,QAAQ,CAAC,IAAI,KAAA,EAAE,EAAE,KAAA,UA6ChC;AAED,eAAO,MAAM,GAAG,MAAM,CAAA;AACtB,eAAO,MAAM,SAAS,MAAM,CAAA;AAE5B,wBAAgB,OAAO,CAAC,IAAI,KAAA,UAiB3B;AAED,wBAAgB,QAAQ,CAAC,IAAI,KAAA,EAAE,GAAG,KAAA,UAOjC;AAED,wBAAgB,OAAO,CAAC,IAAI,KAAA,UAE3B;;;;;;;;;;;;;AACD,wBAWC"}
@@ -1,174 +0,0 @@
1
- function normalizeArray(parts, allowAboveRoot) {
2
- let up = 0;
3
- for (let i = parts.length - 1; i >= 0; i--) {
4
- const last = parts[i];
5
- if (last === ".") {
6
- parts.splice(i, 1);
7
- } else if (last === "..") {
8
- parts.splice(i, 1);
9
- up++;
10
- } else if (up) {
11
- parts.splice(i, 1);
12
- up--;
13
- }
14
- }
15
- if (allowAboveRoot) {
16
- for (; up--; up) {
17
- parts.unshift("..");
18
- }
19
- }
20
- return parts;
21
- }
22
- const splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^/]+?|)(\.[^./]*|))(?:[/]*)$/;
23
- const splitPath = (filename) => splitPathRe.exec(filename).slice(1);
24
- function resolve(...parameters) {
25
- let resolvedPath = "", resolvedAbsolute = false;
26
- for (let i = parameters.length - 1; i >= -1 && !resolvedAbsolute; i--) {
27
- const path = i >= 0 ? parameters[i] : "/";
28
- if (typeof path !== "string") {
29
- throw new TypeError("Arguments to path.resolve must be strings");
30
- }
31
- if (!path) {
32
- continue;
33
- }
34
- resolvedPath = path + "/" + resolvedPath;
35
- resolvedAbsolute = path.charAt(0) === "/";
36
- }
37
- resolvedPath = normalizeArray(
38
- filter(resolvedPath.split("/"), (p) => !!p),
39
- !resolvedAbsolute
40
- ).join("/");
41
- return (resolvedAbsolute ? "/" : "") + resolvedPath || ".";
42
- }
43
- function normalize(path) {
44
- const isPathAbsolute = isAbsolute(path), trailingSlash = substr(path, -1) === "/";
45
- path = normalizeArray(
46
- filter(path.split("/"), (p) => !!p),
47
- !isPathAbsolute
48
- ).join("/");
49
- if (!path && !isPathAbsolute) {
50
- path = ".";
51
- }
52
- if (path && trailingSlash) {
53
- path += "/";
54
- }
55
- return (isPathAbsolute ? "/" : "") + path;
56
- }
57
- function isAbsolute(path) {
58
- return path.charAt(0) === "/";
59
- }
60
- function join(...paths) {
61
- return normalize(
62
- filter(paths, (p, _index) => {
63
- if (typeof p !== "string") {
64
- throw new TypeError("Arguments to path.join must be strings");
65
- }
66
- return p;
67
- }).join("/")
68
- );
69
- }
70
- function relative(from, to) {
71
- from = resolve(from).substr(1);
72
- to = resolve(to).substr(1);
73
- function trim(arr) {
74
- let start = 0;
75
- for (; start < arr.length; start++) {
76
- if (arr[start] !== "") {
77
- break;
78
- }
79
- }
80
- let end = arr.length - 1;
81
- for (; end >= 0; end--) {
82
- if (arr[end] !== "") {
83
- break;
84
- }
85
- }
86
- if (start > end) {
87
- return [];
88
- }
89
- return arr.slice(start, end - start + 1);
90
- }
91
- const fromParts = trim(from.split("/"));
92
- const toParts = trim(to.split("/"));
93
- const length = Math.min(fromParts.length, toParts.length);
94
- let samePartsLength = length;
95
- for (let i = 0; i < length; i++) {
96
- if (fromParts[i] !== toParts[i]) {
97
- samePartsLength = i;
98
- break;
99
- }
100
- }
101
- let outputParts = [];
102
- for (let i = samePartsLength; i < fromParts.length; i++) {
103
- outputParts.push("..");
104
- }
105
- outputParts = outputParts.concat(toParts.slice(samePartsLength));
106
- return outputParts.join("/");
107
- }
108
- const sep = "/";
109
- const delimiter = ":";
110
- function dirname(path) {
111
- const result = splitPath(path), root = result[0];
112
- let dir = result[1];
113
- if (!root && !dir) {
114
- return ".";
115
- }
116
- if (dir) {
117
- dir = dir.substr(0, dir.length - 1);
118
- }
119
- return root + dir;
120
- }
121
- function basename(path, ext) {
122
- let f = splitPath(path)[2];
123
- if (ext && f.substr(-1 * ext.length) === ext) {
124
- f = f.substr(0, f.length - ext.length);
125
- }
126
- return f;
127
- }
128
- function extname(path) {
129
- return splitPath(path)[3];
130
- }
131
- var path_default = {
132
- extname,
133
- basename,
134
- dirname,
135
- sep,
136
- delimiter,
137
- relative,
138
- join,
139
- isAbsolute,
140
- normalize,
141
- resolve
142
- };
143
- function filter(xs, f) {
144
- if (xs.filter) {
145
- return xs.filter(f);
146
- }
147
- const res = [];
148
- for (let i = 0; i < xs.length; i++) {
149
- if (f(xs[i], i, xs)) {
150
- res.push(xs[i]);
151
- }
152
- }
153
- return res;
154
- }
155
- const substr = "ab".substr(-1) === "b" ? (str, start, len) => str.substr(start, len) : (str, start, len) => {
156
- if (start < 0) {
157
- start = str.length + start;
158
- }
159
- return str.substr(start, len);
160
- };
161
- export {
162
- basename,
163
- path_default as default,
164
- delimiter,
165
- dirname,
166
- extname,
167
- isAbsolute,
168
- join,
169
- normalize,
170
- relative,
171
- resolve,
172
- sep
173
- };
174
- //# sourceMappingURL=path.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/polyfills/path.ts"],
4
- "sourcesContent": ["// @ts-nocheck\n\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// resolves . and .. elements in a path array with directory names there\n// must be no slashes, empty elements, or device names (c:\\) in the array\n// (so also no leading and trailing slashes - it does not distinguish\n// relative and absolute paths)\nfunction normalizeArray(parts, allowAboveRoot) {\n // if the path tries to go above the root, `up` ends up > 0\n let up = 0\n for (let i = parts.length - 1; i >= 0; i--) {\n const last = parts[i]\n if (last === '.') {\n parts.splice(i, 1)\n } else if (last === '..') {\n parts.splice(i, 1)\n up++\n } else if (up) {\n parts.splice(i, 1)\n up--\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (allowAboveRoot) {\n for (; up--; up) {\n parts.unshift('..')\n }\n }\n\n return parts\n}\n\n// Split a filename into [root, dir, basename, ext], unix version\n// 'root' is just a slash, or nothing.\nconst splitPathRe = /^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^/]+?|)(\\.[^./]*|))(?:[/]*)$/\nconst splitPath = (filename) => splitPathRe.exec(filename).slice(1)\n\n// path.resolve([from ...], to)\n// posix version\nexport function resolve(...parameters) {\n let resolvedPath = '',\n resolvedAbsolute = false\n\n for (let i = parameters.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n const path = i >= 0 ? parameters[i] : '/'\n\n // Skip empty and invalid entries\n if (typeof path !== 'string') {\n throw new TypeError('Arguments to path.resolve must be strings')\n }\n if (!path) {\n continue\n }\n\n resolvedPath = path + '/' + resolvedPath\n resolvedAbsolute = path.charAt(0) === '/'\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeArray(\n filter(resolvedPath.split('/'), (p) => !!p),\n !resolvedAbsolute,\n ).join('/')\n\n return (resolvedAbsolute ? '/' : '') + resolvedPath || '.'\n}\n\n// path.normalize(path)\n// posix version\nexport function normalize(path) {\n const isPathAbsolute = isAbsolute(path),\n trailingSlash = substr(path, -1) === '/'\n\n // Normalize the path\n path = normalizeArray(\n filter(path.split('/'), (p) => !!p),\n !isPathAbsolute,\n ).join('/')\n\n if (!path && !isPathAbsolute) {\n path = '.'\n }\n if (path && trailingSlash) {\n path += '/'\n }\n\n return (isPathAbsolute ? '/' : '') + path\n}\n\n// posix version\nexport function isAbsolute(path) {\n return path.charAt(0) === '/'\n}\n\n// posix version\nexport function join(...paths: string[]) {\n return normalize(\n filter(paths, (p, _index) => {\n if (typeof p !== 'string') {\n throw new TypeError('Arguments to path.join must be strings')\n }\n return p\n }).join('/'),\n )\n}\n\n// path.relative(from, to)\n// posix version\nexport function relative(from, to) {\n from = resolve(from).substr(1)\n to = resolve(to).substr(1)\n\n function trim(arr) {\n let start = 0\n for (; start < arr.length; start++) {\n if (arr[start] !== '') {\n break\n }\n }\n\n let end = arr.length - 1\n for (; end >= 0; end--) {\n if (arr[end] !== '') {\n break\n }\n }\n\n if (start > end) {\n return []\n }\n return arr.slice(start, end - start + 1)\n }\n\n const fromParts = trim(from.split('/'))\n const toParts = trim(to.split('/'))\n\n const length = Math.min(fromParts.length, toParts.length)\n let samePartsLength = length\n for (let i = 0; i < length; i++) {\n if (fromParts[i] !== toParts[i]) {\n samePartsLength = i\n break\n }\n }\n\n let outputParts = []\n for (let i = samePartsLength; i < fromParts.length; i++) {\n outputParts.push('..')\n }\n\n outputParts = outputParts.concat(toParts.slice(samePartsLength))\n\n return outputParts.join('/')\n}\n\nexport const sep = '/'\nexport const delimiter = ':'\n\nexport function dirname(path) {\n const result = splitPath(path),\n root = result[0]\n\n let dir = result[1]\n\n if (!root && !dir) {\n // No dirname whatsoever\n return '.'\n }\n\n if (dir) {\n // It has a dirname, strip trailing slash\n dir = dir.substr(0, dir.length - 1)\n }\n\n return root + dir\n}\n\nexport function basename(path, ext) {\n let f = splitPath(path)[2]\n // TODO: make this comparison case-insensitive on windows?\n if (ext && f.substr(-1 * ext.length) === ext) {\n f = f.substr(0, f.length - ext.length)\n }\n return f\n}\n\nexport function extname(path) {\n return splitPath(path)[3]\n}\nexport default {\n extname: extname,\n basename: basename,\n dirname: dirname,\n sep: sep,\n delimiter: delimiter,\n relative: relative,\n join: join,\n isAbsolute: isAbsolute,\n normalize: normalize,\n resolve: resolve,\n}\nfunction filter(xs, f) {\n if (xs.filter) {\n return xs.filter(f)\n }\n const res = []\n for (let i = 0; i < xs.length; i++) {\n if (f(xs[i], i, xs)) {\n res.push(xs[i])\n }\n }\n return res\n}\n\n// String.prototype.substr - negative index don't work in IE8\nconst substr =\n 'ab'.substr(-1) === 'b'\n ? (str, start, len) => str.substr(start, len)\n : (str, start, len) => {\n if (start < 0) {\n start = str.length + start\n }\n return str.substr(start, len)\n }\n"],
5
- "mappings": "AA2BA,SAAS,eAAe,OAAO,gBAAgB;AAE7C,MAAI,KAAK;AACT,WAAS,IAAI,MAAM,SAAS,GAAG,KAAK,GAAG,KAAK;AAC1C,UAAM,OAA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MAAM,MAChB,CAAC,KAAK,OAAO,QAAQ,IAAI,OAAO,OAAO,GAAG,IAC1C,CAAC,KAAK,OAAO,QAAQ;AACnB,MAAI,QAAQ,GAAG;AACb,YAAQ,IAAI,SAAS;AAAA,EACvB;AACA,SAAO,IAAI,OAAO,OAAO,GAAG;AAC9B;",
6
- "names": []
7
- }
@@ -1,12 +0,0 @@
1
- export {
2
- resolve,
3
- normalize,
4
- isAbsolute,
5
- join,
6
- relative,
7
- sep,
8
- delimiter,
9
- dirname,
10
- basename,
11
- extname,
12
- } from './path'
@@ -1,248 +0,0 @@
1
- // @ts-nocheck
2
-
3
- // Copyright Joyent, Inc. and other Node contributors.
4
- //
5
- // Permission is hereby granted, free of charge, to any person obtaining a
6
- // copy of this software and associated documentation files (the
7
- // "Software"), to deal in the Software without restriction, including
8
- // without limitation the rights to use, copy, modify, merge, publish,
9
- // distribute, sublicense, and/or sell copies of the Software, and to permit
10
- // persons to whom the Software is furnished to do so, subject to the
11
- // following conditions:
12
- //
13
- // The above copyright notice and this permission notice shall be included
14
- // in all copies or substantial portions of the Software.
15
- //
16
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
19
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
22
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
23
-
24
- // resolves . and .. elements in a path array with directory names there
25
- // must be no slashes, empty elements, or device names (c:\) in the array
26
- // (so also no leading and trailing slashes - it does not distinguish
27
- // relative and absolute paths)
28
- function normalizeArray(parts, allowAboveRoot) {
29
- // if the path tries to go above the root, `up` ends up > 0
30
- let up = 0
31
- for (let i = parts.length - 1; i >= 0; i--) {
32
- const last = parts[i]
33
- if (last === '.') {
34
- parts.splice(i, 1)
35
- } else if (last === '..') {
36
- parts.splice(i, 1)
37
- up++
38
- } else if (up) {
39
- parts.splice(i, 1)
40
- up--
41
- }
42
- }
43
-
44
- // if the path is allowed to go above the root, restore leading ..s
45
- if (allowAboveRoot) {
46
- for (; up--; up) {
47
- parts.unshift('..')
48
- }
49
- }
50
-
51
- return parts
52
- }
53
-
54
- // Split a filename into [root, dir, basename, ext], unix version
55
- // 'root' is just a slash, or nothing.
56
- const splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^/]+?|)(\.[^./]*|))(?:[/]*)$/
57
- const splitPath = (filename) => splitPathRe.exec(filename).slice(1)
58
-
59
- // path.resolve([from ...], to)
60
- // posix version
61
- export function resolve(...parameters) {
62
- let resolvedPath = '',
63
- resolvedAbsolute = false
64
-
65
- for (let i = parameters.length - 1; i >= -1 && !resolvedAbsolute; i--) {
66
- const path = i >= 0 ? parameters[i] : '/'
67
-
68
- // Skip empty and invalid entries
69
- if (typeof path !== 'string') {
70
- throw new TypeError('Arguments to path.resolve must be strings')
71
- }
72
- if (!path) {
73
- continue
74
- }
75
-
76
- resolvedPath = path + '/' + resolvedPath
77
- resolvedAbsolute = path.charAt(0) === '/'
78
- }
79
-
80
- // At this point the path should be resolved to a full absolute path, but
81
- // handle relative paths to be safe (might happen when process.cwd() fails)
82
-
83
- // Normalize the path
84
- resolvedPath = normalizeArray(
85
- filter(resolvedPath.split('/'), (p) => !!p),
86
- !resolvedAbsolute,
87
- ).join('/')
88
-
89
- return (resolvedAbsolute ? '/' : '') + resolvedPath || '.'
90
- }
91
-
92
- // path.normalize(path)
93
- // posix version
94
- export function normalize(path) {
95
- const isPathAbsolute = isAbsolute(path),
96
- trailingSlash = substr(path, -1) === '/'
97
-
98
- // Normalize the path
99
- path = normalizeArray(
100
- filter(path.split('/'), (p) => !!p),
101
- !isPathAbsolute,
102
- ).join('/')
103
-
104
- if (!path && !isPathAbsolute) {
105
- path = '.'
106
- }
107
- if (path && trailingSlash) {
108
- path += '/'
109
- }
110
-
111
- return (isPathAbsolute ? '/' : '') + path
112
- }
113
-
114
- // posix version
115
- export function isAbsolute(path) {
116
- return path.charAt(0) === '/'
117
- }
118
-
119
- // posix version
120
- export function join(...paths: string[]) {
121
- return normalize(
122
- filter(paths, (p, _index) => {
123
- if (typeof p !== 'string') {
124
- throw new TypeError('Arguments to path.join must be strings')
125
- }
126
- return p
127
- }).join('/'),
128
- )
129
- }
130
-
131
- // path.relative(from, to)
132
- // posix version
133
- export function relative(from, to) {
134
- from = resolve(from).substr(1)
135
- to = resolve(to).substr(1)
136
-
137
- function trim(arr) {
138
- let start = 0
139
- for (; start < arr.length; start++) {
140
- if (arr[start] !== '') {
141
- break
142
- }
143
- }
144
-
145
- let end = arr.length - 1
146
- for (; end >= 0; end--) {
147
- if (arr[end] !== '') {
148
- break
149
- }
150
- }
151
-
152
- if (start > end) {
153
- return []
154
- }
155
- return arr.slice(start, end - start + 1)
156
- }
157
-
158
- const fromParts = trim(from.split('/'))
159
- const toParts = trim(to.split('/'))
160
-
161
- const length = Math.min(fromParts.length, toParts.length)
162
- let samePartsLength = length
163
- for (let i = 0; i < length; i++) {
164
- if (fromParts[i] !== toParts[i]) {
165
- samePartsLength = i
166
- break
167
- }
168
- }
169
-
170
- let outputParts = []
171
- for (let i = samePartsLength; i < fromParts.length; i++) {
172
- outputParts.push('..')
173
- }
174
-
175
- outputParts = outputParts.concat(toParts.slice(samePartsLength))
176
-
177
- return outputParts.join('/')
178
- }
179
-
180
- export const sep = '/'
181
- export const delimiter = ':'
182
-
183
- export function dirname(path) {
184
- const result = splitPath(path),
185
- root = result[0]
186
-
187
- let dir = result[1]
188
-
189
- if (!root && !dir) {
190
- // No dirname whatsoever
191
- return '.'
192
- }
193
-
194
- if (dir) {
195
- // It has a dirname, strip trailing slash
196
- dir = dir.substr(0, dir.length - 1)
197
- }
198
-
199
- return root + dir
200
- }
201
-
202
- export function basename(path, ext) {
203
- let f = splitPath(path)[2]
204
- // TODO: make this comparison case-insensitive on windows?
205
- if (ext && f.substr(-1 * ext.length) === ext) {
206
- f = f.substr(0, f.length - ext.length)
207
- }
208
- return f
209
- }
210
-
211
- export function extname(path) {
212
- return splitPath(path)[3]
213
- }
214
- export default {
215
- extname: extname,
216
- basename: basename,
217
- dirname: dirname,
218
- sep: sep,
219
- delimiter: delimiter,
220
- relative: relative,
221
- join: join,
222
- isAbsolute: isAbsolute,
223
- normalize: normalize,
224
- resolve: resolve,
225
- }
226
- function filter(xs, f) {
227
- if (xs.filter) {
228
- return xs.filter(f)
229
- }
230
- const res = []
231
- for (let i = 0; i < xs.length; i++) {
232
- if (f(xs[i], i, xs)) {
233
- res.push(xs[i])
234
- }
235
- }
236
- return res
237
- }
238
-
239
- // String.prototype.substr - negative index don't work in IE8
240
- const substr =
241
- 'ab'.substr(-1) === 'b'
242
- ? (str, start, len) => str.substr(start, len)
243
- : (str, start, len) => {
244
- if (start < 0) {
245
- start = str.length + start
246
- }
247
- return str.substr(start, len)
248
- }