Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 85c85d3

Browse filesBrowse files
ExE-Bosscodebytere
authored andcommitted
path: add path/posix and path/win32 alias modules
Refs: #31553 Refs: #32953 Refs: #33950 Refs: #34001 Refs: #34002 Refs: #34055 PR-URL: #34962 Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
1 parent 3dd0637 commit 85c85d3
Copy full SHA for 85c85d3

File tree

Expand file treeCollapse file tree

8 files changed

+44
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

8 files changed

+44
-0
lines changed
Open diff view settings
Collapse file

‎doc/api/path.md‎

Copy file name to clipboardExpand all lines: doc/api/path.md
+12Lines changed: 12 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -434,13 +434,19 @@ A [`TypeError`][] is thrown if `path` is not a string.
434434
## `path.posix`
435435
<!-- YAML
436436
added: v0.11.15
437+
changes:
438+
- version: REPLACEME
439+
pr-url: https://github.com/nodejs/node/pull/34962
440+
description: Exposed as `require('path/posix')`.
437441
-->
438442

439443
* {Object}
440444

441445
The `path.posix` property provides access to POSIX specific implementations
442446
of the `path` methods.
443447

448+
The API is accessible via `require('path').posix` or `require('path/posix')`.
449+
444450
## `path.relative(from, to)`
445451
<!-- YAML
446452
added: v0.5.0
@@ -568,13 +574,19 @@ method is non-operational and always returns `path` without modifications.
568574
## `path.win32`
569575
<!-- YAML
570576
added: v0.11.15
577+
changes:
578+
- version: REPLACEME
579+
pr-url: https://github.com/nodejs/node/pull/34962
580+
description: Exposed as `require('path/win32')`.
571581
-->
572582

573583
* {Object}
574584

575585
The `path.win32` property provides access to Windows-specific implementations
576586
of the `path` methods.
577587

588+
The API is accessible via `require('path').win32` or `require('path/win32')`.
589+
578590
[MSDN-Rel-Path]: https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file#fully-qualified-vs-relative-paths
579591
[`TypeError`]: errors.md#errors_class_typeerror
580592
[`path.parse()`]: #path_path_parse_path
Collapse file

‎lib/path/posix.js‎

Copy file name to clipboard
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
'use strict';
2+
3+
module.exports = require('path').posix;
Collapse file

‎lib/path/win32.js‎

Copy file name to clipboard
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
'use strict';
2+
3+
module.exports = require('path').win32;
Collapse file

‎node.gyp‎

Copy file name to clipboardExpand all lines: node.gyp
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@
7373
'lib/net.js',
7474
'lib/os.js',
7575
'lib/path.js',
76+
'lib/path/posix.js',
77+
'lib/path/win32.js',
7678
'lib/perf_hooks.js',
7779
'lib/process.js',
7880
'lib/punycode.js',
Collapse file
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import '../common/index.mjs';
2+
import assert from 'assert';
3+
import { posix } from 'path';
4+
import pathPosix from 'path/posix';
5+
6+
assert.strictEqual(pathPosix, posix);
Collapse file
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import '../common/index.mjs';
2+
import assert from 'assert';
3+
import { win32 } from 'path';
4+
import pathWin32 from 'path/win32';
5+
6+
assert.strictEqual(pathWin32, win32);
Collapse file
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
'use strict';
2+
3+
require('../common');
4+
const assert = require('assert');
5+
6+
assert.strictEqual(require('path/posix'), require('path').posix);
Collapse file
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
'use strict';
2+
3+
require('../common');
4+
const assert = require('assert');
5+
6+
assert.strictEqual(require('path/win32'), require('path').win32);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.