Skip to content

Commit

Permalink
⚡ improvement: expose squeezer and infuse function in typing file (#15)…
Browse files Browse the repository at this point in the history
… by @antfu
  • Loading branch information
antfu authored and kazupon committed Nov 18, 2019
1 parent b85d97e commit 51f222d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/squeezer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { reflectSFCDescriptor, parseContent } from './utils'
import { debug as Debug } from 'debug'
const debug = Debug('vue-i18n-locale-message:squeezer')

export default function sqeeze (basePath: string, files: SFCFileInfo[]): MetaLocaleMessage {
export default function squeeze (basePath: string, files: SFCFileInfo[]): MetaLocaleMessage {
const descriptors = reflectSFCDescriptor(basePath, files)
return descriptors.reduce((meta, descriptor) => {
descriptor.customBlocks.sort((a, b) => { return (a.start as number) - (b.start as number) })
Expand Down
5 changes: 4 additions & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export type LocaleMessages = Record<Locale, LocaleMessageObject>

/**
* Locale Message Meta Structure
* e.g.
* e.g.
* {
* "target": "/path/to/project1",
* "components": { // flat component paths
Expand Down Expand Up @@ -151,6 +151,9 @@ export interface SFCFileInfo {
* }
*/

declare function squeeze (basePath: string, files: SFCFileInfo[]): MetaLocaleMessage
declare function infuse (basePath: string, sources: SFCFileInfo[], meta: MetaLocaleMessage): SFCFileInfo[]

// extend for vue-i18n-locale-message
declare module 'vue-template-compiler' {
interface SFCDescriptor {
Expand Down

0 comments on commit 51f222d

Please sign in to comment.