@uapkg/cli 1.1.8 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/CompositionRoot.d.ts +47 -0
- package/dist/app/CompositionRoot.d.ts.map +1 -0
- package/dist/app/CompositionRoot.js +95 -0
- package/dist/app/CompositionRoot.js.map +1 -0
- package/dist/app/UAPKGApplication.d.ts +14 -0
- package/dist/app/UAPKGApplication.d.ts.map +1 -0
- package/dist/app/UAPKGApplication.js +111 -0
- package/dist/app/UAPKGApplication.js.map +1 -0
- package/dist/cli/UAPKGCommandLine.d.ts +166 -0
- package/dist/cli/UAPKGCommandLine.d.ts.map +1 -0
- package/dist/cli/UAPKGCommandLine.js +172 -0
- package/dist/cli/UAPKGCommandLine.js.map +1 -0
- package/dist/cli/parseCommandLine.d.ts +2 -0
- package/dist/cli/parseCommandLine.d.ts.map +1 -0
- package/dist/cli/parseCommandLine.js +6 -0
- package/dist/cli/parseCommandLine.js.map +1 -0
- package/dist/cli/parsing/UAPKGCommandLineParser.d.ts +8 -0
- package/dist/cli/parsing/UAPKGCommandLineParser.d.ts.map +1 -0
- package/dist/cli/parsing/UAPKGCommandLineParser.js +25 -0
- package/dist/cli/parsing/UAPKGCommandLineParser.js.map +1 -0
- package/dist/cli/parsing/UAPKGParserRegistry.d.ts +11 -0
- package/dist/cli/parsing/UAPKGParserRegistry.d.ts.map +1 -0
- package/dist/cli/parsing/UAPKGParserRegistry.js +39 -0
- package/dist/cli/parsing/UAPKGParserRegistry.js.map +1 -0
- package/dist/cli/parsing/contracts/UAPKGCommandModule.d.ts +9 -0
- package/dist/cli/parsing/contracts/UAPKGCommandModule.d.ts.map +1 -0
- package/dist/cli/parsing/contracts/UAPKGCommandModule.js +2 -0
- package/dist/cli/parsing/contracts/UAPKGCommandModule.js.map +1 -0
- package/dist/cli/parsing/modules/AddCommandModule.d.ts +7 -0
- package/dist/cli/parsing/modules/AddCommandModule.d.ts.map +1 -0
- package/dist/cli/parsing/modules/AddCommandModule.js +37 -0
- package/dist/cli/parsing/modules/AddCommandModule.js.map +1 -0
- package/dist/cli/parsing/modules/ConfigCommandModule.d.ts +7 -0
- package/dist/cli/parsing/modules/ConfigCommandModule.d.ts.map +1 -0
- package/dist/cli/parsing/modules/ConfigCommandModule.js +84 -0
- package/dist/cli/parsing/modules/ConfigCommandModule.js.map +1 -0
- package/dist/cli/parsing/modules/InitCommandModule.d.ts +7 -0
- package/dist/cli/parsing/modules/InitCommandModule.d.ts.map +1 -0
- package/dist/cli/parsing/modules/InitCommandModule.js +23 -0
- package/dist/cli/parsing/modules/InitCommandModule.js.map +1 -0
- package/dist/cli/parsing/modules/InstallCommandModule.d.ts +7 -0
- package/dist/cli/parsing/modules/InstallCommandModule.d.ts.map +1 -0
- package/dist/cli/parsing/modules/InstallCommandModule.js +29 -0
- package/dist/cli/parsing/modules/InstallCommandModule.js.map +1 -0
- package/dist/cli/parsing/modules/ListCommandModule.d.ts +7 -0
- package/dist/cli/parsing/modules/ListCommandModule.d.ts.map +1 -0
- package/dist/cli/parsing/modules/ListCommandModule.js +16 -0
- package/dist/cli/parsing/modules/ListCommandModule.js.map +1 -0
- package/dist/cli/parsing/modules/OutdatedCommandModule.d.ts +7 -0
- package/dist/cli/parsing/modules/OutdatedCommandModule.d.ts.map +1 -0
- package/dist/cli/parsing/modules/OutdatedCommandModule.js +17 -0
- package/dist/cli/parsing/modules/OutdatedCommandModule.js.map +1 -0
- package/dist/cli/parsing/modules/PackCommandModule.d.ts +7 -0
- package/dist/cli/parsing/modules/PackCommandModule.d.ts.map +1 -0
- package/dist/cli/parsing/modules/PackCommandModule.js +29 -0
- package/dist/cli/parsing/modules/PackCommandModule.js.map +1 -0
- package/dist/cli/parsing/modules/ProjectGetNameCommandModule.d.ts +7 -0
- package/dist/cli/parsing/modules/ProjectGetNameCommandModule.d.ts.map +1 -0
- package/dist/cli/parsing/modules/ProjectGetNameCommandModule.js +12 -0
- package/dist/cli/parsing/modules/ProjectGetNameCommandModule.js.map +1 -0
- package/dist/cli/parsing/modules/RegistryCommandModule.d.ts +7 -0
- package/dist/cli/parsing/modules/RegistryCommandModule.d.ts.map +1 -0
- package/dist/cli/parsing/modules/RegistryCommandModule.js +92 -0
- package/dist/cli/parsing/modules/RegistryCommandModule.js.map +1 -0
- package/dist/cli/parsing/modules/RemoveCommandModule.d.ts +7 -0
- package/dist/cli/parsing/modules/RemoveCommandModule.d.ts.map +1 -0
- package/dist/cli/parsing/modules/RemoveCommandModule.js +15 -0
- package/dist/cli/parsing/modules/RemoveCommandModule.js.map +1 -0
- package/dist/cli/parsing/modules/UpdateCommandModule.d.ts +7 -0
- package/dist/cli/parsing/modules/UpdateCommandModule.d.ts.map +1 -0
- package/dist/cli/parsing/modules/UpdateCommandModule.js +26 -0
- package/dist/cli/parsing/modules/UpdateCommandModule.js.map +1 -0
- package/dist/cli/parsing/modules/WhyCommandModule.d.ts +7 -0
- package/dist/cli/parsing/modules/WhyCommandModule.d.ts.map +1 -0
- package/dist/cli/parsing/modules/WhyCommandModule.js +15 -0
- package/dist/cli/parsing/modules/WhyCommandModule.js.map +1 -0
- package/dist/cli/parsing/modules/sharedOptions.d.ts +8 -0
- package/dist/cli/parsing/modules/sharedOptions.d.ts.map +1 -0
- package/dist/cli/parsing/modules/sharedOptions.js +26 -0
- package/dist/cli/parsing/modules/sharedOptions.js.map +1 -0
- package/dist/cli/runUAPKGCLI.d.ts +2 -0
- package/dist/cli/runUAPKGCLI.d.ts.map +1 -0
- package/dist/cli/runUAPKGCLI.js +7 -0
- package/dist/cli/runUAPKGCLI.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +18 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/AddCommand.d.ts +26 -0
- package/dist/commands/AddCommand.d.ts.map +1 -0
- package/dist/commands/AddCommand.js +55 -0
- package/dist/commands/AddCommand.js.map +1 -0
- package/dist/commands/Command.d.ts +4 -0
- package/dist/commands/Command.d.ts.map +1 -0
- package/dist/commands/Command.js +2 -0
- package/dist/commands/Command.js.map +1 -0
- package/dist/commands/ConfigCommand.d.ts +28 -0
- package/dist/commands/ConfigCommand.d.ts.map +1 -0
- package/dist/commands/ConfigCommand.js +187 -0
- package/dist/commands/ConfigCommand.js.map +1 -0
- package/dist/commands/InitCommand.d.ts +19 -0
- package/dist/commands/InitCommand.d.ts.map +1 -0
- package/dist/commands/InitCommand.js +61 -0
- package/dist/commands/InitCommand.js.map +1 -0
- package/dist/commands/InstallCommand.d.ts +30 -0
- package/dist/commands/InstallCommand.d.ts.map +1 -0
- package/dist/commands/InstallCommand.js +97 -0
- package/dist/commands/InstallCommand.js.map +1 -0
- package/dist/commands/ListCommand.d.ts +20 -0
- package/dist/commands/ListCommand.d.ts.map +1 -0
- package/dist/commands/ListCommand.js +83 -0
- package/dist/commands/ListCommand.js.map +1 -0
- package/dist/commands/OutdatedCommand.d.ts +20 -0
- package/dist/commands/OutdatedCommand.d.ts.map +1 -0
- package/dist/commands/OutdatedCommand.js +42 -0
- package/dist/commands/OutdatedCommand.js.map +1 -0
- package/dist/commands/PackCommand.d.ts +13 -0
- package/dist/commands/PackCommand.d.ts.map +1 -0
- package/dist/commands/PackCommand.js +22 -0
- package/dist/commands/PackCommand.js.map +1 -0
- package/dist/commands/PostinstallCandidateBuilder.d.ts +25 -0
- package/dist/commands/PostinstallCandidateBuilder.d.ts.map +1 -0
- package/dist/commands/PostinstallCandidateBuilder.js +41 -0
- package/dist/commands/PostinstallCandidateBuilder.js.map +1 -0
- package/dist/commands/ProjectGetNameCommand.d.ts +14 -0
- package/dist/commands/ProjectGetNameCommand.d.ts.map +1 -0
- package/dist/commands/ProjectGetNameCommand.js +26 -0
- package/dist/commands/ProjectGetNameCommand.js.map +1 -0
- package/dist/commands/RegistryCommand.d.ts +29 -0
- package/dist/commands/RegistryCommand.d.ts.map +1 -0
- package/dist/commands/RegistryCommand.js +121 -0
- package/dist/commands/RegistryCommand.js.map +1 -0
- package/dist/commands/RemoveCommand.d.ts +14 -0
- package/dist/commands/RemoveCommand.d.ts.map +1 -0
- package/dist/commands/RemoveCommand.js +55 -0
- package/dist/commands/RemoveCommand.js.map +1 -0
- package/dist/commands/UpdateCommand.d.ts +45 -0
- package/dist/commands/UpdateCommand.d.ts.map +1 -0
- package/dist/commands/UpdateCommand.js +113 -0
- package/dist/commands/UpdateCommand.js.map +1 -0
- package/dist/commands/WhyCommand.d.ts +21 -0
- package/dist/commands/WhyCommand.d.ts.map +1 -0
- package/dist/commands/WhyCommand.js +46 -0
- package/dist/commands/WhyCommand.js.map +1 -0
- package/dist/commands/add/DependencyAddResolver.d.ts +18 -0
- package/dist/commands/add/DependencyAddResolver.d.ts.map +1 -0
- package/dist/commands/add/DependencyAddResolver.js +36 -0
- package/dist/commands/add/DependencyAddResolver.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/postinstall/api/PostinstallDsl.d.ts +44 -0
- package/dist/postinstall/api/PostinstallDsl.d.ts.map +1 -0
- package/dist/postinstall/api/PostinstallDsl.js +39 -0
- package/dist/postinstall/api/PostinstallDsl.js.map +1 -0
- package/dist/postinstall/api/definePostinstall.d.ts +18 -0
- package/dist/postinstall/api/definePostinstall.d.ts.map +1 -0
- package/dist/postinstall/api/definePostinstall.js +19 -0
- package/dist/postinstall/api/definePostinstall.js.map +1 -0
- package/dist/postinstall/index.d.ts +26 -0
- package/dist/postinstall/index.d.ts.map +1 -0
- package/dist/postinstall/index.js +37 -0
- package/dist/postinstall/index.js.map +1 -0
- package/dist/postinstall/loader/EntryResolver.d.ts +20 -0
- package/dist/postinstall/loader/EntryResolver.d.ts.map +1 -0
- package/dist/postinstall/loader/EntryResolver.js +35 -0
- package/dist/postinstall/loader/EntryResolver.js.map +1 -0
- package/dist/postinstall/loader/EsbuildTranspiler.d.ts +18 -0
- package/dist/postinstall/loader/EsbuildTranspiler.d.ts.map +1 -0
- package/dist/postinstall/loader/EsbuildTranspiler.js +58 -0
- package/dist/postinstall/loader/EsbuildTranspiler.js.map +1 -0
- package/dist/postinstall/loader/ExportValidator.d.ts +15 -0
- package/dist/postinstall/loader/ExportValidator.d.ts.map +1 -0
- package/dist/postinstall/loader/ExportValidator.js +34 -0
- package/dist/postinstall/loader/ExportValidator.js.map +1 -0
- package/dist/postinstall/loader/ModuleImporter.d.ts +29 -0
- package/dist/postinstall/loader/ModuleImporter.d.ts.map +1 -0
- package/dist/postinstall/loader/ModuleImporter.js +60 -0
- package/dist/postinstall/loader/ModuleImporter.js.map +1 -0
- package/dist/postinstall/loader/PostinstallLoader.d.ts +32 -0
- package/dist/postinstall/loader/PostinstallLoader.d.ts.map +1 -0
- package/dist/postinstall/loader/PostinstallLoader.js +60 -0
- package/dist/postinstall/loader/PostinstallLoader.js.map +1 -0
- package/dist/postinstall/markers/MarkerBlockEditor.d.ts +30 -0
- package/dist/postinstall/markers/MarkerBlockEditor.d.ts.map +1 -0
- package/dist/postinstall/markers/MarkerBlockEditor.js +46 -0
- package/dist/postinstall/markers/MarkerBlockEditor.js.map +1 -0
- package/dist/postinstall/markers/MarkerBlockService.d.ts +24 -0
- package/dist/postinstall/markers/MarkerBlockService.d.ts.map +1 -0
- package/dist/postinstall/markers/MarkerBlockService.js +46 -0
- package/dist/postinstall/markers/MarkerBlockService.js.map +1 -0
- package/dist/postinstall/markers/MarkerIntegrityValidator.d.ts +29 -0
- package/dist/postinstall/markers/MarkerIntegrityValidator.d.ts.map +1 -0
- package/dist/postinstall/markers/MarkerIntegrityValidator.js +53 -0
- package/dist/postinstall/markers/MarkerIntegrityValidator.js.map +1 -0
- package/dist/postinstall/policy/PostinstallPolicyGate.d.ts +36 -0
- package/dist/postinstall/policy/PostinstallPolicyGate.d.ts.map +1 -0
- package/dist/postinstall/policy/PostinstallPolicyGate.js +57 -0
- package/dist/postinstall/policy/PostinstallPolicyGate.js.map +1 -0
- package/dist/postinstall/runner/PostinstallOrchestrator.d.ts +71 -0
- package/dist/postinstall/runner/PostinstallOrchestrator.d.ts.map +1 -0
- package/dist/postinstall/runner/PostinstallOrchestrator.js +172 -0
- package/dist/postinstall/runner/PostinstallOrchestrator.js.map +1 -0
- package/dist/postinstall/unreal/BuildCsInjector.d.ts +23 -0
- package/dist/postinstall/unreal/BuildCsInjector.d.ts.map +1 -0
- package/dist/postinstall/unreal/BuildCsInjector.js +55 -0
- package/dist/postinstall/unreal/BuildCsInjector.js.map +1 -0
- package/dist/postinstall/unreal/CSharpInjectionEngine.d.ts +22 -0
- package/dist/postinstall/unreal/CSharpInjectionEngine.d.ts.map +1 -0
- package/dist/postinstall/unreal/CSharpInjectionEngine.js +61 -0
- package/dist/postinstall/unreal/CSharpInjectionEngine.js.map +1 -0
- package/dist/postinstall/unreal/CSharpStructureAnalyzer.d.ts +22 -0
- package/dist/postinstall/unreal/CSharpStructureAnalyzer.d.ts.map +1 -0
- package/dist/postinstall/unreal/CSharpStructureAnalyzer.js +130 -0
- package/dist/postinstall/unreal/CSharpStructureAnalyzer.js.map +1 -0
- package/dist/postinstall/unreal/CSharpStructures.d.ts +19 -0
- package/dist/postinstall/unreal/CSharpStructures.d.ts.map +1 -0
- package/dist/postinstall/unreal/CSharpStructures.js +2 -0
- package/dist/postinstall/unreal/CSharpStructures.js.map +1 -0
- package/dist/postinstall/unreal/CSharpWrapperFactory.d.ts +26 -0
- package/dist/postinstall/unreal/CSharpWrapperFactory.d.ts.map +1 -0
- package/dist/postinstall/unreal/CSharpWrapperFactory.js +60 -0
- package/dist/postinstall/unreal/CSharpWrapperFactory.js.map +1 -0
- package/dist/postinstall/unreal/PluginHash.d.ts +8 -0
- package/dist/postinstall/unreal/PluginHash.d.ts.map +1 -0
- package/dist/postinstall/unreal/PluginHash.js +13 -0
- package/dist/postinstall/unreal/PluginHash.js.map +1 -0
- package/dist/postinstall/unreal/PrettyParseError.d.ts +15 -0
- package/dist/postinstall/unreal/PrettyParseError.d.ts.map +1 -0
- package/dist/postinstall/unreal/PrettyParseError.js +43 -0
- package/dist/postinstall/unreal/PrettyParseError.js.map +1 -0
- package/dist/postinstall/unreal/ProjectFileLocator.d.ts +20 -0
- package/dist/postinstall/unreal/ProjectFileLocator.d.ts.map +1 -0
- package/dist/postinstall/unreal/ProjectFileLocator.js +53 -0
- package/dist/postinstall/unreal/ProjectFileLocator.js.map +1 -0
- package/dist/postinstall/unreal/TargetCsInjector.d.ts +23 -0
- package/dist/postinstall/unreal/TargetCsInjector.d.ts.map +1 -0
- package/dist/postinstall/unreal/TargetCsInjector.js +55 -0
- package/dist/postinstall/unreal/TargetCsInjector.js.map +1 -0
- package/dist/postinstall/unreal/UProjectInjector.d.ts +12 -0
- package/dist/postinstall/unreal/UProjectInjector.d.ts.map +1 -0
- package/dist/postinstall/unreal/UProjectInjector.js +54 -0
- package/dist/postinstall/unreal/UProjectInjector.js.map +1 -0
- package/dist/postinstall/unreal/UProjectMetadataReader.d.ts +9 -0
- package/dist/postinstall/unreal/UProjectMetadataReader.d.ts.map +1 -0
- package/dist/postinstall/unreal/UProjectMetadataReader.js +20 -0
- package/dist/postinstall/unreal/UProjectMetadataReader.js.map +1 -0
- package/dist/postinstall/unreal/UnrealSourceCatalog.d.ts +23 -0
- package/dist/postinstall/unreal/UnrealSourceCatalog.d.ts.map +1 -0
- package/dist/postinstall/unreal/UnrealSourceCatalog.js +52 -0
- package/dist/postinstall/unreal/UnrealSourceCatalog.js.map +1 -0
- package/dist/prompts/InkPromptService.d.ts +8 -0
- package/dist/prompts/InkPromptService.d.ts.map +1 -0
- package/dist/prompts/InkPromptService.js +56 -0
- package/dist/prompts/InkPromptService.js.map +1 -0
- package/dist/prompts/ProjectContextDetector.d.ts +10 -0
- package/dist/prompts/ProjectContextDetector.d.ts.map +1 -0
- package/dist/prompts/ProjectContextDetector.js +27 -0
- package/dist/prompts/ProjectContextDetector.js.map +1 -0
- package/dist/prompts/PromptService.d.ts +9 -0
- package/dist/prompts/PromptService.d.ts.map +1 -0
- package/dist/prompts/PromptService.js +8 -0
- package/dist/prompts/PromptService.js.map +1 -0
- package/dist/reporting/DiagnosticDeduplicator.d.ts +11 -0
- package/dist/reporting/DiagnosticDeduplicator.d.ts.map +1 -0
- package/dist/reporting/DiagnosticDeduplicator.js +37 -0
- package/dist/reporting/DiagnosticDeduplicator.js.map +1 -0
- package/dist/reporting/DiagnosticRenderer.d.ts +18 -0
- package/dist/reporting/DiagnosticRenderer.d.ts.map +1 -0
- package/dist/reporting/DiagnosticRenderer.js +2 -0
- package/dist/reporting/DiagnosticRenderer.js.map +1 -0
- package/dist/reporting/DiagnosticReporter.d.ts +23 -0
- package/dist/reporting/DiagnosticReporter.d.ts.map +1 -0
- package/dist/reporting/DiagnosticReporter.js +41 -0
- package/dist/reporting/DiagnosticReporter.js.map +1 -0
- package/dist/reporting/InkDiagnosticRenderer.d.ts +21 -0
- package/dist/reporting/InkDiagnosticRenderer.d.ts.map +1 -0
- package/dist/reporting/InkDiagnosticRenderer.js +44 -0
- package/dist/reporting/InkDiagnosticRenderer.js.map +1 -0
- package/dist/reporting/InstallProgressReporter.d.ts +34 -0
- package/dist/reporting/InstallProgressReporter.d.ts.map +1 -0
- package/dist/reporting/InstallProgressReporter.js +49 -0
- package/dist/reporting/InstallProgressReporter.js.map +1 -0
- package/dist/reporting/JsonReporter.d.ts +26 -0
- package/dist/reporting/JsonReporter.d.ts.map +1 -0
- package/dist/reporting/JsonReporter.js +16 -0
- package/dist/reporting/JsonReporter.js.map +1 -0
- package/dist/reporting/TextDiagnosticRenderer.d.ts +20 -0
- package/dist/reporting/TextDiagnosticRenderer.d.ts.map +1 -0
- package/dist/reporting/TextDiagnosticRenderer.js +30 -0
- package/dist/reporting/TextDiagnosticRenderer.js.map +1 -0
- package/dist/reporting/TextSink.d.ts +21 -0
- package/dist/reporting/TextSink.d.ts.map +1 -0
- package/dist/reporting/TextSink.js +25 -0
- package/dist/reporting/TextSink.js.map +1 -0
- package/package.json +12 -12
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as CSharpAst from '@amplication/csharp-ast';
|
|
2
|
+
/**
|
|
3
|
+
* Produces the hashed helper class that wraps user-supplied `classBody` content.
|
|
4
|
+
*
|
|
5
|
+
* The helper has the shape:
|
|
6
|
+
*
|
|
7
|
+
* ```csharp
|
|
8
|
+
* static class UAPKG_<hash>
|
|
9
|
+
* {
|
|
10
|
+
* public static void Apply(ModuleRules|TargetRules rules|target)
|
|
11
|
+
* {
|
|
12
|
+
* <user body>
|
|
13
|
+
* }
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* We use `@amplication/csharp-ast` to generate a syntactically valid class and
|
|
18
|
+
* then patch the output:
|
|
19
|
+
* * strip an invalid `using ;` line the library emits for empty namespaces;
|
|
20
|
+
* * retype the `object` parameter back to the requested ModuleRules/TargetRules.
|
|
21
|
+
*/
|
|
22
|
+
export class CSharpWrapperFactory {
|
|
23
|
+
createWrapper(className, contextType, contextName, body) {
|
|
24
|
+
const wrapperClass = new CSharpAst.Class({
|
|
25
|
+
name: className,
|
|
26
|
+
namespace: '',
|
|
27
|
+
access: 'private',
|
|
28
|
+
static_: true,
|
|
29
|
+
isNestedClass: true,
|
|
30
|
+
});
|
|
31
|
+
const applyMethod = new CSharpAst.Method({
|
|
32
|
+
name: 'Apply',
|
|
33
|
+
access: 'public',
|
|
34
|
+
isAsync: false,
|
|
35
|
+
type: CSharpAst.MethodType.STATIC,
|
|
36
|
+
parameters: [
|
|
37
|
+
new CSharpAst.Parameter({
|
|
38
|
+
name: contextName,
|
|
39
|
+
// csharp-ast adds invalid `using ;` when ClassReference namespace is empty.
|
|
40
|
+
// We emit with `object` and patch to ModuleRules/TargetRules below.
|
|
41
|
+
type: CSharpAst.Type.object(),
|
|
42
|
+
}),
|
|
43
|
+
],
|
|
44
|
+
body: new CSharpAst.CodeBlock({ code: body.trim() }),
|
|
45
|
+
});
|
|
46
|
+
wrapperClass.addMethod(applyMethod);
|
|
47
|
+
const writer = new CSharpAst.Writer({});
|
|
48
|
+
writer.writeNode(wrapperClass);
|
|
49
|
+
return this.normalize(writer.toString(), contextType, contextName);
|
|
50
|
+
}
|
|
51
|
+
normalize(source, contextType, contextName) {
|
|
52
|
+
const withoutTrailing = source.trim().replace(/[ \t]+\n/g, '\n');
|
|
53
|
+
return withoutTrailing
|
|
54
|
+
.replace(/^private static class/m, 'static class')
|
|
55
|
+
.replace(new RegExp(`public static void Apply\\(object\\s+${contextName}\\)`), `public static void Apply(${contextType} ${contextName})`)
|
|
56
|
+
.replace(/\)\s*{\n/g, ')\n {\n')
|
|
57
|
+
.replace(/;\}/g, ';\n }');
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=CSharpWrapperFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CSharpWrapperFactory.js","sourceRoot":"","sources":["../../../src/postinstall/unreal/CSharpWrapperFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,yBAAyB,CAAC;AAIrD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAO,oBAAoB;IACxB,aAAa,CAAC,SAAiB,EAAE,WAA+B,EAAE,WAAmB,EAAE,IAAY;QACxG,MAAM,YAAY,GAAG,IAAI,SAAS,CAAC,KAAK,CAAC;YACvC,IAAI,EAAE,SAAS;YACf,SAAS,EAAE,EAAE;YACb,MAAM,EAAE,SAAS;YACjB,OAAO,EAAE,IAAI;YACb,aAAa,EAAE,IAAI;SACpB,CAAC,CAAC;QACH,MAAM,WAAW,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC;YACvC,IAAI,EAAE,OAAO;YACb,MAAM,EAAE,QAAQ;YAChB,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,SAAS,CAAC,UAAU,CAAC,MAAM;YACjC,UAAU,EAAE;gBACV,IAAI,SAAS,CAAC,SAAS,CAAC;oBACtB,IAAI,EAAE,WAAW;oBACjB,4EAA4E;oBAC5E,oEAAoE;oBACpE,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE;iBAC9B,CAAC;aACH;YACD,IAAI,EAAE,IAAI,SAAS,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;SACrD,CAAC,CAAC;QACH,YAAY,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QAEpC,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACxC,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QAC/B,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;IACrE,CAAC;IAEO,SAAS,CAAC,MAAc,EAAE,WAA+B,EAAE,WAAmB;QACpF,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QACjE,OAAO,eAAe;aACnB,OAAO,CAAC,wBAAwB,EAAE,cAAc,CAAC;aACjD,OAAO,CACN,IAAI,MAAM,CAAC,wCAAwC,WAAW,KAAK,CAAC,EACpE,4BAA4B,WAAW,IAAI,WAAW,GAAG,CAC1D;aACA,OAAO,CAAC,WAAW,EAAE,YAAY,CAAC;aAClC,OAAO,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACjC,CAAC;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Deterministic 8-char SHA-1 hash of a plugin name; used for uniquely-named helper classes. */
|
|
2
|
+
export declare function getPluginHash(pluginName: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* Name of the nested helper class uapkg injects into a Build.cs / Target.cs.
|
|
5
|
+
* Hashed so two plugins can never collide inside the same module or target.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getWrapperClassName(pluginName: string): string;
|
|
8
|
+
//# sourceMappingURL=PluginHash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PluginHash.d.ts","sourceRoot":"","sources":["../../../src/postinstall/unreal/PluginHash.ts"],"names":[],"mappings":"AAEA,gGAAgG;AAChG,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE9D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
/** Deterministic 8-char SHA-1 hash of a plugin name; used for uniquely-named helper classes. */
|
|
3
|
+
export function getPluginHash(pluginName) {
|
|
4
|
+
return createHash('sha1').update(pluginName).digest('hex').slice(0, 8).toLowerCase();
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Name of the nested helper class uapkg injects into a Build.cs / Target.cs.
|
|
8
|
+
* Hashed so two plugins can never collide inside the same module or target.
|
|
9
|
+
*/
|
|
10
|
+
export function getWrapperClassName(pluginName) {
|
|
11
|
+
return `UAPKG_${getPluginHash(pluginName)}`;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=PluginHash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PluginHash.js","sourceRoot":"","sources":["../../../src/postinstall/unreal/PluginHash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,gGAAgG;AAChG,MAAM,UAAU,aAAa,CAAC,UAAkB;IAC9C,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;AACvF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAAkB;IACpD,OAAO,SAAS,aAAa,CAAC,UAAU,CAAC,EAAE,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured parse failure for C# build files. Emitted as the `reason` payload
|
|
3
|
+
* of `POSTINSTALL_LOAD_FAILED`-adjacent diagnostics by injector callers.
|
|
4
|
+
*
|
|
5
|
+
* Unlike the legacy version this class is still a standard `Error` subclass so
|
|
6
|
+
* it composes cleanly with `try/catch`, but the new postinstall subsystem never
|
|
7
|
+
* lets it escape — injectors catch and convert to diagnostics.
|
|
8
|
+
*/
|
|
9
|
+
export declare class PrettyParseError extends Error {
|
|
10
|
+
readonly filePath: string;
|
|
11
|
+
readonly line: number;
|
|
12
|
+
readonly column: number;
|
|
13
|
+
constructor(filePath: string, message: string, source: string, index: number);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=PrettyParseError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrettyParseError.d.ts","sourceRoot":"","sources":["../../../src/postinstall/unreal/PrettyParseError.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,SAAgB,QAAQ,EAAE,MAAM,CAAC;IACjC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,MAAM,EAAE,MAAM,CAAC;gBAEZ,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;CASpF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured parse failure for C# build files. Emitted as the `reason` payload
|
|
3
|
+
* of `POSTINSTALL_LOAD_FAILED`-adjacent diagnostics by injector callers.
|
|
4
|
+
*
|
|
5
|
+
* Unlike the legacy version this class is still a standard `Error` subclass so
|
|
6
|
+
* it composes cleanly with `try/catch`, but the new postinstall subsystem never
|
|
7
|
+
* lets it escape — injectors catch and convert to diagnostics.
|
|
8
|
+
*/
|
|
9
|
+
export class PrettyParseError extends Error {
|
|
10
|
+
filePath;
|
|
11
|
+
line;
|
|
12
|
+
column;
|
|
13
|
+
constructor(filePath, message, source, index) {
|
|
14
|
+
const { line, column } = toLineAndColumn(source, index);
|
|
15
|
+
const snippet = formatSnippet(source, line, column);
|
|
16
|
+
super(`${filePath}:${line}:${column} ${message}\n${snippet}`);
|
|
17
|
+
this.name = 'PrettyParseError';
|
|
18
|
+
this.filePath = filePath;
|
|
19
|
+
this.line = line;
|
|
20
|
+
this.column = column;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function toLineAndColumn(source, index) {
|
|
24
|
+
let line = 1;
|
|
25
|
+
let column = 1;
|
|
26
|
+
const limit = Math.min(index, source.length);
|
|
27
|
+
for (let i = 0; i < limit; i += 1) {
|
|
28
|
+
if (source[i] === '\n') {
|
|
29
|
+
line += 1;
|
|
30
|
+
column = 1;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
column += 1;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return { line, column };
|
|
37
|
+
}
|
|
38
|
+
function formatSnippet(source, line, column) {
|
|
39
|
+
const lines = source.split(/\r?\n/);
|
|
40
|
+
const lineText = lines[line - 1] ?? '';
|
|
41
|
+
return `${lineText}\n${' '.repeat(Math.max(0, column - 1))}^`;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=PrettyParseError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrettyParseError.js","sourceRoot":"","sources":["../../../src/postinstall/unreal/PrettyParseError.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACzB,QAAQ,CAAS;IACjB,IAAI,CAAS;IACb,MAAM,CAAS;IAE/B,YAAmB,QAAgB,EAAE,OAAe,EAAE,MAAc,EAAE,KAAa;QACjF,MAAM,EAAE,IAA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AM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AAChE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure-IO locator for Unreal build-tree anchors:
|
|
3
|
+
* * `*.Build.cs` files under `<projectRoot>/Source`
|
|
4
|
+
* * `*.Target.cs` files under `<projectRoot>/Source`
|
|
5
|
+
* * The single `*.uproject` at the project root.
|
|
6
|
+
*
|
|
7
|
+
* This module does no parsing; {@link UnrealSourceCatalog} pairs the returned
|
|
8
|
+
* paths with a {@link CSharpStructureAnalyzer} to validate them.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ProjectFileLocator {
|
|
11
|
+
findBuildFiles(projectRoot: string): string[];
|
|
12
|
+
findTargetFiles(projectRoot: string): string[];
|
|
13
|
+
/**
|
|
14
|
+
* Returns the single `.uproject` file at `projectRoot`, or throws if 0 or 2+
|
|
15
|
+
* exist. Callers in the new subsystem catch and convert to diagnostics.
|
|
16
|
+
*/
|
|
17
|
+
findProjectFile(projectRoot: string): string;
|
|
18
|
+
private findBySuffix;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=ProjectFileLocator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectFileLocator.d.ts","sourceRoot":"","sources":["../../../src/postinstall/unreal/ProjectFileLocator.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,qBAAa,kBAAkB;IACtB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE;IAI7C,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE;IAIrD;;;OAGG;IACI,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;IAWnD,OAAO,CAAC,YAAY;CAkBrB"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
/**
|
|
4
|
+
* Pure-IO locator for Unreal build-tree anchors:
|
|
5
|
+
* * `*.Build.cs` files under `<projectRoot>/Source`
|
|
6
|
+
* * `*.Target.cs` files under `<projectRoot>/Source`
|
|
7
|
+
* * The single `*.uproject` at the project root.
|
|
8
|
+
*
|
|
9
|
+
* This module does no parsing; {@link UnrealSourceCatalog} pairs the returned
|
|
10
|
+
* paths with a {@link CSharpStructureAnalyzer} to validate them.
|
|
11
|
+
*/
|
|
12
|
+
export class ProjectFileLocator {
|
|
13
|
+
findBuildFiles(projectRoot) {
|
|
14
|
+
return this.findBySuffix(path.join(projectRoot, 'Source'), '.Build.cs');
|
|
15
|
+
}
|
|
16
|
+
findTargetFiles(projectRoot) {
|
|
17
|
+
return this.findBySuffix(path.join(projectRoot, 'Source'), '.Target.cs');
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Returns the single `.uproject` file at `projectRoot`, or throws if 0 or 2+
|
|
21
|
+
* exist. Callers in the new subsystem catch and convert to diagnostics.
|
|
22
|
+
*/
|
|
23
|
+
findProjectFile(projectRoot) {
|
|
24
|
+
const entries = fs
|
|
25
|
+
.readdirSync(projectRoot, { withFileTypes: true })
|
|
26
|
+
.filter((entry) => entry.isFile() && entry.name.toLowerCase().endsWith('.uproject'))
|
|
27
|
+
.map((entry) => path.join(projectRoot, entry.name));
|
|
28
|
+
if (entries.length !== 1) {
|
|
29
|
+
throw new Error(`Expected exactly one .uproject in ${projectRoot}, found ${entries.length}`);
|
|
30
|
+
}
|
|
31
|
+
return entries[0];
|
|
32
|
+
}
|
|
33
|
+
findBySuffix(root, suffix) {
|
|
34
|
+
if (!fs.existsSync(root))
|
|
35
|
+
return [];
|
|
36
|
+
const files = [];
|
|
37
|
+
const stack = [root];
|
|
38
|
+
while (stack.length > 0) {
|
|
39
|
+
const current = stack.pop();
|
|
40
|
+
for (const entry of fs.readdirSync(current, { withFileTypes: true })) {
|
|
41
|
+
const fullPath = path.join(current, entry.name);
|
|
42
|
+
if (entry.isDirectory()) {
|
|
43
|
+
stack.push(fullPath);
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (entry.isFile() && fullPath.endsWith(suffix))
|
|
47
|
+
files.push(fullPath);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return files.sort((a, b) => a.localeCompare(b));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=ProjectFileLocator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectFileLocator.js","sourceRoot":"","sources":["../../../src/postinstall/unreal/ProjectFileLocator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC;;;;;;;;GAQG;AACH,MAAM,OAAO,kBAAkB;IACtB,cAAc,CAAC,WAAmB;QACvC,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,EAAE,WAAW,CAAC,CAAC;IAC1E,CAAC;IAEM,eAAe,CAAC,WAAmB;QACxC,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,EAAE,YAAY,CAAC,CAAC;IAC3E,CAAC;IAED;;;OAGG;IACI,eAAe,CAAC,WAAmB;QACxC,MAAM,OAAO,GAAG,EAAE;aACf,WAAW,CAAC,WAAW,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;aACjD,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;aACnF,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,CAA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import type { ZoneDefinition } from '../api/PostinstallDsl.js';
|
|
3
|
+
import { MarkerBlockEditor } from '../markers/MarkerBlockEditor.js';
|
|
4
|
+
import { CSharpInjectionEngine } from './CSharpInjectionEngine.js';
|
|
5
|
+
import { CSharpStructureAnalyzer } from './CSharpStructureAnalyzer.js';
|
|
6
|
+
import { CSharpWrapperFactory } from './CSharpWrapperFactory.js';
|
|
7
|
+
/**
|
|
8
|
+
* Injects a plugin's `setupTargets` content into a single `*.Target.cs` file.
|
|
9
|
+
*
|
|
10
|
+
* Mirrors {@link BuildCsInjector} but targets `TargetRules`/`TargetInfo` and a
|
|
11
|
+
* different marker-zone name-space. Never throws — errors become diagnostics.
|
|
12
|
+
* Pre-existing owned marker blocks are integrity-checked before mutation and
|
|
13
|
+
* surfaced as `POSTINSTALL_MARKER_CORRUPT` on failure.
|
|
14
|
+
*/
|
|
15
|
+
export declare class TargetCsInjector {
|
|
16
|
+
private readonly analyzer;
|
|
17
|
+
private readonly wrapperFactory;
|
|
18
|
+
private readonly injector;
|
|
19
|
+
private readonly markerEditor;
|
|
20
|
+
constructor(analyzer?: CSharpStructureAnalyzer, wrapperFactory?: CSharpWrapperFactory, injector?: CSharpInjectionEngine, markerEditor?: MarkerBlockEditor);
|
|
21
|
+
apply(filePath: string, pluginName: string, zones: ZoneDefinition): Result<void>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=TargetCsInjector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TargetCsInjector.d.ts","sourceRoot":"","sources":["../../../src/postinstall/unreal/TargetCsInjector.ts"],"names":[],"mappings":"AACA,OAAO,EAAqC,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACpF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAKjE;;;;;;;GAOG;AACH,qBAAa,gBAAgB;IAEzB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,YAAY;gBAHZ,QAAQ,GAAE,uBAAuD,EACjE,cAAc,GAAE,oBAAiD,EACjE,QAAQ,GAAE,qBAAmD,EAC7D,YAAY,GAAE,iBAA2C;IAGrE,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC;CAgCxF"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import { createIoErrorDiagnostic, fail, ok } from '@uapkg/diagnostics';
|
|
3
|
+
import { MarkerBlockEditor } from '../markers/MarkerBlockEditor.js';
|
|
4
|
+
import { CSharpInjectionEngine } from './CSharpInjectionEngine.js';
|
|
5
|
+
import { CSharpStructureAnalyzer } from './CSharpStructureAnalyzer.js';
|
|
6
|
+
import { CSharpWrapperFactory } from './CSharpWrapperFactory.js';
|
|
7
|
+
import { getWrapperClassName } from './PluginHash.js';
|
|
8
|
+
const TARGET_CS_ZONES = ['target-includes', 'target-class-body', 'target-constructor'];
|
|
9
|
+
/**
|
|
10
|
+
* Injects a plugin's `setupTargets` content into a single `*.Target.cs` file.
|
|
11
|
+
*
|
|
12
|
+
* Mirrors {@link BuildCsInjector} but targets `TargetRules`/`TargetInfo` and a
|
|
13
|
+
* different marker-zone name-space. Never throws — errors become diagnostics.
|
|
14
|
+
* Pre-existing owned marker blocks are integrity-checked before mutation and
|
|
15
|
+
* surfaced as `POSTINSTALL_MARKER_CORRUPT` on failure.
|
|
16
|
+
*/
|
|
17
|
+
export class TargetCsInjector {
|
|
18
|
+
analyzer;
|
|
19
|
+
wrapperFactory;
|
|
20
|
+
injector;
|
|
21
|
+
markerEditor;
|
|
22
|
+
constructor(analyzer = new CSharpStructureAnalyzer(), wrapperFactory = new CSharpWrapperFactory(), injector = new CSharpInjectionEngine(), markerEditor = new MarkerBlockEditor()) {
|
|
23
|
+
this.analyzer = analyzer;
|
|
24
|
+
this.wrapperFactory = wrapperFactory;
|
|
25
|
+
this.injector = injector;
|
|
26
|
+
this.markerEditor = markerEditor;
|
|
27
|
+
}
|
|
28
|
+
apply(filePath, pluginName, zones) {
|
|
29
|
+
try {
|
|
30
|
+
let source = fs.readFileSync(filePath, 'utf-8');
|
|
31
|
+
for (const zone of TARGET_CS_ZONES) {
|
|
32
|
+
const check = this.markerEditor.validate(source, pluginName, zone, filePath);
|
|
33
|
+
if (!check.ok)
|
|
34
|
+
return fail(check.diagnostics);
|
|
35
|
+
}
|
|
36
|
+
if (zones.includes?.trim()) {
|
|
37
|
+
source = this.injector.applyIncludes(source, pluginName, zones.includes, 'target-includes');
|
|
38
|
+
}
|
|
39
|
+
if (zones.classBody?.trim()) {
|
|
40
|
+
const parsedForWrapper = this.analyzer.parseTarget(filePath, source);
|
|
41
|
+
const wrapperClassName = getWrapperClassName(pluginName);
|
|
42
|
+
const wrapper = this.wrapperFactory.createWrapper(wrapperClassName, 'TargetRules', 'target', zones.classBody);
|
|
43
|
+
source = this.injector.applyClassWrapper(parsedForWrapper, pluginName, wrapper, 'target-class-body');
|
|
44
|
+
const parsedForCtor = this.analyzer.parseTarget(filePath, source);
|
|
45
|
+
source = this.injector.applyConstructorCall(parsedForCtor, pluginName, `${wrapperClassName}.Apply(this)`, 'target-constructor');
|
|
46
|
+
}
|
|
47
|
+
fs.writeFileSync(filePath, source, 'utf-8');
|
|
48
|
+
return ok(undefined);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
return fail([createIoErrorDiagnostic(filePath, error instanceof Error ? error.message : String(error))]);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=TargetCsInjector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TargetCsInjector.js","sourceRoot":"","sources":["../../../src/postinstall/unreal/TargetCsInjector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,uBAAuB,EAAE,IAAI,EAAE,EAAE,EAAe,MAAM,oBAAoB,CAAC;AAEpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD,MAAM,eAAe,GAAG,CAAC,iBAAiB,EAAE,mBAAmB,EAAE,oBAAoB,CAAU,CAAC;AAEhG;;;;;;;GAOG;AACH,MAAM,OAAO,gBAAgB;IAER;IACA;IACA;IACA;IAJnB,YACmB,WAAoC,IAAI,uBAAuB,EAAE,EACjE,iBAAuC,IAAI,oBAAoB,EAAE,EACjE,WAAkC,IAAI,qBAAqB,EAAE,EAC7D,eAAkC,IAAI,iBAAiB,EAAE;QAHzD,aAAQ,GAAR,QAAQ,CAAyD;QACjE,mBAAc,GAAd,cAAc,CAAmD;QACjE,aAAQ,GAAR,QAAQ,CAAqD;QAC7D,iBAAY,GAAZ,YAAY,CAA6C;IACzE,CAAC;IAEG,KAAK,CAAC,QAAgB,EAAE,UAAkB,EAAE,KAAqB;QACtE,IAAI,CAAC;YACH,IAAI,MAAM,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YAEhD,KAAK,MAAM,IAAI,IAAI,e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,CAAC,SAAS,CAAC,CAAC;QACvB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CAAC,CAAC,uBAAuB,CAAC,QAAQ,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3G,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Result } from '@uapkg/diagnostics';
|
|
2
|
+
/**
|
|
3
|
+
* Enables the given plugin names in the host project's `.uproject` file,
|
|
4
|
+
* preserving all other fields. Adds new entries with `Enabled: true` when the
|
|
5
|
+
* plugin isn't already listed; toggles `Enabled: true` on existing entries.
|
|
6
|
+
*
|
|
7
|
+
* Never throws — returns a `Result<void>`.
|
|
8
|
+
*/
|
|
9
|
+
export declare class UProjectInjector {
|
|
10
|
+
apply(projectFilePath: string, pluginNames: readonly string[]): Result<void>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=UProjectInjector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UProjectInjector.d.ts","sourceRoot":"","sources":["../../../src/postinstall/unreal/UProjectInjector.ts"],"names":[],"mappings":"AACA,OAAO,EAAiE,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAahH;;;;;;GAMG;AACH,qBAAa,gBAAgB;IACpB,KAAK,CAAC,eAAe,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC;CA0CpF"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import { createIoErrorDiagnostic, createParseErrorDiagnostic, fail, ok } from '@uapkg/diagnostics';
|
|
3
|
+
/**
|
|
4
|
+
* Enables the given plugin names in the host project's `.uproject` file,
|
|
5
|
+
* preserving all other fields. Adds new entries with `Enabled: true` when the
|
|
6
|
+
* plugin isn't already listed; toggles `Enabled: true` on existing entries.
|
|
7
|
+
*
|
|
8
|
+
* Never throws — returns a `Result<void>`.
|
|
9
|
+
*/
|
|
10
|
+
export class UProjectInjector {
|
|
11
|
+
apply(projectFilePath, pluginNames) {
|
|
12
|
+
if (pluginNames.length === 0)
|
|
13
|
+
return ok(undefined);
|
|
14
|
+
let source;
|
|
15
|
+
try {
|
|
16
|
+
source = fs.readFileSync(projectFilePath, 'utf-8');
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
return fail([createIoErrorDiagnostic(projectFilePath, error instanceof Error ? error.message : String(error))]);
|
|
20
|
+
}
|
|
21
|
+
let parsed;
|
|
22
|
+
try {
|
|
23
|
+
parsed = JSON.parse(source);
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
return fail([
|
|
27
|
+
createParseErrorDiagnostic(error instanceof Error ? error.message : String(error), projectFilePath),
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
const plugins = Array.isArray(parsed.Plugins) ? [...parsed.Plugins] : [];
|
|
31
|
+
const indexByName = new Map();
|
|
32
|
+
plugins.forEach((entry, index) => {
|
|
33
|
+
if (typeof entry.Name === 'string' && entry.Name.trim())
|
|
34
|
+
indexByName.set(entry.Name, index);
|
|
35
|
+
});
|
|
36
|
+
for (const pluginName of pluginNames) {
|
|
37
|
+
const existingIndex = indexByName.get(pluginName);
|
|
38
|
+
if (existingIndex === undefined) {
|
|
39
|
+
plugins.push({ Name: pluginName, Enabled: true });
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
plugins[existingIndex] = { ...plugins[existingIndex], Enabled: true };
|
|
43
|
+
}
|
|
44
|
+
parsed.Plugins = plugins;
|
|
45
|
+
try {
|
|
46
|
+
fs.writeFileSync(projectFilePath, `${JSON.stringify(parsed, null, 2)}\n`, 'utf-8');
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
return fail([createIoErrorDiagnostic(projectFilePath, error instanceof Error ? error.message : String(error))]);
|
|
50
|
+
}
|
|
51
|
+
return ok(undefined);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=UProjectInjector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UProjectInjector.js","sourceRoot":"","sources":["../../../src/postinstall/unreal/UProjectInjector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,IAAI,EAAE,EAAE,EAAe,MAAM,oBAAoB,CAAC;AAahH;;;;;;GAMG;AACH,MAAM,OAAO,gBAAgB;IACpB,KAAK,CAAC,eAAuB,EAAE,WAA8B;QAClE,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,EAAE,CAAC,SAAS,CAAC,CAAC;QAEnD,IAAI,MAAc,CAAC;QACnB,IAAI,CAAC;YACH,MAAM,GAAG,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;QACrD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CAAC,CAAC,uBAAuB,CAAC,eAAe,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAClH,CAAC;QAED,IAAI,MAAwB,CAAC;QAC7B,IAAI,CAAC;YACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAqB,CAAC;QAClD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CAAC;gBACV,0BAA0B,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,eAAe,CAAC;aACpG,CAAC,CAAC;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AAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAClH,CAAC;QACD,OAAO,EAAE,CAAC,SAAS,CAAC,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads the `Modules` array from a `.uproject` JSON file and returns the list
|
|
3
|
+
* of module names. Used when no explicit `postinstall.modules` is configured
|
|
4
|
+
* on the project manifest.
|
|
5
|
+
*/
|
|
6
|
+
export declare class UProjectMetadataReader {
|
|
7
|
+
readModuleNames(uprojectPath: string): string[];
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=UProjectMetadataReader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UProjectMetadataReader.d.ts","sourceRoot":"","sources":["../../../src/postinstall/unreal/UProjectMetadataReader.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,qBAAa,sBAAsB;IAC1B,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,EAAE;CAWvD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
/**
|
|
3
|
+
* Reads the `Modules` array from a `.uproject` JSON file and returns the list
|
|
4
|
+
* of module names. Used when no explicit `postinstall.modules` is configured
|
|
5
|
+
* on the project manifest.
|
|
6
|
+
*/
|
|
7
|
+
export class UProjectMetadataReader {
|
|
8
|
+
readModuleNames(uprojectPath) {
|
|
9
|
+
const source = fs.readFileSync(uprojectPath, 'utf-8');
|
|
10
|
+
let parsed;
|
|
11
|
+
try {
|
|
12
|
+
parsed = JSON.parse(source);
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
throw new Error(`Failed to parse ${uprojectPath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
16
|
+
}
|
|
17
|
+
return (parsed.Modules ?? []).map((entry) => entry.Name?.trim()).filter((value) => Boolean(value));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=UProjectMetadataReader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UProjectMetadataReader.js","sourceRoot":"","sources":["../../../src/postinstall/unreal/UProjectMetadataReader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AAUzB;;;;GAIG;AACH,MAAM,OAAO,sBAAsB;IAC1B,eAAe,CAAC,YAAoB;QACzC,MAAM,MAAM,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACtD,IAAI,MAAwB,CAAC;QAC7B,IAAI,CAAC;YACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAqB,CAAC;QAClD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,mBAAmB,YAAY,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAChH,CAAC;QAED,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAmB,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IACtH,CAAC;CACF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CSharpStructureAnalyzer } from './CSharpStructureAnalyzer.js';
|
|
2
|
+
import { ProjectFileLocator } from './ProjectFileLocator.js';
|
|
3
|
+
export interface SourceCatalog {
|
|
4
|
+
/** ModuleName → absolute path of its `*.Build.cs`. */
|
|
5
|
+
readonly moduleFiles: ReadonlyMap<string, string>;
|
|
6
|
+
/** Absolute paths to every `*.Target.cs` in the project source tree. */
|
|
7
|
+
readonly targetFiles: readonly string[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Scans the project source tree and validates every discovered `Build.cs` /
|
|
11
|
+
* `Target.cs` with {@link CSharpStructureAnalyzer}. This is a one-shot
|
|
12
|
+
* pre-flight check: the orchestrator runs it once before any injector mutates
|
|
13
|
+
* a file, so we fail fast on malformed sources.
|
|
14
|
+
*/
|
|
15
|
+
export declare class UnrealSourceCatalogBuilder {
|
|
16
|
+
private readonly fileLocator;
|
|
17
|
+
private readonly analyzer;
|
|
18
|
+
constructor(fileLocator?: ProjectFileLocator, analyzer?: CSharpStructureAnalyzer);
|
|
19
|
+
build(projectRoot: string, expectedModules: readonly string[]): SourceCatalog;
|
|
20
|
+
private resolveModules;
|
|
21
|
+
private resolveTargets;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=UnrealSourceCatalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnrealSourceCatalog.d.ts","sourceRoot":"","sources":["../../../src/postinstall/unreal/UnrealSourceCatalog.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,WAAW,aAAa;IAC5B,sDAAsD;IACtD,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClD,wEAAwE;IACxE,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC;AAED;;;;;GAKG;AACH,qBAAa,0BAA0B;IAEnC,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBADR,WAAW,GAAE,kBAA6C,EAC1D,QAAQ,GAAE,uBAAuD;IAG7E,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,eAAe,EAAE,SAAS,MAAM,EAAE,GAAG,aAAa;IAMpF,OAAO,CAAC,cAAc;IA0BtB,OAAO,CAAC,cAAc;CAQvB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import { CSharpStructureAnalyzer } from './CSharpStructureAnalyzer.js';
|
|
3
|
+
import { ProjectFileLocator } from './ProjectFileLocator.js';
|
|
4
|
+
/**
|
|
5
|
+
* Scans the project source tree and validates every discovered `Build.cs` /
|
|
6
|
+
* `Target.cs` with {@link CSharpStructureAnalyzer}. This is a one-shot
|
|
7
|
+
* pre-flight check: the orchestrator runs it once before any injector mutates
|
|
8
|
+
* a file, so we fail fast on malformed sources.
|
|
9
|
+
*/
|
|
10
|
+
export class UnrealSourceCatalogBuilder {
|
|
11
|
+
fileLocator;
|
|
12
|
+
analyzer;
|
|
13
|
+
constructor(fileLocator = new ProjectFileLocator(), analyzer = new CSharpStructureAnalyzer()) {
|
|
14
|
+
this.fileLocator = fileLocator;
|
|
15
|
+
this.analyzer = analyzer;
|
|
16
|
+
}
|
|
17
|
+
build(projectRoot, expectedModules) {
|
|
18
|
+
const moduleFiles = this.resolveModules(projectRoot, expectedModules);
|
|
19
|
+
const targetFiles = this.resolveTargets(projectRoot);
|
|
20
|
+
return { moduleFiles, targetFiles };
|
|
21
|
+
}
|
|
22
|
+
resolveModules(projectRoot, expectedModules) {
|
|
23
|
+
const files = this.fileLocator.findBuildFiles(projectRoot);
|
|
24
|
+
const discovered = new Map();
|
|
25
|
+
for (const filePath of files) {
|
|
26
|
+
const source = fs.readFileSync(filePath, 'utf-8');
|
|
27
|
+
const parsed = this.analyzer.parseModule(filePath, source);
|
|
28
|
+
if (discovered.has(parsed.classInfo.className)) {
|
|
29
|
+
throw new Error(`Duplicate ModuleRules class '${parsed.classInfo.className}' in ${discovered.get(parsed.classInfo.className)} and ${filePath}`);
|
|
30
|
+
}
|
|
31
|
+
discovered.set(parsed.classInfo.className, filePath);
|
|
32
|
+
}
|
|
33
|
+
const missing = expectedModules.filter((name) => !discovered.has(name));
|
|
34
|
+
if (missing.length > 0) {
|
|
35
|
+
throw new Error(`Missing module Build.cs files for: ${missing.join(', ')}`);
|
|
36
|
+
}
|
|
37
|
+
const moduleFiles = new Map();
|
|
38
|
+
for (const moduleName of expectedModules) {
|
|
39
|
+
moduleFiles.set(moduleName, discovered.get(moduleName));
|
|
40
|
+
}
|
|
41
|
+
return moduleFiles;
|
|
42
|
+
}
|
|
43
|
+
resolveTargets(projectRoot) {
|
|
44
|
+
const files = this.fileLocator.findTargetFiles(projectRoot);
|
|
45
|
+
for (const filePath of files) {
|
|
46
|
+
const source = fs.readFileSync(filePath, 'utf-8');
|
|
47
|
+
this.analyzer.parseTarget(filePath, source);
|
|
48
|
+
}
|
|
49
|
+
return files;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=UnrealSourceCatalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnrealSourceCatalog.js","sourceRoot":"","sources":["../../../src/postinstall/unreal/UnrealSourceCatalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAS7D;;;;;GAKG;AACH,MAAM,OAAO,0BAA0B;IAElB;IACA;IAFnB,YACmB,cAAkC,IAAI,kBAAkB,EAAE,EAC1D,WAAoC,IAAI,uBAAuB,EAAE;QADjE,gBAAW,GAAX,WAAW,CAA+C;QAC1D,aAAQ,GAAR,QAAQ,CAAyD;IACjF,CAAC;IAEG,KAAK,CAAC,WAAmB,EAAE,eAAkC;QAClE,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;QACtE,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QACrD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC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AAW,CAAC,CAAC;QACpE,CAAC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;IAEO,cAAc,CAAC,WAAmB;QACxC,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;QAC5D,KAAK,MAAM,QAAQ,IAAI,KAAK,EAAE,CAAC;YAC7B,MAAM,MAAM,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YAClD,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC9C,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PromptService, SelectOption } from './PromptService.js';
|
|
2
|
+
export declare class InkPromptService implements PromptService {
|
|
3
|
+
private readonly isInteractive;
|
|
4
|
+
constructor(isInteractive?: boolean);
|
|
5
|
+
select(message: string, options: SelectOption[], fallbackValue: string): Promise<string>;
|
|
6
|
+
text(message: string, initialValue: string): Promise<string>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=InkPromptService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkPromptService.d.ts","sourceRoot":"","sources":["../../src/prompts/InkPromptService.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAStE,qBAAa,gBAAiB,YAAW,aAAa;IACjC,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,UAAgE;IAEpG,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAUxF,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAW1E"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, render, Text, useApp, useInput } from 'ink';
|
|
3
|
+
import SelectInput from 'ink-select-input';
|
|
4
|
+
import TextInput from 'ink-text-input';
|
|
5
|
+
import isCI from 'is-ci';
|
|
6
|
+
// biome-ignore lint/correctness/noUnusedImports: Ink requires React
|
|
7
|
+
import React, { useState } from 'react';
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
// InkPromptService — renders interactive prompts via Ink/React.
|
|
10
|
+
//
|
|
11
|
+
// Auto-detects non-interactive environments (no TTY or CI) and returns the
|
|
12
|
+
// supplied fallback without ever rendering.
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
export class InkPromptService {
|
|
15
|
+
isInteractive;
|
|
16
|
+
constructor(isInteractive = Boolean(process.stdin.isTTY && process.stdout.isTTY) && !isCI) {
|
|
17
|
+
this.isInteractive = isInteractive;
|
|
18
|
+
}
|
|
19
|
+
async select(message, options, fallbackValue) {
|
|
20
|
+
if (!this.isInteractive) {
|
|
21
|
+
return fallbackValue;
|
|
22
|
+
}
|
|
23
|
+
return await new Promise((resolve) => {
|
|
24
|
+
const app = render(_jsx(SelectPrompt, { message: message, options: options, onSubmit: (value) => resolve(value) }));
|
|
25
|
+
Promise.resolve().then(() => app.waitUntilExit());
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
async text(message, initialValue) {
|
|
29
|
+
if (!this.isInteractive) {
|
|
30
|
+
return initialValue;
|
|
31
|
+
}
|
|
32
|
+
return await new Promise((resolve) => {
|
|
33
|
+
const app = render(_jsx(TextPrompt, { message: message, initialValue: initialValue, onSubmit: (value) => resolve(value) }));
|
|
34
|
+
Promise.resolve().then(() => app.waitUntilExit());
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function SelectPrompt({ message, options, onSubmit, }) {
|
|
39
|
+
const { exit } = useApp();
|
|
40
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: message }), _jsx(SelectInput, { items: options, onSelect: (item) => {
|
|
41
|
+
onSubmit(item.value);
|
|
42
|
+
exit();
|
|
43
|
+
} })] }));
|
|
44
|
+
}
|
|
45
|
+
function TextPrompt({ message, initialValue, onSubmit, }) {
|
|
46
|
+
const [value, setValue] = useState(initialValue);
|
|
47
|
+
const { exit } = useApp();
|
|
48
|
+
useInput((_, key) => {
|
|
49
|
+
if (key.return) {
|
|
50
|
+
onSubmit(value.trim() || initialValue);
|
|
51
|
+
exit();
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: message }), _jsx(TextInput, { value: value, onChange: setValue }), _jsx(Text, { color: "gray", children: "Press Enter to confirm." })] }));
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=InkPromptService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkPromptService.js","sourceRoot":"","sources":["../../src/prompts/InkPromptService.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC1D,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,IAAI,MAAM,OAAO,CAAC;AACzB,oEAAoE;AACpE,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGxC,8EAA8E;AAC9E,gEAAgE;AAChE,EAAE;AACF,2EAA2E;AAC3E,4CAA4C;AAC5C,8EAA8E;AAE9E,MAAM,OAAO,gBAAgB;IACS;IAApC,YAAoC,gBAAgB,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI;QAA7E,kBA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