Skip to content

Commit

Permalink
feat(injectAtEnd): add new option (#327)
Browse files Browse the repository at this point in the history
Co-authored-by: 121016171 <[email protected]>
  • Loading branch information
peerless-hero and peerless-hero authored Mar 23, 2023
1 parent c5a5fcc commit 93a2f5c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core/ctx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@ export function createContext(options: Options = {}, root = process.cwd()) {
const cachePath = isCache === false
? false
: resolve(root, typeof isCache === 'string' ? isCache : 'node_modules/.cache/unplugin-auto-import.json')

// When "options.injectAtEnd" is undefined or true, it's true.
const injectAtEnd = options.injectAtEnd !== false

const unimport = createUnimport({
imports: [],
presets: [],
injectAtEnd: true,
injectAtEnd,
addons: [
...(options.vueTemplate ? [vueTemplateAddon()] : []),
resolversAddon(resolvers),
Expand Down
7 changes: 7 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ export interface Options {
*/
ignore?: (string | RegExp)[]

/**
* Inject the imports at the end of other imports
*
* @default true
*/
injectAtEnd?: boolean

/**
* Path for directories to be auto imported
*/
Expand Down

0 comments on commit 93a2f5c

Please sign in to comment.