@kontur.candy/generator 5.32.0-RPN2721v1.0 → 5.32.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.
Files changed (2) hide show
  1. package/dist/index.js +52 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -58544,6 +58544,30 @@ function isContextualActionName(handlerName) {
58544
58544
 
58545
58545
  /***/ }),
58546
58546
 
58547
+ /***/ "./Common/FormPathUtils.ts":
58548
+ /*!*********************************!*\
58549
+ !*** ./Common/FormPathUtils.ts ***!
58550
+ \*********************************/
58551
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
58552
+
58553
+ "use strict";
58554
+ __webpack_require__.r(__webpack_exports__);
58555
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
58556
+ /* harmony export */ extractGfvFromFormPath: () => (/* binding */ extractGfvFromFormPath)
58557
+ /* harmony export */ });
58558
+ /* harmony import */ var _TypingUtils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TypingUtils */ "./Common/TypingUtils.ts");
58559
+ /* harmony import */ var _WellKnownDirectories__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./WellKnownDirectories */ "./Common/WellKnownDirectories.ts");
58560
+
58561
+
58562
+ function extractGfvFromFormPath(formPath) {
58563
+ var _ref, _match$groups$gfv, _match$groups, _match$groups2;
58564
+ const regexp = new RegExp(`([\\/\\\\](?<gfv1>\\d{6,})[\\/\\\\]${_WellKnownDirectories__WEBPACK_IMPORTED_MODULE_1__.WellKnownDirectories.CandySubdirectoryName})|(((\\.farm)|(${_WellKnownDirectories__WEBPACK_IMPORTED_MODULE_1__.WellKnownDirectories.TestFarmDir}))[\\/\\\\]forms[\\/\\\\](?<gfv2>\\d{6,}))`);
58565
+ const match = regexp.exec(formPath);
58566
+ return (_ref = (_match$groups$gfv = match === null || match === void 0 ? void 0 : (_match$groups = match.groups) === null || _match$groups === void 0 ? void 0 : _match$groups["gfv1"]) !== null && _match$groups$gfv !== void 0 ? _match$groups$gfv : match === null || match === void 0 ? void 0 : (_match$groups2 = match.groups) === null || _match$groups2 === void 0 ? void 0 : _match$groups2["gfv2"]) !== null && _ref !== void 0 ? _ref : (0,_TypingUtils__WEBPACK_IMPORTED_MODULE_0__.reject)(`Unable to determine gfv from path: ${formPath}`);
58567
+ }
58568
+
58569
+ /***/ }),
58570
+
58547
58571
  /***/ "./Common/IndentString.ts":
58548
58572
  /*!********************************!*\
58549
58573
  !*** ./Common/IndentString.ts ***!
@@ -60312,6 +60336,25 @@ function assertIs(value) {
60312
60336
 
60313
60337
  /***/ }),
60314
60338
 
60339
+ /***/ "./Common/WellKnownDirectories.ts":
60340
+ /*!****************************************!*\
60341
+ !*** ./Common/WellKnownDirectories.ts ***!
60342
+ \****************************************/
60343
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
60344
+
60345
+ "use strict";
60346
+ __webpack_require__.r(__webpack_exports__);
60347
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
60348
+ /* harmony export */ WellKnownDirectories: () => (/* binding */ WellKnownDirectories)
60349
+ /* harmony export */ });
60350
+ class WellKnownDirectories {}
60351
+ WellKnownDirectories.CandySubdirectoryName = "Candy";
60352
+ WellKnownDirectories.FormJsonFileName = "form.json";
60353
+ WellKnownDirectories.GeneratedFormSubdirectory = "form";
60354
+ WellKnownDirectories.TestFarmDir = "TestFarm";
60355
+
60356
+ /***/ }),
60357
+
60315
60358
  /***/ "./Common/getRngSchemaFilename.ts":
60316
60359
  /*!****************************************!*\
60317
60360
  !*** ./Common/getRngSchemaFilename.ts ***!
@@ -80228,6 +80271,8 @@ __webpack_require__.r(__webpack_exports__);
80228
80271
  /* harmony import */ var recursive_readdir__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(recursive_readdir__WEBPACK_IMPORTED_MODULE_7__);
80229
80272
  /* harmony import */ var _common_ExtractSugarReferences__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../common/ExtractSugarReferences */ "./Generator/src/common/ExtractSugarReferences.ts");
80230
80273
  /* harmony import */ var _Common_getRngSchemaFilename__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../Common/getRngSchemaFilename */ "./Common/getRngSchemaFilename.ts");
80274
+ /* harmony import */ var _Common_FormPathUtils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../../Common/FormPathUtils */ "./Common/FormPathUtils.ts");
80275
+
80231
80276
 
80232
80277
 
80233
80278
 
@@ -80244,7 +80289,7 @@ const readdirAsync = (0,util__WEBPACK_IMPORTED_MODULE_2__.promisify)(fs__WEBPACK
80244
80289
  async function readFormSources(formSourcesPath, farmDirectory) {
80245
80290
  var _JSON$parse$settings;
80246
80291
  const rootPath = farmDirectory;
80247
- const formName = path__WEBPACK_IMPORTED_MODULE_1___default().basename(formSourcesPath);
80292
+ const gfv = (0,_Common_FormPathUtils__WEBPACK_IMPORTED_MODULE_10__.extractGfvFromFormPath)(formSourcesPath);
80248
80293
  const formSugarDirectoryPath = path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "sugar");
80249
80294
  const sugarReferences = await extractReferences(formSugarDirectoryPath);
80250
80295
  const sugarContent = await readSugarFiles(formSugarDirectoryPath, sugarReferences);
@@ -80257,7 +80302,7 @@ async function readFormSources(formSourcesPath, farmDirectory) {
80257
80302
  const result = {
80258
80303
  sugarContent: sugarContent,
80259
80304
  resources: {
80260
- gfv: path__WEBPACK_IMPORTED_MODULE_1___default().basename(formSourcesPath),
80305
+ gfv: gfv,
80261
80306
  formSourcesPath: formSourcesPath,
80262
80307
  formJsonSettings: (_JSON$parse$settings = JSON.parse(await readFileSource(formSourcesPath, "form.json", "{}"))["settings"]) !== null && _JSON$parse$settings !== void 0 ? _JSON$parse$settings : {},
80263
80308
  additionalSettings: await readFileSource(formSourcesPath, "settings.json", "{}"),
@@ -80265,9 +80310,9 @@ async function readFormSources(formSourcesPath, farmDirectory) {
80265
80310
  helpersContent: await readJavaScriptFilesWithNames(path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "helpers")),
80266
80311
  commonHelpersContent: await readJavaScriptFilesWithNames(path__WEBPACK_IMPORTED_MODULE_1___default().join(farmDirectory, "jsHelpers")),
80267
80312
  validationsContent: await readJavaScriptFilesWithNames(path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "validations")),
80268
- schemaRngContent: await readSchemaRngFile(path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "schemas"), formName),
80269
- kcJsXmlContent: (await readFileSource(path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "autocalc"), `${formName}.КС.candy.js.xml`, "<dummy/>")) || "",
80270
- kcLangContent: (await readFileSource(path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "autocalc"), `${formName}.КС.candy.js.kclang`, "")) || "",
80313
+ schemaRngContent: await readSchemaRngFile(path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "schemas"), gfv),
80314
+ kcJsXmlContent: (await readFileSource(path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "autocalc"), `${gfv}.КС.candy.js.xml`, "<dummy/>")) || "",
80315
+ kcLangContent: (await readFileSource(path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "autocalc"), `${gfv}.КС.candy.js.kclang`, "")) || "",
80271
80316
  tourSteps: await readFileSource(path__WEBPACK_IMPORTED_MODULE_1___default().join(rootPath, "tour"), "tour.js", "{}"),
80272
80317
  hooksContent: await readHooksFile(formSourcesPath),
80273
80318
  customControlsContent: await readCustomControlsFiles(path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "controls")),
@@ -80277,8 +80322,8 @@ async function readFormSources(formSourcesPath, farmDirectory) {
80277
80322
  additionalNormalizers: await readAdditionalNormalizersFiles(formSourcesPath)
80278
80323
  }
80279
80324
  };
80280
- if (formName.startsWith("4")) {
80281
- const commonResourcesPath = path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "..", "..", "commonResources");
80325
+ if (gfv.startsWith("4")) {
80326
+ const commonResourcesPath = path__WEBPACK_IMPORTED_MODULE_1___default().join(farmDirectory, "commonResources");
80282
80327
  // tslint:disable-next-line no-unsafe-any
80283
80328
  const {
80284
80329
  elements
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontur.candy/generator",
3
- "version": "5.32.0-RPN2721v1.0",
3
+ "version": "5.32.0",
4
4
  "description": "Candy forms generator",
5
5
  "author": "SKBKontur Candy Team",
6
6
  "private": false,