@kontur.candy/tools 2.214.0 → 2.215.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.
- package/distr/Common/CandyApiClient/CandyApiClient.js +3 -2
- package/distr/Common/CandyApiClient/CandyApiClient.js.map +1 -1
- package/distr/Common/CandyApiClient/FakeCandyApiClient.js.map +1 -1
- package/distr/Common/CandyApiClient/ICandyApiClient.js.map +1 -1
- package/distr/Common/CandyApiClient/IsBuffer.js +5 -1
- package/distr/Common/CandyApiClient/IsBuffer.js.map +1 -1
- package/distr/Common/CandyApiClient/Types/QueryCollecton/InnerQueryExpression.js.map +1 -1
- package/distr/Common/CandyApiClient/Types/QueryCollecton/InnerQueryRequest.js.map +1 -1
- package/distr/Common/Errors/ExtendedError.js +1 -0
- package/distr/Common/Errors/ExtendedError.js.map +1 -1
- package/distr/Common/HttpClient/FetchImplementation/NodeFetch.js.map +1 -1
- package/distr/Common/HttpClient/HttpClient.js +10 -5
- package/distr/Common/HttpClient/HttpClient.js.map +1 -1
- package/distr/Common/HttpClient/IHttpClient.js.map +1 -1
- package/distr/Common/ModelPath/AbsoluteModelFieldPath.js.map +1 -1
- package/distr/Common/ModelPath/ModelPath.js +0 -2
- package/distr/Common/ModelPath/ModelPath.js.map +1 -1
- package/distr/Common/ModelPath/PathSplitHelper.js.map +1 -1
- package/distr/Common/PicklistApiClient/Serializers/DigestLogicalFilterSerializer.js.map +1 -1
- package/distr/Common/TypingUtils.js +1 -5
- package/distr/Common/TypingUtils.js.map +1 -1
- package/distr/Tools/src/BuildTasks/Form/CompileForm.js +1 -0
- package/distr/Tools/src/BuildTasks/Form/CompileForm.js.map +1 -1
- package/distr/Tools/src/BuildTasks/Form/GenerateForm.js +1 -0
- package/distr/Tools/src/BuildTasks/Form/GenerateForm.js.map +1 -1
- package/distr/Tools/src/BuildTasks/Generator/BuildGeneratorFromSourcesTask.js +1 -0
- package/distr/Tools/src/BuildTasks/Generator/BuildGeneratorFromSourcesTask.js.map +1 -1
- package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/GeneratorRequireUtils.js +3 -1
- package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/GeneratorRequireUtils.js.map +1 -1
- package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/ProcessSugarWorker.js +1 -0
- package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/ProcessSugarWorker.js.map +1 -1
- package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/ReadSourcesAndProcessSugarWorker.js +1 -0
- package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/ReadSourcesAndProcessSugarWorker.js.map +1 -1
- package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/RequireUncached.js +4 -4
- package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/RequireUncached.js.map +1 -1
- package/distr/Tools/src/BuildTasks/ProcessUtils/ShellProcessHandle.js +1 -0
- package/distr/Tools/src/BuildTasks/ProcessUtils/ShellProcessHandle.js.map +1 -1
- package/distr/Tools/src/BuildTasks/PublishedVersionUtils.js +0 -1
- package/distr/Tools/src/BuildTasks/PublishedVersionUtils.js.map +1 -1
- package/distr/Tools/src/BuildTasks/ReadFormSource.js +2 -1
- package/distr/Tools/src/BuildTasks/ReadFormSource.js.map +1 -1
- package/distr/Tools/src/BuildTasks/ResolveFormInfo.js +0 -3
- package/distr/Tools/src/BuildTasks/ResolveFormInfo.js.map +1 -1
- package/distr/Tools/src/CLICommands/BuildForms/RunBuildForms.js.map +1 -1
- package/distr/Tools/src/CLICommands/BuildServer/ResourcesControllers/BuildServerBackendResourcesUpdatesController.js +5 -1
- package/distr/Tools/src/CLICommands/BuildServer/ResourcesControllers/BuildServerBackendResourcesUpdatesController.js.map +1 -1
- package/distr/Tools/src/CLICommands/BuildServer/ResourcesControllers/DevServers/RunFormCompilationViaWebpackDevServer.js +0 -1
- package/distr/Tools/src/CLICommands/BuildServer/ResourcesControllers/DevServers/RunFormCompilationViaWebpackDevServer.js.map +1 -1
- package/distr/Tools/src/CLICommands/BuildServer/ResourcesControllers/DevServers/WebpackDevServerWorker/WebpackDevServerWorker.js +5 -6
- package/distr/Tools/src/CLICommands/BuildServer/ResourcesControllers/DevServers/WebpackDevServerWorker/WebpackDevServerWorker.js.map +1 -1
- package/distr/Tools/src/CLICommands/BuildServer/ResourcesControllers/DevServers/WebpackDevServerWorker/WebpackDevServerWorkerFactory.js +1 -1
- package/distr/Tools/src/CLICommands/BuildServer/ResourcesControllers/DevServers/WebpackDevServerWorker/WebpackDevServerWorkerFactory.js.map +1 -1
- package/distr/Tools/src/CLICommands/BuildServer/ResourcesControllers/DevServers/WebpackInMemoryUtils/IWatchFileSystem.js.map +1 -1
- package/distr/Tools/src/CLICommands/BuildServer/ResourcesControllers/DevServers/WebpackInMemoryUtils/WebpackHybridFileSystem.js +0 -2
- package/distr/Tools/src/CLICommands/BuildServer/ResourcesControllers/DevServers/WebpackInMemoryUtils/WebpackHybridFileSystem.js.map +1 -1
- package/distr/Tools/src/CLICommands/BuildServer/ResourcesControllers/Directories/FarmDirectory.js +1 -0
- package/distr/Tools/src/CLICommands/BuildServer/ResourcesControllers/Directories/FarmDirectory.js.map +1 -1
- package/distr/Tools/src/CLICommands/InitForm/EmptyFormTemplate/test/browser/Smoke.test.js +0 -1
- package/distr/Tools/src/CLICommands/InitForm/EmptyFormTemplate/test/browser/Smoke.test.js.map +1 -1
- package/distr/Tools/src/CheckNodeJsVersion.js +0 -1
- package/distr/Tools/src/CheckNodeJsVersion.js.map +1 -1
- package/distr/Tools/src/Commons/ExecUtils.js +1 -0
- package/distr/Tools/src/Commons/ExecUtils.js.map +1 -1
- package/distr/Tools/src/Commons/FsUtils.js.map +1 -1
- package/distr/Tools/src/Commons/HttpServer/AttributeRouting/Methods.js +7 -0
- package/distr/Tools/src/Commons/HttpServer/AttributeRouting/Methods.js.map +1 -1
- package/distr/Tools/src/Commons/HttpServer/AttributeRouting/ParamBinders/CookieParamParamBinder.js +0 -1
- package/distr/Tools/src/Commons/HttpServer/AttributeRouting/ParamBinders/CookieParamParamBinder.js.map +1 -1
- package/distr/Tools/src/Commons/HttpServer/AttributeRouting/ParamBinders/JsonBodyParamBinder.js +0 -1
- package/distr/Tools/src/Commons/HttpServer/AttributeRouting/ParamBinders/JsonBodyParamBinder.js.map +1 -1
- package/distr/Tools/src/Commons/HttpServer/AttributeRouting/ParamBinders/StringBodyParamBinder.js +0 -1
- package/distr/Tools/src/Commons/HttpServer/AttributeRouting/ParamBinders/StringBodyParamBinder.js.map +1 -1
- package/distr/Tools/src/Commons/HttpServer/AttributeRouting/ParamBinders/UrlParamBinder.js +0 -1
- package/distr/Tools/src/Commons/HttpServer/AttributeRouting/ParamBinders/UrlParamBinder.js.map +1 -1
- package/distr/Tools/src/Commons/HttpServer/AttributeRouting/ParamBinders/UrlQueryParamBinder.js +0 -1
- package/distr/Tools/src/Commons/HttpServer/AttributeRouting/ParamBinders/UrlQueryParamBinder.js.map +1 -1
- package/distr/Tools/src/Commons/HttpServer/AttributeRouting/Results/StreamResultHandler.js +1 -0
- package/distr/Tools/src/Commons/HttpServer/AttributeRouting/Results/StreamResultHandler.js.map +1 -1
- package/distr/Tools/src/Commons/Logging/ELKLogger.js +0 -1
- package/distr/Tools/src/Commons/Logging/ELKLogger.js.map +1 -1
- package/distr/Tools/src/Commons/Logging/Logger.js +1 -1
- package/distr/Tools/src/Commons/Logging/Logger.js.map +1 -1
- package/distr/Tools/src/Commons/Options/CommandBasedOptionsParser.d.js.map +1 -1
- package/distr/Tools/src/Commons/TasksCore/ChainableValueProducer.js +0 -2
- package/distr/Tools/src/Commons/TasksCore/ChainableValueProducer.js.map +1 -1
- package/distr/Tools/src/Commons/TasksCore/FixedDirectoryEntriesProducer.js +6 -6
- package/distr/Tools/src/Commons/TasksCore/FixedDirectoryEntriesProducer.js.map +1 -1
- package/distr/Tools/src/FormWebpackConfiguration/CacheAssetsPlugin.js +1 -7
- package/distr/Tools/src/FormWebpackConfiguration/CacheAssetsPlugin.js.map +1 -1
- package/distr/Tools/src/FormWebpackConfiguration/createFormWebpackConfiguration.js +1 -4
- package/distr/Tools/src/FormWebpackConfiguration/createFormWebpackConfiguration.js.map +1 -1
- package/distr/Tools/src/FormWebpackConfiguration/variables.less +2 -0
- package/distr/Tools/src/LocalServerFrontEndDist/enhancedClient.js +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 -1
- package/distr/Tools/src/ReadFarmConfig.js.map +1 -1
- package/distr/Tools/src/SelfUpdate.js +0 -1
- package/distr/Tools/src/SelfUpdate.js.map +1 -1
- package/distr/Tools/src/StaticFilesForProductionResourcesDir/client.js.map +1 -1
- package/distr/Tools/src/StaticFilesForProductionResourcesDir/client.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DigestLogicalFilterSerializer.js","names":["_util","require","_DigestQueryFilter","_TypingUtils","_DigestFilterColumnSerializer","serializeToString","filter","isNullOrUndefined","operatorString","serializeOperatorToString","operator","operandsString","operands","reduce","acc","currentOperand","currentOperandString","serializeOperandToString","isNullOrEmpty","exports","operand","serializeDigestFilterColumnToString","DigestLogicalOperator","And","Or"],"sources":["../../../../../Common/PicklistApiClient/Serializers/DigestLogicalFilterSerializer.ts"],"sourcesContent":["import { isNullOrUndefined } from \"util\";\n\nimport {\n DigestFilter,\n DigestLogicalFilter,\n DigestLogicalOperator,\n} from \"../../CandyApiClient/DigestApiClient/Types/DigestQueryFilter\";\nimport { isNullOrEmpty } from \"../../TypingUtils\";\n\nimport { serializeToString as serializeDigestFilterColumnToString } from \"./DigestFilterColumnSerializer\";\n\nexport const serializeToString = (filter?: DigestLogicalFilter): string => {\n if (isNullOrUndefined(filter)) {\n return \"\";\n }\n const operatorString = serializeOperatorToString(filter.operator);\n const operandsString = filter.operands.reduce((acc, currentOperand) => {\n const currentOperandString = serializeOperandToString(currentOperand);\n if (!isNullOrEmpty(operatorString) && !isNullOrEmpty(currentOperandString)) {\n acc += isNullOrEmpty(acc) ? currentOperandString : operatorString + currentOperandString;\n }\n return acc;\n }, \"\");\n\n return isNullOrEmpty(operandsString) ? \"\" : \"(\" + operandsString + \")\";\n};\n\nconst serializeOperandToString = (operand: DigestFilter): string =>\n \"operands\" in operand\n ? serializeToString(operand)\n : \"column\" in operand\n
|
|
1
|
+
{"version":3,"file":"DigestLogicalFilterSerializer.js","names":["_util","require","_DigestQueryFilter","_TypingUtils","_DigestFilterColumnSerializer","serializeToString","filter","isNullOrUndefined","operatorString","serializeOperatorToString","operator","operandsString","operands","reduce","acc","currentOperand","currentOperandString","serializeOperandToString","isNullOrEmpty","exports","operand","serializeDigestFilterColumnToString","DigestLogicalOperator","And","Or"],"sources":["../../../../../Common/PicklistApiClient/Serializers/DigestLogicalFilterSerializer.ts"],"sourcesContent":["import { isNullOrUndefined } from \"util\";\n\nimport {\n DigestFilter,\n DigestLogicalFilter,\n DigestLogicalOperator,\n} from \"../../CandyApiClient/DigestApiClient/Types/DigestQueryFilter\";\nimport { isNullOrEmpty } from \"../../TypingUtils\";\n\nimport { serializeToString as serializeDigestFilterColumnToString } from \"./DigestFilterColumnSerializer\";\n\nexport const serializeToString = (filter?: DigestLogicalFilter): string => {\n if (isNullOrUndefined(filter)) {\n return \"\";\n }\n const operatorString = serializeOperatorToString(filter.operator);\n const operandsString = filter.operands.reduce((acc, currentOperand) => {\n const currentOperandString = serializeOperandToString(currentOperand);\n if (!isNullOrEmpty(operatorString) && !isNullOrEmpty(currentOperandString)) {\n acc += isNullOrEmpty(acc) ? currentOperandString : operatorString + currentOperandString;\n }\n return acc;\n }, \"\");\n\n return isNullOrEmpty(operandsString) ? \"\" : \"(\" + operandsString + \")\";\n};\n\nconst serializeOperandToString = (operand: DigestFilter): string =>\n \"operands\" in operand\n ? serializeToString(operand)\n : \"column\" in operand\n ? serializeDigestFilterColumnToString(operand)\n : \"\";\n\nconst serializeOperatorToString = (operator: DigestLogicalOperator): string => {\n switch (operator) {\n case DigestLogicalOperator.And:\n return \"And\";\n case DigestLogicalOperator.Or:\n return \"Or\";\n default:\n return \"\";\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAEA,IAAAC,kBAAA,GAAAD,OAAA;AAKA,IAAAE,YAAA,GAAAF,OAAA;AAEA,IAAAG,6BAAA,GAAAH,OAAA;AAEO,MAAMI,iBAAiB,GAAIC,MAA4B,IAAa;EACvE,IAAI,IAAAC,uBAAiB,EAACD,MAAM,CAAC,EAAE;IAC3B,OAAO,EAAE;EACb;EACA,MAAME,cAAc,GAAGC,yBAAyB,CAACH,MAAM,CAACI,QAAQ,CAAC;EACjE,MAAMC,cAAc,GAAGL,MAAM,CAACM,QAAQ,CAACC,MAAM,CAAC,CAACC,GAAG,EAAEC,cAAc,KAAK;IACnE,MAAMC,oBAAoB,GAAGC,wBAAwB,CAACF,cAAc,CAAC;IACrE,IAAI,CAAC,IAAAG,0BAAa,EAACV,cAAc,CAAC,IAAI,CAAC,IAAAU,0BAAa,EAACF,oBAAoB,CAAC,EAAE;MACxEF,GAAG,IAAI,IAAAI,0BAAa,EAACJ,GAAG,CAAC,GAAGE,oBAAoB,GAAGR,cAAc,GAAGQ,oBAAoB;IAC5F;IACA,OAAOF,GAAG;EACd,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO,IAAAI,0BAAa,EAACP,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,GAAGA,cAAc,GAAG,GAAG;AAC1E,CAAC;AAACQ,OAAA,CAAAd,iBAAA,GAAAA,iBAAA;AAEF,MAAMY,wBAAwB,GAAIG,OAAqB,IACnD,UAAU,IAAIA,OAAO,GACff,iBAAiB,CAACe,OAAO,CAAC,GAC1B,QAAQ,IAAIA,OAAO,GACjB,IAAAC,+CAAmC,EAACD,OAAO,CAAC,GAC5C,EAAE;AAEd,MAAMX,yBAAyB,GAAIC,QAA+B,IAAa;EAC3E,QAAQA,QAAQ;IACZ,KAAKY,wCAAqB,CAACC,GAAG;MAC1B,OAAO,KAAK;IAChB,KAAKD,wCAAqB,CAACE,EAAE;MACzB,OAAO,IAAI;IACf;MACI,OAAO,EAAE;EACjB;AACJ,CAAC","ignoreList":[]}
|
|
@@ -33,6 +33,7 @@ function isNotNullOrUndefined(input) {
|
|
|
33
33
|
return input != undefined;
|
|
34
34
|
}
|
|
35
35
|
function stringifyUnknownError(error) {
|
|
36
|
+
// @ts-ignore
|
|
36
37
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
37
38
|
return typeof error === "object" && (error === null || error === void 0 ? void 0 : error["message"]);
|
|
38
39
|
}
|
|
@@ -115,9 +116,4 @@ function trimLastSlash(url) {
|
|
|
115
116
|
function assertIs(value) {
|
|
116
117
|
// noop
|
|
117
118
|
}
|
|
118
|
-
|
|
119
|
-
// region FS.Glob hardcode type
|
|
120
|
-
// Костыль с типом, т.к. свежая версия @types/node требует TS 5 FS-8883
|
|
121
|
-
|
|
122
|
-
// endregion
|
|
123
119
|
//# sourceMappingURL=TypingUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypingUtils.js","names":["isNotNullOrUndefined","input","undefined","stringifyUnknownError","error","ensureNotNullOrUndefined","Error","noop","reject","message","isLengthGreaterThenOrEqual","items","minLength","length","minLengthOrUndefined","ensureIsArray","Array","isArray","arrayHasLength","arrayIsNotEmpty","arrayHasAtLeastOneItem","ensureArrayIsNotEmpty","ensureArrayHasLength","ensureArrayLengthGreaterThenOrEqual","ensureNever","neverArgument","ensureAndGetString","runAsyncAction","action","isNullOrEmpty","isNotNullOrEmpty","isNullOrWhiteSpace","trim","trimLastSlash","url","slice","assertIs","value"],"sources":["../../../Common/TypingUtils.ts"],"sourcesContent":["/***\n * Строготипизированная замена для Boolean(...)\n * Обычно используется для [...].filter(isNotNullOrUndefined)\n */\nexport function isNotNullOrUndefined<T>(input: T): input is NonNullable<T> {\n return input != undefined;\n}\n\nexport function stringifyUnknownError(error: unknown): undefined | string {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return typeof error === \"object\" && error?.[\"message\"];\n}\n\nexport function ensureNotNullOrUndefined<T>(input: T): asserts input is NonNullable<T> {\n if (!isNotNullOrUndefined(input)) {\n throw new Error(`Value must be defined`);\n }\n}\n\nexport function noop(): void {\n // noop\n}\n\nexport type ErrorFirstCallback<T> = (...args: [Error, null | undefined] | [null | undefined, T] | [Error]) => void;\n\nexport function reject(message?: string | Error): never {\n if (typeof message === \"string\" || message == undefined) {\n throw new Error(message ?? \"Undefined is not allowed\");\n } else {\n throw message;\n }\n}\n\ntype ArrayOfLength<TItem, TLength extends number, TRest extends TItem[] = []> = TRest extends { length: TLength }\n ? TRest\n : ArrayOfLength<TItem, TLength, [TItem, ...TRest]>;\n\nexport type MinLengthArray<TItem, TLength extends number, TRest extends TItem[] = []> = TRest extends {\n length: TLength;\n}\n ? [...TRest, ...TItem[]]\n : MinLengthArray<TItem, TLength, [...TRest, TItem]>;\n\nexport function isLengthGreaterThenOrEqual<T, TNum extends number>(\n items: readonly T[],\n minLength: TNum\n): items is MinLengthArray<T, TNum> {\n return items.length >= minLength;\n}\n\nexport function minLengthOrUndefined<T, TNum extends number>(\n items: T[],\n minLength: TNum\n): undefined | MinLengthArray<T, TNum> {\n if (isLengthGreaterThenOrEqual(items, minLength)) {\n return items;\n }\n return undefined;\n}\n\nexport function ensureIsArray<T>(items: unknown): T[] {\n if (!Array.isArray(items)) {\n throw new Error(`Must be an array!`);\n }\n return items as T[];\n}\n\nexport function arrayHasLength<T, TNum extends number>(\n items: readonly T[],\n length: TNum\n): items is ArrayOfLength<T, TNum> {\n return items.length === length;\n}\n\nexport function arrayIsNotEmpty<T>(items: readonly T[]): items is MinLengthArray<T, 1> {\n return items.length > 0;\n}\n\nexport function arrayHasAtLeastOneItem<T>(items: readonly T[]): items is MinLengthArray<T, 1> {\n return items.length > 0;\n}\n\nexport function ensureArrayIsNotEmpty<T>(items: readonly T[]): asserts items is MinLengthArray<T, 1> {\n if (!arrayIsNotEmpty(items)) {\n throw new Error(`Array must be not empty`);\n }\n}\n\nexport function ensureArrayHasLength<T, TNum extends number>(\n items: readonly T[],\n length: TNum\n): asserts items is ArrayOfLength<T, TNum> {\n if (!arrayHasLength(items, length)) {\n throw new Error(`Array should has length ${length}`);\n }\n}\n\nexport function ensureArrayLengthGreaterThenOrEqual<T, TNum extends number>(\n items: readonly T[],\n length: TNum\n): asserts items is ArrayOfLength<T, TNum> {\n if (!isLengthGreaterThenOrEqual(items, length)) {\n throw new Error(`Array must have minimal length ${length}`);\n }\n}\n\nexport function ensureNever(neverArgument: never): void {\n // noop\n}\n\nexport function ensureAndGetString(neverArgument: never): string {\n return `${neverArgument}`;\n}\n\nexport function runAsyncAction(action: () => Promise<void>): void {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n action();\n}\n\nexport function isNullOrEmpty(input: string | undefined): input is undefined {\n return input == undefined || input === \"\";\n}\n\nexport function isNotNullOrEmpty(input: string | undefined): input is string {\n return !isNullOrEmpty(input);\n}\n\nexport function isNullOrWhiteSpace(input: string | undefined | null): input is undefined | null {\n return input == undefined || input.trim() === \"\";\n}\n\nexport function trimLastSlash(url: string): string {\n return url.slice(-1) === \"/\" ? url.slice(0, -1) : url;\n}\n\nexport function assertIs<T>(value: T): void {\n // noop\n}\n
|
|
1
|
+
{"version":3,"file":"TypingUtils.js","names":["isNotNullOrUndefined","input","undefined","stringifyUnknownError","error","ensureNotNullOrUndefined","Error","noop","reject","message","isLengthGreaterThenOrEqual","items","minLength","length","minLengthOrUndefined","ensureIsArray","Array","isArray","arrayHasLength","arrayIsNotEmpty","arrayHasAtLeastOneItem","ensureArrayIsNotEmpty","ensureArrayHasLength","ensureArrayLengthGreaterThenOrEqual","ensureNever","neverArgument","ensureAndGetString","runAsyncAction","action","isNullOrEmpty","isNotNullOrEmpty","isNullOrWhiteSpace","trim","trimLastSlash","url","slice","assertIs","value"],"sources":["../../../Common/TypingUtils.ts"],"sourcesContent":["/***\n * Строготипизированная замена для Boolean(...)\n * Обычно используется для [...].filter(isNotNullOrUndefined)\n */\nexport function isNotNullOrUndefined<T>(input: T): input is NonNullable<T> {\n return input != undefined;\n}\n\nexport function stringifyUnknownError(error: unknown): undefined | string {\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return typeof error === \"object\" && error?.[\"message\"];\n}\n\nexport function ensureNotNullOrUndefined<T>(input: T): asserts input is NonNullable<T> {\n if (!isNotNullOrUndefined(input)) {\n throw new Error(`Value must be defined`);\n }\n}\n\nexport function noop(): void {\n // noop\n}\n\nexport type ErrorFirstCallback<T> = (...args: [Error, null | undefined] | [null | undefined, T] | [Error]) => void;\n\nexport function reject(message?: string | Error): never {\n if (typeof message === \"string\" || message == undefined) {\n throw new Error(message ?? \"Undefined is not allowed\");\n } else {\n throw message;\n }\n}\n\ntype ArrayOfLength<TItem, TLength extends number, TRest extends TItem[] = []> = TRest extends { length: TLength }\n ? TRest\n : ArrayOfLength<TItem, TLength, [TItem, ...TRest]>;\n\nexport type MinLengthArray<TItem, TLength extends number, TRest extends TItem[] = []> = TRest extends {\n length: TLength;\n}\n ? [...TRest, ...TItem[]]\n : MinLengthArray<TItem, TLength, [...TRest, TItem]>;\n\nexport function isLengthGreaterThenOrEqual<T, TNum extends number>(\n items: readonly T[],\n minLength: TNum\n): items is MinLengthArray<T, TNum> {\n return items.length >= minLength;\n}\n\nexport function minLengthOrUndefined<T, TNum extends number>(\n items: T[],\n minLength: TNum\n): undefined | MinLengthArray<T, TNum> {\n if (isLengthGreaterThenOrEqual(items, minLength)) {\n return items;\n }\n return undefined;\n}\n\nexport function ensureIsArray<T>(items: unknown): T[] {\n if (!Array.isArray(items)) {\n throw new Error(`Must be an array!`);\n }\n return items as T[];\n}\n\nexport function arrayHasLength<T, TNum extends number>(\n items: readonly T[],\n length: TNum\n): items is ArrayOfLength<T, TNum> {\n return items.length === length;\n}\n\nexport function arrayIsNotEmpty<T>(items: readonly T[]): items is MinLengthArray<T, 1> {\n return items.length > 0;\n}\n\nexport function arrayHasAtLeastOneItem<T>(items: readonly T[]): items is MinLengthArray<T, 1> {\n return items.length > 0;\n}\n\nexport function ensureArrayIsNotEmpty<T>(items: readonly T[]): asserts items is MinLengthArray<T, 1> {\n if (!arrayIsNotEmpty(items)) {\n throw new Error(`Array must be not empty`);\n }\n}\n\nexport function ensureArrayHasLength<T, TNum extends number>(\n items: readonly T[],\n length: TNum\n): asserts items is ArrayOfLength<T, TNum> {\n if (!arrayHasLength(items, length)) {\n throw new Error(`Array should has length ${length}`);\n }\n}\n\nexport function ensureArrayLengthGreaterThenOrEqual<T, TNum extends number>(\n items: readonly T[],\n length: TNum\n): asserts items is ArrayOfLength<T, TNum> {\n if (!isLengthGreaterThenOrEqual(items, length)) {\n throw new Error(`Array must have minimal length ${length}`);\n }\n}\n\nexport function ensureNever(neverArgument: never): void {\n // noop\n}\n\nexport function ensureAndGetString(neverArgument: never): string {\n return `${neverArgument}`;\n}\n\nexport function runAsyncAction(action: () => Promise<void>): void {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n action();\n}\n\nexport function isNullOrEmpty(input: string | undefined): input is undefined {\n return input == undefined || input === \"\";\n}\n\nexport function isNotNullOrEmpty(input: string | undefined): input is string {\n return !isNullOrEmpty(input);\n}\n\nexport function isNullOrWhiteSpace(input: string | undefined | null): input is undefined | null {\n return input == undefined || input.trim() === \"\";\n}\n\nexport function trimLastSlash(url: string): string {\n return url.slice(-1) === \"/\" ? url.slice(0, -1) : url;\n}\n\nexport function assertIs<T>(value: T): void {\n // noop\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACO,SAASA,oBAAoBA,CAAIC,KAAQ,EAA2B;EACvE,OAAOA,KAAK,IAAIC,SAAS;AAC7B;AAEO,SAASC,qBAAqBA,CAACC,KAAc,EAAsB;EACtE;EACA;EAC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,GAAG,GAAGD,GAAG,CAACC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAGD,GAAG;AACzD;AAEO,SAASE,QAAQA,CAAIC,KAAQ,EAAQ;EACxC;AAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompileForm.js","names":["_path","_interopRequireDefault","require","temp","_interopRequireWildcard","_ExecUtils","_FsUtils","_ILogger","_StaticLogger","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","track","tempMKDir","affixes","Promise","resolve","reject","mkdir","err","result","compileForm","gfv","formPath","resourcesDirectory","resourcesHash","buildDebugOnly","parentLogger","getLogger","compileForProduction","buildCacheOptions","logger","withPrefix","pathToWebpackConfigFactory","options","resourcesDirectoryPath","modes","action","buildActionBegin","formBuildTempDir","formBuildWebpackConfig","path","join","writeFileAsync","JSON","stringify","pathToWebPackExecutable","execCommand","execCommandAsync","caption","complete"],"sources":["../../../../../src/BuildTasks/Form/CompileForm.ts"],"sourcesContent":["import path from \"path\";\n\nimport * as temp from \"temp\";\n\nimport { execCommandAsync } from \"../../Commons/ExecUtils\";\nimport { writeFileAsync } from \"../../Commons/FsUtils\";\nimport { buildActionBegin, ILogger } from \"../../Commons/Logging/ILogger\";\nimport { getLogger } from \"../../Commons/Logging/StaticLogger\";\nimport { CreateWebpackConfigurationOptions } from \"../../FormWebpackConfiguration/createFormWebpackConfiguration\";\nimport { FormBuildCacheOptions } from \"../../FormWebpackConfiguration/CacheAssetsPlugin\";\n\ntemp.track();\n\nfunction tempMKDir(affixes?: string | temp.AffixOptions): Promise<string> {\n return new Promise<string>((resolve, reject) => {\n temp.mkdir(affixes, (err, result) => {\n if (err) {\n reject(err);\n } else {\n resolve(result);\n }\n });\n });\n}\n\nexport async function compileForm(\n gfv: string,\n formPath: string,\n resourcesDirectory: string,\n resourcesHash: string,\n buildDebugOnly: boolean,\n parentLogger: ILogger = getLogger(),\n compileForProduction: boolean,\n buildCacheOptions?: FormBuildCacheOptions\n): Promise<void> {\n const logger = parentLogger.withPrefix(`COMPILE:${gfv}`);\n const pathToWebpackConfigFactory = require.resolve(\"../../FormWebpackConfiguration/createFormWebpackConfiguration\");\n\n const options: CreateWebpackConfigurationOptions = {\n gfv: gfv,\n resourcesHash: resourcesHash,\n formPath: formPath,\n resourcesDirectoryPath: resourcesDirectory,\n modes: buildDebugOnly ? [\"development\"] : compileForProduction ? [\"production\"] : [\"production\", \"development\"],\n buildCacheOptions: buildCacheOptions,\n };\n\n const action = buildActionBegin(logger, \"Compile\");\n\n const formBuildTempDir = await tempMKDir(`candy-forms-${gfv}-build`);\n const formBuildWebpackConfig = path.join(formBuildTempDir, \"webpack.config.js\");\n await writeFileAsync(\n formBuildWebpackConfig,\n `\nconst createConfig = require(${JSON.stringify(pathToWebpackConfigFactory)}).createConfig;\nmodule.exports = createConfig(${JSON.stringify(options)})`,\n \"utf8\"\n );\n const pathToWebPackExecutable = path.join(require.resolve(\"webpack\"), \"..\", \"..\", \"..\", \".bin\", \"webpack\");\n const execCommand = `${pathToWebPackExecutable} --config ${formBuildWebpackConfig}`;\n await execCommandAsync(logger, execCommand, {\n caption: \"Compiling form\",\n });\n\n action.complete();\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,IAAA,GAAAC,uBAAA,CAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AAA+D,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,CA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_ILogger","_StaticLogger","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","track","tempMKDir","affixes","Promise","resolve","reject","mkdir","err","result","compileForm","gfv","formPath","resourcesDirectory","resourcesHash","buildDebugOnly","parentLogger","getLogger","compileForProduction","buildCacheOptions","logger","withPrefix","pathToWebpackConfigFactory","options","resourcesDirectoryPath","modes","action","buildActionBegin","formBuildTempDir","formBuildWebpackConfig","path","join","writeFileAsync","JSON","stringify","pathToWebPackExecutable","execCommand","execCommandAsync","caption","complete"],"sources":["../../../../../src/BuildTasks/Form/CompileForm.ts"],"sourcesContent":["import path from \"path\";\n\nimport * as temp from \"temp\";\n\nimport { execCommandAsync } from \"../../Commons/ExecUtils\";\nimport { writeFileAsync } from \"../../Commons/FsUtils\";\nimport { buildActionBegin, ILogger } from \"../../Commons/Logging/ILogger\";\nimport { getLogger } from \"../../Commons/Logging/StaticLogger\";\nimport { CreateWebpackConfigurationOptions } from \"../../FormWebpackConfiguration/createFormWebpackConfiguration\";\nimport { FormBuildCacheOptions } from \"../../FormWebpackConfiguration/CacheAssetsPlugin\";\n\ntemp.track();\n\nfunction tempMKDir(affixes?: string | temp.AffixOptions): Promise<string> {\n return new Promise<string>((resolve, reject) => {\n temp.mkdir(affixes, (err, result) => {\n if (err) {\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n reject(err);\n } else {\n resolve(result);\n }\n });\n });\n}\n\nexport async function compileForm(\n gfv: string,\n formPath: string,\n resourcesDirectory: string,\n resourcesHash: string,\n buildDebugOnly: boolean,\n parentLogger: ILogger = getLogger(),\n compileForProduction: boolean,\n buildCacheOptions?: FormBuildCacheOptions\n): Promise<void> {\n const logger = parentLogger.withPrefix(`COMPILE:${gfv}`);\n const pathToWebpackConfigFactory = require.resolve(\"../../FormWebpackConfiguration/createFormWebpackConfiguration\");\n\n const options: CreateWebpackConfigurationOptions = {\n gfv: gfv,\n resourcesHash: resourcesHash,\n formPath: formPath,\n resourcesDirectoryPath: resourcesDirectory,\n modes: buildDebugOnly ? [\"development\"] : compileForProduction ? [\"production\"] : [\"production\", \"development\"],\n buildCacheOptions: buildCacheOptions,\n };\n\n const action = buildActionBegin(logger, \"Compile\");\n\n const formBuildTempDir = await tempMKDir(`candy-forms-${gfv}-build`);\n const formBuildWebpackConfig = path.join(formBuildTempDir, \"webpack.config.js\");\n await writeFileAsync(\n formBuildWebpackConfig,\n `\nconst createConfig = require(${JSON.stringify(pathToWebpackConfigFactory)}).createConfig;\nmodule.exports = createConfig(${JSON.stringify(options)})`,\n \"utf8\"\n );\n const pathToWebPackExecutable = path.join(require.resolve(\"webpack\"), \"..\", \"..\", \"..\", \".bin\", \"webpack\");\n const execCommand = `${pathToWebPackExecutable} --config ${formBuildWebpackConfig}`;\n await execCommandAsync(logger, execCommand, {\n caption: \"Compiling form\",\n });\n\n action.complete();\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,IAAA,GAAAC,uBAAA,CAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AAA+D,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,SAAAN,wBAAAM,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,O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
@@ -36,6 +36,7 @@ async function writeGeneratedFiles(candyFormContent, outputDirectory, fileWriter
|
|
|
36
36
|
for (const filePath of Object.keys(candyFormContent)) {
|
|
37
37
|
const content = candyFormContent[filePath];
|
|
38
38
|
if (content != undefined && content !== "") {
|
|
39
|
+
// @ts-ignore
|
|
39
40
|
fileBatch[path.join(outputDirectory, filePath)] = content;
|
|
40
41
|
}
|
|
41
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenerateForm.js","names":["path","_interopRequireWildcard","require","_fsExtra","_FsUtils","_ILogger","_StaticLogger","_FormPathUtils","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","DefaultFileWriter","writeBatch","fileBatch","filePath","keys","content","undefined","ensureDir","parse","dir","writeFileAsync","generateForm","formSourcesPath","farmDirectory","hlDirPath","generator","parentLogger","getLogger","generationOptions","fileWriter","logger","withPrefix","extractGfvFromFormPath","action","buildActionBegin","generatedContent","readSourcesAndProcessSugar","log","writeGeneratedFiles","join","complete","candyFormContent","outputDirectory"],"sources":["../../../../../src/BuildTasks/Form/GenerateForm.ts"],"sourcesContent":["import * as path from \"path\";\n\nimport { ensureDir } from \"fs-extra\";\n\nimport { writeFileAsync } from \"../../Commons/FsUtils\";\nimport { buildActionBegin, ILogger } from \"../../Commons/Logging/ILogger\";\nimport { getLogger } from \"../../Commons/Logging/StaticLogger\";\nimport { FormResources, FormSource, SugarContent } from \"../ReadFormSource\";\nimport { extractGfvFromFormPath } from \"../../../../Common/FormPathUtils\";\nimport { ExtractorResult } from \"../../../../Common/TextExtractor/TextExtractorTypes\";\n\nexport interface GeneratedForm {\n [relativeFileName: string]: Buffer | string;\n}\n\nexport interface LocalizationDictionaryContent {\n [relativeFileName: string]: string;\n}\n\nexport interface LocalizationEntryPoint {\n getLocalizedSugar(sugarFiles: SugarContent, resources: FormResources): Promise<SugarContent>;\n getDictionary(sugarFiles: SugarContent, resources: FormResources): Promise<LocalizationDictionaryContent>;\n}\n\nexport interface FormGenerator {\n readSources(formSourcesPath: string, farmDirectory: string, hlFarmDirectoryPath: string): Promise<FormSource>;\n getAllDependencies(formSourcesPath: string, farmDirectory: string, hlFarmDirectoryPath: string): Promise<string[]>;\n getAllDependenciesHash(\n formSourcesPath: string,\n farmDirectory: string,\n hlFarmDirectoryPath: string\n ): Promise<string>;\n supportsDependenciesExtraction(): Promise<boolean>;\n processSugar(\n sugarFiles: SugarContent,\n resources: FormResources,\n generationOptions?: GenerationOptions\n ): Promise<GeneratedForm>;\n readSourcesAndProcessSugar(\n formSourcesPath: string,\n farmDirectory: string,\n hlFarmDirectoryPath: string,\n generationOptions?: GenerationOptions\n ): Promise<GeneratedForm>;\n getLocalizedSugar(sugarFiles: SugarContent, resources: FormResources): Promise<SugarContent>;\n getDictionary(sugarFiles: SugarContent, resources: FormResources): Promise<LocalizationDictionaryContent>;\n getSugarTexts(\n formSourcesPath: string,\n farmDirectory: string,\n hlFarmDirectoryPath: string\n ): Promise<ExtractorResult>;\n}\n\nexport interface GenerationOptions {\n skipCodeReformatting: boolean;\n resourcesHash: string;\n}\n\nexport interface IFileWriter {\n writeBatch(fileBatch: { [absoluteFileName: string]: string }): Promise<void>;\n}\n\nclass DefaultFileWriter implements IFileWriter {\n public async writeBatch(fileBatch: { [absoluteFileName: string]: string }): Promise<void> {\n for (const filePath of Object.keys(fileBatch)) {\n const content = fileBatch[filePath];\n if (content != undefined && content !== \"\") {\n await ensureDir(path.parse(filePath).dir);\n await writeFileAsync(filePath, content);\n }\n }\n }\n}\n\nexport async function generateForm(\n formSourcesPath: string,\n farmDirectory: string,\n hlDirPath: string,\n generator: FormGenerator,\n parentLogger: ILogger = getLogger(),\n generationOptions?: GenerationOptions,\n fileWriter: IFileWriter = new DefaultFileWriter()\n): Promise<void> {\n const logger = parentLogger.withPrefix(`GENERATE:${extractGfvFromFormPath(formSourcesPath)}`);\n const action = buildActionBegin(logger, \"Generation\");\n const generatedContent = await generator.readSourcesAndProcessSugar(\n formSourcesPath,\n farmDirectory,\n hlDirPath,\n generationOptions\n );\n logger.log(\"Writing files\");\n await writeGeneratedFiles(generatedContent, path.join(formSourcesPath, \"form\"), fileWriter);\n action.complete();\n}\n\nasync function writeGeneratedFiles(\n candyFormContent: GeneratedForm,\n outputDirectory: string,\n fileWriter: IFileWriter\n): Promise<void> {\n const fileBatch = {};\n for (const filePath of Object.keys(candyFormContent)) {\n const content = candyFormContent[filePath];\n if (content != undefined && content !== \"\") {\n fileBatch[path.join(outputDirectory, filePath)] = content;\n }\n }\n await fileWriter.writeBatch(fileBatch);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,IAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAEA,IAAAK,cAAA,GAAAL,OAAA;AAA0E,SAAAM,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,SAAAR,wBAAAQ,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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AAMW,MAAM,GAAG,IAAAC,yBAAgB,EAACJ,MAAM,EAAE,YAAY,CAAC;EACrD,MAAMK,gBAAgB,GAAG,MAAMV,SAAS,CAACW,0BAA0B,CAC/Dd,eAAe,EACfC,aAAa,EACbC,SAAS,EACTI,iBACJ,CAAC;EACDE,MAAM,CAACO,GAAG,CAAC,eAAe,CAAC;EAC3B,MAAMC,mBAAmB,CAACH,gBAAgB,EAAErD,IAAI,CAACyD,IAAI,CAACjB,eAAe,EAAE,MAAM,CAAC,EAAEO,UAAU,CAAC;EAC3FI,MAAM,CAACO,QAAQ,CAAC,CAAC;AACrB;AAEA,eAAeF,mBAAmBA,CAC9BG,gBAA+B,EAC/BC,eAAuB,EACvBb,UAAuB,EACV;EACb,MAAMjB,SAAS,GAAG,CAAC,CAAC;EACpB,KAAK,MAAMC,QAAQ,IAAIX,MAAM,CAACY,IAAI,CAAC2B,gBAAgB,CAAC,EAAE;IAClD,MAAM1B,OAAO,GAAG0B,gBAAgB,CAAC5B,QAAQ,CAAC;IAC1C,IAAIE,OAAO,IAAIC,SAAS,IAAID,OAAO,KAAK,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"GenerateForm.js","names":["path","_interopRequireWildcard","require","_fsExtra","_FsUtils","_ILogger","_StaticLogger","_FormPathUtils","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","DefaultFileWriter","writeBatch","fileBatch","filePath","keys","content","undefined","ensureDir","parse","dir","writeFileAsync","generateForm","formSourcesPath","farmDirectory","hlDirPath","generator","parentLogger","getLogger","generationOptions","fileWriter","logger","withPrefix","extractGfvFromFormPath","action","buildActionBegin","generatedContent","readSourcesAndProcessSugar","log","writeGeneratedFiles","join","complete","candyFormContent","outputDirectory"],"sources":["../../../../../src/BuildTasks/Form/GenerateForm.ts"],"sourcesContent":["import * as path from \"path\";\n\nimport { ensureDir } from \"fs-extra\";\n\nimport { writeFileAsync } from \"../../Commons/FsUtils\";\nimport { buildActionBegin, ILogger } from \"../../Commons/Logging/ILogger\";\nimport { getLogger } from \"../../Commons/Logging/StaticLogger\";\nimport { FormResources, FormSource, SugarContent } from \"../ReadFormSource\";\nimport { extractGfvFromFormPath } from \"../../../../Common/FormPathUtils\";\nimport { ExtractorResult } from \"../../../../Common/TextExtractor/TextExtractorTypes\";\n\nexport interface GeneratedForm {\n [relativeFileName: string]: Buffer | string;\n}\n\nexport interface LocalizationDictionaryContent {\n [relativeFileName: string]: string;\n}\n\nexport interface LocalizationEntryPoint {\n getLocalizedSugar(sugarFiles: SugarContent, resources: FormResources): Promise<SugarContent>;\n getDictionary(sugarFiles: SugarContent, resources: FormResources): Promise<LocalizationDictionaryContent>;\n}\n\nexport interface FormGenerator {\n readSources(formSourcesPath: string, farmDirectory: string, hlFarmDirectoryPath: string): Promise<FormSource>;\n getAllDependencies(formSourcesPath: string, farmDirectory: string, hlFarmDirectoryPath: string): Promise<string[]>;\n getAllDependenciesHash(\n formSourcesPath: string,\n farmDirectory: string,\n hlFarmDirectoryPath: string\n ): Promise<string>;\n supportsDependenciesExtraction(): Promise<boolean>;\n processSugar(\n sugarFiles: SugarContent,\n resources: FormResources,\n generationOptions?: GenerationOptions\n ): Promise<GeneratedForm>;\n readSourcesAndProcessSugar(\n formSourcesPath: string,\n farmDirectory: string,\n hlFarmDirectoryPath: string,\n generationOptions?: GenerationOptions\n ): Promise<GeneratedForm>;\n getLocalizedSugar(sugarFiles: SugarContent, resources: FormResources): Promise<SugarContent>;\n getDictionary(sugarFiles: SugarContent, resources: FormResources): Promise<LocalizationDictionaryContent>;\n getSugarTexts(\n formSourcesPath: string,\n farmDirectory: string,\n hlFarmDirectoryPath: string\n ): Promise<ExtractorResult>;\n}\n\nexport interface GenerationOptions {\n skipCodeReformatting: boolean;\n resourcesHash: string;\n}\n\nexport interface IFileWriter {\n writeBatch(fileBatch: { [absoluteFileName: string]: string }): Promise<void>;\n}\n\nclass DefaultFileWriter implements IFileWriter {\n public async writeBatch(fileBatch: { [absoluteFileName: string]: string }): Promise<void> {\n for (const filePath of Object.keys(fileBatch)) {\n const content = fileBatch[filePath];\n if (content != undefined && content !== \"\") {\n await ensureDir(path.parse(filePath).dir);\n await writeFileAsync(filePath, content);\n }\n }\n }\n}\n\nexport async function generateForm(\n formSourcesPath: string,\n farmDirectory: string,\n hlDirPath: string,\n generator: FormGenerator,\n parentLogger: ILogger = getLogger(),\n generationOptions?: GenerationOptions,\n fileWriter: IFileWriter = new DefaultFileWriter()\n): Promise<void> {\n const logger = parentLogger.withPrefix(`GENERATE:${extractGfvFromFormPath(formSourcesPath)}`);\n const action = buildActionBegin(logger, \"Generation\");\n const generatedContent = await generator.readSourcesAndProcessSugar(\n formSourcesPath,\n farmDirectory,\n hlDirPath,\n generationOptions\n );\n logger.log(\"Writing files\");\n await writeGeneratedFiles(generatedContent, path.join(formSourcesPath, \"form\"), fileWriter);\n action.complete();\n}\n\nasync function writeGeneratedFiles(\n candyFormContent: GeneratedForm,\n outputDirectory: string,\n fileWriter: IFileWriter\n): Promise<void> {\n const fileBatch = {};\n for (const filePath of Object.keys(candyFormContent)) {\n const content = candyFormContent[filePath];\n if (content != undefined && content !== \"\") {\n // @ts-ignore\n fileBatch[path.join(outputDirectory, filePath)] = content;\n }\n }\n await fileWriter.writeBatch(fileBatch);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,IAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAEA,IAAAK,cAAA,GAAAL,OAAA;AAA0E,SAAAM,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GA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;EACJ;EACA,MAAMc,UAAU,CAAClB,UAAU,CAACC,SAAS,CAAC;AAC1C","ignoreList":[]}
|
|
@@ -119,6 +119,7 @@ class BuildGeneratorFromSourcesTask extends _ChainableValueProducer.ObservableVa
|
|
|
119
119
|
const handleAnyFsEventDebounced = _lodash.default.debounce(() => this.handleUpdate(), 500);
|
|
120
120
|
watcher.on("all", handleAnyFsEventDebounced);
|
|
121
121
|
watcher.on("error", handleAnyFsEventDebounced);
|
|
122
|
+
// @ts-ignore
|
|
122
123
|
return watcher;
|
|
123
124
|
}
|
|
124
125
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuildGeneratorFromSourcesTask.js","names":["_path","_interopRequireDefault","require","_chokidar","_lodash","_pLimit","_ExecUtils","_ILogger","_StaticLogger","_ChainableValueProducer","_EngineStructureUtils","_ProcessUtils","_IsWebpack","_CreateAsyncGenerator","generatorBuildLimit","pLimit","BuildGeneratorFromSourcesTask","ObservableValueProducerBase","constructor","pathToEngineSources","logger","getLogger","useWatch","currentGenerator","buildProcess","buildResultWatcher","handleUpdate","log","emitUpdate","createAsyncGenerator","path","join","withPrefix","getCurrentValue","undefined","runWatchProcessStarted","createBuildResultWatcher","acquireGeneratorFromSources","Error","beginListening","stopListening","kill","error","close","action","buildActionBegin","buildDirectory","getBuildDirectory","execCommandAsync","cwd","result","complete","isNewEngineStructure","isYarn","ProcessUtils","createShellProcess","onStdOut","subscribe","data","verbose","toString","onStdErr","start","waitFirstCompilationCompleted","waitOutputIncludesString","pathToGeneratorOutputDir","maskToObserveGeneratorChanges","isOldGeneratorSourcesStructure","watcher","watch","ignoreInitial","ignorePermissionErrors","usePolling","handleAnyFsEventDebounced","_","debounce","on","exports"],"sources":["../../../../../src/BuildTasks/Generator/BuildGeneratorFromSourcesTask.ts"],"sourcesContent":["import { FSWatcher } from \"fs\";\nimport path from \"path\";\n\nimport { watch } from \"chokidar\";\nimport _ from \"lodash\";\nimport pLimit from \"p-limit\";\n\nimport { execCommandAsync } from \"../../Commons/ExecUtils\";\nimport { buildActionBegin, ILogger } from \"../../Commons/Logging/ILogger\";\nimport { getLogger } from \"../../Commons/Logging/StaticLogger\";\nimport { ObservableValueProducerBase } from \"../../Commons/TasksCore/ChainableValueProducer\";\nimport { isNewEngineStructure, isOldGeneratorSourcesStructure } from \"../EngineStructureUtils\";\nimport { FormGenerator } from \"../Form/GenerateForm\";\nimport { ProcessUtils } from \"../ProcessUtils/ProcessUtils\";\nimport { ShellProcessHandle } from \"../ProcessUtils/ShellProcessHandle\";\nimport { isYarn } from \"../ClientJS/IsWebpack5\";\n\nimport { createAsyncGenerator } from \"./GeneratorWorker/CreateAsyncGenerator\";\n\nconst generatorBuildLimit = pLimit(1);\n\nexport class BuildGeneratorFromSourcesTask extends ObservableValueProducerBase<FormGenerator> {\n private readonly pathToEngineSources: string;\n private readonly logger: ILogger;\n private useWatch = false;\n private currentGenerator?: FormGenerator;\n private buildProcess?: ShellProcessHandle;\n private buildResultWatcher?: FSWatcher;\n\n public constructor(pathToEngineSources: string, logger: ILogger = getLogger()) {\n super();\n this.logger = logger.withPrefix(\"GENERATOR\");\n this.pathToEngineSources = pathToEngineSources;\n }\n\n public async getCurrentValue(): Promise<FormGenerator> {\n return generatorBuildLimit(async () => {\n if (this.currentGenerator != undefined) {\n return this.currentGenerator;\n }\n if (this.useWatch) {\n if (this.buildProcess == undefined) {\n this.buildProcess = await this.runWatchProcessStarted();\n this.buildResultWatcher = await this.createBuildResultWatcher(\n path.join(this.pathToEngineSources, \"Generator\", \"dist\")\n );\n this.currentGenerator = createAsyncGenerator(\n path.join(this.pathToEngineSources, \"Generator\"),\n this.useWatch,\n this.useWatch\n );\n }\n } else {\n this.currentGenerator = await this.acquireGeneratorFromSources();\n }\n if (this.currentGenerator == undefined) {\n throw new Error(\"InvalidProgramState\");\n }\n return this.currentGenerator;\n });\n }\n\n protected async beginListening(): Promise<void> {\n this.useWatch = true;\n }\n\n protected async stopListening(): Promise<void> {\n if (this.buildProcess != undefined) {\n try {\n const buildProcess = this.buildProcess;\n this.buildProcess = undefined;\n await buildProcess.kill();\n } catch (error) {\n this.logger.error(`Failed to stop process: ${error}`);\n }\n }\n if (this.buildResultWatcher != undefined) {\n this.buildResultWatcher.close();\n }\n this.useWatch = false;\n }\n\n private readonly handleUpdate = async (): Promise<void> => {\n this.logger.log(\"Generator sources updated\");\n await this.emitUpdate(\n createAsyncGenerator(path.join(this.pathToEngineSources, \"Generator\"), this.useWatch, this.useWatch)\n );\n };\n\n private async acquireGeneratorFromSources(): Promise<FormGenerator> {\n const action = buildActionBegin(this.logger, \"Build generator\");\n const buildDirectory = await this.getBuildDirectory();\n await execCommandAsync(this.logger, `npm run generator:build`, {\n cwd: buildDirectory,\n });\n const result = createAsyncGenerator(\n path.join(this.pathToEngineSources, \"Generator\"),\n this.useWatch,\n this.useWatch\n );\n action.complete();\n return result;\n }\n\n private async getBuildDirectory(): Promise<string> {\n return (await isNewEngineStructure(this.pathToEngineSources))\n ? path.join(this.pathToEngineSources, \"Generator\")\n : this.pathToEngineSources;\n }\n\n private async runWatchProcessStarted(): Promise<ShellProcessHandle> {\n this.logger.log(\"Start watch\");\n const buildDirectory = await this.getBuildDirectory();\n const result = (await isYarn(buildDirectory))\n ? ProcessUtils.createShellProcess(\"yarn\", [\"generator:build\", \"--watch\"], buildDirectory)\n : ProcessUtils.createShellProcess(\"npm\", [\"run\", \"generator:build\", \"--\", \"--watch\"], buildDirectory);\n result.onStdOut.subscribe(data => {\n this.logger.verbose(data.toString());\n });\n result.onStdErr.subscribe(data => {\n this.logger.verbose(data.toString());\n });\n result.start();\n await this.waitFirstCompilationCompleted(result);\n this.logger.log(\"Successfully complied\");\n return result;\n }\n\n private async waitFirstCompilationCompleted(result: ShellProcessHandle): Promise<void> {\n await result.waitOutputIncludesString(\"Successfully compiled\");\n }\n\n private async createBuildResultWatcher(pathToGeneratorOutputDir: string): Promise<FSWatcher> {\n let maskToObserveGeneratorChanges: string[];\n if (await isOldGeneratorSourcesStructure(this.pathToEngineSources)) {\n maskToObserveGeneratorChanges = [\"**/*.js\"];\n } else {\n maskToObserveGeneratorChanges = [\"Generator/src/**/*.js\", \"index.js\"];\n }\n const watcher = watch(maskToObserveGeneratorChanges, {\n ignoreInitial: true,\n cwd: pathToGeneratorOutputDir,\n ignorePermissionErrors: false,\n usePolling: true,\n });\n const handleAnyFsEventDebounced = _.debounce(() => this.handleUpdate(), 500);\n watcher.on(\"all\", handleAnyFsEventDebounced);\n watcher.on(\"error\", handleAnyFsEventDebounced);\n return watcher;\n }\n}\n"],"mappings":";;;;;;;AACA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,uBAAA,GAAAP,OAAA;AACA,IAAAQ,qBAAA,GAAAR,OAAA;AAEA,IAAAS,aAAA,GAAAT,OAAA;AAEA,IAAAU,UAAA,GAAAV,OAAA;AAEA,IAAAW,qBAAA,GAAAX,OAAA;AAEA,MAAMY,mBAAmB,GAAG,IAAAC,eAAM,EAAC,CAAC,CAAC;AAE9B,MAAMC,6BAA6B,SAASC,mDAA2B,CAAgB;EAQnFC,WAAWA,CAACC,mBAA2B,EAAEC,MAAe,GAAG,IAAAC,uBAAS,EAAC,CAAC,EAAE;IAC3E,KAAK,CAAC,CAAC;IAAC,KARKF,mBAAmB;IAAA,KACnBC,MAAM;IAAA,KACfE,QAAQ,GAAG,KAAK;IAAA,KAChBC,gBAAgB;IAAA,KAChBC,YAAY;IAAA,KACZC,kBAAkB;IAAA,KAuDTC,YAAY,GAAG,YAA2B;MACvD,IAAI,CAACN,MAAM,CAACO,GAAG,CAAC,2BAA2B,CAA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,CAAC,EAAE;MAChE+C,6BAA6B,GAAG,CAAC,SAAS,CAAC;IAC/C,CAAC,MAAM;MACHA,6BAA6B,GAAG,CAAC,uBAAuB,EAAE,UAAU,CAAC;IACzE;IACA,MAAME,OAAO,GAAG,IAAAC,eAAK,EAACH,6BAA6B,EAAE;MACjDI,aAAa,EAAE,IAAI;MACnBrB,GAAG,EAAEgB,wBAAwB;MAC7BM,sBAAsB,EAAE,KAAK;MAC7BC,UAAU,EAAE;IAChB,CAAC,CAAC;IACF,MAAMC,yBAAyB,GAAGC,eAAC,CAACC,QAAQ,CAAC,MAAM,IAAI,CAACjD,YAAY,CAAC,CAAC,EAAE,GAAG,CAAC;IAC5E0C,OAAO,CAACQ,EAAE,CAAC,KAAK,EAAEH,yBAAyB,CAAC;IAC5CL,OAAO,CAACQ,EAAE,CAAC,OAAO,EAAEH,yBAAyB,CAAC;IAC9C,OAAOL,OAAO;EAClB;AACJ;AAACS,OAAA,CAAA7D,6BAAA,GAAAA,6BAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"BuildGeneratorFromSourcesTask.js","names":["_path","_interopRequireDefault","require","_chokidar","_lodash","_pLimit","_ExecUtils","_ILogger","_StaticLogger","_ChainableValueProducer","_EngineStructureUtils","_ProcessUtils","_IsWebpack","_CreateAsyncGenerator","generatorBuildLimit","pLimit","BuildGeneratorFromSourcesTask","ObservableValueProducerBase","constructor","pathToEngineSources","logger","getLogger","useWatch","currentGenerator","buildProcess","buildResultWatcher","handleUpdate","log","emitUpdate","createAsyncGenerator","path","join","withPrefix","getCurrentValue","undefined","runWatchProcessStarted","createBuildResultWatcher","acquireGeneratorFromSources","Error","beginListening","stopListening","kill","error","close","action","buildActionBegin","buildDirectory","getBuildDirectory","execCommandAsync","cwd","result","complete","isNewEngineStructure","isYarn","ProcessUtils","createShellProcess","onStdOut","subscribe","data","verbose","toString","onStdErr","start","waitFirstCompilationCompleted","waitOutputIncludesString","pathToGeneratorOutputDir","maskToObserveGeneratorChanges","isOldGeneratorSourcesStructure","watcher","watch","ignoreInitial","ignorePermissionErrors","usePolling","handleAnyFsEventDebounced","_","debounce","on","exports"],"sources":["../../../../../src/BuildTasks/Generator/BuildGeneratorFromSourcesTask.ts"],"sourcesContent":["import { FSWatcher } from \"fs\";\nimport path from \"path\";\n\nimport { watch } from \"chokidar\";\nimport _ from \"lodash\";\nimport pLimit from \"p-limit\";\n\nimport { execCommandAsync } from \"../../Commons/ExecUtils\";\nimport { buildActionBegin, ILogger } from \"../../Commons/Logging/ILogger\";\nimport { getLogger } from \"../../Commons/Logging/StaticLogger\";\nimport { ObservableValueProducerBase } from \"../../Commons/TasksCore/ChainableValueProducer\";\nimport { isNewEngineStructure, isOldGeneratorSourcesStructure } from \"../EngineStructureUtils\";\nimport { FormGenerator } from \"../Form/GenerateForm\";\nimport { ProcessUtils } from \"../ProcessUtils/ProcessUtils\";\nimport { ShellProcessHandle } from \"../ProcessUtils/ShellProcessHandle\";\nimport { isYarn } from \"../ClientJS/IsWebpack5\";\n\nimport { createAsyncGenerator } from \"./GeneratorWorker/CreateAsyncGenerator\";\n\nconst generatorBuildLimit = pLimit(1);\n\nexport class BuildGeneratorFromSourcesTask extends ObservableValueProducerBase<FormGenerator> {\n private readonly pathToEngineSources: string;\n private readonly logger: ILogger;\n private useWatch = false;\n private currentGenerator?: FormGenerator;\n private buildProcess?: ShellProcessHandle;\n private buildResultWatcher?: FSWatcher;\n\n public constructor(pathToEngineSources: string, logger: ILogger = getLogger()) {\n super();\n this.logger = logger.withPrefix(\"GENERATOR\");\n this.pathToEngineSources = pathToEngineSources;\n }\n\n public async getCurrentValue(): Promise<FormGenerator> {\n return generatorBuildLimit(async () => {\n if (this.currentGenerator != undefined) {\n return this.currentGenerator;\n }\n if (this.useWatch) {\n if (this.buildProcess == undefined) {\n this.buildProcess = await this.runWatchProcessStarted();\n this.buildResultWatcher = await this.createBuildResultWatcher(\n path.join(this.pathToEngineSources, \"Generator\", \"dist\")\n );\n this.currentGenerator = createAsyncGenerator(\n path.join(this.pathToEngineSources, \"Generator\"),\n this.useWatch,\n this.useWatch\n );\n }\n } else {\n this.currentGenerator = await this.acquireGeneratorFromSources();\n }\n if (this.currentGenerator == undefined) {\n throw new Error(\"InvalidProgramState\");\n }\n return this.currentGenerator;\n });\n }\n\n protected async beginListening(): Promise<void> {\n this.useWatch = true;\n }\n\n protected async stopListening(): Promise<void> {\n if (this.buildProcess != undefined) {\n try {\n const buildProcess = this.buildProcess;\n this.buildProcess = undefined;\n await buildProcess.kill();\n } catch (error) {\n this.logger.error(`Failed to stop process: ${error}`);\n }\n }\n if (this.buildResultWatcher != undefined) {\n this.buildResultWatcher.close();\n }\n this.useWatch = false;\n }\n\n private readonly handleUpdate = async (): Promise<void> => {\n this.logger.log(\"Generator sources updated\");\n await this.emitUpdate(\n createAsyncGenerator(path.join(this.pathToEngineSources, \"Generator\"), this.useWatch, this.useWatch)\n );\n };\n\n private async acquireGeneratorFromSources(): Promise<FormGenerator> {\n const action = buildActionBegin(this.logger, \"Build generator\");\n const buildDirectory = await this.getBuildDirectory();\n await execCommandAsync(this.logger, `npm run generator:build`, {\n cwd: buildDirectory,\n });\n const result = createAsyncGenerator(\n path.join(this.pathToEngineSources, \"Generator\"),\n this.useWatch,\n this.useWatch\n );\n action.complete();\n return result;\n }\n\n private async getBuildDirectory(): Promise<string> {\n return (await isNewEngineStructure(this.pathToEngineSources))\n ? path.join(this.pathToEngineSources, \"Generator\")\n : this.pathToEngineSources;\n }\n\n private async runWatchProcessStarted(): Promise<ShellProcessHandle> {\n this.logger.log(\"Start watch\");\n const buildDirectory = await this.getBuildDirectory();\n const result = (await isYarn(buildDirectory))\n ? ProcessUtils.createShellProcess(\"yarn\", [\"generator:build\", \"--watch\"], buildDirectory)\n : ProcessUtils.createShellProcess(\"npm\", [\"run\", \"generator:build\", \"--\", \"--watch\"], buildDirectory);\n result.onStdOut.subscribe(data => {\n this.logger.verbose(data.toString());\n });\n result.onStdErr.subscribe(data => {\n this.logger.verbose(data.toString());\n });\n result.start();\n await this.waitFirstCompilationCompleted(result);\n this.logger.log(\"Successfully complied\");\n return result;\n }\n\n private async waitFirstCompilationCompleted(result: ShellProcessHandle): Promise<void> {\n await result.waitOutputIncludesString(\"Successfully compiled\");\n }\n\n private async createBuildResultWatcher(pathToGeneratorOutputDir: string): Promise<FSWatcher> {\n let maskToObserveGeneratorChanges: string[];\n if (await isOldGeneratorSourcesStructure(this.pathToEngineSources)) {\n maskToObserveGeneratorChanges = [\"**/*.js\"];\n } else {\n maskToObserveGeneratorChanges = [\"Generator/src/**/*.js\", \"index.js\"];\n }\n const watcher = watch(maskToObserveGeneratorChanges, {\n ignoreInitial: true,\n cwd: pathToGeneratorOutputDir,\n ignorePermissionErrors: false,\n usePolling: true,\n });\n const handleAnyFsEventDebounced = _.debounce(() => this.handleUpdate(), 500);\n watcher.on(\"all\", handleAnyFsEventDebounced);\n watcher.on(\"error\", handleAnyFsEventDebounced);\n // @ts-ignore\n return watcher;\n }\n}\n"],"mappings":";;;;;;;AACA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,uBAAA,GAAAP,OAAA;AACA,IAAAQ,qBAAA,GAAAR,OAAA;AAEA,IAAAS,aAAA,GAAAT,OAAA;AAEA,IAAAU,UAAA,GAAAV,OAAA;AAEA,IAAAW,qBAAA,GAAAX,OAAA;AAEA,MAAMY,mBAAmB,GAAG,IAAAC,eAAM,EAAC,CAAC,CAAC;AAE9B,MAAMC,6BAA6B,SAASC,mDAA2B,CAAgB;EAQnFC,WAAWA,CAACC,mBAA2B,EAAEC,MAAe,GAAG,IAAAC,uBAAS,E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C;IACxC,OAAOuB,MAAM;EACjB;EAEA,MAAca,6BAA6BA,CAACb,MAA0B,EAAiB;IACnF,MAAMA,MAAM,CAACc,wBAAwB,CAAC,uBAAuB,CAAC;EAClE;EAEA,MAAc5B,wBAAwBA,CAAC6B,wBAAgC,EAAsB;IACzF,IAAIC,6BAAuC;IAC3C,IAAI,MAAM,IAAAC,oDAA8B,EAAC,IAAI,CAAChD,mBAAmB,CAAC,EAAE;MAChE+C,6BAA6B,GAAG,CAAC,SAAS,CAAC;IAC/C,CAAC,MAAM;MACHA,6BAA6B,GAAG,CAAC,uBAAuB,EAAE,UAAU,CAAC;IACzE;IACA,MAAME,OAAO,GAAG,IAAAC,eAAK,EAACH,6BAA6B,EAAE;MACjDI,aAAa,EAAE,IAAI;MACnBrB,GAAG,EAAEgB,wBAAwB;MAC7BM,sBAAsB,EAAE,KAAK;MAC7BC,UAAU,EAAE;IAChB,CAAC,CAAC;IACF,MAAMC,yBAAyB,GAAGC,eAAC,CAACC,QAAQ,CAAC,MAAM,IAAI,CAACjD,YAAY,CAAC,CAAC,EAAE,GAAG,CAAC;IAC5E0C,OAAO,CAACQ,EAAE,CAAC,KAAK,EAAEH,yBAAyB,CAAC;IAC5CL,OAAO,CAACQ,EAAE,CAAC,OAAO,EAAEH,yBAAyB,CAAC;IAC9C;IACA,OAAOL,OAAO;EAClB;AACJ;AAACS,OAAA,CAAA7D,6BAAA,GAAAA,6BAAA","ignoreList":[]}
|
|
@@ -62,7 +62,8 @@ class GeneratorSourcesImporter {
|
|
|
62
62
|
async importProcessSugar(pathToGenerator) {
|
|
63
63
|
if (await (0, _EngineStructureUtils.isOldGeneratorSourcesStructure)(pathToGenerator)) {
|
|
64
64
|
const processSugarPath = path.join(pathToGenerator, "dist", "generators", "processSugar.js");
|
|
65
|
-
|
|
65
|
+
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
66
67
|
return require(processSugarPath).default;
|
|
67
68
|
} else {
|
|
68
69
|
const generatorMain = this.requireUncachedAllNamed(pathToGenerator);
|
|
@@ -75,6 +76,7 @@ class GeneratorSourcesImporter {
|
|
|
75
76
|
if (!(await (0, _fsExtra.pathExists)(localizationEntryPointPath))) {
|
|
76
77
|
return undefined;
|
|
77
78
|
}
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
78
80
|
return require(localizationEntryPointPath);
|
|
79
81
|
} else {
|
|
80
82
|
const generatorMain = this.requireUncachedAllNamed(pathToGenerator);
|
|
@@ -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 // eslint-disable-next-line @typescript-eslint/no-var-requires\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 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,GA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,EAAE,UAAU,CAAC;MACpG,IAAI,CAACC,aAAa,IAAI,EAAAH,qBAAA,GAACG,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":["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,CA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AI,CAACI,8BAA8B,CAACD,WAAW,CAAC;IAC1D,CAAC;IAAA,KAEgBC,8BAA8B,GAAG,MAAOD,WAA0B,IAAoB;MAAA,IAAAE,qBAAA,EAAAC,sBAAA;MACnG,MAAMC,kBAAkB,GAAGJ,WAAW,CAAC,sBAAsB,CAAC;MAC9D,IAAI,CAACI,kBAAkB,IAAI,OAAOA,kBAAkB,KAAK,QAAQ,EAAE;QAC/D;MACJ;MACA,MAAMC,aAAa,GAAG,MAAM,IAAI,CAACP,SAAS,CAACQ,yBAAyB,CAACF,kBAAkB,EAAE,UAAU,CAAC;MACpG,IAAI,CAACC,aAAa,IAAI,EAAAH,qBAAA,GAACG,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":[]}
|
|
@@ -13,6 +13,7 @@ _TypedProcessWorker.TypedProcessWorker.start(async ([pathToGeneratorProcessSugar
|
|
|
13
13
|
// NOTE Because only JSON are allowed for IPC we need to convert Buffer -> Base64
|
|
14
14
|
// Another solution is use a stream, but formContent still need to convert or send by chunks
|
|
15
15
|
for (const [key, formContentItem] of (0, _IterableUtils.iterateEntries)(formContent)) {
|
|
16
|
+
// @ts-ignore
|
|
16
17
|
result[key] = formContentItem instanceof Buffer ? {
|
|
17
18
|
payload: formContentItem.toString("base64"),
|
|
18
19
|
encoding: "base64"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProcessSugarWorker.js","names":["_IterableUtils","require","_GeneratorRequireUtils","_TypedProcessWorker","TypedProcessWorker","start","pathToGeneratorProcessSugar","formSugarContent","additionalContent","generationOptions","purgeCache","requestNumber","send","importer","GeneratorSourcesImporter","processSugar","importProcessSugar","formContent","result","key","formContentItem","iterateEntries","Buffer","payload","toString","encoding","type","gfv","generatedForm","error","Error","errorText","stack"],"sources":["../../../../../../src/BuildTasks/Generator/GeneratorWorker/ProcessSugarWorker.ts"],"sourcesContent":["import { GeneratedForm, GenerationOptions } from \"../../Form/GenerateForm\";\nimport { FormResources, SugarContent } from \"../../ReadFormSource\";\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 = [string, SugarContent, FormResources, undefined | GenerationOptions, boolean, number];\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 [\n pathToGeneratorProcessSugar,\n formSugarContent,\n additionalContent,\n generationOptions,\n purgeCache,\n requestNumber,\n ],\n send\n ): Promise<void> => {\n try {\n const importer = new GeneratorSourcesImporter(purgeCache);\n const processSugar = await importer.importProcessSugar(pathToGeneratorProcessSugar);\n\n const formContent: GeneratedForm = await processSugar(\n formSugarContent,\n additionalContent,\n generationOptions\n );\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 result[key] =\n formContentItem instanceof Buffer\n ? { payload: formContentItem.toString(\"base64\"), encoding: \"base64\" as BufferEncoding }\n : formContentItem;\n }\n\n send({ type: \"Result\", gfv: additionalContent.gfv, generatedForm: result, requestNumber: requestNumber });\n } catch (error) {\n if (error instanceof Error) {\n send({\n type: \"Error\",\n gfv: additionalContent.gfv,\n errorText: `${error.toString()}\\n${error.stack}`,\n requestNumber: requestNumber,\n });\n } else {\n send({\n type: \"Error\",\n gfv: additionalContent.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;AAWAG,sCAAkB,CAACC,KAAK,CACpB,OACI,CACIC,2BAA2B,EAC3BC,gBAAgB,EAChBC,iBAAiB,EACjBC,iBAAiB,EACjBC,UAAU,EACVC,aAAa,CAChB,EACDC,IAAI,KACY;EAChB,IAAI;IACA,MAAMC,QAAQ,GAAG,IAAIC,+CAAwB,CAACJ,UAAU,CAAC;IACzD,MAAMK,YAAY,GAAG,MAAMF,QAAQ,CAACG,kBAAkB,CAACV,2BAA2B,CAAC;IAEnF,MAAMW,WAA0B,GAAG,MAAMF,YAAY,CACjDR,gBAAgB,EAChBC,iBAAiB,EACjBC,iBACJ,CAAC;IAED,MAAMS,MAAwC,GAAG,CAAC,CAAC;;IAEnD;IACA;IACA,KAAK,MAAM,CAACC,GAAG,EAAEC,eAAe,CAAC,IAAI,IAAAC,6BAAc,EAACJ,WAAW,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"ProcessSugarWorker.js","names":["_IterableUtils","require","_GeneratorRequireUtils","_TypedProcessWorker","TypedProcessWorker","start","pathToGeneratorProcessSugar","formSugarContent","additionalContent","generationOptions","purgeCache","requestNumber","send","importer","GeneratorSourcesImporter","processSugar","importProcessSugar","formContent","result","key","formContentItem","iterateEntries","Buffer","payload","toString","encoding","type","gfv","generatedForm","error","Error","errorText","stack"],"sources":["../../../../../../src/BuildTasks/Generator/GeneratorWorker/ProcessSugarWorker.ts"],"sourcesContent":["import { GeneratedForm, GenerationOptions } from \"../../Form/GenerateForm\";\nimport { FormResources, SugarContent } from \"../../ReadFormSource\";\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 = [string, SugarContent, FormResources, undefined | GenerationOptions, boolean, number];\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 [\n pathToGeneratorProcessSugar,\n formSugarContent,\n additionalContent,\n generationOptions,\n purgeCache,\n requestNumber,\n ],\n send\n ): Promise<void> => {\n try {\n const importer = new GeneratorSourcesImporter(purgeCache);\n const processSugar = await importer.importProcessSugar(pathToGeneratorProcessSugar);\n\n const formContent: GeneratedForm = await processSugar(\n formSugarContent,\n additionalContent,\n generationOptions\n );\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\" as BufferEncoding }\n : formContentItem;\n }\n\n send({ type: \"Result\", gfv: additionalContent.gfv, generatedForm: result, requestNumber: requestNumber });\n } catch (error) {\n if (error instanceof Error) {\n send({\n type: \"Error\",\n gfv: additionalContent.gfv,\n errorText: `${error.toString()}\\n${error.stack}`,\n requestNumber: requestNumber,\n });\n } else {\n send({\n type: \"Error\",\n gfv: additionalContent.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;AAWAG,sCAAkB,CAACC,KAAK,CACpB,OACI,CACIC,2BAA2B,EAC3BC,gBAAgB,EAChBC,iBAAiB,EACjBC,iBAAiB,EACjBC,UAAU,EACVC,aAAa,CAChB,EACDC,IAAI,KACY;EAChB,IAAI;IACA,MAAMC,QAAQ,GAAG,IAAIC,+CAAwB,CAACJ,UAAU,CAAC;IACzD,MAAMK,YAAY,GAAG,MAAMF,QAAQ,CAACG,kBAAkB,CAACV,2BAA2B,CAAC;IAEnF,MAAMW,WAA0B,GAAG,MAAMF,YAAY,CACjDR,gBAAgB,EAChBC,iBAAiB,EACjBC,iBACJ,CAAC;IAED,MAAMS,MAAwC,GAAG,CAAC,CAAC;;IAEnD;IACA;IACA,KAAK,MAAM,CAACC,GAAG,EAAEC,eAAe,CAAC,IAAI,IAAAC,6BAAc,EAACJ,WAAW,CAAC,EAAE;MAC9D;MACAC,MAAM,CAACC,GAAG,CAAC,GACPC,eAAe,YAAYE,MAAM,GAC3B;QAAEC,OAAO,EAAEH,eAAe,CAACI,QAAQ,CAAC,QAAQ,CAAC;QAAEC,QAAQ,EAAE;MAA2B,CAAC,GACrFL,eAAe;IAC7B;IAEAR,IAAI,CAAC;MAAEc,IAAI,EAAE,QAAQ;MAAEC,GAAG,EAAEnB,iBAAiB,CAACmB,GAAG;MAAEC,aAAa,EAAEV,MAAM;MAAEP,aAAa,EAAEA;IAAc,CAAC,CAAC;EAC7G,CAAC,CAAC,OAAOkB,KAAK,EAAE;IACZ,IAAIA,KAAK,YAAYC,KAAK,EAAE;MACxBlB,IAAI,CAAC;QACDc,IAAI,EAAE,OAAO;QACbC,GAAG,EAAEnB,iBAAiB,CAACmB,GAAG;QAC1BI,SAAS,EAAE,GAAGF,KAAK,CAACL,QAAQ,CAAC,CAAC,KAAKK,KAAK,CAACG,KAAK,EAAE;QAChDrB,aAAa,EAAEA;MACnB,CAAC,CAAC;IACN,CAAC,MAAM;MACHC,IAAI,CAAC;QACDc,IAAI,EAAE,OAAO;QACbC,GAAG,EAAEnB,iBAAiB,CAACmB,GAAG;QAC1BI,SAAS,EAAE,GAAGF,KAAK,EAAE;QACrBlB,aAAa,EAAEA;MACnB,CAAC,CAAC;IACN;EACJ;AACJ,CACJ,CAAC","ignoreList":[]}
|
package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/ReadSourcesAndProcessSugarWorker.js
CHANGED
|
@@ -18,6 +18,7 @@ _TypedProcessWorker.TypedProcessWorker.start(async ([pathToGeneratorProcessSugar
|
|
|
18
18
|
// NOTE Because only JSON are allowed for IPC we need to convert Buffer -> Base64
|
|
19
19
|
// Another solution is use a stream, but formContent still need to convert or send by chunks
|
|
20
20
|
for (const [key, formContentItem] of (0, _IterableUtils.iterateEntries)(formContent)) {
|
|
21
|
+
// @ts-ignore
|
|
21
22
|
result[key] = formContentItem instanceof Buffer ? {
|
|
22
23
|
payload: formContentItem.toString("base64"),
|
|
23
24
|
encoding: "base64"
|
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","hlFarmDirectoryPath","generationOptions","purgeCache","requestNumber","send","formSource","importer","GeneratorSourcesImporter","readSources","importReadSources","processSugar","importProcessSugar","formContent","sugarContent","resources","validator","GeneratorSourcesValidator","validate","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 { GeneratedForm, GenerationOptions } from \"../../Form/GenerateForm\";\nimport { FormSource } from \"../../ReadFormSource\";\nimport { iterateEntries } from \"../../../../../Common/IterableUtils\";\n\nimport { GeneratorSourcesImporter, GeneratorSourcesValidator } from \"./GeneratorRequireUtils\";\nimport { TypedProcessWorker } from \"./TypedProcessWorker\";\n\nexport interface GeneratedFormInterProcessMessage {\n [relativeFileName: string]: string | { payload: string; encoding: string };\n}\n\nexport type CallMessage = [string, string, string, string, undefined | GenerationOptions, boolean, number];\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 [\n pathToGeneratorProcessSugar,\n formSourcesPath,\n farmDirectory,\n hlFarmDirectoryPath,\n generationOptions,\n purgeCache,\n requestNumber,\n ],\n send\n ): Promise<void> => {\n let formSource: FormSource | undefined;\n try {\n const importer = new GeneratorSourcesImporter(purgeCache);\n const readSources = await importer.importReadSources(pathToGeneratorProcessSugar);\n formSource = await readSources(formSourcesPath, farmDirectory, hlFarmDirectoryPath);\n\n const processSugar = await importer.importProcessSugar(pathToGeneratorProcessSugar);\n\n const formContent: GeneratedForm = await processSugar(\n formSource.sugarContent,\n formSource.resources,\n generationOptions\n );\n\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 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;AAWAG,sCAAkB,CAACC,KAAK,CACpB,OACI,CACIC,2BAA2B,EAC3BC,eAAe,EACfC,aAAa,EACbC,mBAAmB,EACnBC,iBAAiB,EACjBC,UAAU,EACVC,aAAa,CAChB,EACDC,IAAI,KACY;EAChB,IAAIC,UAAkC;EACtC,IAAI;IACA,MAAMC,QAAQ,GAAG,IAAIC,+CAAwB,CAACL,UAAU,CAAC;IACzD,MAAMM,WAAW,GAAG,MAAMF,QAAQ,CAACG,iBAAiB,CAACZ,2BAA2B,CAAC;IACjFQ,UAAU,GAAG,MAAMG,WAAW,CAACV,eAAe,EAAEC,aAAa,EAAEC,mBAAmB,CAAC;IAEnF,MAAMU,YAAY,GAAG,MAAMJ,QAAQ,CAACK,kBAAkB,CAACd,2BAA2B,CAAC;IAEnF,MAAMe,WAA0B,GAAG,MAAMF,YAAY,CACjDL,UAAU,CAACQ,YAAY,EACvBR,UAAU,CAACS,SAAS,EACpBb,iBACJ,CAAC;IAED,MAAMc,SAAS,GAAG,IAAIC,gDAAyB,CAACf,iBAAiB,CAAC;IAClE,MAAMc,SAAS,CAACE,QAAQ,CAACL,WAAW,CAAC;IAErC,MAAMM,MAAwC,GAAG,CAAC,CAAC;;IAEnD;IACA;IACA,KAAK,MAAM,CAACC,GAAG,EAAEC,eAAe,CAAC,IAAI,IAAAC,6BAAc,EAACT,WAAW,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"ReadSourcesAndProcessSugarWorker.js","names":["_IterableUtils","require","_GeneratorRequireUtils","_TypedProcessWorker","TypedProcessWorker","start","pathToGeneratorProcessSugar","formSourcesPath","farmDirectory","hlFarmDirectoryPath","generationOptions","purgeCache","requestNumber","send","formSource","importer","GeneratorSourcesImporter","readSources","importReadSources","processSugar","importProcessSugar","formContent","sugarContent","resources","validator","GeneratorSourcesValidator","validate","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 { GeneratedForm, GenerationOptions } from \"../../Form/GenerateForm\";\nimport { FormSource } from \"../../ReadFormSource\";\nimport { iterateEntries } from \"../../../../../Common/IterableUtils\";\n\nimport { GeneratorSourcesImporter, GeneratorSourcesValidator } from \"./GeneratorRequireUtils\";\nimport { TypedProcessWorker } from \"./TypedProcessWorker\";\n\nexport interface GeneratedFormInterProcessMessage {\n [relativeFileName: string]: string | { payload: string; encoding: string };\n}\n\nexport type CallMessage = [string, string, string, string, undefined | GenerationOptions, boolean, number];\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 [\n pathToGeneratorProcessSugar,\n formSourcesPath,\n farmDirectory,\n hlFarmDirectoryPath,\n generationOptions,\n purgeCache,\n requestNumber,\n ],\n send\n ): Promise<void> => {\n let formSource: FormSource | undefined;\n try {\n const importer = new GeneratorSourcesImporter(purgeCache);\n const readSources = await importer.importReadSources(pathToGeneratorProcessSugar);\n formSource = await readSources(formSourcesPath, farmDirectory, hlFarmDirectoryPath);\n\n const processSugar = await importer.importProcessSugar(pathToGeneratorProcessSugar);\n\n const formContent: GeneratedForm = await processSugar(\n formSource.sugarContent,\n formSource.resources,\n generationOptions\n );\n\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;AAWAG,sCAAkB,CAACC,KAAK,CACpB,OACI,CACIC,2BAA2B,EAC3BC,eAAe,EACfC,aAAa,EACbC,mBAAmB,EACnBC,iBAAiB,EACjBC,UAAU,EACVC,aAAa,CAChB,EACDC,IAAI,KACY;EAChB,IAAIC,UAAkC;EACtC,IAAI;IACA,MAAMC,QAAQ,GAAG,IAAIC,+CAAwB,CAACL,UAAU,CAAC;IACzD,MAAMM,WAAW,GAAG,MAAMF,QAAQ,CAACG,iBAAiB,CAACZ,2BAA2B,CAAC;IACjFQ,UAAU,GAAG,MAAMG,WAAW,CAACV,eAAe,EAAEC,aAAa,EAAEC,mBAAmB,CAAC;IAEnF,MAAMU,YAAY,GAAG,MAAMJ,QAAQ,CAACK,kBAAkB,CAACd,2BAA2B,CAAC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AAYpB,SAAS,CAACa,GAAG;QAC9BK,SAAS,EAAE,GAAGH,KAAK,EAAE;QACrB1B,aAAa,EAAEA;MACnB,CAAC,CAAC;IACN;EACJ;AACJ,CACJ,CAAC","ignoreList":[]}
|
|
@@ -11,10 +11,8 @@ exports.requireUncachedDefault = requireUncachedDefault;
|
|
|
11
11
|
|
|
12
12
|
function purgeCache(moduleName) {
|
|
13
13
|
const moduleKey = require.resolve(moduleName);
|
|
14
|
-
// tslint:disable-next-line no-unsafe-any
|
|
15
14
|
const module = require.cache[moduleKey];
|
|
16
15
|
if (module) {
|
|
17
|
-
// tslint:disable-next-line no-unsafe-any no-dynamic-delete
|
|
18
16
|
delete require.cache[moduleKey];
|
|
19
17
|
if (Array.isArray(module.children)) {
|
|
20
18
|
for (const subModule of module.children) {
|
|
@@ -36,14 +34,16 @@ function requireUncachedDefault(module, purgeCacheOnImport) {
|
|
|
36
34
|
if (purgeCacheOnImport) {
|
|
37
35
|
purgeCache(module);
|
|
38
36
|
}
|
|
39
|
-
|
|
37
|
+
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
40
39
|
return interopRequireDefault(require(module)).default;
|
|
41
40
|
}
|
|
42
41
|
function requireUncachedAllNamed(module, purgeCacheOnImport) {
|
|
43
42
|
if (purgeCacheOnImport) {
|
|
44
43
|
purgeCache(module);
|
|
45
44
|
}
|
|
46
|
-
|
|
45
|
+
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
47
47
|
return interopRequireDefault(require(module));
|
|
48
48
|
}
|
|
49
49
|
//# sourceMappingURL=RequireUncached.js.map
|
|
@@ -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","requireUncachedDefault","purgeCacheOnImport","requireUncachedAllNamed"],"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
|
|
1
|
+
{"version":3,"file":"RequireUncached.js","names":["purgeCache","moduleName","moduleKey","require","resolve","module","cache","Array","isArray","children","subModule","id","isEsModule","obj","__esModule","interopRequireDefault","default","requireUncachedDefault","purgeCacheOnImport","requireUncachedAllNamed"],"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 requireUncachedDefault(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)).default;\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,sBAAsBA,CAACZ,MAAc,EAAEa,kBAA2B,EAAwB;EACtG,IAAIA,kBAAkB,EAAE;IACpBlB,UAAU,CAACK,MAAM,CAAC;EACtB;;EAEA;EACA,OAAOU,qBAAqB,CAACZ,OAAO,CAACE,MAAM,CAAC,CAAC,CAACW,OAAO;AACzD;AAEO,SAASG,uBAAuBA,CAACd,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":[]}
|
|
@@ -33,6 +33,7 @@ class ShellProcessHandle {
|
|
|
33
33
|
this.process = undefined;
|
|
34
34
|
(_processToKill$stderr = processToKill.stderr) === null || _processToKill$stderr === void 0 || _processToKill$stderr.pause();
|
|
35
35
|
(_processToKill$stdout = processToKill.stdout) === null || _processToKill$stdout === void 0 || _processToKill$stdout.pause();
|
|
36
|
+
// @ts-ignore
|
|
36
37
|
await _ProcessUtils.ProcessUtils.killTreeAsync(pid);
|
|
37
38
|
}
|
|
38
39
|
waitOutputIncludesString(expectedString) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShellProcessHandle.js","names":["_child_process","require","_ConsoleApplication","_EventObject","_ProcessUtils","ShellProcessHandle","constructor","startInfo","process","onStdOut","createEvent","onStdErr","subscription","handleExit","kill","_processToKill$stderr","_processToKill$stdout","undefined","unsubscribe","processToKill","Error","pid","stderr","pause","stdout","ProcessUtils","killTreeAsync","waitOutputIncludesString","expectedString","Promise","resolve","subscribe","output","includes","start","_this$process$stdout","_this$process$stderr","ConsoleApplication","onExit","shellExe","shellArg","platform","command","args","join","spawn","cwd","workingDirectory","stdio","on","data","emit","toString","waitForExit","currentProcess","code","exports"],"sources":["../../../../../src/BuildTasks/ProcessUtils/ShellProcessHandle.ts"],"sourcesContent":["import { ChildProcess, spawn } from \"child_process\";\n\nimport { ConsoleApplication } from \"../../Commons/ConsoleApplication/ConsoleApplication\";\nimport { createEvent, IEventSubscription } from \"../../Commons/EventObject\";\n\nimport { ProcessUtils } from \"./ProcessUtils\";\n\nexport interface ShellProcessStartInfo {\n command: string;\n args: string[];\n workingDirectory?: string;\n}\n\nexport class ShellProcessHandle {\n private readonly startInfo: ShellProcessStartInfo;\n private process?: ChildProcess;\n\n public readonly onStdOut = createEvent<[string]>();\n public readonly onStdErr = createEvent<[string]>();\n private subscription?: IEventSubscription;\n\n public constructor(startInfo: ShellProcessStartInfo) {\n this.startInfo = startInfo;\n }\n\n public async kill(): Promise<void> {\n if (this.subscription != undefined) {\n this.subscription.unsubscribe();\n }\n const processToKill = this.process;\n if (processToKill == undefined) {\n throw new Error(\"Process not started\");\n }\n const pid = processToKill.pid;\n this.process = undefined;\n processToKill.stderr?.pause();\n processToKill.stdout?.pause();\n await ProcessUtils.killTreeAsync(pid);\n }\n\n public waitOutputIncludesString(expectedString: string): Promise<void> {\n return new Promise<void>(resolve => {\n const subscription = this.onStdOut.subscribe(output => {\n if (output.includes(expectedString)) {\n subscription.unsubscribe();\n resolve();\n }\n });\n });\n }\n\n public start(): void {\n this.subscription = ConsoleApplication.onExit.subscribe(this.handleExit);\n let shellExe: string, shellArg: string[];\n if (process.platform === \"win32\") {\n shellExe = \"cmd.exe\";\n shellArg = [\"/c\", this.startInfo.command, ...this.startInfo.args];\n } else {\n shellExe = \"/bin/sh\";\n shellArg = [\"-c\", [this.startInfo.command, ...this.startInfo.args].join(\" \")];\n }\n this.process = spawn(shellExe, shellArg, {\n cwd: this.startInfo.workingDirectory,\n stdio: \"pipe\",\n });\n this.process.stdout?.on(\"data\", (data: Buffer | string) => {\n this.onStdOut.emit(data.toString());\n });\n this.process.stderr?.on(\"data\", (data: Buffer | string) => {\n this.onStdErr.emit(data.toString());\n });\n }\n\n public waitForExit(): Promise<null | number> {\n const currentProcess = this.process;\n if (currentProcess != undefined) {\n return new Promise<null | number>(resolve => {\n currentProcess.on(\"exit\", code => {\n resolve(code);\n });\n });\n } else {\n throw new Error(\"No process started\");\n }\n }\n\n private readonly handleExit = async (): Promise<void> => {\n await this.kill();\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAEA,IAAAG,aAAA,GAAAH,OAAA;AAQO,MAAMI,kBAAkB,CAAC;EAQrBC,WAAWA,CAACC,SAAgC,EAAE;IAAA,KAPpCA,SAAS;IAAA,KAClBC,OAAO;IAAA,KAECC,QAAQ,GAAG,IAAAC,wBAAW,EAAW,CAAC;IAAA,KAClCC,QAAQ,GAAG,IAAAD,wBAAW,EAAW,CAAC;IAAA,KAC1CE,YAAY;IAAA,
|
|
1
|
+
{"version":3,"file":"ShellProcessHandle.js","names":["_child_process","require","_ConsoleApplication","_EventObject","_ProcessUtils","ShellProcessHandle","constructor","startInfo","process","onStdOut","createEvent","onStdErr","subscription","handleExit","kill","_processToKill$stderr","_processToKill$stdout","undefined","unsubscribe","processToKill","Error","pid","stderr","pause","stdout","ProcessUtils","killTreeAsync","waitOutputIncludesString","expectedString","Promise","resolve","subscribe","output","includes","start","_this$process$stdout","_this$process$stderr","ConsoleApplication","onExit","shellExe","shellArg","platform","command","args","join","spawn","cwd","workingDirectory","stdio","on","data","emit","toString","waitForExit","currentProcess","code","exports"],"sources":["../../../../../src/BuildTasks/ProcessUtils/ShellProcessHandle.ts"],"sourcesContent":["import { ChildProcess, spawn } from \"child_process\";\n\nimport { ConsoleApplication } from \"../../Commons/ConsoleApplication/ConsoleApplication\";\nimport { createEvent, IEventSubscription } from \"../../Commons/EventObject\";\n\nimport { ProcessUtils } from \"./ProcessUtils\";\n\nexport interface ShellProcessStartInfo {\n command: string;\n args: string[];\n workingDirectory?: string;\n}\n\nexport class ShellProcessHandle {\n private readonly startInfo: ShellProcessStartInfo;\n private process?: ChildProcess;\n\n public readonly onStdOut = createEvent<[string]>();\n public readonly onStdErr = createEvent<[string]>();\n private subscription?: IEventSubscription;\n\n public constructor(startInfo: ShellProcessStartInfo) {\n this.startInfo = startInfo;\n }\n\n public async kill(): Promise<void> {\n if (this.subscription != undefined) {\n this.subscription.unsubscribe();\n }\n const processToKill = this.process;\n if (processToKill == undefined) {\n throw new Error(\"Process not started\");\n }\n const pid = processToKill.pid;\n this.process = undefined;\n processToKill.stderr?.pause();\n processToKill.stdout?.pause();\n // @ts-ignore\n await ProcessUtils.killTreeAsync(pid);\n }\n\n public waitOutputIncludesString(expectedString: string): Promise<void> {\n return new Promise<void>(resolve => {\n const subscription = this.onStdOut.subscribe(output => {\n if (output.includes(expectedString)) {\n subscription.unsubscribe();\n resolve();\n }\n });\n });\n }\n\n public start(): void {\n this.subscription = ConsoleApplication.onExit.subscribe(this.handleExit);\n let shellExe: string, shellArg: string[];\n if (process.platform === \"win32\") {\n shellExe = \"cmd.exe\";\n shellArg = [\"/c\", this.startInfo.command, ...this.startInfo.args];\n } else {\n shellExe = \"/bin/sh\";\n shellArg = [\"-c\", [this.startInfo.command, ...this.startInfo.args].join(\" \")];\n }\n this.process = spawn(shellExe, shellArg, {\n cwd: this.startInfo.workingDirectory,\n stdio: \"pipe\",\n });\n this.process.stdout?.on(\"data\", (data: Buffer | string) => {\n this.onStdOut.emit(data.toString());\n });\n this.process.stderr?.on(\"data\", (data: Buffer | string) => {\n this.onStdErr.emit(data.toString());\n });\n }\n\n public waitForExit(): Promise<null | number> {\n const currentProcess = this.process;\n if (currentProcess != undefined) {\n return new Promise<null | number>(resolve => {\n currentProcess.on(\"exit\", code => {\n resolve(code);\n });\n });\n } else {\n throw new Error(\"No process started\");\n }\n }\n\n private readonly handleExit = async (): Promise<void> => {\n await this.kill();\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAEA,IAAAG,aAAA,GAAAH,OAAA;AAQO,MAAMI,kBAAkB,CAAC;EAQrBC,WAAWA,CAACC,SAAgC,EAAE;IAAA,KAPpCA,SAAS;IAAA,KAClBC,OAAO;IAAA,KAECC,QAAQ,GAAG,IAAAC,wBAAW,EAAW,CAAC;IAAA,KAClCC,QAAQ,GAAG,IAAAD,wBAAW,EAAW,CAAC;IAAA,KAC1CE,YAAY;IAAA,KAoEHC,UAAU,GAAG,YAA2B;MACrD,MAAM,IAAI,C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,IAAI;QACzCwB,cAAc,CAACL,EAAE,CAAC,MAAM,EAAEM,IAAI,IAAI;UAC9BzB,OAAO,CAACyB,IAAI,CAAC;QACjB,CAAC,CAAC;MACN,CAAC,CAAC;IACN,CAAC,MAAM;MACH,MAAM,IAAInC,KAAK,CAAC,oBAAoB,CAAC;IACzC;EACJ;AAKJ;AAACoC,OAAA,CAAAnD,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -165,7 +165,6 @@ async function getPackageVersionsInReverseOrder(packageName) {
|
|
|
165
165
|
}
|
|
166
166
|
});
|
|
167
167
|
});
|
|
168
|
-
// tslint:disable-next-line no-unsafe-any
|
|
169
168
|
const versions = JSON.parse(output.trim());
|
|
170
169
|
const sortedVersions = versions.sort(semver.compare).reverse();
|
|
171
170
|
packageVersionsCache.set(packageName, sortedVersions);
|