babel-plugin-hylid-bridge
Advanced tools
Comparing version 3.2.0-alpha.1 to 3.2.0-alpha.2
@@ -12,3 +12,4 @@ import type babelCore from '@babel/core'; | ||
transformMy?: boolean; | ||
compact?: boolean; | ||
}) => babelCore.PluginObj<IState>; | ||
export default _default; |
@@ -29,3 +29,3 @@ "use strict"; | ||
var _default = exports.default = function _default(core, opts) { | ||
var _opts$libraryDir, _opts$transformMy; | ||
var _opts$libraryDir, _opts$transformMy, _opts$compact; | ||
var libraryDir = (_opts$libraryDir = opts === null || opts === void 0 ? void 0 : opts.libraryDir) !== null && _opts$libraryDir !== void 0 ? _opts$libraryDir : (0, _getLibraryDir.default)(); | ||
@@ -36,4 +36,5 @@ var targets = (0, _helper.getTargets)(libraryDir, opts === null || opts === void 0 ? void 0 : opts.targets); | ||
var transformMy = (_opts$transformMy = opts === null || opts === void 0 ? void 0 : opts.transformMy) !== null && _opts$transformMy !== void 0 ? _opts$transformMy : false; | ||
var compact = (_opts$compact = opts === null || opts === void 0 ? void 0 : opts.compact) !== null && _opts$compact !== void 0 ? _opts$compact : false; | ||
// 生成 babel-compact 文件 | ||
(0, _generateJSAPIs.default)(targets); | ||
compact && (0, _generateJSAPIs.default)(targets); | ||
return { | ||
@@ -43,2 +44,3 @@ name: 'babel-plugin-hylid-bridge', | ||
ImportDeclaration: function ImportDeclaration(path) { | ||
if (!compact) return; | ||
if (path.node.source.value === libraryName) { | ||
@@ -50,2 +52,3 @@ path.node.source = core.types.stringLiteral("".concat(libraryName, "/babel-compact")); | ||
var _path$node$source; | ||
if (!compact) return; | ||
if (((_path$node$source = path.node.source) === null || _path$node$source === void 0 ? void 0 : _path$node$source.value) === libraryName) { | ||
@@ -52,0 +55,0 @@ path.node.source = core.types.stringLiteral("".concat(libraryName, "/babel-compact")); |
{ | ||
"name": "babel-plugin-hylid-bridge", | ||
"version": "3.2.0-alpha.1", | ||
"version": "3.2.0-alpha.2", | ||
"description": "babel-plugin-hylid-bridge", | ||
@@ -25,3 +25,3 @@ "main": "lib/index.js", | ||
"babel-plugin-tester": "^10.1.0", | ||
"hylid-bridge": "^3.2.0-alpha.1" | ||
"hylid-bridge": "^3.2.0-alpha.2" | ||
}, | ||
@@ -28,0 +28,0 @@ "sideEffects": false, |
28030
486