babel-plugin-hylid-bridge 3.2.0-alpha.0 → 3.2.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -9,5 +9,6 @@ declare const _default: (core: typeof babelCore, opts?: {
9
9
  libraryDir?: string;
10
10
  polyfillDir?: string;
11
11
  transformMy?: boolean;
12
+ compact?: boolean;
12
13
  }) => babelCore.PluginObj<IState>;
13
14
  export default _default;
package/lib/index.js CHANGED
@@ -26,24 +26,27 @@ var identifierPrefix = '__hylid_bridge__';
26
26
  var libraryName = 'hylid-bridge';
27
27
  var myLocalName = "".concat(identifierPrefix, "my__");
28
28
  var _default = exports.default = function _default(core, opts) {
29
- var _opts$libraryDir, _opts$transformMy;
29
+ var _opts$libraryDir, _opts$transformMy, _opts$compact;
30
30
  var libraryDir = (_opts$libraryDir = opts === null || opts === void 0 ? void 0 : opts.libraryDir) !== null && _opts$libraryDir !== void 0 ? _opts$libraryDir : (0, _getLibraryDir.default)();
31
31
  var targets = (0, _helper.getTargets)(libraryDir, opts === null || opts === void 0 ? void 0 : opts.targets);
32
32
  var userAppEnvPath = (0, _helper.getUserAppEnvPath)(opts === null || opts === void 0 ? void 0 : opts.appEnvPath);
33
33
  var polyfillDir = opts === null || opts === void 0 ? void 0 : opts.polyfillDir;
34
34
  var transformMy = (_opts$transformMy = opts === null || opts === void 0 ? void 0 : opts.transformMy) !== null && _opts$transformMy !== void 0 ? _opts$transformMy : false;
35
+ var compact = (_opts$compact = opts === null || opts === void 0 ? void 0 : opts.compact) !== null && _opts$compact !== void 0 ? _opts$compact : false;
35
36
  // 生成 babel-compact 文件
36
- (0, _generateJSAPIs.default)(targets);
37
+ compact && (0, _generateJSAPIs.default)(targets);
37
38
  return {
38
39
  name: 'babel-plugin-hylid-bridge',
39
40
  visitor: {
40
41
  ImportDeclaration: function ImportDeclaration(path) {
42
+ if (!compact) return;
41
43
  if (path.node.source.value === libraryName) {
42
44
  path.node.source = core.types.stringLiteral("".concat(libraryName, "/babel-compact"));
43
45
  }
44
46
  },
45
47
  ExportNamedDeclaration: function ExportNamedDeclaration(path) {
46
48
  var _path$node$source;
49
+ if (!compact) return;
47
50
  if (((_path$node$source = path.node.source) === null || _path$node$source === void 0 ? void 0 : _path$node$source.value) === libraryName) {
48
51
  path.node.source = core.types.stringLiteral("".concat(libraryName, "/babel-compact"));
49
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babel-plugin-hylid-bridge",
3
- "version": "3.2.0-alpha.0",
3
+ "version": "3.2.0-alpha.2",
4
4
  "description": "babel-plugin-hylid-bridge",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -22,7 +22,7 @@
22
22
  "devDependencies": {
23
23
  "@types/babel-plugin-tester": "^9.0.7",
24
24
  "babel-plugin-tester": "^10.1.0",
25
- "hylid-bridge": "^3.2.0-alpha.0"
25
+ "hylid-bridge": "^3.2.0-alpha.2"
26
26
  },
27
27
  "sideEffects": false,
28
28
  "registry": "https://registry.npmjs.org/",