@kontur.candy/tools 2.250.0 → 2.251.1
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/distr/Common/hashUtils.js +9 -0
- package/distr/Common/hashUtils.js.map +1 -1
- package/distr/Tools/src/BuildTasks/ClientJS/BuildClientJsTask.js +2 -12
- package/distr/Tools/src/BuildTasks/ClientJS/BuildClientJsTask.js.map +1 -1
- package/distr/Tools/src/BuildTasks/Engine/BuildLocalEngineTask.js +2 -3
- package/distr/Tools/src/BuildTasks/Engine/BuildLocalEngineTask.js.map +1 -1
- package/distr/Tools/src/BuildTasks/EngineStructureUtils.js +2 -27
- package/distr/Tools/src/BuildTasks/EngineStructureUtils.js.map +1 -1
- package/distr/Tools/src/BuildTasks/Form/GenerateForm.js +2 -2
- package/distr/Tools/src/BuildTasks/Form/GenerateForm.js.map +1 -1
- package/distr/Tools/src/BuildTasks/Form/NullFormGenerator.js +0 -3
- package/distr/Tools/src/BuildTasks/Form/NullFormGenerator.js.map +1 -1
- package/distr/Tools/src/BuildTasks/Form/WriteFLangNormalizationFiles.js +2 -2
- package/distr/Tools/src/BuildTasks/Form/WriteFLangNormalizationFiles.js.map +1 -1
- package/distr/Tools/src/BuildTasks/FormSource.js +6 -0
- package/distr/Tools/src/BuildTasks/FormSource.js.map +1 -0
- package/distr/Tools/src/BuildTasks/Generator/BuildGeneratorFromSourcesTask.js +3 -10
- package/distr/Tools/src/BuildTasks/Generator/BuildGeneratorFromSourcesTask.js.map +1 -1
- package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/CreateAsyncGenerator.js +18 -70
- package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/CreateAsyncGenerator.js.map +1 -1
- package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/GeneratorRequireUtils.js +17 -67
- package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/GeneratorRequireUtils.js.map +1 -1
- package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/ReadSourcesAndProcessSugarWorker.js +5 -5
- package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/ReadSourcesAndProcessSugarWorker.js.map +1 -1
- package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/RequireUncached.js +0 -9
- package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/RequireUncached.js.map +1 -1
- package/distr/Tools/src/CLICommands/BuildForms/RunBuildForms.js +3 -3
- package/distr/Tools/src/CLICommands/BuildForms/RunBuildForms.js.map +1 -1
- package/distr/Tools/src/CLICommands/BuildServer/ResourcesControllers/BuildServerBuildFormsController.js +4 -9
- package/distr/Tools/src/CLICommands/BuildServer/ResourcesControllers/BuildServerBuildFormsController.js.map +1 -1
- package/distr/Tools/src/CLICommands/BuildServer/ResourcesControllers/DevServers/BuildFormDevServer.js +2 -8
- package/distr/Tools/src/CLICommands/BuildServer/ResourcesControllers/DevServers/BuildFormDevServer.js.map +1 -1
- package/distr/Tools/src/CLICommands/DevBuild/RunDevBuild.js +4 -4
- package/distr/Tools/src/CLICommands/DevBuild/RunDevBuild.js.map +1 -1
- package/distr/Tools/src/CLICommands/Localization/RunLocalization.js +2 -2
- package/distr/Tools/src/CLICommands/Localization/RunLocalization.js.map +1 -1
- package/distr/Tools/src/CLICommands/SugarExtractor/ExtractTextsFromSugarController.js +1 -2
- package/distr/Tools/src/CLICommands/SugarExtractor/ExtractTextsFromSugarController.js.map +1 -1
- package/distr/Tools/src/CLICommands/SugarExtractor/Utils.js +1 -3
- package/distr/Tools/src/CLICommands/SugarExtractor/Utils.js.map +1 -1
- package/distr/Tools/src/CandyCLI.js +3 -3
- package/distr/Tools/src/CandyCLI.js.map +1 -1
- package/distr/Tools/src/LocalServerFrontEndDist/index.js +1 -1
- package/distr/Tools/src/LocalServerFrontEndDist/index.js.map +1 -1
- package/distr/Tools/src/ReadFarmConfig.js +1 -2
- package/distr/Tools/src/ReadFarmConfig.js.map +1 -1
- package/package.json +1 -1
- package/distr/Tools/src/BuildTasks/ClientJS/IsWebpack5.js +0 -14
- package/distr/Tools/src/BuildTasks/ClientJS/IsWebpack5.js.map +0 -1
- package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/ProcessSugarWorker.js +0 -46
- package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/ProcessSugarWorker.js.map +0 -1
- package/distr/Tools/src/BuildTasks/ReadFormSource.js +0 -114
- package/distr/Tools/src/BuildTasks/ReadFormSource.js.map +0 -1
|
@@ -21,53 +21,43 @@ class GeneratorAsyncProxy {
|
|
|
21
21
|
this.useGeneratorRestarting = useGeneratorRestarting;
|
|
22
22
|
this.pathToGeneratorRootDir = pathToGeneratorRootDir;
|
|
23
23
|
this.purgeCache = purgeCache;
|
|
24
|
-
this.generatorSourcesImporter = new _GeneratorRequireUtils.GeneratorSourcesImporter(purgeCache);
|
|
24
|
+
this.generatorSourcesImporter = new _GeneratorRequireUtils.GeneratorSourcesImporter(this.pathToGeneratorRootDir, this.purgeCache);
|
|
25
25
|
}
|
|
26
26
|
async getLocalizedSugar(sugarFiles, resources) {
|
|
27
|
-
const localizationEntryPoint = await this.generatorSourcesImporter.importLocalization(
|
|
27
|
+
const localizationEntryPoint = await this.generatorSourcesImporter.importLocalization();
|
|
28
28
|
if (localizationEntryPoint == undefined) {
|
|
29
29
|
throw new Error("Данная версия генератора не поддерживает локализацию.");
|
|
30
30
|
}
|
|
31
31
|
return localizationEntryPoint.getLocalizedSugar(sugarFiles, resources);
|
|
32
32
|
}
|
|
33
33
|
async getDictionary(sugarFiles, resources) {
|
|
34
|
-
const localizationEntryPoint = await this.generatorSourcesImporter.importLocalization(
|
|
34
|
+
const localizationEntryPoint = await this.generatorSourcesImporter.importLocalization();
|
|
35
35
|
if (localizationEntryPoint == undefined) {
|
|
36
36
|
throw new Error("Данная версия генератора не поддерживает локализацию.");
|
|
37
37
|
}
|
|
38
38
|
return localizationEntryPoint.getDictionary(sugarFiles, resources);
|
|
39
39
|
}
|
|
40
|
-
async readSources(formSourcesPath, farmDirectory
|
|
41
|
-
const readSources = await this.generatorSourcesImporter.importReadSources(
|
|
42
|
-
|
|
43
|
-
return formSource;
|
|
40
|
+
async readSources(formSourcesPath, farmDirectory) {
|
|
41
|
+
const readSources = await this.generatorSourcesImporter.importReadSources();
|
|
42
|
+
return await readSources(formSourcesPath, farmDirectory);
|
|
44
43
|
}
|
|
45
|
-
async getSugarTexts(formSourcesPath, farmDirectory
|
|
46
|
-
const getSugarTexts = await this.generatorSourcesImporter.importGetSugarTexts(
|
|
47
|
-
|
|
48
|
-
return result;
|
|
44
|
+
async getSugarTexts(formSourcesPath, farmDirectory) {
|
|
45
|
+
const getSugarTexts = await this.generatorSourcesImporter.importGetSugarTexts();
|
|
46
|
+
return await getSugarTexts(formSourcesPath, farmDirectory);
|
|
49
47
|
}
|
|
50
|
-
async getAllDependencies(formSourcesPath, farmDirectory
|
|
51
|
-
const getAllDependencies = await this.generatorSourcesImporter.importGetAllDependencies(
|
|
52
|
-
|
|
53
|
-
throw new Error("This version of generator does not support dependencies extraction");
|
|
54
|
-
}
|
|
55
|
-
const formSource = await getAllDependencies(formSourcesPath, farmDirectory, hlFarmDirectoryPath);
|
|
56
|
-
return formSource;
|
|
48
|
+
async getAllDependencies(formSourcesPath, farmDirectory) {
|
|
49
|
+
const getAllDependencies = await this.generatorSourcesImporter.importGetAllDependencies();
|
|
50
|
+
return await getAllDependencies(formSourcesPath, farmDirectory);
|
|
57
51
|
}
|
|
58
52
|
async supportsDependenciesExtraction() {
|
|
59
|
-
const getAllDependenciesHash = await this.generatorSourcesImporter.importGetAllDependenciesHash(
|
|
53
|
+
const getAllDependenciesHash = await this.generatorSourcesImporter.importGetAllDependenciesHash();
|
|
60
54
|
return getAllDependenciesHash != undefined;
|
|
61
55
|
}
|
|
62
|
-
async getAllDependenciesHash(formSourcesPath, farmDirectory
|
|
63
|
-
const getAllDependenciesHash = await this.generatorSourcesImporter.importGetAllDependenciesHash(
|
|
64
|
-
|
|
65
|
-
throw new Error("This version of generator does not support dependencies extraction");
|
|
66
|
-
}
|
|
67
|
-
const formSource = await getAllDependenciesHash(formSourcesPath, farmDirectory, hlFarmDirectoryPath);
|
|
68
|
-
return formSource;
|
|
56
|
+
async getAllDependenciesHash(formSourcesPath, farmDirectory) {
|
|
57
|
+
const getAllDependenciesHash = await this.generatorSourcesImporter.importGetAllDependenciesHash();
|
|
58
|
+
return await getAllDependenciesHash(formSourcesPath, farmDirectory);
|
|
69
59
|
}
|
|
70
|
-
async readSourcesAndProcessSugar(formSourcesPath, farmDirectory,
|
|
60
|
+
async readSourcesAndProcessSugar(formSourcesPath, farmDirectory, generationOptions) {
|
|
71
61
|
this.maxRequestNumber++;
|
|
72
62
|
const currentRequestNumber = this.maxRequestNumber;
|
|
73
63
|
const promise = new Promise((resolve, reject) => {
|
|
@@ -88,53 +78,11 @@ class GeneratorAsyncProxy {
|
|
|
88
78
|
console.log("Restarted generator");
|
|
89
79
|
}
|
|
90
80
|
}
|
|
91
|
-
this.generatorProcess.send([this.pathToGeneratorRootDir, formSourcesPath, farmDirectory,
|
|
92
|
-
const result = await promise;
|
|
93
|
-
this.processSugarDeferredMap.delete(currentRequestNumber);
|
|
94
|
-
return result;
|
|
95
|
-
}
|
|
96
|
-
async processSugar(sugarFiles, resources, generationOptions) {
|
|
97
|
-
this.maxRequestNumber++;
|
|
98
|
-
const currentRequestNumber = this.maxRequestNumber;
|
|
99
|
-
const promise = new Promise((resolve, reject) => {
|
|
100
|
-
this.processSugarDeferredMap.set(currentRequestNumber, {
|
|
101
|
-
resolve: resolve,
|
|
102
|
-
reject: reject
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
if (!this.generatorProcess) {
|
|
106
|
-
this.generatorProcess = this.forkProcessSugarWorker();
|
|
107
|
-
}
|
|
108
|
-
this.generatorProcess.send([this.pathToGeneratorRootDir, sugarFiles, resources, generationOptions, this.purgeCache, currentRequestNumber]);
|
|
81
|
+
this.generatorProcess.send([this.pathToGeneratorRootDir, formSourcesPath, farmDirectory, generationOptions, this.purgeCache, currentRequestNumber]);
|
|
109
82
|
const result = await promise;
|
|
110
83
|
this.processSugarDeferredMap.delete(currentRequestNumber);
|
|
111
84
|
return result;
|
|
112
85
|
}
|
|
113
|
-
forkProcessSugarWorker() {
|
|
114
|
-
const processSugarWorker = (0, _child_process.fork)("./ProcessSugarWorker", [], {
|
|
115
|
-
cwd: __dirname
|
|
116
|
-
});
|
|
117
|
-
processSugarWorker.on("message", response => {
|
|
118
|
-
const currentDeferred = this.processSugarDeferredMap.get(response.requestNumber);
|
|
119
|
-
if (currentDeferred == undefined) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
if (response.type === "Error") {
|
|
123
|
-
currentDeferred.reject(new Error(response.errorText));
|
|
124
|
-
} else {
|
|
125
|
-
const formContent = response.generatedForm;
|
|
126
|
-
const result = {};
|
|
127
|
-
for (const [key, formContentItem] of (0, _IterableUtils.iterateEntries)(formContent)) {
|
|
128
|
-
result[key] = typeof formContentItem === "string" ? formContentItem : Buffer.from(formContentItem.payload, formContentItem.encoding);
|
|
129
|
-
}
|
|
130
|
-
currentDeferred.resolve(result);
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
processSugarWorker.on("error", error => {
|
|
134
|
-
throw error;
|
|
135
|
-
});
|
|
136
|
-
return processSugarWorker;
|
|
137
|
-
}
|
|
138
86
|
forkReadSourcesAndProcessSugarWorker() {
|
|
139
87
|
const processSugarWorker = (0, _child_process.fork)("./ReadSourcesAndProcessSugarWorker", [], {
|
|
140
88
|
cwd: __dirname
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateAsyncGenerator.js","names":["_child_process","require","_IterableUtils","_GeneratorRequireUtils","GeneratorAsyncProxy","constructor","pathToGeneratorRootDir","purgeCache","useGeneratorRestarting","generatorSourcesImporter","generatorProcess","maxRequestNumber","processSugarDeferredMap","Map","GeneratorSourcesImporter","getLocalizedSugar","sugarFiles","resources","localizationEntryPoint","importLocalization","undefined","Error","getDictionary","readSources","formSourcesPath","farmDirectory","hlFarmDirectoryPath","importReadSources","formSource","getSugarTexts","importGetSugarTexts","result","getAllDependencies","importGetAllDependencies","supportsDependenciesExtraction","getAllDependenciesHash","importGetAllDependenciesHash","readSourcesAndProcessSugar","generationOptions","currentRequestNumber","promise","Promise","resolve","reject","set","forkReadSourcesAndProcessSugarWorker","console","log","kill","send","delete","processSugar","forkProcessSugarWorker","processSugarWorker","fork","cwd","__dirname","on","response","currentDeferred","get","requestNumber","type","errorText","formContent","generatedForm","key","formContentItem","iterateEntries","Buffer","from","payload","encoding","error","generatorsCache","createAsyncGenerator"],"sources":["../../../../../../src/BuildTasks/Generator/GeneratorWorker/CreateAsyncGenerator.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport { ChildProcess, fork } from \"child_process\";\n\nimport {\n FormGenerator,\n GeneratedForm,\n GenerationOptions,\n LocalizationDictionaryContent,\n} from \"../../Form/GenerateForm\";\nimport { FormResources, FormSource, SugarContent } from \"../../ReadFormSource\";\nimport { iterateEntries } from \"../../../../../Common/IterableUtils\";\nimport { ExtractorResult } from \"../../../../../Common/TextExtractor/TextExtractorTypes\";\n\nimport { GeneratorSourcesImporter } from \"./GeneratorRequireUtils\";\nimport { CallResponse } from \"./ProcessSugarWorker\";\n\ninterface ProcessSugarDeferred {\n resolve: (result: GeneratedForm) => void;\n reject: (error: unknown) => void;\n}\n\nclass GeneratorAsyncProxy implements FormGenerator {\n private readonly pathToGeneratorRootDir: string;\n private readonly generatorSourcesImporter: GeneratorSourcesImporter;\n private readonly purgeCache: boolean;\n private readonly useGeneratorRestarting: boolean;\n private generatorProcess?: ChildProcess;\n private maxRequestNumber = 0;\n private readonly processSugarDeferredMap: Map<number, ProcessSugarDeferred> = new Map();\n\n public constructor(pathToGeneratorRootDir: string, purgeCache: boolean, useGeneratorRestarting: boolean) {\n this.useGeneratorRestarting = useGeneratorRestarting;\n this.pathToGeneratorRootDir = pathToGeneratorRootDir;\n this.purgeCache = purgeCache;\n this.generatorSourcesImporter = new GeneratorSourcesImporter(purgeCache);\n }\n\n public async getLocalizedSugar(sugarFiles: SugarContent, resources: FormResources): Promise<SugarContent> {\n const localizationEntryPoint = await this.generatorSourcesImporter.importLocalization(\n this.pathToGeneratorRootDir\n );\n if (localizationEntryPoint == undefined) {\n throw new Error(\"Данная версия генератора не поддерживает локализацию.\");\n }\n return localizationEntryPoint.getLocalizedSugar(sugarFiles, resources);\n }\n\n public async getDictionary(\n sugarFiles: SugarContent,\n resources: FormResources\n ): Promise<LocalizationDictionaryContent> {\n const localizationEntryPoint = await this.generatorSourcesImporter.importLocalization(\n this.pathToGeneratorRootDir\n );\n if (localizationEntryPoint == undefined) {\n throw new Error(\"Данная версия генератора не поддерживает локализацию.\");\n }\n return localizationEntryPoint.getDictionary(sugarFiles, resources);\n }\n\n public async readSources(\n formSourcesPath: string,\n farmDirectory: string,\n hlFarmDirectoryPath: string\n ): Promise<FormSource> {\n const readSources: FormGenerator[\"readSources\"] = await this.generatorSourcesImporter.importReadSources(\n this.pathToGeneratorRootDir\n );\n const formSource = await readSources(formSourcesPath, farmDirectory, hlFarmDirectoryPath);\n\n return formSource;\n }\n\n public async getSugarTexts(\n formSourcesPath: string,\n farmDirectory: string,\n hlFarmDirectoryPath: string\n ): Promise<ExtractorResult> {\n const getSugarTexts: FormGenerator[\"getSugarTexts\"] = await this.generatorSourcesImporter.importGetSugarTexts(\n this.pathToGeneratorRootDir\n );\n const result = await getSugarTexts(formSourcesPath, farmDirectory, hlFarmDirectoryPath);\n\n return result;\n }\n\n public async getAllDependencies(\n formSourcesPath: string,\n farmDirectory: string,\n hlFarmDirectoryPath: string\n ): Promise<string[]> {\n const getAllDependencies = await this.generatorSourcesImporter.importGetAllDependencies(\n this.pathToGeneratorRootDir\n );\n if (getAllDependencies == undefined) {\n throw new Error(\"This version of generator does not support dependencies extraction\");\n }\n const formSource = await getAllDependencies(formSourcesPath, farmDirectory, hlFarmDirectoryPath);\n return formSource;\n }\n\n public async supportsDependenciesExtraction(): Promise<boolean> {\n const getAllDependenciesHash = await this.generatorSourcesImporter.importGetAllDependenciesHash(\n this.pathToGeneratorRootDir\n );\n return getAllDependenciesHash != undefined;\n }\n\n public async getAllDependenciesHash(\n formSourcesPath: string,\n farmDirectory: string,\n hlFarmDirectoryPath: string\n ): Promise<string> {\n const getAllDependenciesHash = await this.generatorSourcesImporter.importGetAllDependenciesHash(\n this.pathToGeneratorRootDir\n );\n if (getAllDependenciesHash == undefined) {\n throw new Error(\"This version of generator does not support dependencies extraction\");\n }\n const formSource = await getAllDependenciesHash(formSourcesPath, farmDirectory, hlFarmDirectoryPath);\n return formSource;\n }\n\n public async readSourcesAndProcessSugar(\n formSourcesPath: string,\n farmDirectory: string,\n hlFarmDirectoryPath: string,\n generationOptions?: GenerationOptions\n ): Promise<GeneratedForm> {\n this.maxRequestNumber++;\n const currentRequestNumber = this.maxRequestNumber;\n const promise = new Promise<GeneratedForm>((resolve, reject) => {\n this.processSugarDeferredMap.set(currentRequestNumber, {\n resolve: resolve,\n reject: reject,\n });\n });\n\n if (!this.generatorProcess) {\n this.generatorProcess = this.forkReadSourcesAndProcessSugarWorker();\n }\n if (this.useGeneratorRestarting) {\n if (this.maxRequestNumber % 10 === 0) {\n console.log(\"Restarting generator\");\n this.generatorProcess.kill();\n this.generatorProcess = undefined;\n this.generatorProcess = this.forkReadSourcesAndProcessSugarWorker();\n console.log(\"Restarted generator\");\n }\n }\n\n this.generatorProcess.send([\n this.pathToGeneratorRootDir,\n formSourcesPath,\n farmDirectory,\n hlFarmDirectoryPath,\n generationOptions,\n this.purgeCache,\n currentRequestNumber,\n ]);\n\n const result = await promise;\n this.processSugarDeferredMap.delete(currentRequestNumber);\n return result;\n }\n\n public async processSugar(\n sugarFiles: SugarContent,\n resources: FormResources,\n generationOptions?: GenerationOptions\n ): Promise<GeneratedForm> {\n this.maxRequestNumber++;\n const currentRequestNumber = this.maxRequestNumber;\n const promise = new Promise<GeneratedForm>((resolve, reject) => {\n this.processSugarDeferredMap.set(currentRequestNumber, {\n resolve: resolve,\n reject: reject,\n });\n });\n\n if (!this.generatorProcess) {\n this.generatorProcess = this.forkProcessSugarWorker();\n }\n\n this.generatorProcess.send([\n this.pathToGeneratorRootDir,\n sugarFiles,\n resources,\n generationOptions,\n this.purgeCache,\n currentRequestNumber,\n ]);\n\n const result = await promise;\n this.processSugarDeferredMap.delete(currentRequestNumber);\n return result;\n }\n\n private forkProcessSugarWorker(): ChildProcess {\n const processSugarWorker = fork(\"./ProcessSugarWorker\", [], {\n cwd: __dirname,\n });\n\n processSugarWorker.on(\"message\", (response: CallResponse) => {\n const currentDeferred = this.processSugarDeferredMap.get(response.requestNumber);\n if (currentDeferred == undefined) {\n return;\n }\n if (response.type === \"Error\") {\n currentDeferred.reject(new Error(response.errorText));\n } else {\n const formContent = response.generatedForm;\n const result: GeneratedForm = {};\n\n for (const [key, formContentItem] of iterateEntries(formContent)) {\n result[key] =\n typeof formContentItem === \"string\"\n ? formContentItem\n : Buffer.from(formContentItem.payload, formContentItem.encoding);\n }\n\n currentDeferred.resolve(result);\n }\n });\n\n processSugarWorker.on(\"error\", error => {\n throw error;\n });\n\n return processSugarWorker;\n }\n\n private forkReadSourcesAndProcessSugarWorker(): ChildProcess {\n const processSugarWorker = fork(\"./ReadSourcesAndProcessSugarWorker\", [], {\n cwd: __dirname,\n });\n\n processSugarWorker.on(\"message\", (response: CallResponse) => {\n const currentDeferred = this.processSugarDeferredMap.get(response.requestNumber);\n if (currentDeferred == undefined) {\n return;\n }\n if (response.type === \"Error\") {\n currentDeferred.reject(new Error(response.errorText));\n } else {\n const formContent = response.generatedForm;\n const result: GeneratedForm = {};\n\n for (const [key, formContentItem] of iterateEntries(formContent)) {\n result[key] =\n typeof formContentItem === \"string\"\n ? formContentItem\n : Buffer.from(formContentItem.payload, formContentItem.encoding);\n }\n\n currentDeferred.resolve(result);\n }\n });\n\n processSugarWorker.on(\"error\", error => {\n throw error;\n });\n\n return processSugarWorker;\n }\n}\n\nconst generatorsCache: Map<string, GeneratorAsyncProxy> = new Map();\n\nexport function createAsyncGenerator(\n pathToGeneratorRootDir: string,\n purgeCache: boolean,\n useGeneratorRestarting: boolean\n): FormGenerator {\n let result = generatorsCache.get(pathToGeneratorRootDir);\n if (result == undefined) {\n result = new GeneratorAsyncProxy(pathToGeneratorRootDir, purgeCache, useGeneratorRestarting);\n generatorsCache.set(pathToGeneratorRootDir, result);\n }\n return result;\n}\n"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AASA,IAAAC,cAAA,GAAAD,OAAA;AAGA,IAAAE,sBAAA,GAAAF,OAAA;AAbA;;AAqBA,MAAMG,mBAAmB,CAA0B;EASxCC,WAAWA,CAACC,sBAA8B,EAAEC,UAAmB,EAAEC,sBAA+B,EAAE;IAAA,KARxFF,sBAAsB;IAAA,KACtBG,wBAAwB;IAAA,KACxBF,UAAU;IAAA,KACVC,sBAAsB;IAAA,KAC/BE,gBAAgB;IAAA,KAChBC,gBAAgB,GAAG,CAAC;IAAA,KACXC,uBAAuB,GAAsC,IAAIC,GAAG,CAAC,CAAC;IAGnF,IAAI,CAACL,sBAAsB,GAAGA,sBAAsB;IACpD,IAAI,CAACF,sBAAsB,GAAGA,sBAAsB;IACpD,IAAI,CAACC,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACE,wBAAwB,GAAG,IAAIK,+CAAwB,CAACP,UAAU,CAAC;EAC5E;EAEA,MAAaQ,iBAAiBA,CAACC,UAAwB,EAAEC,SAAwB,EAAyB;IACtG,MAAMC,sBAAsB,GAAG,MAAM,IAAI,CAACT,wBAAwB,CAACU,kBAAkB,CACjF,IAAI,CAACb,sBACT,CAAC;IACD,IAAIY,sBAAsB,IAAIE,SAAS,EAAE;MACrC,MAAM,IAAIC,KAAK,CAAC,uDAAuD,CAAC;IAC5E;IACA,OAAOH,sBAAsB,CAACH,iBAAiB,CAACC,UAAU,EAAEC,SAAS,CAAC;EAC1E;EAEA,MAAaK,aAAaA,CACt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E;IACrBW,MAAM,GAAG,IAAI3B,mBAAmB,CAACE,sBAAsB,EAAEC,UAAU,EAAEC,sBAAsB,CAAC;IAC5FkE,eAAe,CAAC9B,GAAG,CAACtC,sBAAsB,EAAEyB,MAAM,CAAC;EACvD;EACA,OAAOA,MAAM;AACjB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"CreateAsyncGenerator.js","names":["_child_process","require","_IterableUtils","_GeneratorRequireUtils","GeneratorAsyncProxy","constructor","pathToGeneratorRootDir","purgeCache","useGeneratorRestarting","generatorSourcesImporter","generatorProcess","maxRequestNumber","processSugarDeferredMap","Map","GeneratorSourcesImporter","getLocalizedSugar","sugarFiles","resources","localizationEntryPoint","importLocalization","undefined","Error","getDictionary","readSources","formSourcesPath","farmDirectory","importReadSources","getSugarTexts","importGetSugarTexts","getAllDependencies","importGetAllDependencies","supportsDependenciesExtraction","getAllDependenciesHash","importGetAllDependenciesHash","readSourcesAndProcessSugar","generationOptions","currentRequestNumber","promise","Promise","resolve","reject","set","forkReadSourcesAndProcessSugarWorker","console","log","kill","send","result","delete","processSugarWorker","fork","cwd","__dirname","on","response","currentDeferred","get","requestNumber","type","errorText","formContent","generatedForm","key","formContentItem","iterateEntries","Buffer","from","payload","encoding","error","generatorsCache","createAsyncGenerator"],"sources":["../../../../../../src/BuildTasks/Generator/GeneratorWorker/CreateAsyncGenerator.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport { ChildProcess, fork } from \"child_process\";\n\nimport {\n FormGenerator,\n GeneratedForm,\n GenerationOptions,\n LocalizationDictionaryContent,\n} from \"../../Form/GenerateForm\";\nimport { FormResources, FormSource, SugarContent } from \"../../FormSource\";\nimport { iterateEntries } from \"../../../../../Common/IterableUtils\";\nimport { ExtractorResult } from \"../../../../../Common/TextExtractor/TextExtractorTypes\";\n\nimport { GeneratorSourcesImporter } from \"./GeneratorRequireUtils\";\nimport type { CallResponse } from \"./ReadSourcesAndProcessSugarWorker\";\n\ninterface ProcessSugarDeferred {\n resolve: (result: GeneratedForm) => void;\n reject: (error: unknown) => void;\n}\n\nclass GeneratorAsyncProxy implements FormGenerator {\n private readonly pathToGeneratorRootDir: string;\n private readonly generatorSourcesImporter: GeneratorSourcesImporter;\n private readonly purgeCache: boolean;\n private readonly useGeneratorRestarting: boolean;\n private generatorProcess?: ChildProcess;\n private maxRequestNumber = 0;\n private readonly processSugarDeferredMap: Map<number, ProcessSugarDeferred> = new Map();\n\n public constructor(pathToGeneratorRootDir: string, purgeCache: boolean, useGeneratorRestarting: boolean) {\n this.useGeneratorRestarting = useGeneratorRestarting;\n this.pathToGeneratorRootDir = pathToGeneratorRootDir;\n this.purgeCache = purgeCache;\n this.generatorSourcesImporter = new GeneratorSourcesImporter(this.pathToGeneratorRootDir, this.purgeCache);\n }\n\n public async getLocalizedSugar(sugarFiles: SugarContent, resources: FormResources): Promise<SugarContent> {\n const localizationEntryPoint = await this.generatorSourcesImporter.importLocalization();\n if (localizationEntryPoint == undefined) {\n throw new Error(\"Данная версия генератора не поддерживает локализацию.\");\n }\n return localizationEntryPoint.getLocalizedSugar(sugarFiles, resources);\n }\n\n public async getDictionary(\n sugarFiles: SugarContent,\n resources: FormResources\n ): Promise<LocalizationDictionaryContent> {\n const localizationEntryPoint = await this.generatorSourcesImporter.importLocalization();\n if (localizationEntryPoint == undefined) {\n throw new Error(\"Данная версия генератора не поддерживает локализацию.\");\n }\n return localizationEntryPoint.getDictionary(sugarFiles, resources);\n }\n\n public async readSources(formSourcesPath: string, farmDirectory: string): Promise<FormSource> {\n const readSources: FormGenerator[\"readSources\"] = await this.generatorSourcesImporter.importReadSources();\n return await readSources(formSourcesPath, farmDirectory);\n }\n\n public async getSugarTexts(formSourcesPath: string, farmDirectory: string): Promise<ExtractorResult> {\n const getSugarTexts: FormGenerator[\"getSugarTexts\"] = await this.generatorSourcesImporter.importGetSugarTexts();\n return await getSugarTexts(formSourcesPath, farmDirectory);\n }\n\n public async getAllDependencies(formSourcesPath: string, farmDirectory: string): Promise<string[]> {\n const getAllDependencies = await this.generatorSourcesImporter.importGetAllDependencies();\n return await getAllDependencies(formSourcesPath, farmDirectory);\n }\n\n public async supportsDependenciesExtraction(): Promise<boolean> {\n const getAllDependenciesHash = await this.generatorSourcesImporter.importGetAllDependenciesHash();\n return getAllDependenciesHash != undefined;\n }\n\n public async getAllDependenciesHash(formSourcesPath: string, farmDirectory: string): Promise<string> {\n const getAllDependenciesHash = await this.generatorSourcesImporter.importGetAllDependenciesHash();\n return await getAllDependenciesHash(formSourcesPath, farmDirectory);\n }\n\n public async readSourcesAndProcessSugar(\n formSourcesPath: string,\n farmDirectory: string,\n generationOptions?: GenerationOptions\n ): Promise<GeneratedForm> {\n this.maxRequestNumber++;\n const currentRequestNumber = this.maxRequestNumber;\n const promise = new Promise<GeneratedForm>((resolve, reject) => {\n this.processSugarDeferredMap.set(currentRequestNumber, {\n resolve: resolve,\n reject: reject,\n });\n });\n\n if (!this.generatorProcess) {\n this.generatorProcess = this.forkReadSourcesAndProcessSugarWorker();\n }\n if (this.useGeneratorRestarting) {\n if (this.maxRequestNumber % 10 === 0) {\n console.log(\"Restarting generator\");\n this.generatorProcess.kill();\n this.generatorProcess = undefined;\n this.generatorProcess = this.forkReadSourcesAndProcessSugarWorker();\n console.log(\"Restarted generator\");\n }\n }\n\n this.generatorProcess.send([\n this.pathToGeneratorRootDir,\n formSourcesPath,\n farmDirectory,\n generationOptions,\n this.purgeCache,\n currentRequestNumber,\n ]);\n\n const result = await promise;\n this.processSugarDeferredMap.delete(currentRequestNumber);\n return result;\n }\n\n private forkReadSourcesAndProcessSugarWorker(): ChildProcess {\n const processSugarWorker = fork(\"./ReadSourcesAndProcessSugarWorker\", [], {\n cwd: __dirname,\n });\n\n processSugarWorker.on(\"message\", (response: CallResponse) => {\n const currentDeferred = this.processSugarDeferredMap.get(response.requestNumber);\n if (currentDeferred == undefined) {\n return;\n }\n if (response.type === \"Error\") {\n currentDeferred.reject(new Error(response.errorText));\n } else {\n const formContent = response.generatedForm;\n const result: GeneratedForm = {};\n\n for (const [key, formContentItem] of iterateEntries(formContent)) {\n result[key] =\n typeof formContentItem === \"string\"\n ? formContentItem\n : Buffer.from(formContentItem.payload, formContentItem.encoding);\n }\n\n currentDeferred.resolve(result);\n }\n });\n\n processSugarWorker.on(\"error\", error => {\n throw error;\n });\n\n return processSugarWorker;\n }\n}\n\nconst generatorsCache: Map<string, GeneratorAsyncProxy> = new Map();\n\nexport function createAsyncGenerator(\n pathToGeneratorRootDir: string,\n purgeCache: boolean,\n useGeneratorRestarting: boolean\n): FormGenerator {\n let result = generatorsCache.get(pathToGeneratorRootDir);\n if (result == undefined) {\n result = new GeneratorAsyncProxy(pathToGeneratorRootDir, purgeCache, useGeneratorRestarting);\n generatorsCache.set(pathToGeneratorRootDir, result);\n }\n return result;\n}\n"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AASA,IAAAC,cAAA,GAAAD,OAAA;AAGA,IAAAE,sBAAA,GAAAF,OAAA;AAbA;;AAqBA,MAAMG,mBAAmB,CAA0B;EASxCC,WAAWA,CAACC,sBAA8B,EAAEC,UAAmB,EAAEC,sBAA+B,EAAE;IAAA,KARxFF,sBAAsB;IAAA,KACtBG,wBAAwB;IAAA,KACxBF,UAAU;IAAA,KACVC,sBAAsB;IAAA,KAC/BE,gBAAgB;IAAA,KAChBC,gBAAgB,GAAG,CAAC;IAAA,KACXC,uBAAuB,GAAsC,IAAIC,GAAG,CAAC,CAAC;IAGnF,IAAI,CAACL,sBAAsB,GAAGA,sBAAsB;IACpD,IAAI,CAACF,sBAAsB,GAAGA,sBAAsB;IACpD,IAAI,CAACC,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACE,wBAAwB,GAAG,IAAIK,+CAAwB,CAAC,IAAI,CAACR,sBAAsB,EAAE,IAAI,CAACC,UAAU,CAAC;EAC9G;EAEA,MAAaQ,iBAAiBA,CAACC,UAAwB,EAAEC,SAAwB,EAAyB;IACtG,MAAMC,sBAAsB,GAAG,MAAM,I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B;AACJ;AAEA,MAAMqB,eAAiD,GAAG,IAAIzD,GAAG,CAAC,CAAC;AAE5D,SAAS0D,oBAAoBA,CAChCjE,sBAA8B,EAC9BC,UAAmB,EACnBC,sBAA+B,EAClB;EACb,IAAIuC,MAAM,GAAGuB,eAAe,CAACd,GAAG,CAAClD,sBAAsB,CAAC;EACxD,IAAIyC,MAAM,IAAI3B,SAAS,EAAE;IACrB2B,MAAM,GAAG,IAAI3C,mBAAmB,CAACE,sBAAsB,EAAEC,UAAU,EAAEC,sBAAsB,CAAC;IAC5F8D,eAAe,CAAC7B,GAAG,CAACnC,sBAAsB,EAAEyC,MAAM,CAAC;EACvD;EACA,OAAOA,MAAM;AACjB","ignoreList":[]}
|
|
@@ -4,87 +4,37 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.GeneratorSourcesValidator = exports.GeneratorSourcesImporter = void 0;
|
|
7
|
-
var path = _interopRequireWildcard(require("path"));
|
|
8
|
-
var _fsExtra = require("fs-extra");
|
|
9
|
-
var _FsUtils = require("../../../Commons/FsUtils");
|
|
10
|
-
var _EngineStructureUtils = require("../../EngineStructureUtils");
|
|
11
|
-
var _ReadFormSource = require("../../ReadFormSource");
|
|
12
7
|
var _ToolsApiClient = require("../../../Commons/ApiClient/ToolsApiClient");
|
|
13
8
|
var _RequireUncached = require("./RequireUncached");
|
|
14
|
-
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); }
|
|
15
|
-
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; }
|
|
16
9
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
17
10
|
|
|
18
11
|
class GeneratorSourcesImporter {
|
|
19
|
-
constructor(purgeCache) {
|
|
12
|
+
constructor(generatorPath, purgeCache) {
|
|
13
|
+
this.generatorPath = void 0;
|
|
20
14
|
this.purgeCache = void 0;
|
|
15
|
+
this.generatorPath = generatorPath;
|
|
21
16
|
this.purgeCache = purgeCache;
|
|
22
17
|
}
|
|
23
|
-
async importReadSources(
|
|
24
|
-
|
|
25
|
-
const readSourcesPath = path.join(pathToGenerator, "dist", "generators", "readSources.js");
|
|
26
|
-
if (await (0, _FsUtils.isFileExists)(readSourcesPath)) {
|
|
27
|
-
return this.requireUncachedDefault(readSourcesPath);
|
|
28
|
-
} else {
|
|
29
|
-
return _ReadFormSource.readFormSource;
|
|
30
|
-
}
|
|
31
|
-
} else {
|
|
32
|
-
const generatorMain = this.requireUncachedAllNamed(pathToGenerator);
|
|
33
|
-
return generatorMain["readSources"];
|
|
34
|
-
}
|
|
18
|
+
async importReadSources() {
|
|
19
|
+
return this.require("readSources");
|
|
35
20
|
}
|
|
36
|
-
async importGetSugarTexts(
|
|
37
|
-
|
|
38
|
-
const getSugarTextsPath = path.join(pathToGenerator, "dist", "generators", "getSugarTexts.js");
|
|
39
|
-
if (await (0, _FsUtils.isFileExists)(getSugarTextsPath)) {
|
|
40
|
-
return this.requireUncachedDefault(getSugarTextsPath);
|
|
41
|
-
}
|
|
42
|
-
throw new Error("Для данной формы извлекание сахара не поддерживается. Подними движок до версии ^5.37.0");
|
|
43
|
-
} else {
|
|
44
|
-
const generatorMain = this.requireUncachedAllNamed(pathToGenerator);
|
|
45
|
-
return generatorMain["getSugarTexts"];
|
|
46
|
-
}
|
|
21
|
+
async importGetSugarTexts() {
|
|
22
|
+
return this.require("getSugarTexts");
|
|
47
23
|
}
|
|
48
|
-
async importGetAllDependencies(
|
|
49
|
-
|
|
50
|
-
return undefined;
|
|
51
|
-
}
|
|
52
|
-
const generatorMain = this.requireUncachedAllNamed(pathToGenerator);
|
|
53
|
-
return generatorMain["getAllDependencies"];
|
|
24
|
+
async importGetAllDependencies() {
|
|
25
|
+
return this.require("getAllDependencies");
|
|
54
26
|
}
|
|
55
|
-
async importGetAllDependenciesHash(
|
|
56
|
-
|
|
57
|
-
return undefined;
|
|
58
|
-
}
|
|
59
|
-
const generatorMain = this.requireUncachedAllNamed(pathToGenerator);
|
|
60
|
-
return generatorMain["getAllDependenciesHash"];
|
|
27
|
+
async importGetAllDependenciesHash() {
|
|
28
|
+
return this.require("getAllDependenciesHash");
|
|
61
29
|
}
|
|
62
|
-
async importProcessSugar(
|
|
63
|
-
|
|
64
|
-
const processSugarPath = path.join(pathToGenerator, "dist", "generators", "processSugar.js");
|
|
65
|
-
|
|
66
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
67
|
-
return require(processSugarPath).default;
|
|
68
|
-
} else {
|
|
69
|
-
const generatorMain = this.requireUncachedAllNamed(pathToGenerator);
|
|
70
|
-
return generatorMain["processSugar"];
|
|
71
|
-
}
|
|
30
|
+
async importProcessSugar() {
|
|
31
|
+
return this.require("processSugar");
|
|
72
32
|
}
|
|
73
|
-
async importLocalization(
|
|
74
|
-
|
|
75
|
-
const localizationEntryPointPath = path.join(pathToGenerator, "dist", "generators", "localization.js");
|
|
76
|
-
if (!(await (0, _fsExtra.pathExists)(localizationEntryPointPath))) {
|
|
77
|
-
return undefined;
|
|
78
|
-
}
|
|
79
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
80
|
-
return require(localizationEntryPointPath);
|
|
81
|
-
} else {
|
|
82
|
-
const generatorMain = this.requireUncachedAllNamed(pathToGenerator);
|
|
83
|
-
return generatorMain["localization"];
|
|
84
|
-
}
|
|
33
|
+
async importLocalization() {
|
|
34
|
+
return this.require("localization");
|
|
85
35
|
}
|
|
86
|
-
|
|
87
|
-
return
|
|
36
|
+
async require(name) {
|
|
37
|
+
return this.requireUncachedAllNamed(this.generatorPath)[name];
|
|
88
38
|
}
|
|
89
39
|
requireUncachedAllNamed(module) {
|
|
90
40
|
return (0, _RequireUncached.requireUncachedAllNamed)(module, this.purgeCache);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeneratorRequireUtils.js","names":["path","_interopRequireWildcard","require","_fsExtra","_FsUtils","_EngineStructureUtils","_ReadFormSource","_ToolsApiClient","_RequireUncached","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","GeneratorSourcesImporter","constructor","purgeCache","importReadSources","pathToGenerator","isOldGeneratorSourcesStructure","readSourcesPath","join","isFileExists","requireUncachedDefault","readFormSource","generatorMain","requireUncachedAllNamed","importGetSugarTexts","isOldGeneratorGetSugarTextsStructure","getSugarTextsPath","Error","importGetAllDependencies","undefined","importGetAllDependenciesHash","importProcessSugar","processSugarPath","importLocalization","localizationEntryPointPath","pathExists","module","exports","GeneratorSourcesValidator","generationOptions","isLocalDebug","apiClient","validate","formContent","compileNormalizationRulesOrDie","_compileResult$diagno","_compileResult$diagno2","normalizationRules","compileResult","compileNormalizationRules","diagnosticMessages","length","JSON","stringify","sourceText","resourcesHash","ToolsApiClient"],"sources":["../../../../../../src/BuildTasks/Generator/GeneratorWorker/GeneratorRequireUtils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-return */\nimport * as path from \"path\";\n\nimport { pathExists } from \"fs-extra\";\n\nimport { isFileExists } from \"../../../Commons/FsUtils\";\nimport { isOldGeneratorGetSugarTextsStructure, isOldGeneratorSourcesStructure } from \"../../EngineStructureUtils\";\nimport { FormGenerator, GeneratedForm, GenerationOptions, LocalizationEntryPoint } from \"../../Form/GenerateForm\";\nimport { FormResources, readFormSource, SugarContent } from \"../../ReadFormSource\";\nimport { ToolsApiClient } from \"../../../Commons/ApiClient/ToolsApiClient\";\n\nimport { RequireDefaultResult, requireUncachedAllNamed, requireUncachedDefault } from \"./RequireUncached\";\n\ntype ProcessSugarFunc = (\n sugarFiles: SugarContent,\n resources: FormResources,\n generationOptions?: GenerationOptions\n) => GeneratedForm | Promise<GeneratedForm>;\n\nexport class GeneratorSourcesImporter {\n private readonly purgeCache: boolean;\n\n public constructor(purgeCache: boolean) {\n this.purgeCache = purgeCache;\n }\n\n public async importReadSources(pathToGenerator: string): Promise<FormGenerator[\"readSources\"]> {\n if (await isOldGeneratorSourcesStructure(pathToGenerator)) {\n const readSourcesPath = path.join(pathToGenerator, \"dist\", \"generators\", \"readSources.js\");\n\n if (await isFileExists(readSourcesPath)) {\n return this.requireUncachedDefault(readSourcesPath);\n } else {\n return readFormSource;\n }\n } else {\n const generatorMain = this.requireUncachedAllNamed(pathToGenerator);\n return generatorMain[\"readSources\"];\n }\n }\n\n public async importGetSugarTexts(pathToGenerator: string): Promise<FormGenerator[\"getSugarTexts\"]> {\n if (await isOldGeneratorGetSugarTextsStructure(pathToGenerator)) {\n const getSugarTextsPath = path.join(pathToGenerator, \"dist\", \"generators\", \"getSugarTexts.js\");\n\n if (await isFileExists(getSugarTextsPath)) {\n return this.requireUncachedDefault(getSugarTextsPath);\n }\n throw new Error(\"Для данной формы извлекание сахара не поддерживается. Подними движок до версии ^5.37.0\");\n } else {\n const generatorMain = this.requireUncachedAllNamed(pathToGenerator);\n return generatorMain[\"getSugarTexts\"];\n }\n }\n\n public async importGetAllDependencies(\n pathToGenerator: string\n ): Promise<FormGenerator[\"getAllDependencies\"] | undefined> {\n if (await isOldGeneratorSourcesStructure(pathToGenerator)) {\n return undefined;\n }\n const generatorMain = this.requireUncachedAllNamed(pathToGenerator);\n return generatorMain[\"getAllDependencies\"];\n }\n\n public async importGetAllDependenciesHash(\n pathToGenerator: string\n ): Promise<FormGenerator[\"getAllDependenciesHash\"] | undefined> {\n if (await isOldGeneratorSourcesStructure(pathToGenerator)) {\n return undefined;\n }\n const generatorMain = this.requireUncachedAllNamed(pathToGenerator);\n return generatorMain[\"getAllDependenciesHash\"];\n }\n\n public async importProcessSugar(pathToGenerator: string): Promise<ProcessSugarFunc> {\n if (await isOldGeneratorSourcesStructure(pathToGenerator)) {\n const processSugarPath = path.join(pathToGenerator, \"dist\", \"generators\", \"processSugar.js\");\n\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n return require(processSugarPath).default;\n } else {\n const generatorMain = this.requireUncachedAllNamed(pathToGenerator);\n return generatorMain[\"processSugar\"];\n }\n }\n\n public async importLocalization(pathToGenerator: string): Promise<undefined | LocalizationEntryPoint> {\n if (await isOldGeneratorSourcesStructure(pathToGenerator)) {\n const localizationEntryPointPath = path.join(pathToGenerator, \"dist\", \"generators\", \"localization.js\");\n if (!(await pathExists(localizationEntryPointPath))) {\n return undefined;\n }\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n return require(localizationEntryPointPath);\n } else {\n const generatorMain = this.requireUncachedAllNamed(pathToGenerator);\n return generatorMain[\"localization\"];\n }\n }\n private requireUncachedDefault(module: string): RequireDefaultResult {\n return requireUncachedDefault(module, this.purgeCache);\n }\n\n private requireUncachedAllNamed(module: string): RequireDefaultResult {\n return requireUncachedAllNamed(module, this.purgeCache);\n }\n}\n\nexport class GeneratorSourcesValidator {\n private readonly isLocalDebug: boolean;\n private readonly apiClient: ToolsApiClient;\n\n public constructor(generationOptions: GenerationOptions | undefined) {\n this.isLocalDebug = generationOptions?.resourcesHash == \"local-hash\";\n this.apiClient = new ToolsApiClient();\n }\n\n public validate = async (formContent: GeneratedForm): Promise<void> => {\n if (!this.isLocalDebug) {\n return;\n }\n await this.compileNormalizationRulesOrDie(formContent);\n };\n\n private readonly compileNormalizationRulesOrDie = async (formContent: GeneratedForm): Promise<void> => {\n const normalizationRules = formContent[\"ServerSide.normalize\"];\n if (!normalizationRules || typeof normalizationRules !== \"string\") {\n return;\n }\n const compileResult = await this.apiClient.compileNormalizationRules(normalizationRules, \"formulas\");\n if (!compileResult || (compileResult?.diagnosticMessages?.length ?? 0) == 0) {\n return;\n }\n\n throw Error(\n `Invalid ServerSide.normalize:\\r\\n\n ${JSON.stringify(compileResult.diagnosticMessages)}\\r\\n\n ${compileResult.sourceText}`\n );\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,IAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAH,OAAA;AAEA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AAEA,IAAAM,gBAAA,GAAAN,OAAA;AAA0G,SAAAO,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAT,wBAAAS,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,C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G,aAAa,aAAbA,aAAa,gBAAAF,sBAAA,GAAbE,aAAa,CAAEE,kBAAkB,cAAAJ,sBAAA,uBAAjCA,sBAAA,CAAmCK,MAAM,cAAAN,qBAAA,cAAAA,qBAAA,GAAI,CAAC,KAAK,CAAC,EAAE;QACzE;MACJ;MAEA,MAAMlB,KAAK,CACP;AACZ,eAAeyB,IAAI,CAACC,SAAS,CAACL,aAAa,CAACE,kBAAkB,CAAC;AAC/D,eAAeF,aAAa,CAACM,UAAU,EAC/B,CAAC;IACL,CAAC;IA1BG,IAAI,CAACd,YAAY,GAAG,CAAAD,iBAAiB,aAAjBA,iBAAiB,uBAAjBA,iBAAiB,CAAEgB,aAAa,KAAI,YAAY;IACpE,IAAI,CAACd,SAAS,GAAG,IAAIe,8BAAc,CAAC,CAAC;EACzC;AAyBJ;AAACnB,OAAA,CAAAC,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"GeneratorRequireUtils.js","names":["_ToolsApiClient","require","_RequireUncached","GeneratorSourcesImporter","constructor","generatorPath","purgeCache","importReadSources","importGetSugarTexts","importGetAllDependencies","importGetAllDependenciesHash","importProcessSugar","importLocalization","name","requireUncachedAllNamed","module","exports","GeneratorSourcesValidator","generationOptions","isLocalDebug","apiClient","validate","formContent","compileNormalizationRulesOrDie","_compileResult$diagno","_compileResult$diagno2","normalizationRules","compileResult","compileNormalizationRules","diagnosticMessages","length","Error","JSON","stringify","sourceText","resourcesHash","ToolsApiClient"],"sources":["../../../../../../src/BuildTasks/Generator/GeneratorWorker/GeneratorRequireUtils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-return */\nimport { FormGenerator, GeneratedForm, GenerationOptions, LocalizationEntryPoint } from \"../../Form/GenerateForm\";\nimport { FormResources, SugarContent } from \"../../FormSource\";\nimport { ToolsApiClient } from \"../../../Commons/ApiClient/ToolsApiClient\";\n\nimport { RequireDefaultResult, requireUncachedAllNamed } from \"./RequireUncached\";\n\ntype ProcessSugarFunc = (\n sugarFiles: SugarContent,\n resources: FormResources,\n generationOptions?: GenerationOptions\n) => GeneratedForm | Promise<GeneratedForm>;\n\nexport class GeneratorSourcesImporter {\n private readonly generatorPath: string;\n private readonly purgeCache: boolean;\n\n public constructor(generatorPath: string, purgeCache: boolean) {\n this.generatorPath = generatorPath;\n this.purgeCache = purgeCache;\n }\n\n public async importReadSources(): Promise<FormGenerator[\"readSources\"]> {\n return this.require(\"readSources\");\n }\n\n public async importGetSugarTexts(): Promise<FormGenerator[\"getSugarTexts\"]> {\n return this.require(\"getSugarTexts\");\n }\n\n public async importGetAllDependencies(): Promise<FormGenerator[\"getAllDependencies\"]> {\n return this.require(\"getAllDependencies\");\n }\n\n public async importGetAllDependenciesHash(): Promise<FormGenerator[\"getAllDependenciesHash\"]> {\n return this.require(\"getAllDependenciesHash\");\n }\n\n public async importProcessSugar(): Promise<ProcessSugarFunc> {\n return this.require(\"processSugar\");\n }\n\n public async importLocalization(): Promise<LocalizationEntryPoint> {\n return this.require(\"localization\");\n }\n\n private async require(name: string) {\n return this.requireUncachedAllNamed(this.generatorPath)[name];\n }\n\n private requireUncachedAllNamed(module: string): RequireDefaultResult {\n return requireUncachedAllNamed(module, this.purgeCache);\n }\n}\n\nexport class GeneratorSourcesValidator {\n private readonly isLocalDebug: boolean;\n private readonly apiClient: ToolsApiClient;\n\n public constructor(generationOptions: GenerationOptions | undefined) {\n this.isLocalDebug = generationOptions?.resourcesHash == \"local-hash\";\n this.apiClient = new ToolsApiClient();\n }\n\n public validate = async (formContent: GeneratedForm): Promise<void> => {\n if (!this.isLocalDebug) {\n return;\n }\n await this.compileNormalizationRulesOrDie(formContent);\n };\n\n private readonly compileNormalizationRulesOrDie = async (formContent: GeneratedForm): Promise<void> => {\n const normalizationRules = formContent[\"ServerSide.normalize\"];\n if (!normalizationRules || typeof normalizationRules !== \"string\") {\n return;\n }\n const compileResult = await this.apiClient.compileNormalizationRules(normalizationRules, \"formulas\");\n if (!compileResult || (compileResult?.diagnosticMessages?.length ?? 0) == 0) {\n return;\n }\n\n throw Error(\n `Invalid ServerSide.normalize:\\r\\n\n ${JSON.stringify(compileResult.diagnosticMessages)}\\r\\n\n ${compileResult.sourceText}`\n );\n };\n}\n"],"mappings":";;;;;;AAGA,IAAAA,eAAA,GAAAC,OAAA;AAEA,IAAAC,gBAAA,GAAAD,OAAA;AALA;;AAaO,MAAME,wBAAwB,CAAC;EAI3BC,WAAWA,CAACC,aAAqB,EAAEC,UAAmB,EAAE;IAAA,KAH9CD,aAAa;IAAA,KACbC,UAAU;IAGvB,IAAI,CAACD,aAAa,GAAGA,aAAa;IAClC,IAAI,CAACC,UAAU,GAAGA,UAAU;EAChC;EAEA,MAAaC,iBAAiBA,CAAA,EAA0C;IACpE,OAAO,IAAI,CAACN,OAAO,CAAC,aAAa,CAAC;EACtC;EAEA,MAAaO,mBAAmBA,CAAA,EAA4C;IACxE,OAAO,IAAI,CAACP,OAAO,CAAC,eAAe,CAAC;EACxC;EAEA,MAAaQ,wBAAwBA,CAAA,EAAiD;IAClF,OAAO,IAAI,CAACR,OAAO,CAAC,oBAAoB,CAAC;EAC7C;EAEA,MAAaS,4BAA4BA,CAAA,EAAqD;IAC1F,OAAO,IAAI,CAACT,OAAO,CAAC,wBAAwB,CAAC;EACjD;EAEA,MAAaU,kBAAkBA,CAAA,EAA8B;IACzD,OAAO,IAAI,CAACV,OAAO,CAAC,cAAc,CAAC;EACvC;EAEA,MAAaW,kBAAkBA,CAAA,EAAoC;IAC/D,OAAO,IAAI,CAACX,OAAO,CAAC,cAAc,CAAC;EACvC;EAEA,MAAcA,OAAOA,CAACY,IAAY,EAAE;IAChC,OAAO,IAAI,CAACC,uBAAuB,CAAC,IAAI,CAACT,aAAa,CAAC,CAACQ,IAAI,CAAC;EACjE;EAEQC,uBAAuBA,CAACC,MAAc,EAAwB;IAClE,OAAO,IAAAD,wCAAuB,EAACC,MAAM,EAAE,IAAI,CAACT,UAAU,CAAC;EAC3D;AACJ;AAAC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":[]}
|
package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/ReadSourcesAndProcessSugarWorker.js
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
var _IterableUtils = require("../../../../../Common/IterableUtils");
|
|
4
4
|
var _GeneratorRequireUtils = require("./GeneratorRequireUtils");
|
|
5
5
|
var _TypedProcessWorker = require("./TypedProcessWorker");
|
|
6
|
-
_TypedProcessWorker.TypedProcessWorker.start(async ([pathToGeneratorProcessSugar, formSourcesPath, farmDirectory,
|
|
6
|
+
_TypedProcessWorker.TypedProcessWorker.start(async ([pathToGeneratorProcessSugar, formSourcesPath, farmDirectory, generationOptions, purgeCache, requestNumber], send) => {
|
|
7
7
|
let formSource;
|
|
8
8
|
try {
|
|
9
|
-
const importer = new _GeneratorRequireUtils.GeneratorSourcesImporter(purgeCache);
|
|
10
|
-
const readSources = await importer.importReadSources(
|
|
11
|
-
formSource = await readSources(formSourcesPath, farmDirectory
|
|
12
|
-
const processSugar = await importer.importProcessSugar(
|
|
9
|
+
const importer = new _GeneratorRequireUtils.GeneratorSourcesImporter(pathToGeneratorProcessSugar, purgeCache);
|
|
10
|
+
const readSources = await importer.importReadSources();
|
|
11
|
+
formSource = await readSources(formSourcesPath, farmDirectory);
|
|
12
|
+
const processSugar = await importer.importProcessSugar();
|
|
13
13
|
const formContent = await processSugar(formSource.sugarContent, formSource.resources, generationOptions);
|
|
14
14
|
|
|
15
15
|
// eslint-disable-next-line no-warning-comments
|
package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/ReadSourcesAndProcessSugarWorker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReadSourcesAndProcessSugarWorker.js","names":["_IterableUtils","require","_GeneratorRequireUtils","_TypedProcessWorker","TypedProcessWorker","start","pathToGeneratorProcessSugar","formSourcesPath","farmDirectory","
|
|
1
|
+
{"version":3,"file":"ReadSourcesAndProcessSugarWorker.js","names":["_IterableUtils","require","_GeneratorRequireUtils","_TypedProcessWorker","TypedProcessWorker","start","pathToGeneratorProcessSugar","formSourcesPath","farmDirectory","generationOptions","purgeCache","requestNumber","send","formSource","importer","GeneratorSourcesImporter","readSources","importReadSources","processSugar","importProcessSugar","formContent","sugarContent","resources","result","key","formContentItem","iterateEntries","Buffer","payload","toString","encoding","type","gfv","generatedForm","error","Error","_formSource","errorText","stack","_formSource2"],"sources":["../../../../../../src/BuildTasks/Generator/GeneratorWorker/ReadSourcesAndProcessSugarWorker.ts"],"sourcesContent":["import type { GeneratedForm, GenerationOptions } from \"../../Form/GenerateForm\";\nimport type { FormSource } from \"../../FormSource\";\nimport { iterateEntries } from \"../../../../../Common/IterableUtils\";\n\nimport { GeneratorSourcesImporter } from \"./GeneratorRequireUtils\";\nimport { TypedProcessWorker } from \"./TypedProcessWorker\";\n\nexport interface GeneratedFormInterProcessMessage {\n [relativeFileName: string]: string | { payload: string; encoding: BufferEncoding };\n}\n\nexport type CallMessage = [\n generatorPath: string,\n formPath: string,\n farmPath: string,\n undefined | GenerationOptions,\n purgeCache: boolean,\n requestNumber: number,\n];\n\nexport type CallResponse =\n | { type: \"Result\"; gfv: string; generatedForm: GeneratedFormInterProcessMessage; requestNumber: number }\n | { type: \"Error\"; gfv?: string; errorText: string; requestNumber: number };\n\nTypedProcessWorker.start<CallMessage, CallResponse>(\n async (\n [pathToGeneratorProcessSugar, formSourcesPath, farmDirectory, generationOptions, purgeCache, requestNumber],\n send\n ): Promise<void> => {\n let formSource: FormSource | undefined;\n try {\n const importer = new GeneratorSourcesImporter(pathToGeneratorProcessSugar, purgeCache);\n const readSources = await importer.importReadSources();\n formSource = await readSources(formSourcesPath, farmDirectory);\n\n const processSugar = await importer.importProcessSugar();\n\n const formContent: GeneratedForm = await processSugar(\n formSource.sugarContent,\n formSource.resources,\n generationOptions\n );\n\n // eslint-disable-next-line no-warning-comments\n // TODO(2026-06-30): временно отключаем валидацию компиляции Flang на бэкенде (исправить в задаче https://yt.skbkontur.ru/issue/FS-9242)\n // const validator = new GeneratorSourcesValidator(generationOptions);\n // await validator.validate(formContent);\n\n const result: GeneratedFormInterProcessMessage = {};\n\n // NOTE Because only JSON are allowed for IPC we need to convert Buffer -> Base64\n // Another solution is use a stream, but formContent still need to convert or send by chunks\n for (const [key, formContentItem] of iterateEntries(formContent)) {\n // @ts-ignore\n result[key] =\n formContentItem instanceof Buffer\n ? { payload: formContentItem.toString(\"base64\"), encoding: \"base64\" }\n : formContentItem;\n }\n\n send({\n type: \"Result\",\n gfv: formSource.resources.gfv,\n generatedForm: result,\n requestNumber: requestNumber,\n });\n } catch (error) {\n if (error instanceof Error) {\n send({\n type: \"Error\",\n gfv: formSource?.resources.gfv,\n errorText: `${error.toString()}\\n${error.stack}`,\n requestNumber: requestNumber,\n });\n } else {\n send({\n type: \"Error\",\n gfv: formSource?.resources.gfv,\n errorText: `${error}`,\n requestNumber: requestNumber,\n });\n }\n }\n }\n);\n"],"mappings":";;AAEA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,sBAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AAmBAG,sCAAkB,CAACC,KAAK,CACpB,OACI,CAACC,2BAA2B,EAAEC,eAAe,EAAEC,aAAa,EAAEC,iBAAiB,EAAEC,UAAU,EAAEC,aAAa,CAAC,EAC3GC,IAAI,KACY;EAChB,IAAIC,UAAkC;EACtC,IAAI;IACA,MAAMC,QAAQ,GAAG,IAAIC,+CAAwB,CAACT,2BAA2B,EAAEI,UAAU,CAAC;IACtF,MAAMM,WAAW,GAAG,MAAMF,QAAQ,CAACG,iBAAiB,CAAC,CAAC;IACtDJ,UAAU,GAAG,MAAMG,WAAW,CAACT,eAAe,EAAEC,aAAa,CAAC;IAE9D,MAAMU,YAAY,GAAG,MAAMJ,QAAQ,CAACK,kBAAkB,CAAC,CAAC;IAExD,MAAMC,WAA0B,GAAG,MAAMF,YAAY,CACjDL,UAAU,CAACQ,YAAY,EACvBR,UAAU,CAACS,SAAS,EACpBb,iB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|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.requireUncachedAllNamed = requireUncachedAllNamed;
|
|
7
|
-
exports.requireUncachedDefault = requireUncachedDefault;
|
|
8
7
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
8
|
|
|
10
9
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -30,14 +29,6 @@ function interopRequireDefault(obj) {
|
|
|
30
29
|
default: obj
|
|
31
30
|
};
|
|
32
31
|
}
|
|
33
|
-
function requireUncachedDefault(module, purgeCacheOnImport) {
|
|
34
|
-
if (purgeCacheOnImport) {
|
|
35
|
-
purgeCache(module);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
39
|
-
return interopRequireDefault(require(module)).default;
|
|
40
|
-
}
|
|
41
32
|
function requireUncachedAllNamed(module, purgeCacheOnImport) {
|
|
42
33
|
if (purgeCacheOnImport) {
|
|
43
34
|
purgeCache(module);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequireUncached.js","names":["purgeCache","moduleName","moduleKey","require","resolve","module","cache","Array","isArray","children","subModule","id","isEsModule","obj","__esModule","interopRequireDefault","default","
|
|
1
|
+
{"version":3,"file":"RequireUncached.js","names":["purgeCache","moduleName","moduleKey","require","resolve","module","cache","Array","isArray","children","subModule","id","isEsModule","obj","__esModule","interopRequireDefault","default","requireUncachedAllNamed","purgeCacheOnImport"],"sources":["../../../../../../src/BuildTasks/Generator/GeneratorWorker/RequireUncached.ts"],"sourcesContent":["interface EsRequireResult {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n default?: any;\n __esModule?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [module: string]: any;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype CommonJsRequireResult = any;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type RequireDefaultResult = any;\n\nfunction purgeCache(moduleName: string): void {\n const moduleKey = require.resolve(moduleName);\n const module: undefined | NodeModule = require.cache[moduleKey];\n\n if (module) {\n delete require.cache[moduleKey];\n\n if (Array.isArray(module.children)) {\n for (const subModule of module.children) {\n purgeCache(subModule.id);\n }\n }\n }\n}\n\nfunction isEsModule(obj: EsRequireResult | CommonJsRequireResult): obj is EsRequireResult {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return obj && obj.__esModule;\n}\n\nfunction interopRequireDefault(obj: EsRequireResult | CommonJsRequireResult): EsRequireResult {\n return isEsModule(obj) ? obj : { default: obj };\n}\n\nexport function requireUncachedAllNamed(module: string, purgeCacheOnImport: boolean): RequireDefaultResult {\n if (purgeCacheOnImport) {\n purgeCache(module);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n return interopRequireDefault(require(module));\n}\n"],"mappings":";;;;;;AAQA;;AAGA;;AAGA,SAASA,UAAUA,CAACC,UAAkB,EAAQ;EAC1C,MAAMC,SAAS,GAAGC,OAAO,CAACC,OAAO,CAACH,UAAU,CAAC;EAC7C,MAAMI,MAA8B,GAAGF,OAAO,CAACG,KAAK,CAACJ,SAAS,CAAC;EAE/D,IAAIG,MAAM,EAAE;IACR,OAAOF,OAAO,CAACG,KAAK,CAACJ,SAAS,CAAC;IAE/B,IAAIK,KAAK,CAACC,OAAO,CAACH,MAAM,CAACI,QAAQ,CAAC,EAAE;MAChC,KAAK,MAAMC,SAAS,IAAIL,MAAM,CAACI,QAAQ,EAAE;QACrCT,UAAU,CAACU,SAAS,CAACC,EAAE,CAAC;MAC5B;IACJ;EACJ;AACJ;AAEA,SAASC,UAAUA,CAACC,GAA4C,EAA0B;EACtF;EACA,OAAOA,GAAG,IAAIA,GAAG,CAACC,UAAU;AAChC;AAEA,SAASC,qBAAqBA,CAACF,GAA4C,EAAmB;EAC1F,OAAOD,UAAU,CAACC,GAAG,CAAC,GAAGA,GAAG,GAAG;IAAEG,OAAO,EAAEH;EAAI,CAAC;AACnD;AAEO,SAASI,uBAAuBA,CAACZ,MAAc,EAAEa,kBAA2B,EAAwB;EACvG,IAAIA,kBAAkB,EAAE;IACpBlB,UAAU,CAACK,MAAM,CAAC;EACtB;;EAEA;EACA,OAAOU,qBAAqB,CAACZ,OAAO,CAACE,MAAM,CAAC,CAAC;AACjD","ignoreList":[]}
|
|
@@ -44,7 +44,7 @@ function getGeneratorVersion(generatorSource) {
|
|
|
44
44
|
throw new Error("InvalidProgramState");
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
async function runBuildForms(context, options, farmDirectory, resourcesDirectory, engineDirectory, candyModulesDirectory
|
|
47
|
+
async function runBuildForms(context, options, farmDirectory, resourcesDirectory, engineDirectory, candyModulesDirectory) {
|
|
48
48
|
const buildOptions = options;
|
|
49
49
|
const pickListsChain = _Observe.Observe.files(_path.default.join(farmDirectory, "picklists"), "*.json").do(x => _FSTask.FSTask.copyRecursively(context.logger.withPrefix("PICKLISTS"), x, _path.default.join(resourcesDirectory, "picklists")));
|
|
50
50
|
const formInfos = await _FormGlobsUtils.FormGlobs.resolveGfvGlobs(options.formGlobs, farmDirectory);
|
|
@@ -124,7 +124,7 @@ async function runBuildForms(context, options, farmDirectory, resourcesDirectory
|
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
126
|
if (await fi.generator.supportsDependenciesExtraction()) {
|
|
127
|
-
dependenciesHash = await fi.generator.getAllDependenciesHash(formDirPath, farmDirectory
|
|
127
|
+
dependenciesHash = await fi.generator.getAllDependenciesHash(formDirPath, farmDirectory);
|
|
128
128
|
}
|
|
129
129
|
return {
|
|
130
130
|
...fi,
|
|
@@ -148,7 +148,7 @@ async function runBuildForms(context, options, farmDirectory, resourcesDirectory
|
|
|
148
148
|
context.logger.withPrefix(`GENERATE:${gfv}`).log("Skipped due build cache exits");
|
|
149
149
|
return undefined;
|
|
150
150
|
}
|
|
151
|
-
return (0, _GenerateForm.generateForm)(fi.formSourcesPath, farmDirectory,
|
|
151
|
+
return (0, _GenerateForm.generateForm)(fi.formSourcesPath, farmDirectory, fi.generator, undefined, {
|
|
152
152
|
skipCodeReformatting: options.skipGeneratedCodeReformatting,
|
|
153
153
|
resourcesHash: (_fi$dependenciesHash = fi.dependenciesHash) !== null && _fi$dependenciesHash !== void 0 ? _fi$dependenciesHash : "UndefinedResourcesHash"
|
|
154
154
|
});
|