-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: fix lint * fix(twitter): add components dir to Windi scan options (#379) * docs: fix nuxt-img usage (#383) * fix(storage): clean deleted contents from storage (#382) * feat: respect nuxtignore * fix: revert ohmyfetch to 0.1.8
- Loading branch information
Showing
8 changed files
with
104 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { resolve } from 'path' | ||
import { promises as fsPromises } from 'fs' | ||
|
||
export async function useNuxtIgnoreList(nuxt: any): Promise<string[]> { | ||
const ignore = nuxt.options.ignore || [] | ||
const ignoreFile = resolve(nuxt.options.rootDir, '.nuxtignore') | ||
const ignoreContent = await fsPromises.readFile(ignoreFile, { encoding: 'utf-8' }).catch(() => '') | ||
if (ignoreContent) { | ||
ignore.push(...ignoreContent.split('\n').filter(Boolean)) | ||
} | ||
return ignore | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from './driver' | ||
export * from './ignore' | ||
export * from './storage' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { createStorage, Storage } from 'unstorage' | ||
import { StorageOptions } from '../../types' | ||
import { logger } from '..' | ||
import { docusDriver, DocusDriver } from './driver' | ||
|
||
let _storage: Storage | ||
let drivers: DocusDriver[] | ||
export function initStorage(options: StorageOptions) { | ||
drivers = [] | ||
_storage = createStorage() | ||
|
||
if (!options?.drivers) { | ||
logger.warn('No driver specified for storage') | ||
} else { | ||
drivers = options.drivers.map(options => { | ||
// Initialize driver | ||
const driver = docusDriver(options) as DocusDriver | ||
|
||
_storage.mount(options.mountPoint, driver) | ||
|
||
return driver | ||
}) | ||
} | ||
|
||
return { | ||
storage: _storage, | ||
drivers, | ||
lazyIndex: () => Promise.all(drivers.map(d => d.init())) | ||
} | ||
} | ||
|
||
export async function destroyStorage() { | ||
await _storage.dispose() | ||
_storage = null | ||
drivers = null | ||
} | ||
|
||
export function useStorage() { | ||
return { | ||
storage: _storage, | ||
drivers | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters