Skip to content

Commit 1e663df

Browse files
authored
feat(GeneratorAPI): accept multiple arguments for the resolve method (vuejs#4715)
* feat(GeneratorAPI): accept multiple arguments for the resolve method To make its signature conform to the standard `path.resolve`, avoid confusions. There's already a bug in the downstream plugin that was caused by such confusion: https://github.com/Akryum/vue-cli-plugin-ssr/blob/a742953b8376817950a01ad79967b9aa02da5388/generator/index.js#L163-L171 * docs: update descriptions of the `resolve` api [ci skip]
1 parent 9ebc2ab commit 1e663df

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

docs/dev-guide/generator-api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ The version string for the **project local** `@vue/cli-service` version that is
4444
## resolve
4545

4646
- **Arguments**
47-
- `{string} _path` - relative path from project root
47+
- `{string} ..._paths` - A sequence of relative paths or path segments
4848

4949
- **Returns**
50-
- `{string}`- the resolved absolute path
50+
- `{string}`- the resolved absolute path, caculated based on the current project root
5151

5252
- **Usage**:
5353
Resolve a path for the current project

packages/@vue/cli/lib/GeneratorAPI.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ class GeneratorAPI {
6868
/**
6969
* Resolve path for a project.
7070
*
71-
* @param {string} _path - Relative path from project root
72-
* @return {string} The resolved absolute path.
71+
* @param {string} _paths - A sequence of relative paths or path segments
72+
* @return {string} The resolved absolute path, caculated based on the current project root.
7373
*/
74-
resolve (_path) {
75-
return path.resolve(this.generator.context, _path)
74+
resolve (..._paths) {
75+
return path.resolve(this.generator.context, ..._paths)
7676
}
7777

7878
get cliVersion () {

0 commit comments

Comments
 (0)