From 8264e60e1d38ab247be86af0e0a7f24ef725e2f9 Mon Sep 17 00:00:00 2001 From: "ilya.tychinin" Date: Thu, 2 May 2019 14:44:39 +0500 Subject: [PATCH] feat(docz-core): add config not use specifiers --- core/docz-core/src/config/argv.ts | 1 + core/docz-core/src/config/babel.ts | 7 ++++++- other-packages/babel-plugin-export-metadata/src/index.js | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/docz-core/src/config/argv.ts b/core/docz-core/src/config/argv.ts index 111ad345b..f898f64e9 100644 --- a/core/docz-core/src/config/argv.ts +++ b/core/docz-core/src/config/argv.ts @@ -75,6 +75,7 @@ export interface Argv { native: boolean codeSandbox: boolean sourcemaps: boolean + notUseSpecifiers: boolean /* template args */ title: string description: string diff --git a/core/docz-core/src/config/babel.ts b/core/docz-core/src/config/babel.ts index b0675e191..28502d3f2 100644 --- a/core/docz-core/src/config/babel.ts +++ b/core/docz-core/src/config/babel.ts @@ -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'), { diff --git a/other-packages/babel-plugin-export-metadata/src/index.js b/other-packages/babel-plugin-export-metadata/src/index.js index 4951174b7..1d5c5f174 100644 --- a/other-packages/babel-plugin-export-metadata/src/index.js +++ b/other-packages/babel-plugin-export-metadata/src/index.js @@ -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')