feat(builder): followSymlinks option to allow for symlinks (#6368)

This commit is contained in:
Snir Shechter 2019-09-29 12:06:44 +03:00 committed by Pooya Parsa
parent d1df5c8124
commit 92c7f4ed24
10 changed files with 30 additions and 2 deletions

View File

@ -310,7 +310,8 @@ export default class Builder {
async resolveFiles (dir, cwd = this.options.srcDir) {
return this.ignore.filter(await glob(this.globPathWithExtensions(dir), {
cwd,
ignore: this.options.ignore
ignore: this.options.ignore,
follow: this.options.build.followSymlinks
}))
}

View File

@ -118,5 +118,6 @@ export default () => ({
},
friendlyErrors: true,
additionalExtensions: [],
warningIgnoreFilters: []
warningIgnoreFilters: [],
followSymlinks: false
})

View File

@ -39,6 +39,7 @@ Object {
"img": [Function],
"video": [Function],
},
"followSymlinks": false,
"friendlyErrors": true,
"hardSource": false,
"hotMiddleware": Object {},

View File

@ -26,6 +26,7 @@ Object {
"img": [Function],
"video": [Function],
},
"followSymlinks": false,
"friendlyErrors": true,
"hardSource": false,
"hotMiddleware": Object {},
@ -376,6 +377,7 @@ Object {
"img": [Function],
"video": [Function],
},
"followSymlinks": false,
"friendlyErrors": true,
"hardSource": false,
"hotMiddleware": Object {},

View File

@ -77,6 +77,7 @@ export default {
build: {
scopeHoisting: true,
publicPath: '',
followSymlinks: true,
postcss: {
preset: {
features: {

View File

@ -0,0 +1,3 @@
<template>
<h1>Nested symlink page</h1>
</template>

View File

@ -0,0 +1,3 @@
<template>
<h1>Symlinked page</h1>
</template>

View File

@ -0,0 +1,3 @@
<template>
<h1>Nested symlink page</h1>
</template>

View File

@ -0,0 +1,3 @@
<template>
<h1>Symlinked page</h1>
</template>

View File

@ -358,6 +358,16 @@ describe('basic ssr', () => {
expect(html).toMatch('<h1>JS Layout</h1>')
expect(html).toMatch('<h2>custom page</h2>')
})
/* Testing symlinks functionality */
test('/symlink/symlinked', async () => {
const { html } = await nuxt.server.renderRoute('/symlink/symlinked')
expect(html).toContain('<h1>Symlinked page</h1>')
})
test('/symlink/deep/nested-symlinked', async () => {
const { html } = await nuxt.server.renderRoute('/symlink/deep/nested-symlinked')
expect(html).toContain('<h1>Nested symlink page</h1>')
})
// Close server and ask nuxt to stop listening to file changes
afterAll(async () => {