Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(docz-core): add config not use specifiers #849

Merged
merged 1 commit into from
May 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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