Skip to content
This repository has been archived by the owner on Nov 17, 2021. It is now read-only.

Commit

Permalink
fix(Extensions): Only quote name when need to
Browse files Browse the repository at this point in the history
  • Loading branch information
nokome committed Feb 20, 2020
1 parent c871034 commit f189065
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/extensions/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
* Map of extension Javascript modules
*/
export const extensions: {
'cite': Promise<unknown>
cite: Promise<unknown>
'cite-apa': Promise<unknown>
'cite-mla': Promise<unknown>
'code': Promise<unknown>
'math': Promise<unknown>
'person': Promise<unknown>
code: Promise<unknown>
math: Promise<unknown>
person: Promise<unknown>
} = {
'cite': import('./cite'),
cite: import('./cite'),
'cite-apa': import('./cite-apa'),
'cite-mla': import('./cite-mla'),
'code': import('./code'),
'math': import('./math'),
'person': import('./person')
code: import('./code'),
math: import('./math'),
person: import('./person')
}
14 changes: 12 additions & 2 deletions src/scripts/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,21 @@ function update(all = true): void {
*/
export const extensions: {
${extensions
.map(extension => `'${extension}': Promise<unknown>`)
.map(
extension =>
`${
/^\w+$/.test(extension) ? extension : `'${extension}'`
}: Promise<unknown>`
)
.join('\n ')}
} = {
${extensions
.map(extension => `'${extension}': import('./${extension}')`)
.map(
extension =>
`${
/^\w+$/.test(extension) ? extension : `'${extension}'`
}: import('./${extension}')`
)
.join(',\n ')}
}\n`
)
Expand Down

0 comments on commit f189065

Please sign in to comment.