Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGar <gar+gh@danger.computer>2021-06-02 20:48:28 +0300
committerGar <gar+gh@danger.computer>2021-06-02 20:59:51 +0300
commite92b5f2ba07746ae07646566f3dc73c9e004a2fc (patch)
tree1044dff07f30bd016a71ff0290ee52da1b836f2f /node_modules/path-parse
parent54de5c6a4cd593bbbe364132f3f7348586441b31 (diff)
make-fetch-happen@9.0.1/npm-registry-fetch@11.0.0
make-fetch-happen@9.0.1 * breaking: complete refactor of caching. cache will no longer grow endlessly with duplicate requests. cache will be used in cases where it should have been but wasn't before. it will cache multiple content-types of the same url. it will dedupe existing caches of their unused entries. * fix: support url-encoded proxy authorization * fix: do not lazy-load proxy agents or agentkeepalive. fixes the intermittent failures to update npm on slower connections. npm-registry-fetch@11.0.0 * breaking: drop handling of deprecated warning headers * docs: fix header type for npm-command * docs: update registry param * feat: improved logging of cache status
Diffstat (limited to 'node_modules/path-parse')
-rw-r--r--node_modules/path-parse/.travis.yml9
-rw-r--r--node_modules/path-parse/index.js52
-rw-r--r--node_modules/path-parse/package.json2
-rw-r--r--node_modules/path-parse/test.js77
4 files changed, 18 insertions, 122 deletions
diff --git a/node_modules/path-parse/.travis.yml b/node_modules/path-parse/.travis.yml
deleted file mode 100644
index dae31da96..000000000
--- a/node_modules/path-parse/.travis.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-language: node_js
-node_js:
- - "0.12"
- - "0.11"
- - "0.10"
- - "0.10.12"
- - "0.8"
- - "0.6"
- - "iojs"
diff --git a/node_modules/path-parse/index.js b/node_modules/path-parse/index.js
index 3b7601fe4..f062d0a23 100644
--- a/node_modules/path-parse/index.js
+++ b/node_modules/path-parse/index.js
@@ -2,29 +2,14 @@
var isWindows = process.platform === 'win32';
-// Regex to split a windows path into three parts: [*, device, slash,
-// tail] windows-only
-var splitDeviceRe =
- /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
-
-// Regex to split the tail part of the above into [*, dir, basename, ext]
-var splitTailRe =
- /^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/;
+// Regex to split a windows path into into [dir, root, basename, name, ext]
+var splitWindowsRe =
+ /^(((?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?[\\\/]?)(?:[^\\\/]*[\\\/])*)((\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))[\\\/]*$/;
var win32 = {};
-// Function to split a filename into [root, dir, basename, ext]
function win32SplitPath(filename) {
- // Separate device+slash from tail
- var result = splitDeviceRe.exec(filename),
- device = (result[1] || '') + (result[2] || ''),
- tail = result[3] || '';
- // Split the tail into dir, basename and extension
- var result2 = splitTailRe.exec(tail),
- dir = result2[1],
- basename = result2[2],
- ext = result2[3];
- return [device, dir, basename, ext];
+ return splitWindowsRe.exec(filename).slice(1);
}
win32.parse = function(pathString) {
@@ -34,24 +19,24 @@ win32.parse = function(pathString) {
);
}
var allParts = win32SplitPath(pathString);
- if (!allParts || allParts.length !== 4) {
+ if (!allParts || allParts.length !== 5) {
throw new TypeError("Invalid path '" + pathString + "'");
}
return {
- root: allParts[0],
- dir: allParts[0] + allParts[1].slice(0, -1),
+ root: allParts[1],
+ dir: allParts[0] === allParts[1] ? allParts[0] : allParts[0].slice(0, -1),
base: allParts[2],
- ext: allParts[3],
- name: allParts[2].slice(0, allParts[2].length - allParts[3].length)
+ ext: allParts[4],
+ name: allParts[3]
};
};
-// Split a filename into [root, dir, basename, ext], unix version
+// Split a filename into [dir, root, basename, name, ext], unix version
// 'root' is just a slash, or nothing.
var splitPathRe =
- /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
+ /^((\/?)(?:[^\/]*\/)*)((\.{1,2}|[^\/]+?|)(\.[^.\/]*|))[\/]*$/;
var posix = {};
@@ -67,19 +52,16 @@ posix.parse = function(pathString) {
);
}
var allParts = posixSplitPath(pathString);
- if (!allParts || allParts.length !== 4) {
+ if (!allParts || allParts.length !== 5) {
throw new TypeError("Invalid path '" + pathString + "'");
}
- allParts[1] = allParts[1] || '';
- allParts[2] = allParts[2] || '';
- allParts[3] = allParts[3] || '';
-
+
return {
- root: allParts[0],
- dir: allParts[0] + allParts[1].slice(0, -1),
+ root: allParts[1],
+ dir: allParts[0].slice(0, -1),
base: allParts[2],
- ext: allParts[3],
- name: allParts[2].slice(0, allParts[2].length - allParts[3].length)
+ ext: allParts[4],
+ name: allParts[3],
};
};
diff --git a/node_modules/path-parse/package.json b/node_modules/path-parse/package.json
index 21332bb14..36c23f84e 100644
--- a/node_modules/path-parse/package.json
+++ b/node_modules/path-parse/package.json
@@ -1,6 +1,6 @@
{
"name": "path-parse",
- "version": "1.0.6",
+ "version": "1.0.7",
"description": "Node.js path.parse() ponyfill",
"main": "index.js",
"scripts": {
diff --git a/node_modules/path-parse/test.js b/node_modules/path-parse/test.js
deleted file mode 100644
index 0b30c1239..000000000
--- a/node_modules/path-parse/test.js
+++ /dev/null
@@ -1,77 +0,0 @@
-var assert = require('assert');
-var pathParse = require('./index');
-
-var winParseTests = [
- [{ root: 'C:\\', dir: 'C:\\path\\dir', base: 'index.html', ext: '.html', name: 'index' }, 'C:\\path\\dir\\index.html'],
- [{ root: 'C:\\', dir: 'C:\\another_path\\DIR\\1\\2\\33', base: 'index', ext: '', name: 'index' }, 'C:\\another_path\\DIR\\1\\2\\33\\index'],
- [{ root: '', dir: 'another_path\\DIR with spaces\\1\\2\\33', base: 'index', ext: '', name: 'index' }, 'another_path\\DIR with spaces\\1\\2\\33\\index'],
- [{ root: '\\', dir: '\\foo', base: 'C:', ext: '', name: 'C:' }, '\\foo\\C:'],
- [{ root: '', dir: '', base: 'file', ext: '', name: 'file' }, 'file'],
- [{ root: '', dir: '.', base: 'file', ext: '', name: 'file' }, '.\\file'],
-
- // unc
- [{ root: '\\\\server\\share\\', dir: '\\\\server\\share\\', base: 'file_path', ext: '', name: 'file_path' }, '\\\\server\\share\\file_path'],
- [{ root: '\\\\server two\\shared folder\\', dir: '\\\\server two\\shared folder\\', base: 'file path.zip', ext: '.zip', name: 'file path' }, '\\\\server two\\shared folder\\file path.zip'],
- [{ root: '\\\\teela\\admin$\\', dir: '\\\\teela\\admin$\\', base: 'system32', ext: '', name: 'system32' }, '\\\\teela\\admin$\\system32'],
- [{ root: '\\\\?\\UNC\\', dir: '\\\\?\\UNC\\server', base: 'share', ext: '', name: 'share' }, '\\\\?\\UNC\\server\\share']
-];
-
-var winSpecialCaseFormatTests = [
- [{dir: 'some\\dir'}, 'some\\dir\\'],
- [{base: 'index.html'}, 'index.html'],
- [{}, '']
-];
-
-var unixParseTests = [
- [{ root: '/', dir: '/home/user/dir', base: 'file.txt', ext: '.txt', name: 'file' }, '/home/user/dir/file.txt'],
- [{ root: '/', dir: '/home/user/a dir', base: 'another File.zip', ext: '.zip', name: 'another File' }, '/home/user/a dir/another File.zip'],
- [{ root: '/', dir: '/home/user/a dir/', base: 'another&File.', ext: '.', name: 'another&File' }, '/home/user/a dir//another&File.'],
- [{ root: '/', dir: '/home/user/a$$$dir/', base: 'another File.zip', ext: '.zip', name: 'another File' }, '/home/user/a$$$dir//another File.zip'],
- [{ root: '', dir: 'user/dir', base: 'another File.zip', ext: '.zip', name: 'another File' }, 'user/dir/another File.zip'],
- [{ root: '', dir: '', base: 'file', ext: '', name: 'file' }, 'file'],
- [{ root: '', dir: '', base: '.\\file', ext: '', name: '.\\file' }, '.\\file'],
- [{ root: '', dir: '.', base: 'file', ext: '', name: 'file' }, './file'],
- [{ root: '', dir: '', base: 'C:\\foo', ext: '', name: 'C:\\foo' }, 'C:\\foo']
-];
-
-var unixSpecialCaseFormatTests = [
- [{dir: 'some/dir'}, 'some/dir/'],
- [{base: 'index.html'}, 'index.html'],
- [{}, '']
-];
-
-var errors = [
- {input: null, message: /Parameter 'pathString' must be a string, not/},
- {input: {}, message: /Parameter 'pathString' must be a string, not object/},
- {input: true, message: /Parameter 'pathString' must be a string, not boolean/},
- {input: 1, message: /Parameter 'pathString' must be a string, not number/},
- {input: undefined, message: /Parameter 'pathString' must be a string, not undefined/},
-];
-
-checkParseFormat(pathParse.win32, winParseTests);
-checkParseFormat(pathParse.posix, unixParseTests);
-checkErrors(pathParse.win32);
-checkErrors(pathParse.posix);
-
-function checkErrors(parse) {
- errors.forEach(function(errorCase) {
- try {
- parse(errorCase.input);
- } catch(err) {
- assert.ok(err instanceof TypeError);
- assert.ok(
- errorCase.message.test(err.message),
- 'expected ' + errorCase.message + ' to match ' + err.message
- );
- return;
- }
-
- assert.fail('should have thrown');
- });
-}
-
-function checkParseFormat(parse, testCases) {
- testCases.forEach(function(testCase) {
- assert.deepEqual(parse(testCase[1]), testCase[0]);
- });
-}