@kontur.candy/generator 5.54.1-crlfhash.0 → 5.54.1-crlfhash.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/dist/index.js +24 -63
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -67742,14 +67742,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
67742
67742
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
|
|
67743
67743
|
/* harmony import */ var util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! util */ "util");
|
|
67744
67744
|
/* harmony import */ var util__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(util__WEBPACK_IMPORTED_MODULE_2__);
|
|
67745
|
-
/* harmony import */ var
|
|
67746
|
-
/* harmony import */ var
|
|
67745
|
+
/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! crypto */ "crypto");
|
|
67746
|
+
/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_3__);
|
|
67747
|
+
/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! chalk */ "./node_modules/chalk/source/index.js");
|
|
67748
|
+
/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_4__);
|
|
67747
67749
|
/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! fs-extra */ "./node_modules/fs-extra/lib/index.js");
|
|
67748
67750
|
/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(fs_extra__WEBPACK_IMPORTED_MODULE_10__);
|
|
67749
|
-
/* harmony import */ var
|
|
67750
|
-
/* harmony import */ var
|
|
67751
|
-
/* harmony import */ var md5_file__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! md5-file */ "./node_modules/md5-file/index.js");
|
|
67752
|
-
/* harmony import */ var md5_file__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(md5_file__WEBPACK_IMPORTED_MODULE_5__);
|
|
67751
|
+
/* harmony import */ var md5__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! md5 */ "./node_modules/md5/md5.js");
|
|
67752
|
+
/* harmony import */ var md5__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(md5__WEBPACK_IMPORTED_MODULE_5__);
|
|
67753
67753
|
/* harmony import */ var recursive_readdir__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! recursive-readdir */ "./node_modules/recursive-readdir/index.js");
|
|
67754
67754
|
/* harmony import */ var recursive_readdir__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(recursive_readdir__WEBPACK_IMPORTED_MODULE_6__);
|
|
67755
67755
|
/* harmony import */ var _common_ExtractSugarReferences__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../common/ExtractSugarReferences */ "./Generator/src/common/ExtractSugarReferences.ts");
|
|
@@ -67778,7 +67778,7 @@ async function readFormSources(formSourcesPath, farmDirectory) {
|
|
|
67778
67778
|
const sugarContent = await readSugarFiles(formSugarDirectoryPath, sugarReferences);
|
|
67779
67779
|
if (sugarReferences.fetchFunctionFiles.length === 0) {
|
|
67780
67780
|
// eslint-disable-next-line no-console
|
|
67781
|
-
console.warn(
|
|
67781
|
+
console.warn(chalk__WEBPACK_IMPORTED_MODULE_4___default().yellow(`[WARN] Форма не содержит ссылок на fetch-функции. Будут автоматически подключены функции из каталога legacyfetchfuctions\n` + `[WARN] В будущем необходимо явно прописывать ссылки на используемые fetch-функции`));
|
|
67782
67782
|
const legacyfetchfunctionsDirectory = (await (0,fs_extra__WEBPACK_IMPORTED_MODULE_10__.pathExists)(path__WEBPACK_IMPORTED_MODULE_1___default().join(farmDirectory, "legacyfetchfunctions"))) ? path__WEBPACK_IMPORTED_MODULE_1___default().join(farmDirectory, "legacyfetchfunctions") : path__WEBPACK_IMPORTED_MODULE_1___default().join(farmDirectory, "candy.farm", "legacyfetchfunctions");
|
|
67783
67783
|
sugarReferences.fetchFunctionFiles = (await readdirAsync(legacyfetchfunctionsDirectory)).map(x => path__WEBPACK_IMPORTED_MODULE_1___default().resolve(legacyfetchfunctionsDirectory, x));
|
|
67784
67784
|
}
|
|
@@ -67886,8 +67886,22 @@ async function getAllDependencies(formSourcesPath, farmDirectory) {
|
|
|
67886
67886
|
}
|
|
67887
67887
|
async function getAllDependenciesHash(formSourcesPath, farmDirectory) {
|
|
67888
67888
|
const allDeps = await getAllDependencies(formSourcesPath, farmDirectory);
|
|
67889
|
-
const hashes = await Promise.all(allDeps.map(async depFilePath =>
|
|
67890
|
-
|
|
67889
|
+
const hashes = await Promise.all(allDeps.map(async depFilePath => hashFile(depFilePath)));
|
|
67890
|
+
console.log("hashes", hashes);
|
|
67891
|
+
console.log("md5(hashes.join())", md5__WEBPACK_IMPORTED_MODULE_5___default()(hashes.join()));
|
|
67892
|
+
return md5__WEBPACK_IMPORTED_MODULE_5___default()(hashes.join());
|
|
67893
|
+
}
|
|
67894
|
+
function normalizeLineEndings(content) {
|
|
67895
|
+
return content.replace(/\r/gi, "");
|
|
67896
|
+
}
|
|
67897
|
+
async function hashFile(filePath) {
|
|
67898
|
+
const fileBuffer = await readFileAsync(filePath, "utf-8");
|
|
67899
|
+
const clearedCRLF = normalizeLineEndings(fileBuffer);
|
|
67900
|
+
const hashBuffer = (0,crypto__WEBPACK_IMPORTED_MODULE_3__.createHash)("sha256");
|
|
67901
|
+
hashBuffer.update(clearedCRLF);
|
|
67902
|
+
const a = hashBuffer.digest("hex");
|
|
67903
|
+
console.log(filePath, a);
|
|
67904
|
+
return a;
|
|
67891
67905
|
}
|
|
67892
67906
|
async function readSugarFiles(formSugarDirectoryPath, references) {
|
|
67893
67907
|
const result = {
|
|
@@ -67950,7 +67964,7 @@ async function readAdditionalNormalizersFiles(rootPath) {
|
|
|
67950
67964
|
return normalizerFiles;
|
|
67951
67965
|
} catch (error) {
|
|
67952
67966
|
// eslint-disable-next-line no-console
|
|
67953
|
-
console.warn(
|
|
67967
|
+
console.warn(chalk__WEBPACK_IMPORTED_MODULE_4___default().yellow(`Error while reading normalizers at ${rootPath}`, error));
|
|
67954
67968
|
return [];
|
|
67955
67969
|
}
|
|
67956
67970
|
}
|
|
@@ -130479,59 +130493,6 @@ const forEachStep = (self, fn, node, thisp) => {
|
|
|
130479
130493
|
module.exports = LRUCache
|
|
130480
130494
|
|
|
130481
130495
|
|
|
130482
|
-
/***/ }),
|
|
130483
|
-
|
|
130484
|
-
/***/ "./node_modules/md5-file/index.js":
|
|
130485
|
-
/*!****************************************!*\
|
|
130486
|
-
!*** ./node_modules/md5-file/index.js ***!
|
|
130487
|
-
\****************************************/
|
|
130488
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
130489
|
-
|
|
130490
|
-
const crypto = __webpack_require__(/*! crypto */ "crypto")
|
|
130491
|
-
const fs = __webpack_require__(/*! fs */ "fs")
|
|
130492
|
-
|
|
130493
|
-
const BUFFER_SIZE = 8192
|
|
130494
|
-
|
|
130495
|
-
function md5FileSync (path) {
|
|
130496
|
-
const fd = fs.openSync(path, 'r')
|
|
130497
|
-
const hash = crypto.createHash('md5')
|
|
130498
|
-
const buffer = Buffer.alloc(BUFFER_SIZE)
|
|
130499
|
-
|
|
130500
|
-
try {
|
|
130501
|
-
let bytesRead
|
|
130502
|
-
|
|
130503
|
-
do {
|
|
130504
|
-
bytesRead = fs.readSync(fd, buffer, 0, BUFFER_SIZE)
|
|
130505
|
-
hash.update(buffer.slice(0, bytesRead))
|
|
130506
|
-
} while (bytesRead === BUFFER_SIZE)
|
|
130507
|
-
} finally {
|
|
130508
|
-
fs.closeSync(fd)
|
|
130509
|
-
}
|
|
130510
|
-
|
|
130511
|
-
return hash.digest('hex')
|
|
130512
|
-
}
|
|
130513
|
-
|
|
130514
|
-
function md5File (path) {
|
|
130515
|
-
return new Promise((resolve, reject) => {
|
|
130516
|
-
const output = crypto.createHash('md5')
|
|
130517
|
-
const input = fs.createReadStream(path)
|
|
130518
|
-
|
|
130519
|
-
input.on('error', (err) => {
|
|
130520
|
-
reject(err)
|
|
130521
|
-
})
|
|
130522
|
-
|
|
130523
|
-
output.once('readable', () => {
|
|
130524
|
-
resolve(output.read().toString('hex'))
|
|
130525
|
-
})
|
|
130526
|
-
|
|
130527
|
-
input.pipe(output)
|
|
130528
|
-
})
|
|
130529
|
-
}
|
|
130530
|
-
|
|
130531
|
-
module.exports = md5File
|
|
130532
|
-
module.exports.sync = md5FileSync
|
|
130533
|
-
|
|
130534
|
-
|
|
130535
130496
|
/***/ }),
|
|
130536
130497
|
|
|
130537
130498
|
/***/ "./node_modules/md5/md5.js":
|