This commit is contained in:
Yamozha
2021-04-02 02:24:13 +03:00
parent c23950b545
commit 7256d79e2c
31493 changed files with 3036630 additions and 0 deletions

View File

@ -0,0 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = applyParams;
function _lodash() {
const data = require("lodash");
_lodash = function () {
return data;
};
return data;
}
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
function applyParams(str, params, prefix) {
return str.replace(/\$\{(\w+)\}/g, (_pattern, param) => {
const name = `${(0, _lodash().camelCase)(prefix)}_${param}`; // @ts-ignore
return params[param] ? `getResources().getString(R.string.${name})` : 'null';
});
}
//# sourceMappingURL=applyParams.js.map

View File

@ -0,0 +1,45 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = applyPatch;
function _fs() {
const data = _interopRequireDefault(require("fs"));
_fs = function () {
return data;
};
return data;
}
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
function applyPatch(file, patch) {
if (file) {
_cliTools().logger.debug(`Patching ${file}`);
}
_fs().default.writeFileSync(file, _fs().default.readFileSync(file, 'utf8').replace(patch.pattern, match => `${match}${patch.patch}`));
}
//# sourceMappingURL=applyPatch.js.map

View File

@ -0,0 +1,66 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = makeBuildPatch;
function _fs() {
const data = _interopRequireDefault(require("fs"));
_fs = function () {
return data;
};
return data;
}
var _normalizeProjectName = _interopRequireDefault(require("./normalizeProjectName"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
const depConfigs = ['compile', 'api', 'implementation'];
function makeBuildPatch(name, buildGradlePath) {
const normalizedProjectName = (0, _normalizeProjectName.default)(name);
const installPattern = new RegExp(buildDepRegExp(normalizedProjectName, ...depConfigs));
return {
installPattern,
pattern: /[^ \t]dependencies {(\r\n|\n)/,
patch: makePatchString(normalizedProjectName, buildGradlePath)
};
}
function makePatchString(normalizedProjectName, buildGradlePath) {
const defaultPatchString = ` implementation project(':${normalizedProjectName}')\n`;
if (!buildGradlePath) {
return defaultPatchString;
}
const buildGradle = _fs().default.readFileSync(buildGradlePath, 'utf8');
for (const config of depConfigs) {
const depPattern = new RegExp(buildDepRegExp(normalizedProjectName, config));
if (depPattern.test(buildGradle)) {
return ` ${config} project(':${normalizedProjectName}')\n`;
}
}
return defaultPatchString;
}
function buildDepRegExp(normalizedProjectName, ...configs) {
const orConfigs = configs.join('|');
return `(${orConfigs})\\w*\\s*\\(*project\\s*\\(['"]:${normalizedProjectName}['"]\\)`;
}
//# sourceMappingURL=makeBuildPatch.js.map

View File

@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = makeImportPatch;
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
function makeImportPatch(packageImportPath) {
return {
pattern: 'import com.facebook.react.ReactApplication;',
patch: `\n${packageImportPath}`
};
}
//# sourceMappingURL=makeImportPatch.js.map

View File

@ -0,0 +1,27 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = makePackagePatch;
var _applyParams = _interopRequireDefault(require("./applyParams"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
function makePackagePatch(packageInstance, params, prefix) {
const processedInstance = (0, _applyParams.default)(packageInstance, params, prefix);
return {
pattern: 'new MainReactPackage()',
patch: `,\n ${processedInstance}`
};
}
//# sourceMappingURL=makePackagePatch.js.map

View File

@ -0,0 +1,49 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = makeSettingsPatch;
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _slash() {
const data = _interopRequireDefault(require("slash"));
_slash = function () {
return data;
};
return data;
}
var _normalizeProjectName = _interopRequireDefault(require("./normalizeProjectName"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
function makeSettingsPatch(name, androidConfig, projectConfig) {
// Gradle expects paths to be posix even on Windows
const projectDir = (0, _slash().default)(_path().default.relative(_path().default.dirname(projectConfig.settingsGradlePath), androidConfig.sourceDir));
const normalizedProjectName = (0, _normalizeProjectName.default)(name);
return {
pattern: '\n',
patch: `include ':${normalizedProjectName}'\n` + `project(':${normalizedProjectName}').projectDir = ` + `new File(rootProject.projectDir, '${projectDir}')\n`
};
}
//# sourceMappingURL=makeSettingsPatch.js.map

View File

@ -0,0 +1,38 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = makeStringsPatch;
function _lodash() {
const data = require("lodash");
_lodash = function () {
return data;
};
return data;
}
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
function makeStringsPatch(params, prefix) {
const values = Object.keys(params).map(param => {
const name = `${(0, _lodash().camelCase)(prefix)}_${param}`;
return ' ' + // @ts-ignore
`<string moduleConfig="true" name="${name}">${params[param]}</string>`;
});
const patch = values.length > 0 ? `${values.join('\n')}\n` : '';
return {
pattern: '<resources>\n',
patch
};
}
//# sourceMappingURL=makeStringsPatch.js.map

View File

@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = normalizeProjectName;
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
function normalizeProjectName(name) {
return name.replace(/\//g, '_');
}
//# sourceMappingURL=normalizeProjectName.js.map

View File

@ -0,0 +1,45 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = revokePatch;
function _fs() {
const data = _interopRequireDefault(require("fs"));
_fs = function () {
return data;
};
return data;
}
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
function revokePatch(file, patch) {
if (file) {
_cliTools().logger.debug(`Patching ${file}`);
}
_fs().default.writeFileSync(file, _fs().default.readFileSync(file, 'utf8').replace(patch.patch, ''));
}
//# sourceMappingURL=revokePatch.js.map