@driveflux/fab 1.0.10 → 2.1.0

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/dist/build.js CHANGED
@@ -6,6 +6,9 @@ function _array_like_to_array(arr, len) {
6
6
  function _array_with_holes(arr) {
7
7
  if (Array.isArray(arr)) return arr;
8
8
  }
9
+ function _array_without_holes(arr) {
10
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
11
+ }
9
12
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
10
13
  try {
11
14
  var info = gen[key](arg);
@@ -35,6 +38,9 @@ function _async_to_generator(fn) {
35
38
  });
36
39
  };
37
40
  }
41
+ function _iterable_to_array(iter) {
42
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
43
+ }
38
44
  function _iterable_to_array_limit(arr, i) {
39
45
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
40
46
  if (_i == null) return;
@@ -62,12 +68,14 @@ function _iterable_to_array_limit(arr, i) {
62
68
  function _non_iterable_rest() {
63
69
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
64
70
  }
71
+ function _non_iterable_spread() {
72
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
73
+ }
65
74
  function _sliced_to_array(arr, i) {
66
75
  return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
67
76
  }
68
- function _type_of(obj) {
69
- "@swc/helpers - typeof";
70
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
77
+ function _to_consumable_array(arr) {
78
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
71
79
  }
72
80
  function _unsupported_iterable_to_array(o, minLen) {
73
81
  if (!o) return;
@@ -172,14 +180,11 @@ function _ts_generator(thisArg, body) {
172
180
  };
173
181
  }
174
182
  }
175
- import fg from 'fast-glob';
176
- import merge from 'lodash.merge';
177
- import assert from 'node:assert';
178
183
  import fs from 'node:fs/promises';
179
184
  import path from 'node:path';
185
+ import merge from 'lodash.merge';
180
186
  import { clean } from './clean.js';
181
- import { ensureDir, getDefaultOptions, runCommand, validatePackageJson } from './utils.js';
182
- var glob = fg.glob;
187
+ import { ensureDir, getDefaultOptions, runBin, runCommand } from './utils.js';
183
188
  export var build = function() {
184
189
  var _ref = _async_to_generator(function(rawOptions) {
185
190
  var options, promises;
@@ -195,15 +200,10 @@ export var build = function() {
195
200
  case 1:
196
201
  _state.sent();
197
202
  promises = [];
198
- if (!options.noESM) {
199
- promises.push(buildEsm(options));
200
- }
203
+ promises.push(buildEsm(options));
201
204
  if (!options.noTypes) {
202
205
  promises.push(buildTypes(options));
203
206
  }
204
- if (!options.noCJS) {
205
- promises.push(buildCjs(options));
206
- }
207
207
  promises.push(copyVerbatim(options));
208
208
  // Build necessary files
209
209
  return [
@@ -212,18 +212,6 @@ export var build = function() {
212
212
  ];
213
213
  case 2:
214
214
  _state.sent();
215
- if (!!options.noCJS) return [
216
- 3,
217
- 4
218
- ];
219
- return [
220
- 4,
221
- makeBaseExports(options)
222
- ];
223
- case 3:
224
- _state.sent();
225
- _state.label = 4;
226
- case 4:
227
215
  return [
228
216
  2
229
217
  ];
@@ -236,7 +224,7 @@ export var build = function() {
236
224
  }();
237
225
  export var copyVerbatim = function() {
238
226
  var _ref = _async_to_generator(function(rawOptions) {
239
- var _options_copyVerbatim, options, _options_cwd, cwd, _options_destination, destination;
227
+ var _options_copyVerbatim, options, destination, guessTarget;
240
228
  return _ts_generator(this, function(_state) {
241
229
  switch(_state.label){
242
230
  case 0:
@@ -245,40 +233,39 @@ export var copyVerbatim = function() {
245
233
  3,
246
234
  2
247
235
  ];
248
- cwd = (_options_cwd = options.cwd) !== null && _options_cwd !== void 0 ? _options_cwd : process.cwd();
249
- destination = (_options_destination = options.destination) !== null && _options_destination !== void 0 ? _options_destination : getDefaultOptions().destination;
236
+ destination = options.destination;
237
+ guessTarget = function(copySource) {
238
+ var relative = path.relative(options.source, copySource);
239
+ var targetPath = path.resolve(destination, relative);
240
+ if (!copySource.startsWith(options.source)) {
241
+ throw new Error('The files to be copied must be a subdirectory of the source directory. Or you can provide a destination path using an array: { copyVerbatim: [source, target] }');
242
+ }
243
+ return targetPath;
244
+ };
250
245
  return [
251
246
  4,
252
247
  Promise.all(options.copyVerbatim.map(function() {
253
248
  var _ref = _async_to_generator(function(fileOrFolderRaw) {
254
- var fileOrFolder, targetPath, targetPathCjs;
249
+ var source, target, tagetBasedir;
255
250
  return _ts_generator(this, function(_state) {
256
251
  switch(_state.label){
257
252
  case 0:
258
- fileOrFolder = "src/".concat(fileOrFolderRaw.replace(/^(\/)*src/, ''));
259
- targetPath = path.resolve(destination, fileOrFolder).replace('/src', '');
260
- targetPathCjs = path.resolve(destination, 'cjs', fileOrFolder).replace('/src', '');
253
+ source = typeof fileOrFolderRaw === 'string' ? fileOrFolderRaw : fileOrFolderRaw[0];
254
+ target = Array.isArray(fileOrFolderRaw) ? fileOrFolderRaw[1] : guessTarget(source);
255
+ tagetBasedir = path.dirname(target);
261
256
  return [
262
257
  4,
263
- ensureDir(path.dirname(targetPath))
258
+ ensureDir(path.dirname(tagetBasedir))
264
259
  ];
265
260
  case 1:
266
261
  _state.sent();
267
262
  return [
268
263
  4,
269
- fs.cp(path.resolve(cwd, fileOrFolder), targetPath, {
264
+ fs.cp(source, target, {
270
265
  recursive: true
271
266
  })
272
267
  ];
273
268
  case 2:
274
- _state.sent();
275
- return [
276
- 4,
277
- fs.cp(path.resolve(cwd, fileOrFolder), targetPathCjs, {
278
- recursive: true
279
- })
280
- ];
281
- case 3:
282
269
  _state.sent();
283
270
  return [
284
271
  2
@@ -307,90 +294,23 @@ export var copyVerbatim = function() {
307
294
  }();
308
295
  export var buildTypes = function() {
309
296
  var _ref = _async_to_generator(function(rawOptions) {
310
- var options;
297
+ var options, tsProject;
311
298
  return _ts_generator(this, function(_state) {
312
299
  switch(_state.label){
313
300
  case 0:
314
301
  options = merge({}, getDefaultOptions(), rawOptions);
315
- return [
316
- 4,
317
- validatePackageJson({
318
- command: 'tsc',
319
- cwd: options.cwd
320
- })
321
- ];
322
- case 1:
323
- _state.sent();
302
+ tsProject = path.resolve(options.cwd, 'tsconfig.json');
324
303
  return [
325
304
  4,
326
305
  runCommand('pnpm', [
327
306
  'tsc',
307
+ '--project',
308
+ tsProject,
328
309
  '--emitDeclarationOnly',
329
310
  '--declarationMap'
330
- ], {
331
- cwd: options.cwd
332
- })
333
- ];
334
- case 2:
335
- _state.sent();
336
- return [
337
- 2
338
- ];
339
- }
340
- });
341
- });
342
- return function buildTypes(rawOptions) {
343
- return _ref.apply(this, arguments);
344
- };
345
- }();
346
- export var buildCjs = function() {
347
- var _ref = _async_to_generator(function(rawOptions) {
348
- var options, _options_cwd, cwd, _options_destination, destination, cjsPath, targetPath;
349
- return _ts_generator(this, function(_state) {
350
- switch(_state.label){
351
- case 0:
352
- options = merge({}, getDefaultOptions(), rawOptions);
353
- cwd = (_options_cwd = options.cwd) !== null && _options_cwd !== void 0 ? _options_cwd : process.cwd();
354
- destination = (_options_destination = options.destination) !== null && _options_destination !== void 0 ? _options_destination : getDefaultOptions().destination;
355
- cjsPath = path.resolve(destination, 'cjs');
356
- return [
357
- 4,
358
- validatePackageJson({
359
- command: 'swc',
360
- cwd: cwd
361
- })
311
+ ])
362
312
  ];
363
313
  case 1:
364
- _state.sent();
365
- // We start by emitting the CJS files
366
- return [
367
- 4,
368
- runCommand("pnpm", [
369
- 'swc',
370
- 'src',
371
- '-C',
372
- 'module.type=commonjs',
373
- '--strip-leading-paths',
374
- '-d',
375
- cjsPath
376
- ], {
377
- cwd: cwd
378
- })
379
- ];
380
- case 2:
381
- _state.sent();
382
- targetPath = path.resolve(cwd, cjsPath, 'package.json');
383
- return [
384
- 4,
385
- ensureDir(path.dirname(targetPath))
386
- ];
387
- case 3:
388
- _state.sent();
389
- return [
390
- 4,
391
- fs.writeFile(targetPath, '{\n "type": "commonjs"\n}')
392
- ];
393
- case 4:
394
314
  _state.sent();
395
315
  return [
396
316
  2
@@ -398,390 +318,73 @@ export var buildCjs = function() {
398
318
  }
399
319
  });
400
320
  });
401
- return function buildCjs(rawOptions) {
321
+ return function buildTypes(rawOptions) {
402
322
  return _ref.apply(this, arguments);
403
323
  };
404
324
  }();
405
- export var makeBaseExports = function() {
325
+ export var buildEsm = function() {
406
326
  var _ref = _async_to_generator(function(rawOptions) {
407
- var options, _options_cwd, cwd, exp, _tmp, baseMap;
327
+ var options, finalOptions, swcrc, e, isValid, compilerOptions;
408
328
  return _ts_generator(this, function(_state) {
409
329
  switch(_state.label){
410
330
  case 0:
411
331
  options = merge({}, getDefaultOptions(), rawOptions);
412
- cwd = (_options_cwd = options.cwd) !== null && _options_cwd !== void 0 ? _options_cwd : process.cwd();
413
- _tmp = options.exports;
414
- if (_tmp) return [
415
- 3,
416
- 2
417
- ];
418
- return [
419
- 4,
420
- parseExports(cwd)
421
- ];
422
- case 1:
423
- _tmp = _state.sent();
424
- _state.label = 2;
425
- case 2:
426
- exp = _tmp;
427
- // Let's validate the exports
428
- if (!exp) {
429
- throw new Error('No exports found');
430
- }
431
- if ((typeof exp === "undefined" ? "undefined" : _type_of(exp)) !== 'object' && Array.isArray(exp)) {
432
- throw new Error('Exports must be an object');
433
- }
434
- return [
435
- 4,
436
- Promise.all(Object.entries(exp).map(function(entry) {
437
- return processEntry(entry, options);
438
- }))
439
- ];
440
- case 3:
441
- baseMap = _state.sent().flat();
442
- return [
443
- 4,
444
- Promise.all(baseMap.map(function(param) {
445
- var targetFile = param.targetFile, content = param.content;
446
- return createBaseExportFile(targetFile, content, cwd);
447
- }))
448
- ];
449
- case 4:
450
- return [
451
- 2,
452
- _state.sent()
453
- ];
454
- }
455
- });
456
- });
457
- return function makeBaseExports(rawOptions) {
458
- return _ref.apply(this, arguments);
459
- };
460
- }();
461
- var createBaseExportFile = function() {
462
- var _ref = _async_to_generator(function(targetFile, content, cwd) {
463
- var targetPath;
464
- return _ts_generator(this, function(_state) {
465
- switch(_state.label){
466
- case 0:
467
- targetPath = path.resolve(cwd, targetFile);
468
- return [
469
- 4,
470
- ensureDir(path.dirname(targetPath))
471
- ];
472
- case 1:
473
- _state.sent();
474
- return [
475
- 4,
476
- fs.writeFile(targetPath, content)
477
- ];
478
- case 2:
479
- _state.sent();
480
- return [
481
- 2,
482
- targetPath
483
- ];
484
- }
485
- });
486
- });
487
- return function createBaseExportFile(targetFile, content, cwd) {
488
- return _ref.apply(this, arguments);
489
- };
490
- }();
491
- var processEntry = function() {
492
- var _ref = _async_to_generator(function(entry, options) {
493
- var cjsExportsPromise, typesExportsPromise;
494
- return _ts_generator(this, function(_state) {
495
- switch(_state.label){
496
- case 0:
497
- cjsExportsPromise = Promise.resolve([]);
498
- if (!options.noCJS) {
499
- cjsExportsPromise = extractBaseExportsFromEntry(entry, 'cjs', options);
500
- }
501
- typesExportsPromise = Promise.resolve([]);
502
- if (!options.noTypes) {
503
- typesExportsPromise = extractBaseExportsFromEntry(entry, 'types', options);
504
- }
505
- return [
506
- 4,
507
- Promise.all([
508
- cjsExportsPromise,
509
- typesExportsPromise
510
- ])
511
- ];
512
- case 1:
513
- return [
514
- 2,
515
- _state.sent().flat()
516
- ];
517
- }
518
- });
519
- });
520
- return function processEntry(entry, options) {
521
- return _ref.apply(this, arguments);
522
- };
523
- }();
524
- var extractBaseExportsFromEntry = function() {
525
- var _ref = _async_to_generator(function(param, type, options) {
526
- var _param, key, value, _options_cwd, cwd, hasWildcard, exportTypeKey, exportKeyValue, asteriskPosition, paths, targetFiles;
527
- return _ts_generator(this, function(_state) {
528
- switch(_state.label){
529
- case 0:
530
- _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
531
- cwd = (_options_cwd = options.cwd) !== null && _options_cwd !== void 0 ? _options_cwd : process.cwd();
532
- assert([
533
- 'cjs',
534
- 'types'
535
- ].includes(type), "The type of the entry ".concat(key, ' must be "cjs" | "types". ').concat(type, " given"));
536
- // We need to make sure the * is ONLY once at most and is at the end of the key
537
- hasWildcard = /^[^*]*\*$/.test(key);
538
- if (key.includes('*') && !hasWildcard) {
539
- throw new Error("Only 1 wildcard at the end of the export path is allowed. Provided ".concat(key));
540
- }
541
- exportTypeKey = type === 'cjs' ? 'require' : 'types';
542
- if ((typeof value === "undefined" ? "undefined" : _type_of(value)) !== 'object' || !value || Array.isArray(value) || !(exportTypeKey in value) || typeof value[exportTypeKey] === 'undefined') {
543
- throw new Error("Missing key ".concat(exportTypeKey, " from the exports map of ").concat(key, ". If this is desired, then set it to null."));
544
- }
545
- exportKeyValue = value[exportTypeKey];
546
- if (exportKeyValue === null) {
547
- return [
548
- 2,
549
- []
550
- ];
551
- }
552
- if (typeof exportKeyValue !== 'string') {
553
- throw new Error('Only strings are allowed in the "'.concat(exportTypeKey, '" field'));
554
- }
555
- asteriskPosition = exportKeyValue.replace('./', '').split('/').findIndex(function(p) {
556
- return p.startsWith('*');
557
- });
558
- return [
559
- 4,
560
- parseExportPath(exportKeyValue, cwd)
561
- ];
332
+ finalOptions = {
333
+ '--out-dir': options.destination,
334
+ '--strip-leading-paths': true
335
+ };
336
+ swcrc = path.resolve(options.cwd, '.swcrc');
337
+ _state.label = 1;
562
338
  case 1:
563
- paths = _state.sent();
564
- targetFiles = Promise.all(paths.map(function() {
565
- var _ref = _async_to_generator(function(p) {
566
- var finalKey, content, targetFile, geImportPaths, importPaths, relativeImportPath, importPaths1, relativeImportPath1, fileContent, exportObj;
567
- return _ts_generator(this, function(_state) {
568
- switch(_state.label){
569
- case 0:
570
- finalKey = key;
571
- if (hasWildcard) {
572
- finalKey = key.replace('*', p.split('/').slice(asteriskPosition, asteriskPosition + 1).join('/'));
573
- }
574
- if (finalKey === '.' || finalKey === './') {
575
- finalKey = 'index';
576
- }
577
- content = '';
578
- targetFile = '';
579
- geImportPaths = function(importPath) {
580
- var targetFile = path.resolve(cwd, importPath);
581
- var importFromPath = path.dirname(targetFile);
582
- var fullImportPath = path.resolve(cwd, p);
583
- var relativeImportPath = path.relative(importFromPath, fullImportPath);
584
- return {
585
- relativeImportPath: relativeImportPath,
586
- fullImportPath: fullImportPath,
587
- targetFile: targetFile
588
- };
589
- };
590
- if (!(type === 'cjs')) return [
591
- 3,
592
- 2
593
- ];
594
- return [
595
- 4,
596
- resolvePathWithExtension(finalKey, 'cjs')
597
- ];
598
- case 1:
599
- finalKey = _state.sent();
600
- importPaths = geImportPaths(finalKey);
601
- relativeImportPath = importPaths.relativeImportPath;
602
- targetFile = importPaths.targetFile;
603
- content = "module.exports = require('".concat(formatImportPath(relativeImportPath), "')");
604
- _state.label = 2;
605
- case 2:
606
- if (!(type === 'types')) return [
607
- 3,
608
- 5
609
- ];
610
- return [
611
- 4,
612
- resolvePathWithExtension(finalKey, 'd.ts')
613
- ];
614
- case 3:
615
- finalKey = _state.sent();
616
- importPaths1 = geImportPaths(finalKey);
617
- relativeImportPath1 = importPaths1.relativeImportPath;
618
- targetFile = importPaths1.targetFile;
619
- // Typescript will complain about exprting .d.ts, so we just omt that
620
- content = "export * from '".concat(formatImportPath(relativeImportPath1).replace('.d.ts', ''), "'");
621
- return [
622
- 4,
623
- fs.readFile(importPaths1.fullImportPath, 'utf-8')
624
- ];
625
- case 4:
626
- fileContent = _state.sent();
627
- if (/export default/.test(fileContent)) {
628
- content += "\nexport { default } from '".concat(formatImportPath(relativeImportPath1), "'");
629
- }
630
- _state.label = 5;
631
- case 5:
632
- if (!content) {
633
- throw new Error("No content found for ".concat(exportKeyValue));
634
- }
635
- exportObj = {
636
- type: type,
637
- targetFile: targetFile,
638
- content: content
639
- };
640
- return [
641
- 2,
642
- exportObj
643
- ];
644
- }
645
- });
646
- });
647
- return function(p) {
648
- return _ref.apply(this, arguments);
649
- };
650
- }()));
651
- if (!targetFiles) {
652
- console.log("⚠️ No CJS target files for ".concat(key));
653
- }
654
- return [
655
- 2,
656
- targetFiles
657
- ];
658
- }
659
- });
660
- });
661
- return function extractBaseExportsFromEntry(_, type, options) {
662
- return _ref.apply(this, arguments);
663
- };
664
- }();
665
- var resolvePathWithExtension = function() {
666
- var _ref = _async_to_generator(function(targetFile, extension) {
667
- var e;
668
- return _ts_generator(this, function(_state) {
669
- switch(_state.label){
670
- case 0:
671
339
  _state.trys.push([
672
- 0,
673
- 2,
340
+ 1,
341
+ 3,
674
342
  ,
675
- 3
343
+ 4
676
344
  ]);
677
345
  return [
678
346
  4,
679
- fs.stat(targetFile)
680
- ];
681
- case 1:
682
- if (_state.sent().isDirectory()) {
683
- return [
684
- 2,
685
- "".concat(targetFile, "/index.").concat(extension)
686
- ];
687
- }
688
- return [
689
- 3,
690
- 3
347
+ fs.stat(swcrc)
691
348
  ];
692
349
  case 2:
693
- e = _state.sent();
350
+ _state.sent();
351
+ finalOptions['--config-file'] = swcrc;
694
352
  return [
695
353
  3,
696
- 3
354
+ 4
697
355
  ];
698
356
  case 3:
699
- if (targetFile.endsWith(extension)) {
700
- return [
701
- 2,
702
- targetFile
703
- ];
704
- }
705
- if (targetFile.endsWith(".js")) {
706
- return [
707
- 2,
708
- targetFile.replace(/\.js$/, ".".concat(extension))
709
- ];
710
- }
357
+ e = _state.sent();
711
358
  return [
712
- 2,
713
- "".concat(targetFile, ".").concat(extension)
359
+ 3,
360
+ 4
714
361
  ];
715
- }
716
- });
717
- });
718
- return function resolvePathWithExtension(targetFile, extension) {
719
- return _ref.apply(this, arguments);
720
- };
721
- }();
722
- var formatImportPath = function(exportPath) {
723
- return exportPath.startsWith('.') ? exportPath : "./".concat(exportPath);
724
- };
725
- var parseExportPath = function() {
726
- var _ref = _async_to_generator(function(exportPath) {
727
- var cwd, split, files;
728
- var _arguments = arguments;
729
- return _ts_generator(this, function(_state) {
730
- switch(_state.label){
731
- case 0:
732
- cwd = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : process.cwd();
733
- split = exportPath.split('*');
734
- if (split.length === 1) {
362
+ case 4:
363
+ isValid = function(v) {
364
+ return typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean' && v;
365
+ };
366
+ compilerOptions = Object.entries(finalOptions).map(function(param) {
367
+ var _param = _sliced_to_array(param, 2), k = _param[0], v = _param[1];
735
368
  return [
736
- 2,
737
- [
738
- exportPath
739
- ]
740
- ];
741
- }
742
- // Allow only 1 * in the path
743
- if (split.length > 2) {
744
- throw new Error('Invalid export path. Only one * is allowed');
745
- }
746
- return [
747
- 4,
748
- glob(exportPath)
749
- ];
750
- case 1:
751
- files = _state.sent();
752
- return [
753
- 2,
754
- files.map(function(f) {
755
- return path.relative(cwd, f);
756
- })
757
- ];
758
- }
759
- });
760
- });
761
- return function parseExportPath(exportPath) {
762
- return _ref.apply(this, arguments);
763
- };
764
- }();
765
- export var buildEsm = function() {
766
- var _ref = _async_to_generator(function(rawOptions) {
767
- var options, _options_destination;
768
- return _ts_generator(this, function(_state) {
769
- switch(_state.label){
770
- case 0:
771
- options = merge({}, getDefaultOptions(), rawOptions);
369
+ k
370
+ ].concat(_to_consumable_array(isValid(v) ? [
371
+ typeof v === 'boolean' ? '' : "".concat(v)
372
+ ] : [
373
+ null
374
+ ]));
375
+ }).filter(function(param) {
376
+ var _param = _sliced_to_array(param, 2), _ = _param[0], v = _param[1];
377
+ return v !== null && v !== undefined;
378
+ }).flat().filter(function(v) {
379
+ return v !== '';
380
+ });
772
381
  return [
773
382
  4,
774
- runCommand("pnpm", [
775
- 'swc',
776
- 'src',
777
- '--strip-leading-paths',
778
- '-d',
779
- (_options_destination = options.destination) !== null && _options_destination !== void 0 ? _options_destination : getDefaultOptions().destination
780
- ], {
781
- cwd: options.cwd
782
- })
383
+ runBin('swc', [
384
+ options.source
385
+ ].concat(_to_consumable_array(compilerOptions)))
783
386
  ];
784
- case 1:
387
+ case 5:
785
388
  _state.sent();
786
389
  return [
787
390
  2
@@ -793,31 +396,3 @@ export var buildEsm = function() {
793
396
  return _ref.apply(this, arguments);
794
397
  };
795
398
  }();
796
- var parseExports = function() {
797
- var _ref = _async_to_generator(function() {
798
- var cwd, pkg, _;
799
- var _arguments = arguments;
800
- return _ts_generator(this, function(_state) {
801
- switch(_state.label){
802
- case 0:
803
- cwd = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : process.cwd();
804
- _ = JSON.parse;
805
- return [
806
- 4,
807
- fs.readFile(path.join(cwd, 'package.json'), 'utf-8')
808
- ];
809
- case 1:
810
- pkg = _.apply(JSON, [
811
- _state.sent()
812
- ]);
813
- return [
814
- 2,
815
- pkg.exports
816
- ];
817
- }
818
- });
819
- });
820
- return function parseExports() {
821
- return _ref.apply(this, arguments);
822
- };
823
- }();