Skip to content

Commit

Permalink
feat(docz-core): add config not use specifiers (#849)
Browse files Browse the repository at this point in the history
  • Loading branch information
ejuo authored and pedronauck committed May 8, 2019
1 parent 84283f1 commit d8595a9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions core/docz-core/src/config/argv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export interface Argv {
native: boolean
codeSandbox: boolean
sourcemaps: boolean
notUseSpecifiers: boolean
/* template args */
title: string
description: string
Expand Down
7 changes: 6 additions & 1 deletion core/docz-core/src/config/babel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ export const getBabelConfig = async (
]

const defaultPlugins = [
require.resolve('babel-plugin-export-metadata'),
[
require.resolve('babel-plugin-export-metadata'),
{
notUseSpecifiers: args.notUseSpecifiers,
},
],
[
require.resolve('babel-plugin-named-asset-import'),
{
Expand Down
2 changes: 1 addition & 1 deletion other-packages/babel-plugin-export-metadata/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const insertNodeExport = t => (path, state) => {
const declarationName = get(declaration, 'id.name')
addFileMetaProperties(t, path, filename, declarationName)
}
} else if (specifiers) {
} else if (specifiers && !state.opts.notUseSpecifiers) {
for (specifier of specifiers) {
const localName = get(specifier, 'local.name')
const exportedName = get(specifier, 'exported.name')
Expand Down

0 comments on commit d8595a9

Please sign in to comment.