react-native-builder-bob 0.38.1 → 0.38.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/__fixtures__/project/MyNativeComponent.js +2 -0
- package/lib/__fixtures__/project/MyNativeComponent.js.map +1 -0
- package/lib/__fixtures__/project/NativeMyLib.js +2 -0
- package/lib/__fixtures__/project/NativeMyLib.js.map +1 -0
- package/lib/__fixtures__/project/code/$exports-input.js +10 -10
- package/lib/__fixtures__/project/code/$exports-input.js.map +1 -1
- package/lib/__fixtures__/project/code/$exports-output.js +10 -10
- package/lib/__fixtures__/project/code/$exports-output.js.map +1 -1
- package/lib/__fixtures__/project/code/$imports-input.js +10 -10
- package/lib/__fixtures__/project/code/$imports-input.js.map +1 -1
- package/lib/__fixtures__/project/code/$imports-output.js +10 -10
- package/lib/__fixtures__/project/code/$imports-output.js.map +1 -1
- package/lib/__fixtures__/project/code/MyNativeComponent.js +2 -0
- package/lib/__fixtures__/project/code/MyNativeComponent.js.map +1 -0
- package/lib/__fixtures__/project/code/NativeMyLib.js +2 -0
- package/lib/__fixtures__/project/code/NativeMyLib.js.map +1 -0
- package/lib/__tests__/{index.test.js → babel.test.js} +8 -1
- package/lib/__tests__/babel.test.js.map +1 -0
- package/lib/__tests__/init.test.js +78 -0
- package/lib/__tests__/init.test.js.map +1 -0
- package/lib/build.js +163 -0
- package/lib/build.js.map +1 -0
- package/lib/index.js +3 -433
- package/lib/index.js.map +1 -1
- package/lib/init.js +371 -0
- package/lib/init.js.map +1 -0
- package/lib/targets/commonjs.js +2 -0
- package/lib/targets/commonjs.js.map +1 -1
- package/lib/targets/module.js +2 -0
- package/lib/targets/module.js.map +1 -1
- package/lib/targets/typescript.js +48 -25
- package/lib/targets/typescript.js.map +1 -1
- package/lib/types.js.map +1 -1
- package/lib/utils/compile.js +47 -23
- package/lib/utils/compile.js.map +1 -1
- package/lib/utils/loadConfig.js +21 -0
- package/lib/utils/loadConfig.js.map +1 -0
- package/package.json +4 -3
- package/lib/__tests__/index.test.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MyNativeComponent.js","names":[],"sources":["../../../src/__fixtures__/project/MyNativeComponent.tsx"],"sourcesContent":[""],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeMyLib.js","names":[],"sources":["../../../src/__fixtures__/project/NativeMyLib.tsx"],"sourcesContent":[""],"mappings":"","ignoreList":[]}
|
|
@@ -75,25 +75,25 @@ exports.pak = _pak;
|
|
|
75
75
|
var _pax = _interopRequireWildcard(require("../index"));
|
|
76
76
|
exports.pax = _pax;
|
|
77
77
|
var _a3 = require("./a");
|
|
78
|
-
var _NativeLibA = _interopRequireWildcard(require("./
|
|
78
|
+
var _NativeLibA = _interopRequireWildcard(require("./NativeMyLib"));
|
|
79
79
|
exports.NativeLibA = _NativeLibA;
|
|
80
|
-
var _NativeLibB = _interopRequireWildcard(require("../
|
|
80
|
+
var _NativeLibB = _interopRequireWildcard(require("../NativeMyLib"));
|
|
81
81
|
exports.NativeLibB = _NativeLibB;
|
|
82
|
-
var _NativeLibC = _interopRequireWildcard(require("./
|
|
82
|
+
var _NativeLibC = _interopRequireWildcard(require("./NativeMyLib.ts"));
|
|
83
83
|
exports.NativeLibC = _NativeLibC;
|
|
84
|
-
var _NativeLibD = _interopRequireWildcard(require("../
|
|
84
|
+
var _NativeLibD = _interopRequireWildcard(require("../NativeMyLib.ts"));
|
|
85
85
|
exports.NativeLibD = _NativeLibD;
|
|
86
|
-
var _NativeLibE = _interopRequireWildcard(require("./
|
|
86
|
+
var _NativeLibE = _interopRequireWildcard(require("./NativeMyLib.tsx"));
|
|
87
87
|
exports.NativeLibE = _NativeLibE;
|
|
88
|
-
var _NativeLibF = _interopRequireWildcard(require("../
|
|
88
|
+
var _NativeLibF = _interopRequireWildcard(require("../NativeMyLib.tsx"));
|
|
89
89
|
exports.NativeLibF = _NativeLibF;
|
|
90
|
-
var _NativeLibG = _interopRequireWildcard(require("./
|
|
90
|
+
var _NativeLibG = _interopRequireWildcard(require("./NativeMyLib.js"));
|
|
91
91
|
exports.NativeLibG = _NativeLibG;
|
|
92
|
-
var _NativeLibH = _interopRequireWildcard(require("../
|
|
92
|
+
var _NativeLibH = _interopRequireWildcard(require("../NativeMyLib.js"));
|
|
93
93
|
exports.NativeLibH = _NativeLibH;
|
|
94
|
-
var _NativeLibI = _interopRequireWildcard(require("./
|
|
94
|
+
var _NativeLibI = _interopRequireWildcard(require("./NativeMyLib.jsx"));
|
|
95
95
|
exports.NativeLibI = _NativeLibI;
|
|
96
|
-
var _NativeLibJ = _interopRequireWildcard(require("../
|
|
96
|
+
var _NativeLibJ = _interopRequireWildcard(require("../NativeMyLib.jsx"));
|
|
97
97
|
exports.NativeLibJ = _NativeLibJ;
|
|
98
98
|
var _NativeViewA = _interopRequireWildcard(require("./MyNativeComponent"));
|
|
99
99
|
exports.NativeViewA = _NativeViewA;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"$exports-input.js","names":["_b","_interopRequireWildcard","require","exports","b","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","defineProperty","enumerable","get","_c","c","_d","d","_e","e","_f","f","_pac","pac","_pak","pak","_pax","pax","_a3","_NativeLibA","NativeLibA","_NativeLibB","NativeLibB","_NativeLibC","NativeLibC","_NativeLibD","NativeLibD","_NativeLibE","NativeLibE","_NativeLibF","NativeLibF","_NativeLibG","NativeLibG","_NativeLibH","NativeLibH","_NativeLibI","NativeLibI","_NativeLibJ","NativeLibJ","_NativeViewA","NativeViewA","_NativeViewB","NativeViewB","_NativeViewC","NativeViewC","_NativeViewD","NativeViewD","_NativeViewE","NativeViewE","_NativeViewF","NativeViewF","_NativeViewG","NativeViewG","_NativeViewH","NativeViewH","_NativeViewI","NativeViewI","_NativeViewJ","NativeViewJ","_getRequireWildcardCache","WeakMap","r","t","__esModule","default","has","n","__proto__","a","getOwnPropertyDescriptor","u","i","set","foo","bar"],"sources":["../../../../src/__fixtures__/project/code/$exports-input.ts"],"sourcesContent":["export * as a from \"a\";\nexport * as b from \"./b\";\nexport * as c from \"./c\";\nexport * as d from \"./d\";\nexport * as e from \"./e.story\";\nexport * as f from \"../f\";\nexport * as pac from \"..\";\nexport * as pak from \"../\";\nexport * as pax from \"../index\";\n\nexport { a as a1 } from \"./a\";\nexport * from \"./b\";\n\nexport type { A } from \"./a\";\n\nexport const foo = \"foo\";\n\nconst bar = \"bar\";\n\nexport { bar };\n\nexport * as NativeLibA from \"./
|
|
1
|
+
{"version":3,"file":"$exports-input.js","names":["_b","_interopRequireWildcard","require","exports","b","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","defineProperty","enumerable","get","_c","c","_d","d","_e","e","_f","f","_pac","pac","_pak","pak","_pax","pax","_a3","_NativeLibA","NativeLibA","_NativeLibB","NativeLibB","_NativeLibC","NativeLibC","_NativeLibD","NativeLibD","_NativeLibE","NativeLibE","_NativeLibF","NativeLibF","_NativeLibG","NativeLibG","_NativeLibH","NativeLibH","_NativeLibI","NativeLibI","_NativeLibJ","NativeLibJ","_NativeViewA","NativeViewA","_NativeViewB","NativeViewB","_NativeViewC","NativeViewC","_NativeViewD","NativeViewD","_NativeViewE","NativeViewE","_NativeViewF","NativeViewF","_NativeViewG","NativeViewG","_NativeViewH","NativeViewH","_NativeViewI","NativeViewI","_NativeViewJ","NativeViewJ","_getRequireWildcardCache","WeakMap","r","t","__esModule","default","has","n","__proto__","a","getOwnPropertyDescriptor","u","i","set","foo","bar"],"sources":["../../../../src/__fixtures__/project/code/$exports-input.ts"],"sourcesContent":["export * as a from \"a\";\nexport * as b from \"./b\";\nexport * as c from \"./c\";\nexport * as d from \"./d\";\nexport * as e from \"./e.story\";\nexport * as f from \"../f\";\nexport * as pac from \"..\";\nexport * as pak from \"../\";\nexport * as pax from \"../index\";\n\nexport { a as a1 } from \"./a\";\nexport * from \"./b\";\n\nexport type { A } from \"./a\";\n\nexport const foo = \"foo\";\n\nconst bar = \"bar\";\n\nexport { bar };\n\nexport * as NativeLibA from \"./NativeMyLib\";\nexport * as NativeLibB from \"../NativeMyLib\";\nexport * as NativeLibC from \"./NativeMyLib.ts\";\nexport * as NativeLibD from \"../NativeMyLib.ts\";\nexport * as NativeLibE from \"./NativeMyLib.tsx\";\nexport * as NativeLibF from \"../NativeMyLib.tsx\";\nexport * as NativeLibG from \"./NativeMyLib.js\";\nexport * as NativeLibH from \"../NativeMyLib.js\";\nexport * as NativeLibI from \"./NativeMyLib.jsx\";\nexport * as NativeLibJ from \"../NativeMyLib.jsx\";\n\nexport * as NativeViewA from \"./MyNativeComponent\";\nexport * as NativeViewB from \"../MyNativeComponent\";\nexport * as NativeViewC from \"./MyNativeComponent.ts\";\nexport * as NativeViewD from \"../MyNativeComponent.ts\";\nexport * as NativeViewE from \"./MyNativeComponent.tsx\";\nexport * as NativeViewF from \"../MyNativeComponent.tsx\";\nexport * as NativeViewG from \"./MyNativeComponent.js\";\nexport * as NativeViewH from \"../MyNativeComponent.js\";\nexport * as NativeViewI from \"./MyNativeComponent.jsx\";\nexport * as NativeViewJ from \"../MyNativeComponent.jsx\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,IAAAA,EAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAoBC,OAAA,CAAAC,CAAA,GAAAJ,EAAA;AAApBK,MAAA,CAAAC,IAAA,CAAAN,EAAA,EAAAO,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAL,OAAA,IAAAA,OAAA,CAAAK,GAAA,MAAAR,EAAA,CAAAQ,GAAA;EAAAH,MAAA,CAAAQ,cAAA,CAAAV,OAAA,EAAAK,GAAA;IAAAM,UAA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AMC,GAAG,GAAAnF,OAAA,CAAAmF,GAAA,GAAG,KAAK","ignoreList":[]}
|
|
@@ -75,25 +75,25 @@ exports.pac = _pac;
|
|
|
75
75
|
exports.pak = _pac;
|
|
76
76
|
exports.pax = _pac;
|
|
77
77
|
var _a3 = require("./a.mjs");
|
|
78
|
-
var _NativeLibA = _interopRequireWildcard(require("./
|
|
78
|
+
var _NativeLibA = _interopRequireWildcard(require("./NativeMyLib"));
|
|
79
79
|
exports.NativeLibA = _NativeLibA;
|
|
80
|
-
var _NativeLibB = _interopRequireWildcard(require("../
|
|
80
|
+
var _NativeLibB = _interopRequireWildcard(require("../NativeMyLib"));
|
|
81
81
|
exports.NativeLibB = _NativeLibB;
|
|
82
|
-
var _NativeLibC = _interopRequireWildcard(require("./
|
|
82
|
+
var _NativeLibC = _interopRequireWildcard(require("./NativeMyLib.ts"));
|
|
83
83
|
exports.NativeLibC = _NativeLibC;
|
|
84
|
-
var _NativeLibD = _interopRequireWildcard(require("../
|
|
84
|
+
var _NativeLibD = _interopRequireWildcard(require("../NativeMyLib.ts"));
|
|
85
85
|
exports.NativeLibD = _NativeLibD;
|
|
86
|
-
var _NativeLibE = _interopRequireWildcard(require("./
|
|
86
|
+
var _NativeLibE = _interopRequireWildcard(require("./NativeMyLib.tsx"));
|
|
87
87
|
exports.NativeLibE = _NativeLibE;
|
|
88
|
-
var _NativeLibF = _interopRequireWildcard(require("../
|
|
88
|
+
var _NativeLibF = _interopRequireWildcard(require("../NativeMyLib.tsx"));
|
|
89
89
|
exports.NativeLibF = _NativeLibF;
|
|
90
|
-
var _NativeLibG = _interopRequireWildcard(require("./
|
|
90
|
+
var _NativeLibG = _interopRequireWildcard(require("./NativeMyLib.js"));
|
|
91
91
|
exports.NativeLibG = _NativeLibG;
|
|
92
|
-
var _NativeLibH = _interopRequireWildcard(require("../
|
|
92
|
+
var _NativeLibH = _interopRequireWildcard(require("../NativeMyLib.js"));
|
|
93
93
|
exports.NativeLibH = _NativeLibH;
|
|
94
|
-
var _NativeLibI = _interopRequireWildcard(require("./
|
|
94
|
+
var _NativeLibI = _interopRequireWildcard(require("./NativeMyLib.jsx"));
|
|
95
95
|
exports.NativeLibI = _NativeLibI;
|
|
96
|
-
var _NativeLibJ = _interopRequireWildcard(require("../
|
|
96
|
+
var _NativeLibJ = _interopRequireWildcard(require("../NativeMyLib.jsx"));
|
|
97
97
|
exports.NativeLibJ = _NativeLibJ;
|
|
98
98
|
var _NativeViewA = _interopRequireWildcard(require("./MyNativeComponent"));
|
|
99
99
|
exports.NativeViewA = _NativeViewA;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"$exports-output.js","names":["_b","_interopRequireWildcard","require","exports","b","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","defineProperty","enumerable","get","_c","c","_d","d","_e","e","_f","f","_pac","_pak","_pax","pac","pak","pax","_a3","_NativeLibA","NativeLibA","_NativeLibB","NativeLibB","_NativeLibC","NativeLibC","_NativeLibD","NativeLibD","_NativeLibE","NativeLibE","_NativeLibF","NativeLibF","_NativeLibG","NativeLibG","_NativeLibH","NativeLibH","_NativeLibI","NativeLibI","_NativeLibJ","NativeLibJ","_NativeViewA","NativeViewA","_NativeViewB","NativeViewB","_NativeViewC","NativeViewC","_NativeViewD","NativeViewD","_NativeViewE","NativeViewE","_NativeViewF","NativeViewF","_NativeViewG","NativeViewG","_NativeViewH","NativeViewH","_NativeViewI","NativeViewI","_NativeViewJ","NativeViewJ","_getRequireWildcardCache","WeakMap","r","t","__esModule","default","has","n","__proto__","a","getOwnPropertyDescriptor","u","i","set","foo","bar"],"sources":["../../../../src/__fixtures__/project/code/$exports-output.ts"],"sourcesContent":["export * as a from \"a\";\nexport * as b from \"./b.mjs\";\nexport * as c from \"./c.mjs\";\nexport * as d from \"./d\";\nexport * as e from \"./e.story.mjs\";\nexport * as f from \"../f.mjs\";\nexport * as pac from \"../index.mjs\";\nexport * as pak from \"../index.mjs\";\nexport * as pax from \"../index.mjs\";\nexport { a as a1 } from \"./a.mjs\";\nexport * from \"./b.mjs\";\nexport type { A } from \"./a\";\nexport const foo = \"foo\";\nconst bar = \"bar\";\nexport { bar };\nexport * as NativeLibA from \"./
|
|
1
|
+
{"version":3,"file":"$exports-output.js","names":["_b","_interopRequireWildcard","require","exports","b","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","defineProperty","enumerable","get","_c","c","_d","d","_e","e","_f","f","_pac","_pak","_pax","pac","pak","pax","_a3","_NativeLibA","NativeLibA","_NativeLibB","NativeLibB","_NativeLibC","NativeLibC","_NativeLibD","NativeLibD","_NativeLibE","NativeLibE","_NativeLibF","NativeLibF","_NativeLibG","NativeLibG","_NativeLibH","NativeLibH","_NativeLibI","NativeLibI","_NativeLibJ","NativeLibJ","_NativeViewA","NativeViewA","_NativeViewB","NativeViewB","_NativeViewC","NativeViewC","_NativeViewD","NativeViewD","_NativeViewE","NativeViewE","_NativeViewF","NativeViewF","_NativeViewG","NativeViewG","_NativeViewH","NativeViewH","_NativeViewI","NativeViewI","_NativeViewJ","NativeViewJ","_getRequireWildcardCache","WeakMap","r","t","__esModule","default","has","n","__proto__","a","getOwnPropertyDescriptor","u","i","set","foo","bar"],"sources":["../../../../src/__fixtures__/project/code/$exports-output.ts"],"sourcesContent":["export * as a from \"a\";\nexport * as b from \"./b.mjs\";\nexport * as c from \"./c.mjs\";\nexport * as d from \"./d\";\nexport * as e from \"./e.story.mjs\";\nexport * as f from \"../f.mjs\";\nexport * as pac from \"../index.mjs\";\nexport * as pak from \"../index.mjs\";\nexport * as pax from \"../index.mjs\";\nexport { a as a1 } from \"./a.mjs\";\nexport * from \"./b.mjs\";\nexport type { A } from \"./a\";\nexport const foo = \"foo\";\nconst bar = \"bar\";\nexport { bar };\nexport * as NativeLibA from \"./NativeMyLib\";\nexport * as NativeLibB from \"../NativeMyLib\";\nexport * as NativeLibC from \"./NativeMyLib.ts\";\nexport * as NativeLibD from \"../NativeMyLib.ts\";\nexport * as NativeLibE from \"./NativeMyLib.tsx\";\nexport * as NativeLibF from \"../NativeMyLib.tsx\";\nexport * as NativeLibG from \"./NativeMyLib.js\";\nexport * as NativeLibH from \"../NativeMyLib.js\";\nexport * as NativeLibI from \"./NativeMyLib.jsx\";\nexport * as NativeLibJ from \"../NativeMyLib.jsx\";\nexport * as NativeViewA from \"./MyNativeComponent\";\nexport * as NativeViewB from \"../MyNativeComponent\";\nexport * as NativeViewC from \"./MyNativeComponent.ts\";\nexport * as NativeViewD from \"../MyNativeComponent.ts\";\nexport * as NativeViewE from \"./MyNativeComponent.tsx\";\nexport * as NativeViewF from \"../MyNativeComponent.tsx\";\nexport * as NativeViewG from \"./MyNativeComponent.js\";\nexport * as NativeViewH from \"../MyNativeComponent.js\";\nexport * as NativeViewI from \"./MyNativeComponent.jsx\";\nexport * as NativeViewJ from \"../MyNativeComponent.jsx\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,IAAAA,EAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAwBC,OAAA,CAAAC,CAAA,GAAAJ,EAAA;AAAxBK,MAAA,CAAAC,IAAA,CAAAN,EAAA,EAAAO,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAL,OAAA,IAAAA,OAAA,CAAAK,GAAA,MAAAR,EAAA,CAAAQ,GAAA;EAAAH,MAAA,CAAAQ,cAAA,CAAAV,OAAA,EAAAK,GAAA;IAAAM,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAf,EAAA,CAAAQ,GAAA;IAAA;EAAA;AAAA;AAAwB,IAAAQ,EAAA,GAAAf,uBAAA,CAAAC,OAAA;AAAAC,OAAA,CAAAc,CAAA,GAAAD,EAAA;AAAA,IAAAE,EAAA,GAAAjB,uBAAA,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
-
require("../
|
|
10
|
-
require("./
|
|
11
|
-
require("../
|
|
12
|
-
require("./
|
|
13
|
-
require("../
|
|
4
|
+
require("./NativeMyLib");
|
|
5
|
+
require("../NativeMyLib");
|
|
6
|
+
require("./NativeMyLib.ts");
|
|
7
|
+
require("../NativeMyLib.ts");
|
|
8
|
+
require("./NativeMyLib.tsx");
|
|
9
|
+
require("../NativeMyLib.tsx");
|
|
10
|
+
require("./NativeMyLib.js");
|
|
11
|
+
require("../NativeMyLib.js");
|
|
12
|
+
require("./NativeMyLib.jsx");
|
|
13
|
+
require("../NativeMyLib.jsx");
|
|
14
14
|
require("./MyNativeComponent");
|
|
15
15
|
require("../MyNativeComponent");
|
|
16
16
|
require("./MyNativeComponent.ts");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"$imports-input.js","names":["require"],"sources":["../../../../src/__fixtures__/project/code/$imports-input.ts"],"sourcesContent":["import \"./a\";\nimport a from \"a\";\nimport b from \"./b\";\nimport c from \"./c\";\nimport d from \"./d\";\nimport e from \"./e.story\";\nimport f from \"../f\";\nimport pac from \"..\";\nimport pak from \"../\";\nimport pax from \"../index\";\n\nimport { a as a1 } from \"./a\";\nimport * as b1 from \"./b\";\nimport something, { c as c1 } from \"./c\";\n\nimport type { A } from \"./a\";\n\nimport \"./
|
|
1
|
+
{"version":3,"file":"$imports-input.js","names":["require"],"sources":["../../../../src/__fixtures__/project/code/$imports-input.ts"],"sourcesContent":["import \"./a\";\nimport a from \"a\";\nimport b from \"./b\";\nimport c from \"./c\";\nimport d from \"./d\";\nimport e from \"./e.story\";\nimport f from \"../f\";\nimport pac from \"..\";\nimport pak from \"../\";\nimport pax from \"../index\";\n\nimport { a as a1 } from \"./a\";\nimport * as b1 from \"./b\";\nimport something, { c as c1 } from \"./c\";\n\nimport type { A } from \"./a\";\n\nimport \"./NativeMyLib\";\nimport \"../NativeMyLib\";\nimport \"./NativeMyLib.ts\";\nimport \"../NativeMyLib.ts\";\nimport \"./NativeMyLib.tsx\";\nimport \"../NativeMyLib.tsx\";\nimport \"./NativeMyLib.js\";\nimport \"../NativeMyLib.js\";\nimport \"./NativeMyLib.jsx\";\nimport \"../NativeMyLib.jsx\";\n\nimport \"./MyNativeComponent\";\nimport \"../MyNativeComponent\";\nimport \"./MyNativeComponent.ts\";\nimport \"../MyNativeComponent.ts\";\nimport \"./MyNativeComponent.tsx\";\nimport \"../MyNativeComponent.tsx\";\nimport \"./MyNativeComponent.js\";\nimport \"../MyNativeComponent.js\";\nimport \"./MyNativeComponent.jsx\";\nimport \"../MyNativeComponent.jsx\";\n"],"mappings":";;AAAAA,OAAA;AAiBAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AAEAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA","ignoreList":[]}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
require("./a.mjs");
|
|
4
|
-
require("./
|
|
5
|
-
require("../
|
|
6
|
-
require("./
|
|
7
|
-
require("../
|
|
8
|
-
require("./
|
|
9
|
-
require("../
|
|
10
|
-
require("./
|
|
11
|
-
require("../
|
|
12
|
-
require("./
|
|
13
|
-
require("../
|
|
4
|
+
require("./NativeMyLib");
|
|
5
|
+
require("../NativeMyLib");
|
|
6
|
+
require("./NativeMyLib.ts");
|
|
7
|
+
require("../NativeMyLib.ts");
|
|
8
|
+
require("./NativeMyLib.tsx");
|
|
9
|
+
require("../NativeMyLib.tsx");
|
|
10
|
+
require("./NativeMyLib.js");
|
|
11
|
+
require("../NativeMyLib.js");
|
|
12
|
+
require("./NativeMyLib.jsx");
|
|
13
|
+
require("../NativeMyLib.jsx");
|
|
14
14
|
require("./MyNativeComponent");
|
|
15
15
|
require("../MyNativeComponent");
|
|
16
16
|
require("./MyNativeComponent.ts");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"$imports-output.js","names":["require"],"sources":["../../../../src/__fixtures__/project/code/$imports-output.ts"],"sourcesContent":["import \"./a.mjs\";\nimport a from \"a\";\nimport b from \"./b.mjs\";\nimport c from \"./c.mjs\";\nimport d from \"./d\";\nimport e from \"./e.story.mjs\";\nimport f from \"../f.mjs\";\nimport pac from \"../index.mjs\";\nimport pak from \"../index.mjs\";\nimport pax from \"../index.mjs\";\nimport { a as a1 } from \"./a.mjs\";\nimport * as b1 from \"./b.mjs\";\nimport something, { c as c1 } from \"./c.mjs\";\nimport type { A } from \"./a\";\nimport \"./
|
|
1
|
+
{"version":3,"file":"$imports-output.js","names":["require"],"sources":["../../../../src/__fixtures__/project/code/$imports-output.ts"],"sourcesContent":["import \"./a.mjs\";\nimport a from \"a\";\nimport b from \"./b.mjs\";\nimport c from \"./c.mjs\";\nimport d from \"./d\";\nimport e from \"./e.story.mjs\";\nimport f from \"../f.mjs\";\nimport pac from \"../index.mjs\";\nimport pak from \"../index.mjs\";\nimport pax from \"../index.mjs\";\nimport { a as a1 } from \"./a.mjs\";\nimport * as b1 from \"./b.mjs\";\nimport something, { c as c1 } from \"./c.mjs\";\nimport type { A } from \"./a\";\nimport \"./NativeMyLib\";\nimport \"../NativeMyLib\";\nimport \"./NativeMyLib.ts\";\nimport \"../NativeMyLib.ts\";\nimport \"./NativeMyLib.tsx\";\nimport \"../NativeMyLib.tsx\";\nimport \"./NativeMyLib.js\";\nimport \"../NativeMyLib.js\";\nimport \"./NativeMyLib.jsx\";\nimport \"../NativeMyLib.jsx\";\nimport \"./MyNativeComponent\";\nimport \"../MyNativeComponent\";\nimport \"./MyNativeComponent.ts\";\nimport \"../MyNativeComponent.ts\";\nimport \"./MyNativeComponent.tsx\";\nimport \"../MyNativeComponent.tsx\";\nimport \"./MyNativeComponent.js\";\nimport \"../MyNativeComponent.js\";\nimport \"./MyNativeComponent.jsx\";\nimport \"../MyNativeComponent.jsx\";\n"],"mappings":";;AAAAA,OAAA;AAcAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MyNativeComponent.js","names":[],"sources":["../../../../src/__fixtures__/project/code/MyNativeComponent.tsx"],"sourcesContent":[""],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeMyLib.js","names":[],"sources":["../../../../src/__fixtures__/project/code/NativeMyLib.tsx"],"sourcesContent":[""],"mappings":"","ignoreList":[]}
|
|
@@ -8,6 +8,13 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
8
8
|
_globals.it.each(['imports', 'exports'])(`adds extension to %s`, async name => {
|
|
9
9
|
const filepath = _nodePath.default.resolve(__dirname, `../__fixtures__/project/code/$${name}-input.ts`);
|
|
10
10
|
const result = await (0, _core.transformFileAsync)(filepath, {
|
|
11
|
+
caller: {
|
|
12
|
+
name: 'test',
|
|
13
|
+
supportsStaticESM: false,
|
|
14
|
+
rewriteImportExtensions: true,
|
|
15
|
+
jsxRuntime: 'automatic',
|
|
16
|
+
codegenEnabled: true
|
|
17
|
+
},
|
|
11
18
|
configFile: false,
|
|
12
19
|
babelrc: false,
|
|
13
20
|
plugins: ['@babel/plugin-syntax-typescript', [require.resolve('../babel.ts'), {
|
|
@@ -17,4 +24,4 @@ _globals.it.each(['imports', 'exports'])(`adds extension to %s`, async name => {
|
|
|
17
24
|
const expected = await _nodeFs.default.promises.readFile(_nodePath.default.resolve(__dirname, `../__fixtures__/project/code/$${name}-output.ts`), 'utf8');
|
|
18
25
|
(0, _globals.expect)(result?.code).toEqual(expected.trim());
|
|
19
26
|
});
|
|
20
|
-
//# sourceMappingURL=
|
|
27
|
+
//# sourceMappingURL=babel.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"babel.test.js","names":["_globals","require","_core","_nodeFs","_interopRequireDefault","_nodePath","e","__esModule","default","it","each","name","filepath","path","resolve","__dirname","result","transformFileAsync","caller","supportsStaticESM","rewriteImportExtensions","jsxRuntime","codegenEnabled","configFile","babelrc","plugins","extension","expected","fs","promises","readFile","expect","code","toEqual","trim"],"sources":["../../src/__tests__/babel.test.ts"],"sourcesContent":["import { expect, it } from '@jest/globals';\nimport { transformFileAsync } from '@babel/core';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nit.each(['imports', 'exports'])(`adds extension to %s`, async (name) => {\n const filepath = path.resolve(\n __dirname,\n `../__fixtures__/project/code/$${name}-input.ts`\n );\n\n const result = await transformFileAsync(filepath, {\n caller: {\n name: 'test',\n supportsStaticESM: false,\n rewriteImportExtensions: true,\n jsxRuntime: 'automatic',\n codegenEnabled: true,\n },\n configFile: false,\n babelrc: false,\n plugins: [\n '@babel/plugin-syntax-typescript',\n [require.resolve('../babel.ts'), { extension: 'mjs' }],\n ],\n });\n\n const expected = await fs.promises.readFile(\n path.resolve(__dirname, `../__fixtures__/project/code/$${name}-output.ts`),\n 'utf8'\n );\n\n expect(result?.code).toEqual(expected.trim());\n});\n"],"mappings":";;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,SAAA,GAAAD,sBAAA,CAAAH,OAAA;AAA6B,SAAAG,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE7BG,WAAE,CAACC,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,sBAAsB,EAAE,MAAOC,IAAI,IAAK;EACtE,MAAMC,QAAQ,GAAGC,iBAAI,CAACC,OAAO,CAC3BC,SAAS,EACT,iCAAiCJ,IAAI,WACvC,CAAC;EAED,MAAMK,MAAM,GAAG,MAAM,IAAAC,wBAAkB,EAACL,QAAQ,EAAE;IAChDM,MAAM,EAAE;MACNP,IAAI,EAAE,MAAM;MACZQ,iBAAiB,EAAE,KAAK;MACxBC,uBAAuB,EAAE,IAAI;MAC7BC,UAAU,EAAE,WAAW;MACvBC,cAAc,EAAE;IAClB,CAAC;IACDC,UAAU,EAAE,KAAK;IACjBC,OAAO,EAAE,KAAK;IACdC,OAAO,EAAE,CACP,iCAAiC,EACjC,CAACxB,OAAO,CAACa,OAAO,CAAC,aAAa,CAAC,EAAE;MAAEY,SAAS,EAAE;IAAM,CAAC,CAAC;EAE1D,CAAC,CAAC;EAEF,MAAMC,QAAQ,GAAG,MAAMC,eAAE,CAACC,QAAQ,CAACC,QAAQ,CACzCjB,iBAAI,CAACC,OAAO,CAACC,SAAS,EAAE,iCAAiCJ,IAAI,YAAY,CAAC,EAC1E,MACF,CAAC;EAED,IAAAoB,eAAM,EAACf,MAAM,EAAEgB,IAAI,CAAC,CAACC,OAAO,CAACN,QAAQ,CAACO,IAAI,CAAC,CAAC,CAAC;AAC/C,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _globals = require("@jest/globals");
|
|
4
|
+
var _fsExtra = require("fs-extra");
|
|
5
|
+
var _mockFs = _interopRequireDefault(require("mock-fs"));
|
|
6
|
+
var _mockStdin = require("mock-stdin");
|
|
7
|
+
var _path = require("path");
|
|
8
|
+
var _init = require("../init");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
let io;
|
|
11
|
+
const root = '/path/to/library';
|
|
12
|
+
const enter = '\x0D';
|
|
13
|
+
const waitFor = async callback => {
|
|
14
|
+
const interval = 10;
|
|
15
|
+
let timeout = 50;
|
|
16
|
+
return new Promise((resolve, reject) => {
|
|
17
|
+
const intervalId = setInterval(() => {
|
|
18
|
+
try {
|
|
19
|
+
callback();
|
|
20
|
+
clearInterval(intervalId);
|
|
21
|
+
resolve(undefined);
|
|
22
|
+
} catch (error) {
|
|
23
|
+
if (timeout <= 0) {
|
|
24
|
+
clearInterval(intervalId);
|
|
25
|
+
reject(error);
|
|
26
|
+
}
|
|
27
|
+
timeout -= interval;
|
|
28
|
+
}
|
|
29
|
+
}, interval);
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
(0, _globals.beforeEach)(() => {
|
|
33
|
+
io = (0, _mockStdin.stdin)();
|
|
34
|
+
(0, _mockFs.default)({
|
|
35
|
+
[root]: {
|
|
36
|
+
'package.json': JSON.stringify({
|
|
37
|
+
name: 'library',
|
|
38
|
+
version: '1.0.0'
|
|
39
|
+
}),
|
|
40
|
+
'src': {
|
|
41
|
+
'index.ts': "export default 'hello world';"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
(0, _globals.afterEach)(() => {
|
|
47
|
+
io?.restore();
|
|
48
|
+
_mockFs.default.restore();
|
|
49
|
+
_globals.jest.restoreAllMocks();
|
|
50
|
+
});
|
|
51
|
+
(0, _globals.it)('initializes the configuration', async () => {
|
|
52
|
+
_globals.jest.spyOn(process.stdout, 'write').mockImplementation(() => true);
|
|
53
|
+
process.chdir(root);
|
|
54
|
+
const run = async () => {
|
|
55
|
+
await waitFor(() => {
|
|
56
|
+
const lastCall = process.stdout.write.mock.lastCall;
|
|
57
|
+
if (lastCall == null) {
|
|
58
|
+
throw new Error('No output');
|
|
59
|
+
}
|
|
60
|
+
if (/The working directory is not clean/.test(String(lastCall[0]))) {
|
|
61
|
+
io?.send('y');
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
await waitFor(() => (0, _globals.expect)(process.stdout.write).toHaveBeenLastCalledWith(_globals.expect.stringMatching('Where are your source files?')));
|
|
65
|
+
io?.send(enter);
|
|
66
|
+
await waitFor(() => (0, _globals.expect)(process.stdout.write).toHaveBeenLastCalledWith(_globals.expect.stringMatching('Where do you want to generate the output files?')));
|
|
67
|
+
io?.send(enter);
|
|
68
|
+
await waitFor(() => (0, _globals.expect)(process.stdout.write).toHaveBeenLastCalledWith(_globals.expect.stringMatching('Which targets do you want to build?')));
|
|
69
|
+
io?.send(enter);
|
|
70
|
+
await waitFor(() => (0, _globals.expect)(process.stdout.write).toHaveBeenLastCalledWith(_globals.expect.stringMatching("You have enabled 'typescript' compilation, but we couldn't find a 'tsconfig.json' in project root")));
|
|
71
|
+
io?.send(enter);
|
|
72
|
+
};
|
|
73
|
+
await Promise.all([run(), (0, _init.init)()]);
|
|
74
|
+
(0, _globals.expect)(process.stdout.write).toHaveBeenLastCalledWith(_globals.expect.stringMatching('configured successfully!'));
|
|
75
|
+
(0, _globals.expect)(await (0, _fsExtra.readFile)((0, _path.join)(root, 'package.json'), 'utf8')).toMatchSnapshot();
|
|
76
|
+
(0, _globals.expect)(await (0, _fsExtra.readFile)((0, _path.join)(root, 'tsconfig.json'), 'utf8')).toMatchSnapshot();
|
|
77
|
+
});
|
|
78
|
+
//# sourceMappingURL=init.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.test.js","names":["_globals","require","_fsExtra","_mockFs","_interopRequireDefault","_mockStdin","_path","_init","e","__esModule","default","io","root","enter","waitFor","callback","interval","timeout","Promise","resolve","reject","intervalId","setInterval","clearInterval","undefined","error","beforeEach","stdin","mockFs","JSON","stringify","name","version","afterEach","restore","jest","restoreAllMocks","it","spyOn","process","stdout","mockImplementation","chdir","run","lastCall","write","mock","Error","test","String","send","expect","toHaveBeenLastCalledWith","stringMatching","all","init","readFile","join","toMatchSnapshot"],"sources":["../../src/__tests__/init.test.ts"],"sourcesContent":["import { afterEach, beforeEach, expect, it, jest } from '@jest/globals';\nimport { readFile } from 'fs-extra';\nimport mockFs from 'mock-fs';\nimport { stdin } from 'mock-stdin';\nimport { join } from 'path';\nimport { init } from '../init';\n\nlet io: ReturnType<typeof stdin> | undefined;\n\nconst root = '/path/to/library';\n\nconst enter = '\\x0D';\n\nconst waitFor = async (callback: () => void) => {\n const interval = 10;\n\n let timeout = 50;\n\n return new Promise((resolve, reject) => {\n const intervalId = setInterval(() => {\n try {\n callback();\n clearInterval(intervalId);\n resolve(undefined);\n } catch (error) {\n if (timeout <= 0) {\n clearInterval(intervalId);\n reject(error);\n }\n\n timeout -= interval;\n }\n }, interval);\n });\n};\n\nbeforeEach(() => {\n io = stdin();\n\n mockFs({\n [root]: {\n 'package.json': JSON.stringify({\n name: 'library',\n version: '1.0.0',\n }),\n 'src': {\n 'index.ts': \"export default 'hello world';\",\n },\n },\n });\n});\n\nafterEach(() => {\n io?.restore();\n mockFs.restore();\n jest.restoreAllMocks();\n});\n\nit('initializes the configuration', async () => {\n jest.spyOn(process.stdout, 'write').mockImplementation(() => true);\n\n process.chdir(root);\n\n const run = async () => {\n await waitFor(() => {\n const lastCall = (process.stdout.write as jest.Mock).mock.lastCall;\n\n if (lastCall == null) {\n throw new Error('No output');\n }\n\n if (/The working directory is not clean/.test(String(lastCall[0]))) {\n io?.send('y');\n }\n });\n\n await waitFor(() =>\n expect(process.stdout.write).toHaveBeenLastCalledWith(\n expect.stringMatching('Where are your source files?')\n )\n );\n\n io?.send(enter);\n\n await waitFor(() =>\n expect(process.stdout.write).toHaveBeenLastCalledWith(\n expect.stringMatching('Where do you want to generate the output files?')\n )\n );\n\n io?.send(enter);\n\n await waitFor(() =>\n expect(process.stdout.write).toHaveBeenLastCalledWith(\n expect.stringMatching('Which targets do you want to build?')\n )\n );\n\n io?.send(enter);\n\n await waitFor(() =>\n expect(process.stdout.write).toHaveBeenLastCalledWith(\n expect.stringMatching(\n \"You have enabled 'typescript' compilation, but we couldn't find a 'tsconfig.json' in project root\"\n )\n )\n );\n\n io?.send(enter);\n };\n\n await Promise.all([run(), init()]);\n\n expect(process.stdout.write).toHaveBeenLastCalledWith(\n expect.stringMatching('configured successfully!')\n );\n\n expect(await readFile(join(root, 'package.json'), 'utf8')).toMatchSnapshot();\n\n expect(await readFile(join(root, 'tsconfig.json'), 'utf8')).toMatchSnapshot();\n});\n"],"mappings":";;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAA+B,SAAAG,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE/B,IAAIG,EAAwC;AAE5C,MAAMC,IAAI,GAAG,kBAAkB;AAE/B,MAAMC,KAAK,GAAG,MAAM;AAEpB,MAAMC,OAAO,GAAG,MAAOC,QAAoB,IAAK;EAC9C,MAAMC,QAAQ,GAAG,EAAE;EAEnB,IAAIC,OAAO,GAAG,EAAE;EAEhB,OAAO,IAAIC,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;IACtC,MAAMC,UAAU,GAAGC,WAAW,CAAC,MAAM;MACnC,IAAI;QACFP,QAAQ,CAAC,CAAC;QACVQ,aAAa,CAACF,UAAU,CAAC;QACzBF,OAAO,CAACK,SAAS,CAAC;MACpB,CAAC,CAAC,OAAOC,KAAK,EAAE;QACd,IAAIR,OAAO,IAAI,CAAC,EAAE;UAChBM,aAAa,CAACF,UAAU,CAAC;UACzBD,MAAM,CAACK,KAAK,CAAC;QACf;QAEAR,OAAO,IAAID,QAAQ;MACrB;IACF,CAAC,EAAEA,QAAQ,CAAC;EACd,CAAC,CAAC;AACJ,CAAC;AAED,IAAAU,m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","ignoreList":[]}
|
package/lib/build.js
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.args = void 0;
|
|
7
|
+
exports.build = build;
|
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
|
9
|
+
var _kleur = _interopRequireDefault(require("kleur"));
|
|
10
|
+
var logger = _interopRequireWildcard(require("./utils/logger"));
|
|
11
|
+
var _commonjs = _interopRequireDefault(require("./targets/commonjs"));
|
|
12
|
+
var _module = _interopRequireDefault(require("./targets/module"));
|
|
13
|
+
var _typescript = _interopRequireDefault(require("./targets/typescript"));
|
|
14
|
+
var _codegen = _interopRequireDefault(require("./targets/codegen"));
|
|
15
|
+
var _custom = _interopRequireDefault(require("./targets/custom"));
|
|
16
|
+
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
17
|
+
var _loadConfig = require("./utils/loadConfig");
|
|
18
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
19
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
|
+
const args = exports.args = {
|
|
22
|
+
target: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
description: 'The target to build',
|
|
25
|
+
choices: ['commonjs', 'module', 'typescript', 'codegen']
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
async function build(argv) {
|
|
29
|
+
const root = process.cwd();
|
|
30
|
+
const projectPackagePath = _path.default.resolve(root, 'package.json');
|
|
31
|
+
if (!(await _fsExtra.default.pathExists(projectPackagePath))) {
|
|
32
|
+
throw new Error(`Couldn't find a 'package.json' file in '${root}'. Are you in a project folder?`);
|
|
33
|
+
}
|
|
34
|
+
const result = await (0, _loadConfig.loadConfig)();
|
|
35
|
+
if (!result?.config) {
|
|
36
|
+
logger.error(`No configuration found. Run '${argv.$0} init' to create one automatically.`);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
const options = result.config;
|
|
40
|
+
if (!options.targets?.length) {
|
|
41
|
+
logger.error(`No targets found in the configuration in '${_path.default.relative(root, result.filepath)}'.`);
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
const source = options.source;
|
|
45
|
+
if (!source) {
|
|
46
|
+
logger.error(`No source option found in the configuration in '${_path.default.relative(root, result.filepath)}'.`);
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
const output = options.output;
|
|
50
|
+
if (!output) {
|
|
51
|
+
logger.error(`No source option found in the configuration in '${_path.default.relative(root, result.filepath)}'.`);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
const exclude = options.exclude ?? '**/{__tests__,__fixtures__,__mocks__}/**';
|
|
55
|
+
const commonjs = options.targets?.some(t => Array.isArray(t) ? t[0] === 'commonjs' : t === 'commonjs');
|
|
56
|
+
const module = options.targets?.some(t => Array.isArray(t) ? t[0] === 'module' : t === 'module');
|
|
57
|
+
const variants = {
|
|
58
|
+
commonjs,
|
|
59
|
+
module
|
|
60
|
+
};
|
|
61
|
+
if (argv.target != null) {
|
|
62
|
+
buildTarget({
|
|
63
|
+
root,
|
|
64
|
+
target: argv.target,
|
|
65
|
+
source,
|
|
66
|
+
output,
|
|
67
|
+
exclude,
|
|
68
|
+
options,
|
|
69
|
+
variants
|
|
70
|
+
});
|
|
71
|
+
} else {
|
|
72
|
+
for (const target of options.targets) {
|
|
73
|
+
buildTarget({
|
|
74
|
+
root,
|
|
75
|
+
target,
|
|
76
|
+
source,
|
|
77
|
+
output,
|
|
78
|
+
exclude,
|
|
79
|
+
options,
|
|
80
|
+
variants
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
async function buildTarget({
|
|
86
|
+
root,
|
|
87
|
+
target,
|
|
88
|
+
source,
|
|
89
|
+
output,
|
|
90
|
+
exclude,
|
|
91
|
+
options,
|
|
92
|
+
variants
|
|
93
|
+
}) {
|
|
94
|
+
const targetName = Array.isArray(target) ? target[0] : target;
|
|
95
|
+
const targetOptions = Array.isArray(target) ? target[1] : undefined;
|
|
96
|
+
const report = logger.grouped(targetName);
|
|
97
|
+
switch (targetName) {
|
|
98
|
+
case 'commonjs':
|
|
99
|
+
await (0, _commonjs.default)({
|
|
100
|
+
root,
|
|
101
|
+
source: _path.default.resolve(root, source),
|
|
102
|
+
output: _path.default.resolve(root, output, 'commonjs'),
|
|
103
|
+
exclude,
|
|
104
|
+
options: targetOptions,
|
|
105
|
+
variants,
|
|
106
|
+
report
|
|
107
|
+
});
|
|
108
|
+
break;
|
|
109
|
+
case 'module':
|
|
110
|
+
await (0, _module.default)({
|
|
111
|
+
root,
|
|
112
|
+
source: _path.default.resolve(root, source),
|
|
113
|
+
output: _path.default.resolve(root, output, 'module'),
|
|
114
|
+
exclude,
|
|
115
|
+
options: targetOptions,
|
|
116
|
+
variants,
|
|
117
|
+
report
|
|
118
|
+
});
|
|
119
|
+
break;
|
|
120
|
+
case 'typescript':
|
|
121
|
+
{
|
|
122
|
+
const esm = options.targets?.some(t => {
|
|
123
|
+
if (Array.isArray(t)) {
|
|
124
|
+
const [name, options] = t;
|
|
125
|
+
if (name === 'module') {
|
|
126
|
+
return options && 'esm' in options && options?.esm;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return false;
|
|
130
|
+
}) ?? false;
|
|
131
|
+
await (0, _typescript.default)({
|
|
132
|
+
root,
|
|
133
|
+
source: _path.default.resolve(root, source),
|
|
134
|
+
output: _path.default.resolve(root, output, 'typescript'),
|
|
135
|
+
options: targetOptions,
|
|
136
|
+
esm,
|
|
137
|
+
variants,
|
|
138
|
+
report
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
break;
|
|
142
|
+
case 'codegen':
|
|
143
|
+
await (0, _codegen.default)({
|
|
144
|
+
root,
|
|
145
|
+
source: _path.default.resolve(root, source),
|
|
146
|
+
output: _path.default.resolve(root, output, 'typescript'),
|
|
147
|
+
report
|
|
148
|
+
});
|
|
149
|
+
break;
|
|
150
|
+
case 'custom':
|
|
151
|
+
await (0, _custom.default)({
|
|
152
|
+
options: targetOptions,
|
|
153
|
+
source: _path.default.resolve(root, source),
|
|
154
|
+
report,
|
|
155
|
+
root
|
|
156
|
+
});
|
|
157
|
+
break;
|
|
158
|
+
default:
|
|
159
|
+
logger.error(`Invalid target ${_kleur.default.blue(targetName)}.`);
|
|
160
|
+
process.exit(1);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=build.js.map
|
package/lib/build.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","names":["_path","_interopRequireDefault","require","_kleur","logger","_interopRequireWildcard","_commonjs","_module","_typescript","_codegen","_custom","_fsExtra","_loadConfig","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","args","exports","target","type","description","choices","build","argv","root","process","cwd","projectPackagePath","path","resolve","fs","pathExists","Error","result","loadConfig","config","error","$0","exit","options","targets","length","relative","filepath","source","output","exclude","commonjs","some","Array","isArray","module","variants","buildTarget","targetName","targetOptions","undefined","report","grouped","buildCommonJS","buildModule","esm","name","buildTypescript","buildCodegen","customTarget","kleur","blue"],"sources":["../src/build.ts"],"sourcesContent":["import path from 'path';\nimport kleur from 'kleur';\nimport * as logger from './utils/logger';\nimport buildCommonJS from './targets/commonjs';\nimport buildModule from './targets/module';\nimport buildTypescript from './targets/typescript';\nimport buildCodegen from './targets/codegen';\nimport customTarget from './targets/custom';\nimport { type Options, type Target } from './types';\nimport fs from 'fs-extra';\nimport { loadConfig } from './utils/loadConfig';\nimport yargs from 'yargs';\n\nexport const args = {\n target: {\n type: 'string',\n description: 'The target to build',\n choices: ['commonjs', 'module', 'typescript', 'codegen'] satisfies Target[],\n },\n} satisfies Record<'target', yargs.Options>;\n\ntype Argv = {\n $0: string;\n target?: Target;\n};\n\nexport async function build(argv: Argv) {\n const root = process.cwd();\n\n const projectPackagePath = path.resolve(root, 'package.json');\n\n if (!(await fs.pathExists(projectPackagePath))) {\n throw new Error(\n `Couldn't find a 'package.json' file in '${root}'. Are you in a project folder?`\n );\n }\n\n const result = await loadConfig();\n\n if (!result?.config) {\n logger.error(\n `No configuration found. Run '${argv.$0} init' to create one automatically.`\n );\n process.exit(1);\n }\n\n const options: Options = result!.config;\n\n if (!options.targets?.length) {\n logger.error(\n `No targets found in the configuration in '${path.relative(\n root,\n result!.filepath\n )}'.`\n );\n process.exit(1);\n }\n\n const source = options.source;\n\n if (!source) {\n logger.error(\n `No source option found in the configuration in '${path.relative(\n root,\n result!.filepath\n )}'.`\n );\n process.exit(1);\n }\n\n const output = options.output;\n\n if (!output) {\n logger.error(\n `No source option found in the configuration in '${path.relative(\n root,\n result!.filepath\n )}'.`\n );\n process.exit(1);\n }\n\n const exclude = options.exclude ?? '**/{__tests__,__fixtures__,__mocks__}/**';\n\n const commonjs = options.targets?.some((t) =>\n Array.isArray(t) ? t[0] === 'commonjs' : t === 'commonjs'\n );\n\n const module = options.targets?.some((t) =>\n Array.isArray(t) ? t[0] === 'module' : t === 'module'\n );\n\n const variants = {\n commonjs,\n module,\n };\n\n if (argv.target != null) {\n buildTarget({\n root,\n target: argv.target,\n source,\n output,\n exclude,\n options,\n variants,\n });\n } else {\n for (const target of options.targets!) {\n buildTarget({\n root,\n target,\n source,\n output,\n exclude,\n options,\n variants,\n });\n }\n }\n}\n\nasync function buildTarget({\n root,\n target,\n source,\n output,\n exclude,\n options,\n variants,\n}: {\n root: string;\n target: Exclude<Options['targets'], undefined>[number];\n source: string;\n output: string;\n exclude: string;\n options: Options;\n variants: {\n commonjs?: boolean;\n module?: boolean;\n };\n}) {\n const targetName = Array.isArray(target) ? target[0] : target;\n const targetOptions = Array.isArray(target) ? target[1] : undefined;\n\n const report = logger.grouped(targetName);\n\n switch (targetName) {\n case 'commonjs':\n await buildCommonJS({\n root,\n source: path.resolve(root, source),\n output: path.resolve(root, output, 'commonjs'),\n exclude,\n options: targetOptions,\n variants,\n report,\n });\n break;\n case 'module':\n await buildModule({\n root,\n source: path.resolve(root, source),\n output: path.resolve(root, output, 'module'),\n exclude,\n options: targetOptions,\n variants,\n report,\n });\n break;\n case 'typescript':\n {\n const esm =\n options.targets?.some((t) => {\n if (Array.isArray(t)) {\n const [name, options] = t;\n\n if (name === 'module') {\n return options && 'esm' in options && options?.esm;\n }\n }\n\n return false;\n }) ?? false;\n\n await buildTypescript({\n root,\n source: path.resolve(root, source),\n output: path.resolve(root, output, 'typescript'),\n options: targetOptions,\n esm,\n variants,\n report,\n });\n }\n break;\n case 'codegen':\n await buildCodegen({\n root,\n source: path.resolve(root, source),\n output: path.resolve(root, output, 'typescript'),\n report,\n });\n break;\n case 'custom':\n await customTarget({\n options: targetOptions,\n source: path.resolve(root, source),\n report,\n root,\n });\n break;\n default:\n logger.error(`Invalid target ${kleur.blue(targetName)}.`);\n process.exit(1);\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA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