react-native-builder-bob 0.40.5 → 0.40.6

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.
@@ -33,11 +33,14 @@ async function build({
33
33
  throw new Error("Couldn't find the 'type' value in 'codegenConfig'. Please check your package.json's 'codegenConfig' property and make sure 'type' is defined. https://reactnative.dev/docs/the-new-architecture/using-codegen#configuring-codegen");
34
34
  }
35
35
  try {
36
- await (0, _spawn.spawn)('npx', ['@react-native-community/cli', 'codegen']);
36
+ const codegenCLISupportsSource = await (0, _removeCodegenAppLevelCode.getCodegenCLISourceSupport)();
37
+ await (0, _spawn.spawn)('npx', ['@react-native-community/cli', 'codegen', ...(codegenCLISupportsSource ? ['--source', 'library'] : [])]);
37
38
  if (codegenType === 'modules' || codegenType === 'all') {
38
39
  await (0, _patchCodegenAndroidPackage.patchCodegenAndroidPackage)(root, packageJson, report);
39
40
  }
40
- await (0, _removeCodegenAppLevelCode.removeCodegenAppLevelCode)(root, packageJson);
41
+ if (!codegenCLISupportsSource) {
42
+ await (0, _removeCodegenAppLevelCode.removeCodegenAppLevelCode)(root, packageJson);
43
+ }
41
44
  report.success('Generated native code with codegen');
42
45
  } catch (e) {
43
46
  if (e != null && typeof e === 'object') {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_kleur","_interopRequireDefault","require","_patchCodegenAndroidPackage","_fsExtra","_path","_del","_removeCodegenAppLevelCode","_spawn","e","__esModule","default","build","root","report","packageJsonPath","path","resolve","packageJson","fs","readJson","codegenIosPath","codegenConfig","outputDir","ios","info","kleur","blue","relative","del","codegenAndroidPath","android","codegenType","type","undefined","Error","spawn","patchCodegenAndroidPackage","removeCodegenAppLevelCode","success","stdout","error","toString","message","includes","cause"],"sources":["../../../src/targets/codegen/index.ts"],"sourcesContent":["import kleur from 'kleur';\nimport type { Input } from '../../types';\nimport { patchCodegenAndroidPackage } from './patches/patchCodegenAndroidPackage';\nimport fs from 'fs-extra';\nimport path from 'path';\nimport del from 'del';\nimport { removeCodegenAppLevelCode } from './patches/removeCodegenAppLevelCode';\nimport { spawn } from '../../utils/spawn';\n\ntype Options = Omit<Input, 'output'>;\n\nexport default async function build({ root, report }: Options) {\n const packageJsonPath = path.resolve(root, 'package.json');\n const packageJson = await fs.readJson(packageJsonPath);\n\n const codegenIosPath = packageJson.codegenConfig?.outputDir?.ios;\n if (codegenIosPath != null) {\n report.info(\n `Cleaning up previous iOS codegen native code at ${kleur.blue(\n path.relative(root, codegenIosPath)\n )}`\n );\n await del([codegenIosPath]);\n }\n\n const codegenAndroidPath = packageJson.codegenConfig?.outputDir?.android;\n if (codegenAndroidPath != null) {\n report.info(\n `Cleaning up previous Android codegen native code at ${kleur.blue(\n path.relative(root, codegenAndroidPath)\n )}`\n );\n await del([codegenAndroidPath]);\n }\n\n const codegenType = packageJson.codegenConfig?.type;\n\n if (codegenType === undefined) {\n throw new Error(\n \"Couldn't find the 'type' value in 'codegenConfig'. Please check your package.json's 'codegenConfig' property and make sure 'type' is defined. https://reactnative.dev/docs/the-new-architecture/using-codegen#configuring-codegen\"\n );\n }\n\n try {\n await spawn('npx', ['@react-native-community/cli', 'codegen']);\n\n if (codegenType === 'modules' || codegenType === 'all') {\n await patchCodegenAndroidPackage(root, packageJson, report);\n }\n await removeCodegenAppLevelCode(root, packageJson);\n\n report.success('Generated native code with codegen');\n } catch (e: unknown) {\n if (e != null && typeof e === 'object') {\n if ('stdout' in e && e.stdout != null) {\n report.error(\n `Errors found while running codegen:\\n\\n${e.stdout.toString()}`\n );\n } else if ('message' in e && typeof e.message === 'string') {\n if (\n e.message.includes(\n \"Error: Cannot find module '@react-native-community/cli/package.json'\"\n )\n ) {\n report.error(\n \"You don't have `@react-native-community/cli` in your root package's dev dependencies. Please install it and make sure it uses the same version as your application.\"\n );\n }\n }\n }\n\n throw new Error('Failed to run codegen.', { cause: e });\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;A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EW,IAAI;EAEnD,IAAID,WAAW,KAAKE,SAAS,EAAE;IAC7B,MAAM,IAAIC,KAAK,CACb,mOACF,CAAC;EACH;EAEA,IAAI;IACF,MAAM,IAAAC,YAAK,EAAC,KAAK,EAAE,CAAC,6BAA6B,EAAE,SAAS,CAAC,CAAC;IAE9D,IAAIJ,WAAW,KAAK,SAAS,IAAIA,WAAW,KAAK,KAAK,EAAE;MACtD,MAAM,IAAAK,sDAA0B,EAACxB,IAAI,EAAEK,WAAW,EAAEJ,MAAM,CAAC;IAC7D;IACA,MAAM,IAAAwB,oDAAyB,EAACzB,IAAI,EAAEK,WAAW,CAAC;IAElDJ,MAAM,CAACyB,OAAO,CAAC,oCAAoC,CAAC;EACtD,CAAC,CAAC,OAAO9B,CAAU,EAAE;IACnB,IAAIA,CAAC,IAAI,IAAI,IAAI,OAAOA,CAAC,KAAK,QAAQ,EAAE;MACtC,IAAI,QAAQ,IAAIA,CAAC,IAAIA,CAAC,CAAC+B,MAAM,IAAI,IAAI,EAAE;QACrC1B,MAAM,CAAC2B,KAAK,CACV,0CAA0ChC,CAAC,CAAC+B,MAAM,CAACE,QAAQ,CAAC,CAAC,EAC/D,CAAC;MACH,CAAC,MAAM,IAAI,SAAS,IAAIjC,CAAC,IAAI,OAAOA,CAAC,CAACkC,OAAO,KAAK,QAAQ,EAAE;QAC1D,IACElC,CAAC,CAACkC,OAAO,CAACC,QAAQ,CAChB,sEACF,CAAC,EACD;UACA9B,MAAM,CAAC2B,KAAK,CACV,qKACF,CAAC;QACH;MACF;IACF;IAEA,MAAM,IAAIN,KAAK,CAAC,wBAAwB,EAAE;MAAEU,KAAK,EAAEpC;IAAE,CAAC,CAAC;EACzD;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_kleur","_interopRequireDefault","require","_patchCodegenAndroidPackage","_fsExtra","_path","_del","_removeCodegenAppLevelCode","_spawn","e","__esModule","default","build","root","report","packageJsonPath","path","resolve","packageJson","fs","readJson","codegenIosPath","codegenConfig","outputDir","ios","info","kleur","blue","relative","del","codegenAndroidPath","android","codegenType","type","undefined","Error","codegenCLISupportsSource","getCodegenCLISourceSupport","spawn","patchCodegenAndroidPackage","removeCodegenAppLevelCode","success","stdout","error","toString","message","includes","cause"],"sources":["../../../src/targets/codegen/index.ts"],"sourcesContent":["import kleur from 'kleur';\nimport type { Input } from '../../types';\nimport { patchCodegenAndroidPackage } from './patches/patchCodegenAndroidPackage';\nimport fs from 'fs-extra';\nimport path from 'path';\nimport del from 'del';\nimport {\n getCodegenCLISourceSupport,\n removeCodegenAppLevelCode,\n} from './patches/removeCodegenAppLevelCode';\nimport { spawn } from '../../utils/spawn';\n\ntype Options = Omit<Input, 'output'>;\n\nexport default async function build({ root, report }: Options) {\n const packageJsonPath = path.resolve(root, 'package.json');\n const packageJson = await fs.readJson(packageJsonPath);\n\n const codegenIosPath = packageJson.codegenConfig?.outputDir?.ios;\n if (codegenIosPath != null) {\n report.info(\n `Cleaning up previous iOS codegen native code at ${kleur.blue(\n path.relative(root, codegenIosPath)\n )}`\n );\n await del([codegenIosPath]);\n }\n\n const codegenAndroidPath = packageJson.codegenConfig?.outputDir?.android;\n if (codegenAndroidPath != null) {\n report.info(\n `Cleaning up previous Android codegen native code at ${kleur.blue(\n path.relative(root, codegenAndroidPath)\n )}`\n );\n await del([codegenAndroidPath]);\n }\n\n const codegenType = packageJson.codegenConfig?.type;\n\n if (codegenType === undefined) {\n throw new Error(\n \"Couldn't find the 'type' value in 'codegenConfig'. Please check your package.json's 'codegenConfig' property and make sure 'type' is defined. https://reactnative.dev/docs/the-new-architecture/using-codegen#configuring-codegen\"\n );\n }\n\n try {\n const codegenCLISupportsSource = await getCodegenCLISourceSupport();\n\n await spawn('npx', [\n '@react-native-community/cli',\n 'codegen',\n ...(codegenCLISupportsSource ? ['--source', 'library'] : []),\n ]);\n\n if (codegenType === 'modules' || codegenType === 'all') {\n await patchCodegenAndroidPackage(root, packageJson, report);\n }\n\n if (!codegenCLISupportsSource) {\n await removeCodegenAppLevelCode(root, packageJson);\n }\n\n report.success('Generated native code with codegen');\n } catch (e: unknown) {\n if (e != null && typeof e === 'object') {\n if ('stdout' in e && e.stdout != null) {\n report.error(\n `Errors found while running codegen:\\n\\n${e.stdout.toString()}`\n );\n } else if ('message' in e && typeof e.message === 'string') {\n if (\n e.message.includes(\n \"Error: Cannot find module '@react-native-community/cli/package.json'\"\n )\n ) {\n report.error(\n \"You don't have `@react-native-community/cli` in your root package's dev dependencies. Please install it and make sure it uses the same version as your application.\"\n );\n }\n }\n }\n\n throw new Error('Failed to run codegen.', { cause: e });\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,2BAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,KAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,IAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,0BAAA,GAAAL,OAAA;AAIA,IAAAM,MAAA,GAAAN,OAAA;AAA0C,SAAAD,uBAAAQ,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAI3B,eAAeG,KAAKA,CAAC;EAAEC,IAAI;EAAEC;AAAgB,CAAC,EAAE;EAC7D,MAAMC,eAAe,GAAGC,aAAI,CAACC,OAAO,CAACJ,IAAI,EAAE,cAAc,CAAC;EAC1D,MAAMK,WAAW,GAAG,MAAMC,gBAAE,CAACC,QAAQ,CAACL,eAAe,CAAC;EAEtD,MAAMM,cAAc,GAAGH,WAAW,CAACI,aAAa,EAAEC,SAAS,EAAEC,GAAG;EAChE,IAAIH,cAAc,IAAI,IAAI,EAAE;IAC1BP,MAAM,CAACW,IAAI,CACT,mDAAmDC,cAAK,CAACC,IAAI,CAC3DX,aAAI,CAACY,QAAQ,CAACf,IAAI,EAAEQ,cAAc,CACpC,CA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M,IAAI,IAAI,EAAE;QACrC5B,MAAM,CAAC6B,KAAK,CACV,0CAA0ClC,CAAC,CAACiC,MAAM,CAACE,QAAQ,CAAC,CAAC,EAC/D,CAAC;MACH,CAAC,MAAM,IAAI,SAAS,IAAInC,CAAC,IAAI,OAAOA,CAAC,CAACoC,OAAO,KAAK,QAAQ,EAAE;QAC1D,IACEpC,CAAC,CAACoC,OAAO,CAACC,QAAQ,CAChB,sEACF,CAAC,EACD;UACAhC,MAAM,CAAC6B,KAAK,CACV,qKACF,CAAC;QACH;MACF;IACF;IAEA,MAAM,IAAIR,KAAK,CAAC,wBAAwB,EAAE;MAAEY,KAAK,EAAEtC;IAAE,CAAC,CAAC;EACzD;AACF","ignoreList":[]}
@@ -3,10 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.getCodegenCLISourceSupport = getCodegenCLISourceSupport;
6
7
  exports.removeCodegenAppLevelCode = removeCodegenAppLevelCode;
7
8
  var _fsExtra = _interopRequireDefault(require("fs-extra"));
8
9
  var _path = _interopRequireDefault(require("path"));
9
10
  var _patchCodegenAndroidPackage = require("./patchCodegenAndroidPackage");
11
+ var _spawn = require("../../../utils/spawn");
10
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
13
  const FILES_TO_REMOVE = ['RCTAppDependencyProvider.h', 'RCTAppDependencyProvider.mm', 'RCTModulesConformingToProtocolsProvider.h', 'RCTModulesConformingToProtocolsProvider.mm', 'RCTThirdPartyComponentsProvider.h', 'RCTThirdPartyComponentsProvider.mm', 'ReactAppDependencyProvider.podspec'];
12
14
 
@@ -41,4 +43,15 @@ packageJson) {
41
43
  const iosPromises = FILES_TO_REMOVE.map(fileName => _fsExtra.default.rm(_path.default.join(codegenIosPath, fileName)));
42
44
  await Promise.allSettled([...androidPromises, ...iosPromises]);
43
45
  }
46
+
47
+ /**
48
+ * Codegen generates a different set of files if the target is an app instead.
49
+ * The following commit adds support for a --source argument to support calling codegen as a library:
50
+ * https://github.com/facebook/react-native/commit/98b8f178110472e5fed97de80766c03b0b5e988c
51
+ * Here we just check if the --source argument is supported.
52
+ */
53
+ async function getCodegenCLISourceSupport() {
54
+ const codegenCLIHelpOutput = await (0, _spawn.spawn)('npx', ['@react-native-community/cli', 'codegen', '--help']);
55
+ return codegenCLIHelpOutput.includes('--source');
56
+ }
44
57
  //# sourceMappingURL=removeCodegenAppLevelCode.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"removeCodegenAppLevelCode.js","names":["_fsExtra","_interopRequireDefault","require","_path","_patchCodegenAndroidPackage","e","__esModule","default","FILES_TO_REMOVE","removeCodegenAppLevelCode","projectPath","packageJson","codegenAndroidPathSetting","codegenConfig","outputDir","android","Error","CODEGEN_DOCS","codegenAndroidPath","path","resolve","fs","pathExists","codegenIosPathSetting","ios","codegenIosPath","androidPromises","map","fileName","rm","join","iosPromises","Promise","allSettled"],"sources":["../../../../src/targets/codegen/patches/removeCodegenAppLevelCode.ts"],"sourcesContent":["import fs from 'fs-extra';\nimport path from 'path';\nimport { CODEGEN_DOCS } from './patchCodegenAndroidPackage';\n\nconst FILES_TO_REMOVE = [\n 'RCTAppDependencyProvider.h',\n 'RCTAppDependencyProvider.mm',\n 'RCTModulesConformingToProtocolsProvider.h',\n 'RCTModulesConformingToProtocolsProvider.mm',\n 'RCTThirdPartyComponentsProvider.h',\n 'RCTThirdPartyComponentsProvider.mm',\n 'ReactAppDependencyProvider.podspec',\n];\n\n/**\n * With React Native 0.77, calling `@react-native-community/cli codegen` generates\n * some app level source files such as `RCTAppDependencyProvider.mm`.\n * These files are supposed to be only generated for apps\n * but the cli misbehaves and generates them for all sorts of projects.\n * You can find the relevant PR here: https://github.com/facebook/react-native/pull/47650\n * This patch can be removed when this gets fixed in React Native.\n */\nexport async function removeCodegenAppLevelCode(\n projectPath: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n packageJson: any\n) {\n const codegenAndroidPathSetting: string | undefined =\n packageJson.codegenConfig?.outputDir?.android;\n if (!codegenAndroidPathSetting) {\n throw new Error(\n `Your package.json doesn't contain codegenConfig.outputDir.android. Please see ${CODEGEN_DOCS}`\n );\n }\n const codegenAndroidPath = path.resolve(\n projectPath,\n codegenAndroidPathSetting\n );\n\n if (!(await fs.pathExists(codegenAndroidPath))) {\n throw new Error(\n `The codegen android path defined in your package.json: ${codegenAndroidPath} doesnt' exist.`\n );\n }\n\n const codegenIosPathSetting: string | undefined =\n packageJson.codegenConfig?.outputDir?.ios;\n if (!codegenIosPathSetting) {\n throw new Error(\n `Your package.json doesn't contain codegenConfig.outputDir.ios. Please see ${CODEGEN_DOCS}`\n );\n }\n const codegenIosPath = path.resolve(projectPath, codegenIosPathSetting);\n\n if (!(await fs.pathExists(codegenAndroidPath))) {\n throw new Error(\n `The codegen iOS path defined in your package.json: ${codegenIosPathSetting} doesnt' exist.`\n );\n }\n\n const androidPromises = FILES_TO_REMOVE.map((fileName) =>\n fs.rm(path.join(codegenAndroidPath, fileName))\n );\n\n const iosPromises = FILES_TO_REMOVE.map((fileName) =>\n fs.rm(path.join(codegenIosPath, fileName))\n );\n\n await Promise.allSettled([...androidPromises, ...iosPromises]);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,2BAAA,GAAAF,OAAA;AAA4D,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE5D,MAAMG,eAAe,GAAG,CACtB,4BAA4B,EAC5B,6BAA6B,EAC7B,2CAA2C,EAC3C,4CAA4C,EAC5C,mCAAmC,EACnC,oCAAoC,EACpC,oCAAoC,CACrC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeC,yBAAyBA,CAC7CC,WAAmB;AACnB;AACAC,WAAgB,EAChB;EACA,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"removeCodegenAppLevelCode.js","names":["_fsExtra","_interopRequireDefault","require","_path","_patchCodegenAndroidPackage","_spawn","e","__esModule","default","FILES_TO_REMOVE","removeCodegenAppLevelCode","projectPath","packageJson","codegenAndroidPathSetting","codegenConfig","outputDir","android","Error","CODEGEN_DOCS","codegenAndroidPath","path","resolve","fs","pathExists","codegenIosPathSetting","ios","codegenIosPath","androidPromises","map","fileName","rm","join","iosPromises","Promise","allSettled","getCodegenCLISourceSupport","codegenCLIHelpOutput","spawn","includes"],"sources":["../../../../src/targets/codegen/patches/removeCodegenAppLevelCode.ts"],"sourcesContent":["import fs from 'fs-extra';\nimport path from 'path';\nimport { CODEGEN_DOCS } from './patchCodegenAndroidPackage';\nimport { spawn } from '../../../utils/spawn';\n\nconst FILES_TO_REMOVE = [\n 'RCTAppDependencyProvider.h',\n 'RCTAppDependencyProvider.mm',\n 'RCTModulesConformingToProtocolsProvider.h',\n 'RCTModulesConformingToProtocolsProvider.mm',\n 'RCTThirdPartyComponentsProvider.h',\n 'RCTThirdPartyComponentsProvider.mm',\n 'ReactAppDependencyProvider.podspec',\n];\n\n/**\n * With React Native 0.77, calling `@react-native-community/cli codegen` generates\n * some app level source files such as `RCTAppDependencyProvider.mm`.\n * These files are supposed to be only generated for apps\n * but the cli misbehaves and generates them for all sorts of projects.\n * You can find the relevant PR here: https://github.com/facebook/react-native/pull/47650\n * This patch can be removed when this gets fixed in React Native.\n */\nexport async function removeCodegenAppLevelCode(\n projectPath: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n packageJson: any\n) {\n const codegenAndroidPathSetting: string | undefined =\n packageJson.codegenConfig?.outputDir?.android;\n if (!codegenAndroidPathSetting) {\n throw new Error(\n `Your package.json doesn't contain codegenConfig.outputDir.android. Please see ${CODEGEN_DOCS}`\n );\n }\n const codegenAndroidPath = path.resolve(\n projectPath,\n codegenAndroidPathSetting\n );\n\n if (!(await fs.pathExists(codegenAndroidPath))) {\n throw new Error(\n `The codegen android path defined in your package.json: ${codegenAndroidPath} doesnt' exist.`\n );\n }\n\n const codegenIosPathSetting: string | undefined =\n packageJson.codegenConfig?.outputDir?.ios;\n if (!codegenIosPathSetting) {\n throw new Error(\n `Your package.json doesn't contain codegenConfig.outputDir.ios. Please see ${CODEGEN_DOCS}`\n );\n }\n const codegenIosPath = path.resolve(projectPath, codegenIosPathSetting);\n\n if (!(await fs.pathExists(codegenAndroidPath))) {\n throw new Error(\n `The codegen iOS path defined in your package.json: ${codegenIosPathSetting} doesnt' exist.`\n );\n }\n\n const androidPromises = FILES_TO_REMOVE.map((fileName) =>\n fs.rm(path.join(codegenAndroidPath, fileName))\n );\n\n const iosPromises = FILES_TO_REMOVE.map((fileName) =>\n fs.rm(path.join(codegenIosPath, fileName))\n );\n\n await Promise.allSettled([...androidPromises, ...iosPromises]);\n}\n\n/**\n * Codegen generates a different set of files if the target is an app instead.\n * The following commit adds support for a --source argument to support calling codegen as a library:\n * https://github.com/facebook/react-native/commit/98b8f178110472e5fed97de80766c03b0b5e988c\n * Here we just check if the --source argument is supported.\n */\nexport async function getCodegenCLISourceSupport(): Promise<boolean> {\n const codegenCLIHelpOutput = await spawn('npx', [\n '@react-native-community/cli',\n 'codegen',\n '--help',\n ]);\n return codegenCLIHelpOutput.includes('--source');\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,2BAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAA6C,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE7C,MAAMG,eAAe,GAAG,CACtB,4BAA4B,EAC5B,6BAA6B,EAC7B,2CAA2C,EAC3C,4CAA4C,EAC5C,mCAAmC,EACnC,oCAAoC,EACpC,oCAAoC,CACrC;;AAED;AACA;AACA;AACA;AACA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AAC,GAAGP,eAAe,EAAE,GAAGK,WAAW,CAAC,CAAC;AAChE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeG,0BAA0BA,CAAA,EAAqB;EACnE,MAAMC,oBAAoB,GAAG,MAAM,IAAAC,YAAK,EAAC,KAAK,EAAE,CAC9C,6BAA6B,EAC7B,SAAS,EACT,QAAQ,CACT,CAAC;EACF,OAAOD,oBAAoB,CAACE,QAAQ,CAAC,UAAU,CAAC;AAClD","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-builder-bob",
3
- "version": "0.40.5",
3
+ "version": "0.40.6",
4
4
  "description": "CLI to build JavaScript files for React Native libraries",
5
5
  "keywords": [
6
6
  "react-native",
@@ -88,5 +88,5 @@
88
88
  "mock-fs": "^5.2.0",
89
89
  "mock-stdin": "^1.0.0"
90
90
  },
91
- "gitHead": "5c07d727b03d3140885c163e9811202c3b4d8233"
91
+ "gitHead": "2fbd8700f66d1e13667c6557cf5fa5f4822069a8"
92
92
  }