Skip to content

Commit

Permalink
feat: implement path (resolves #35)
Browse files Browse the repository at this point in the history
Thanks @danielroe <3
  • Loading branch information
pi0 committed May 5, 2022
1 parent f4bf593 commit bd473c5
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Module | Status | Source
[node:module](https://nodejs.org/api/module.html) | Mocked | -
[node:net](https://nodejs.org/api/net.html) | Polyfilled | [unenv/node/net](./src/runtime/node/net)
[node:os](https://nodejs.org/api/os.html) | Mocked | -
[node:path](https://nodejs.org/api/path.html) | Mocked | -
[node:path](https://nodejs.org/api/path.html) | Polyfilled | [unenv/node/path](./src/runtime/node/path)
[node:perf_hooks](https://nodejs.org/api/perf_hooks.html) | Mocked | -
[node:process](https://nodejs.org/api/process.html) | Polyfilled | -
[node:punycode](https://nodejs.org/api/punycode.html) | Mocked | -
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"abort-controller": "^3.0.0",
"defu": "^6.0.0",
"mime": "^3.0.0",
"node-fetch": "^3.2.4"
"node-fetch": "^3.2.4",
"pathe": "^0.3.0"
},
"devDependencies": {
"@nuxtjs/eslint-config-typescript": "latest",
Expand Down
6 changes: 6 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/presets/nodeless.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const nodeless: Preset = {
'events',
'http',
'net',
'path',
'process',
'stream',
'url',
Expand Down
21 changes: 21 additions & 0 deletions src/runtime/node/path/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// https://nodejs.org/api/path.html
// https://github.com/unjs/pathe
import type path from 'node:path'

import * as _path from 'pathe'
export * from 'pathe'

const _pathModule = {
..._path,
platform: 'posix',
posix: undefined as any,
win32: undefined as any
}
_pathModule.posix = _pathModule
_pathModule.win32 = _pathModule

export const posix: typeof path.posix = _pathModule
export const win32: typeof path.posix = _pathModule
export const platform = 'posix'

export default <typeof path> _pathModule

0 comments on commit bd473c5

Please sign in to comment.