@salesforce/ui-bundle-template-cli 1.117.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +82 -0
- package/README.md +1613 -0
- package/dist/commands/apply-patches.d.ts +23 -0
- package/dist/commands/apply-patches.d.ts.map +1 -0
- package/dist/commands/apply-patches.js +804 -0
- package/dist/commands/apply-patches.js.map +1 -0
- package/dist/commands/new-app-feature.d.ts +7 -0
- package/dist/commands/new-app-feature.d.ts.map +1 -0
- package/dist/commands/new-app-feature.js +215 -0
- package/dist/commands/new-app-feature.js.map +1 -0
- package/dist/commands/new-app.d.ts +6 -0
- package/dist/commands/new-app.d.ts.map +1 -0
- package/dist/commands/new-app.js +7 -0
- package/dist/commands/new-app.js.map +1 -0
- package/dist/commands/watch-patches.d.ts +4 -0
- package/dist/commands/watch-patches.d.ts.map +1 -0
- package/dist/commands/watch-patches.js +134 -0
- package/dist/commands/watch-patches.js.map +1 -0
- package/dist/core/dependency-resolver.d.ts +40 -0
- package/dist/core/dependency-resolver.d.ts.map +1 -0
- package/dist/core/dependency-resolver.js +126 -0
- package/dist/core/dependency-resolver.js.map +1 -0
- package/dist/core/file-operations.d.ts +55 -0
- package/dist/core/file-operations.d.ts.map +1 -0
- package/dist/core/file-operations.js +350 -0
- package/dist/core/file-operations.js.map +1 -0
- package/dist/core/package-json-merger.d.ts +19 -0
- package/dist/core/package-json-merger.d.ts.map +1 -0
- package/dist/core/package-json-merger.js +104 -0
- package/dist/core/package-json-merger.js.map +1 -0
- package/dist/core/patch-loader.d.ts +18 -0
- package/dist/core/patch-loader.d.ts.map +1 -0
- package/dist/core/patch-loader.js +115 -0
- package/dist/core/patch-loader.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +95 -0
- package/dist/index.js.map +1 -0
- package/dist/nx-plugin/executors/apply-patches/executor.d.ts +20 -0
- package/dist/nx-plugin/executors/apply-patches/executor.d.ts.map +1 -0
- package/dist/nx-plugin/executors/apply-patches/executor.js +77 -0
- package/dist/nx-plugin/executors/apply-patches/executor.js.map +1 -0
- package/dist/nx-plugin/executors/build-dist-app/executor.d.ts +20 -0
- package/dist/nx-plugin/executors/build-dist-app/executor.d.ts.map +1 -0
- package/dist/nx-plugin/executors/build-dist-app/executor.js +88 -0
- package/dist/nx-plugin/executors/build-dist-app/executor.js.map +1 -0
- package/dist/nx-plugin/executors/dev-server/executor.d.ts +20 -0
- package/dist/nx-plugin/executors/dev-server/executor.d.ts.map +1 -0
- package/dist/nx-plugin/executors/dev-server/executor.js +59 -0
- package/dist/nx-plugin/executors/dev-server/executor.js.map +1 -0
- package/dist/nx-plugin/executors/utils.d.ts +9 -0
- package/dist/nx-plugin/executors/utils.d.ts.map +1 -0
- package/dist/nx-plugin/executors/utils.js +25 -0
- package/dist/nx-plugin/executors/utils.js.map +1 -0
- package/dist/nx-plugin/executors/watch-patches/executor.d.ts +20 -0
- package/dist/nx-plugin/executors/watch-patches/executor.d.ts.map +1 -0
- package/dist/nx-plugin/executors/watch-patches/executor.js +71 -0
- package/dist/nx-plugin/executors/watch-patches/executor.js.map +1 -0
- package/dist/types.d.ts +28 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/debounce.d.ts +9 -0
- package/dist/utils/debounce.d.ts.map +1 -0
- package/dist/utils/debounce.js +20 -0
- package/dist/utils/debounce.js.map +1 -0
- package/dist/utils/import-merger.d.ts +17 -0
- package/dist/utils/import-merger.d.ts.map +1 -0
- package/dist/utils/import-merger.js +244 -0
- package/dist/utils/import-merger.js.map +1 -0
- package/dist/utils/logger.d.ts +7 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +23 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/path-mappings.d.ts +94 -0
- package/dist/utils/path-mappings.d.ts.map +1 -0
- package/dist/utils/path-mappings.js +139 -0
- package/dist/utils/path-mappings.js.map +1 -0
- package/dist/utils/paths.d.ts +61 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +182 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/route-merger.d.ts +107 -0
- package/dist/utils/route-merger.d.ts.map +1 -0
- package/dist/utils/route-merger.js +358 -0
- package/dist/utils/route-merger.js.map +1 -0
- package/dist/utils/validation.d.ts +35 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +137 -0
- package/dist/utils/validation.js.map +1 -0
- package/executors.json +24 -0
- package/package.json +48 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
7
|
+
import { join } from "path";
|
|
8
|
+
import * as logger from "../utils/logger";
|
|
9
|
+
import { getUIBundlePath } from "../utils/validation";
|
|
10
|
+
export class PackageJsonMergeError extends Error {
|
|
11
|
+
constructor(message) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.name = "PackageJsonMergeError";
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Build package specs array from dependencies object
|
|
18
|
+
* @param dependencies - Object mapping package names to versions
|
|
19
|
+
* @returns Array of package specs in format "package@version"
|
|
20
|
+
*/
|
|
21
|
+
export function buildPackageSpecs(dependencies) {
|
|
22
|
+
return Object.entries(dependencies)
|
|
23
|
+
.filter(([, version]) => {
|
|
24
|
+
// Filter out wildcard versions and workspace protocol (npm doesn't support workspace:)
|
|
25
|
+
return version !== "*" && !version.startsWith("workspace:");
|
|
26
|
+
})
|
|
27
|
+
.map(([name, version]) => `${name}@${version}`);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Replace workspace:* dependencies with * to avoid npm workspace protocol errors
|
|
31
|
+
* npm doesn't support workspace: protocol, so we replace it with * which we filter out
|
|
32
|
+
*/
|
|
33
|
+
function replaceWorkspaceDependencies(packageJsonPath) {
|
|
34
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
35
|
+
let modified = false;
|
|
36
|
+
// Replace workspace:* in dependencies
|
|
37
|
+
if (packageJson.dependencies) {
|
|
38
|
+
for (const [key, value] of Object.entries(packageJson.dependencies)) {
|
|
39
|
+
if (typeof value === "string" && value.startsWith("workspace:")) {
|
|
40
|
+
packageJson.dependencies[key] = "*";
|
|
41
|
+
modified = true;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// Replace workspace:* in devDependencies
|
|
46
|
+
if (packageJson.devDependencies) {
|
|
47
|
+
for (const [key, value] of Object.entries(packageJson.devDependencies)) {
|
|
48
|
+
if (typeof value === "string" && value.startsWith("workspace:")) {
|
|
49
|
+
packageJson.devDependencies[key] = "*";
|
|
50
|
+
modified = true;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (modified) {
|
|
55
|
+
writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n");
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Merge patch dependencies into package.json without running npm install.
|
|
60
|
+
* The build-dist-app executor handles the actual npm install.
|
|
61
|
+
* @param targetDir - Base directory containing uiBundles/<app-name>, or direct path to UI bundle directory if uiBundleDirPath is provided
|
|
62
|
+
* @param patchDependencies - Dependencies to merge from feature patches
|
|
63
|
+
* @param uiBundleDirPath - Optional direct path to the UI bundle directory
|
|
64
|
+
*/
|
|
65
|
+
export async function mergePackageJson(targetDir, patchDependencies, uiBundleDirPath) {
|
|
66
|
+
const uiBundleDir = uiBundleDirPath || getUIBundlePath(targetDir);
|
|
67
|
+
const packageJsonPath = join(uiBundleDir, "package.json");
|
|
68
|
+
if (!existsSync(packageJsonPath)) {
|
|
69
|
+
throw new PackageJsonMergeError(`package.json not found at '${packageJsonPath}'. Expected in UI bundle directory.`);
|
|
70
|
+
}
|
|
71
|
+
replaceWorkspaceDependencies(packageJsonPath);
|
|
72
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
73
|
+
const changes = [];
|
|
74
|
+
if (patchDependencies.dependencies) {
|
|
75
|
+
const packageSpecs = buildPackageSpecs(patchDependencies.dependencies);
|
|
76
|
+
if (packageSpecs.length > 0) {
|
|
77
|
+
logger.info(`Merging ${packageSpecs.length} dependency/dependencies into package.json...`);
|
|
78
|
+
packageSpecs.forEach((spec) => logger.info(` ${spec}`));
|
|
79
|
+
packageJson.dependencies = { ...packageJson.dependencies, ...patchDependencies.dependencies };
|
|
80
|
+
changes.push(...packageSpecs);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (patchDependencies.devDependencies) {
|
|
84
|
+
const packageSpecs = buildPackageSpecs(patchDependencies.devDependencies);
|
|
85
|
+
if (packageSpecs.length > 0) {
|
|
86
|
+
logger.info(`Merging ${packageSpecs.length} dev dependency/dependencies into package.json...`);
|
|
87
|
+
packageSpecs.forEach((spec) => logger.info(` ${spec}`));
|
|
88
|
+
packageJson.devDependencies = {
|
|
89
|
+
...packageJson.devDependencies,
|
|
90
|
+
...patchDependencies.devDependencies,
|
|
91
|
+
};
|
|
92
|
+
changes.push(...packageSpecs.map((spec) => `${spec} (dev)`));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (changes.length > 0) {
|
|
96
|
+
writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n");
|
|
97
|
+
logger.success(`Merged ${changes.length} dependency change(s) into package.json`);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
logger.info("No new dependencies to merge");
|
|
101
|
+
}
|
|
102
|
+
return changes;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=package-json-merger.js.map
|
|
@@ -0,0 +1 @@
|
|
|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,CAAC;IACF,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,aAAa,CAAC,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;QAC5E,MAAM,CAAC,OAAO,CAAC,UAAU,OAAO,CAAC,MAAM,yCAAyC,CAAC,CAAC;IACnF,CAAC;SAAM,CAAC;QACP,MAAM,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;IAC7C,CAAC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Patch, PathMappings } from "../types";
|
|
2
|
+
export declare class PatchLoadError extends Error {
|
|
3
|
+
constructor(message: string);
|
|
4
|
+
}
|
|
5
|
+
export interface PatchConfig {
|
|
6
|
+
patches: Patch[];
|
|
7
|
+
templateDir: string;
|
|
8
|
+
uiBundleName: string;
|
|
9
|
+
routeFilePath: string;
|
|
10
|
+
dependencies: string[];
|
|
11
|
+
pathMappings: PathMappings;
|
|
12
|
+
siteContainer: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Load patches from a patch's patches.ts file
|
|
16
|
+
*/
|
|
17
|
+
export declare function loadPatch(patchPath: string): Promise<PatchConfig>;
|
|
18
|
+
//# sourceMappingURL=patch-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patch-loader.d.ts","sourceRoot":"","sources":["../../src/core/patch-loader.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAEpD,qBAAa,cAAe,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAI3B;AAED,MAAM,WAAW,WAAW;IAC3B,OAAO,EAAE,KAAK,EAAE,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,OAAO,CAAC;CACvB;AAcD;;GAEG;AACH,wBAAsB,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAmGvE"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import { existsSync } from "fs";
|
|
7
|
+
import { join } from "path";
|
|
8
|
+
import { pathToFileURL } from "url";
|
|
9
|
+
export class PatchLoadError extends Error {
|
|
10
|
+
constructor(message) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = "PatchLoadError";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Extract patch name from patch path
|
|
17
|
+
* Examples:
|
|
18
|
+
* - 'packages/feature-navigation-menu' -> 'feature-navigation-menu'
|
|
19
|
+
* - '/absolute/path/to/feature-name' -> 'feature-name'
|
|
20
|
+
* - 'packages/reference-app-vibe-coding-starter' -> 'reference-app-vibe-coding-starter'
|
|
21
|
+
*/
|
|
22
|
+
function extractPatchName(patchPath) {
|
|
23
|
+
const parts = patchPath.split("/");
|
|
24
|
+
return parts[parts.length - 1];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Load patches from a patch's patches.ts file
|
|
28
|
+
*/
|
|
29
|
+
export async function loadPatch(patchPath) {
|
|
30
|
+
const patchesFilePath = join(patchPath, "patches.ts");
|
|
31
|
+
if (!existsSync(patchesFilePath)) {
|
|
32
|
+
throw new PatchLoadError(`No patches.ts found in patch path '${patchPath}'`);
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
// Convert to file URL for dynamic import
|
|
36
|
+
const patchPathUrl = pathToFileURL(patchesFilePath).href;
|
|
37
|
+
const module = await import(patchPathUrl);
|
|
38
|
+
// Require default export
|
|
39
|
+
if (!module.default) {
|
|
40
|
+
throw new PatchLoadError(`patches.ts must have a default export (array or object) in ${patchesFilePath}`);
|
|
41
|
+
}
|
|
42
|
+
// Helper to check if a value looks like a patch object
|
|
43
|
+
// Checks if value is a plain object (not array, not null) that matches Patch structure
|
|
44
|
+
// Accepts any value from dynamic import (module.default is typed as any) and narrows to Patch type
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- module.default from dynamic import is typed as any
|
|
46
|
+
const isPatchLike = (value) => {
|
|
47
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
48
|
+
};
|
|
49
|
+
let patches;
|
|
50
|
+
if (Array.isArray(module.default)) {
|
|
51
|
+
patches = module.default;
|
|
52
|
+
}
|
|
53
|
+
else if (isPatchLike(module.default)) {
|
|
54
|
+
patches = [module.default];
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
throw new PatchLoadError(`Default export must be a Patch object or Patch[] array in ${patchesFilePath}`);
|
|
58
|
+
}
|
|
59
|
+
// Extract patch name from path for constructing defaults
|
|
60
|
+
const patchName = extractPatchName(patchPath);
|
|
61
|
+
// Extract configuration from patches (with defaults)
|
|
62
|
+
// Default to SFDX structure: src/force-app/main/default/uiBundles/{name}
|
|
63
|
+
let templateDir = "src";
|
|
64
|
+
let uiBundleName = patchName; // Default to patch name
|
|
65
|
+
let routeFilePath;
|
|
66
|
+
let dependencies = [];
|
|
67
|
+
let pathMappings = {}; // Default: enabled with no custom mappings
|
|
68
|
+
let siteContainer = false;
|
|
69
|
+
// Check if any patch specifies custom configuration
|
|
70
|
+
for (const patch of patches) {
|
|
71
|
+
if (patch.templateDir) {
|
|
72
|
+
templateDir = patch.templateDir;
|
|
73
|
+
}
|
|
74
|
+
if (patch.uiBundleName) {
|
|
75
|
+
uiBundleName = patch.uiBundleName;
|
|
76
|
+
}
|
|
77
|
+
if (patch.routeFilePath) {
|
|
78
|
+
routeFilePath = patch.routeFilePath;
|
|
79
|
+
}
|
|
80
|
+
if (patch.dependencies) {
|
|
81
|
+
// Merge dependencies from all patches
|
|
82
|
+
dependencies = [...new Set([...dependencies, ...patch.dependencies])];
|
|
83
|
+
}
|
|
84
|
+
if (patch.pathMappings) {
|
|
85
|
+
// If any patch specifies pathMappings, use it
|
|
86
|
+
// Last one wins if multiple patches specify it
|
|
87
|
+
pathMappings = patch.pathMappings;
|
|
88
|
+
}
|
|
89
|
+
if (patch.siteContainer) {
|
|
90
|
+
siteContainer = true;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// Set default routeFilePath if not explicitly provided
|
|
94
|
+
// Default to SFDX structure path
|
|
95
|
+
if (!routeFilePath) {
|
|
96
|
+
routeFilePath = `force-app/main/default/uiBundles/${uiBundleName}/src/routes.tsx`;
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
patches,
|
|
100
|
+
templateDir,
|
|
101
|
+
uiBundleName,
|
|
102
|
+
routeFilePath,
|
|
103
|
+
dependencies,
|
|
104
|
+
pathMappings,
|
|
105
|
+
siteContainer,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
catch (err) {
|
|
109
|
+
if (err instanceof PatchLoadError) {
|
|
110
|
+
throw err;
|
|
111
|
+
}
|
|
112
|
+
throw new PatchLoadError(`Failed to load patch from ${patchesFilePath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=patch-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patch-loader.js","sourceRoot":"","sources":["../../src/core/patch-loader.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,aAAa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,8CAA8C;gBAC9C,+CAA+C;gBAC/C,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;YACnC,CAAC;YACD,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC;gBACzB,aAAa,GAAG,IAAI,CAAC;YACtB,CAAC;QACF,CAAC;QAED,uDAAuD;QACvD,iCAAiC;QACjC,IAAI,CAAC,aAAa,EAAE,CAAC;YACpB,aAAa,GAAG,oCAAoC,YAAY,iBAAiB,CAAC;QACnF,CAAC;QAED,OAAO;YACN,OAAO;YACP,WAAW;YACX,YAAY;YACZ,aAAa;YACb,YAAY;YACZ,YAAY;YACZ,aAAa;SACb,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACd,IAAI,GAAG,YAAY,cAAc,EAAE,CAAC;YACnC,MAAM,GAAG,CAAC;QACX,CAAC;QACD,MAAM,IAAI,cAAc,CACvB,6BAA6B,eAAe,KAAK,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CACnG,CAAC;IACH,CAAC;AACF,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* For full license text, see the LICENSE.txt file
|
|
6
|
+
*/
|
|
7
|
+
import { readFileSync } from "fs";
|
|
8
|
+
import { join, dirname } from "path";
|
|
9
|
+
import { fileURLToPath } from "url";
|
|
10
|
+
import { Command } from "commander";
|
|
11
|
+
import { applyPatchesCommand } from "./commands/apply-patches";
|
|
12
|
+
import { newAppOrFeatureCommand } from "./commands/new-app-feature";
|
|
13
|
+
// Get package.json for version info
|
|
14
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
15
|
+
const packageJsonPath = join(__dirname, "../package.json");
|
|
16
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
17
|
+
const program = new Command();
|
|
18
|
+
program
|
|
19
|
+
.name("apply-patches")
|
|
20
|
+
.description("CLI tool for applying feature patches to base apps")
|
|
21
|
+
.version(packageJson.version);
|
|
22
|
+
program
|
|
23
|
+
.command("apply-patches")
|
|
24
|
+
.description("Apply feature patches to an app")
|
|
25
|
+
.argument("<feature-path>", "Path to the feature (e.g., packages/template/feature/feature-navigation-menu)")
|
|
26
|
+
.argument("<app-path>", "Path to the app (e.g., packages/template/base-app/base-react-app or my-app)")
|
|
27
|
+
.argument("<target-dir>", "Target directory to copy app to before applying patches")
|
|
28
|
+
.option("--skip-dependency-changes", "Skip installing dependencies from package.json")
|
|
29
|
+
.option("--reset", "Reset target directory to base app state before applying patches (preserves node_modules)")
|
|
30
|
+
.action(async (featurePath, appPath, targetDir, options) => {
|
|
31
|
+
try {
|
|
32
|
+
await applyPatchesCommand(featurePath, appPath, {
|
|
33
|
+
targetDirName: targetDir,
|
|
34
|
+
skipDependencyChanges: options.skipDependencyChanges,
|
|
35
|
+
reset: options.reset,
|
|
36
|
+
});
|
|
37
|
+
process.exit(0);
|
|
38
|
+
}
|
|
39
|
+
catch (_err) {
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
program
|
|
44
|
+
.command("watch-patches")
|
|
45
|
+
.description("Watch feature template directory and auto-apply patches on changes")
|
|
46
|
+
.argument("<feature-path>", "Path to the feature (e.g., packages/template/feature/feature-navigation-menu)")
|
|
47
|
+
.argument("<app-path>", "Path to the app (e.g., packages/template/base-app/base-react-app or my-app)")
|
|
48
|
+
.argument("<target-dir>", "Target directory to apply patches to")
|
|
49
|
+
.action(async (featurePath, appPath, targetDir) => {
|
|
50
|
+
try {
|
|
51
|
+
// Dynamic import to avoid loading turbowatch when not needed
|
|
52
|
+
const { watchPatchesCommand } = await import("./commands/watch-patches");
|
|
53
|
+
await watchPatchesCommand(featurePath, appPath, targetDir);
|
|
54
|
+
}
|
|
55
|
+
catch (_err) {
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
program
|
|
60
|
+
.command("new-feature")
|
|
61
|
+
.description("Create a new feature package from the base-feature template")
|
|
62
|
+
.argument("<feature-name>", 'Name of the feature (will be prefixed with "feature-")')
|
|
63
|
+
.action(async (featureName) => {
|
|
64
|
+
try {
|
|
65
|
+
await newAppOrFeatureCommand(featureName, "feature");
|
|
66
|
+
process.exit(0);
|
|
67
|
+
}
|
|
68
|
+
catch (_err) {
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
program
|
|
73
|
+
.command("new-app")
|
|
74
|
+
.description("Create a new reference app package from the base-reference-app template")
|
|
75
|
+
.argument("<app-name>", 'Name of the app (will be prefixed with "app-")')
|
|
76
|
+
.action(async (appName) => {
|
|
77
|
+
try {
|
|
78
|
+
await newAppOrFeatureCommand(appName, "app");
|
|
79
|
+
process.exit(0);
|
|
80
|
+
}
|
|
81
|
+
catch (_err) {
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
// If no command specified, default to apply-patches
|
|
86
|
+
if (process.argv.length > 2 && !process.argv[2].startsWith("-")) {
|
|
87
|
+
// If first argument is not a recognized command, treat as apply-patches command
|
|
88
|
+
const args = process.argv.slice(2);
|
|
89
|
+
const knownCommands = ["apply-patches", "watch-patches", "new-feature", "new-app"];
|
|
90
|
+
if (!knownCommands.includes(args[0]) && !args[0].startsWith("-")) {
|
|
91
|
+
process.argv.splice(2, 0, "apply-patches");
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
program.parse(process.argv);
|
|
95
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@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,20 @@
|
|
|
1
|
+
import { type ExecutorContext } from "@nx/devkit";
|
|
2
|
+
import type { ApplyPatchesExecutorOptions } from "./schema";
|
|
3
|
+
/**
|
|
4
|
+
* Result of the executor
|
|
5
|
+
*/
|
|
6
|
+
export interface ApplyPatchesExecutorResult {
|
|
7
|
+
success: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Nx executor for applying template patches
|
|
11
|
+
*
|
|
12
|
+
* This executor wraps the apply-patches CLI command and automatically determines paths
|
|
13
|
+
* based on the Nx project configuration.
|
|
14
|
+
*
|
|
15
|
+
* @param options - Executor options
|
|
16
|
+
* @param context - Nx executor context
|
|
17
|
+
* @returns Executor result with success status
|
|
18
|
+
*/
|
|
19
|
+
export default function runExecutor(options: ApplyPatchesExecutorOptions, context: ExecutorContext): Promise<ApplyPatchesExecutorResult>;
|
|
20
|
+
//# sourceMappingURL=executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../../src/nx-plugin/executors/apply-patches/executor.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,eAAe,EAAU,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAG5D;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C,OAAO,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;GASG;AACH,wBAA8B,WAAW,CACxC,OAAO,EAAE,2BAA2B,EACpC,OAAO,EAAE,eAAe,GACtB,OAAO,CAAC,0BAA0B,CAAC,CAmErC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import { execSync } from "child_process";
|
|
7
|
+
import { join } from "path";
|
|
8
|
+
import { logger } from "@nx/devkit";
|
|
9
|
+
import { createProjectPaths } from "../utils";
|
|
10
|
+
/**
|
|
11
|
+
* Nx executor for applying template patches
|
|
12
|
+
*
|
|
13
|
+
* This executor wraps the apply-patches CLI command and automatically determines paths
|
|
14
|
+
* based on the Nx project configuration.
|
|
15
|
+
*
|
|
16
|
+
* @param options - Executor options
|
|
17
|
+
* @param context - Nx executor context
|
|
18
|
+
* @returns Executor result with success status
|
|
19
|
+
*/
|
|
20
|
+
export default async function runExecutor(options, context) {
|
|
21
|
+
try {
|
|
22
|
+
const projectPaths = createProjectPaths(context);
|
|
23
|
+
if (!projectPaths) {
|
|
24
|
+
return { success: false };
|
|
25
|
+
}
|
|
26
|
+
// Get workspace root (absolute path)
|
|
27
|
+
const workspaceRoot = context.root;
|
|
28
|
+
// Build paths for CLI command
|
|
29
|
+
const featurePath = projectPaths.root;
|
|
30
|
+
const baseAppPath = options.baseAppPath || "packages/template/base-app/base-react-app";
|
|
31
|
+
const outputPath = projectPaths.dist;
|
|
32
|
+
logger.info(`Applying patches for ${context.projectName}...`);
|
|
33
|
+
logger.info(` Feature path: ${featurePath}`);
|
|
34
|
+
logger.info(` Base app: ${baseAppPath}`);
|
|
35
|
+
logger.info(` Output: ${outputPath}`);
|
|
36
|
+
// Execute the CLI command via npx tsx (compiled dist has ESM resolution issues with Node)
|
|
37
|
+
const cliPath = "packages/template/patches-cli/src/index.ts";
|
|
38
|
+
// Build command with arguments
|
|
39
|
+
let command = `npx tsx ${cliPath} apply-patches ${featurePath} ${baseAppPath} ${outputPath}`;
|
|
40
|
+
// Add flags
|
|
41
|
+
if (options.reset !== false) {
|
|
42
|
+
command += " --reset";
|
|
43
|
+
}
|
|
44
|
+
if (options.skipDependencyChanges) {
|
|
45
|
+
command += " --skip-dependency-changes";
|
|
46
|
+
}
|
|
47
|
+
logger.info(` Executing: ${command}`);
|
|
48
|
+
execSync(command, {
|
|
49
|
+
cwd: workspaceRoot,
|
|
50
|
+
stdio: "inherit",
|
|
51
|
+
env: process.env,
|
|
52
|
+
});
|
|
53
|
+
// Type-check the generated dist app
|
|
54
|
+
const uiBundleAbsPath = join(workspaceRoot, projectPaths.uiBundle);
|
|
55
|
+
const execOptions = {
|
|
56
|
+
cwd: uiBundleAbsPath,
|
|
57
|
+
stdio: "inherit",
|
|
58
|
+
env: process.env,
|
|
59
|
+
};
|
|
60
|
+
logger.info("Running type check on generated dist app...");
|
|
61
|
+
execSync("npx tsc --noEmit", execOptions);
|
|
62
|
+
// Clean up node_modules to prevent it from being cached
|
|
63
|
+
const nodeModulesPath = join(projectPaths.uiBundle, "node_modules");
|
|
64
|
+
logger.info(`\n\nRemoving ${nodeModulesPath} to exclude from Nx cache...`);
|
|
65
|
+
execSync(`rm -rf "${nodeModulesPath}"`, {
|
|
66
|
+
cwd: workspaceRoot,
|
|
67
|
+
stdio: "inherit",
|
|
68
|
+
});
|
|
69
|
+
return { success: true };
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
73
|
+
logger.error(`Failed to apply patches: ${errorMessage}`);
|
|
74
|
+
return { success: false };
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../src/nx-plugin/executors/apply-patches/executor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,QAAQ,EAAwB,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAwB,MAAM,EAAE,MAAM,YAAY,CAAC;AAE1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAS9C;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,WAAW,CACxC,OAAoC,EACpC,OAAwB;IAExB,IAAI,CAAC;QACJ,MAAM,YAA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I,CAAC,aAAa,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;QACnE,MAAM,WAAW,GAAoB;YACpC,GAAG,EAAE,eAAe;YACpB,KAAK,EAAE,SAAS;YAChB,GAAG,EAAE,OAAO,CAAC,GAAG;SAChB,CAAC;QAEF,MAAM,CAAC,IAAI,CAAC,6CAA6C,CAAC,CAAC;QAC3D,QAAQ,CAAC,kBAAkB,EAAE,WAAW,CAAC,CAAC;QAE1C,wDAAwD;QACxD,MAAM,eAAe,GAAG,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;QACpE,MAAM,CAAC,IAAI,CAAC,gBAAgB,eAAe,8BAA8B,CAAC,CAAC;QAC3E,QAAQ,CAAC,WAAW,eAAe,GAAG,EAAE;YACvC,GAAG,EAAE,aAAa;YAClB,KAAK,EAAE,SAAS;SAChB,CAAC,CAAC;QAEH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC1B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5E,MAAM,CAAC,KAAK,CAAC,4BAA4B,YAAY,EAAE,CAAC,CAAC;QACzD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC3B,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ExecutorContext } from "@nx/devkit";
|
|
2
|
+
import type { BuildDistAppExecutorOptions } from "./schema";
|
|
3
|
+
/**
|
|
4
|
+
* Result of the executor
|
|
5
|
+
*/
|
|
6
|
+
export interface BuildDistAppExecutorResult {
|
|
7
|
+
success: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Nx executor for building the application in the dist folder
|
|
11
|
+
*
|
|
12
|
+
* This executor navigates to the project's dist folder and runs npm install (no lockfile),
|
|
13
|
+
* installs internal @salesforce packages from workspace via file:, then npm run build.
|
|
14
|
+
*
|
|
15
|
+
* @param options - Executor options
|
|
16
|
+
* @param context - Nx executor context
|
|
17
|
+
* @returns Executor result with success status
|
|
18
|
+
*/
|
|
19
|
+
export default function runExecutor(options: BuildDistAppExecutorOptions, context: ExecutorContext): Promise<BuildDistAppExecutorResult>;
|
|
20
|
+
//# sourceMappingURL=executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../../src/nx-plugin/executors/build-dist-app/executor.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,eAAe,EAAU,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAiB5D;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C,OAAO,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;GASG;AACH,wBAA8B,WAAW,CACxC,OAAO,EAAE,2BAA2B,EACpC,OAAO,EAAE,eAAe,GACtB,OAAO,CAAC,0BAA0B,CAAC,CA4DrC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import { execSync } from "child_process";
|
|
7
|
+
import { existsSync, readFileSync } from "fs";
|
|
8
|
+
import { join } from "path";
|
|
9
|
+
import { logger } from "@nx/devkit";
|
|
10
|
+
import { createProjectPaths } from "../utils";
|
|
11
|
+
const NO_PACKAGE_LOCK = "--package-lock=false";
|
|
12
|
+
/** Workspace-relative paths for internal @salesforce packages to install from file (not template/app/feature packages). */
|
|
13
|
+
const INTERNAL_PACKAGE_PATHS = [
|
|
14
|
+
"packages/sdk/sdk-core",
|
|
15
|
+
"packages/sdk/sdk-data",
|
|
16
|
+
"packages/sdk/sdk-chat",
|
|
17
|
+
"packages/sdk/sdk-lightning",
|
|
18
|
+
"packages/sdk/sdk-view",
|
|
19
|
+
"packages/ui-bundle",
|
|
20
|
+
"packages/vite-plugin-ui-bundle",
|
|
21
|
+
"packages/agentforceConversationClient",
|
|
22
|
+
];
|
|
23
|
+
/**
|
|
24
|
+
* Nx executor for building the application in the dist folder
|
|
25
|
+
*
|
|
26
|
+
* This executor navigates to the project's dist folder and runs npm install (no lockfile),
|
|
27
|
+
* installs internal @salesforce packages from workspace via file:, then npm run build.
|
|
28
|
+
*
|
|
29
|
+
* @param options - Executor options
|
|
30
|
+
* @param context - Nx executor context
|
|
31
|
+
* @returns Executor result with success status
|
|
32
|
+
*/
|
|
33
|
+
export default async function runExecutor(options, context) {
|
|
34
|
+
try {
|
|
35
|
+
const projectPaths = createProjectPaths(context);
|
|
36
|
+
if (!projectPaths) {
|
|
37
|
+
return { success: false };
|
|
38
|
+
}
|
|
39
|
+
// Build absolute path to the UI Bundle
|
|
40
|
+
const targetPath = join(context.root, projectPaths.uiBundle);
|
|
41
|
+
logger.info(`Building application in ${targetPath}...`);
|
|
42
|
+
const execOptions = { cwd: targetPath, stdio: "inherit", env: process.env };
|
|
43
|
+
// Collect all valid internal @salesforce packages to install from workspace
|
|
44
|
+
const fileInstalls = [];
|
|
45
|
+
for (const relPath of INTERNAL_PACKAGE_PATHS) {
|
|
46
|
+
const pkgPath = join(context.root, relPath);
|
|
47
|
+
const pkgJsonPath = join(pkgPath, "package.json");
|
|
48
|
+
if (!existsSync(pkgJsonPath))
|
|
49
|
+
continue;
|
|
50
|
+
const distPath = join(pkgPath, "dist");
|
|
51
|
+
if (!existsSync(distPath))
|
|
52
|
+
continue;
|
|
53
|
+
let name;
|
|
54
|
+
try {
|
|
55
|
+
name = JSON.parse(readFileSync(pkgJsonPath, "utf8")).name;
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
if (!name || !name.startsWith("@salesforce/"))
|
|
61
|
+
continue;
|
|
62
|
+
fileInstalls.push(`${name}@file:${pkgPath}`);
|
|
63
|
+
}
|
|
64
|
+
// Single npm install: package.json deps + local @salesforce packages (no lockfile for publish-safe dist)
|
|
65
|
+
const installArgs = [NO_PACKAGE_LOCK, ...fileInstalls].filter(Boolean);
|
|
66
|
+
logger.info(fileInstalls.length > 0
|
|
67
|
+
? `Running npm install with ${fileInstalls.length} local @salesforce packages...`
|
|
68
|
+
: "Running npm install (no package lock)...");
|
|
69
|
+
execSync(`npm install ${installArgs.join(" ")}`, execOptions);
|
|
70
|
+
// Lint the dist app before building to catch issues early
|
|
71
|
+
logger.info("Running lint on dist app...");
|
|
72
|
+
execSync("npm run lint", execOptions);
|
|
73
|
+
// Execute npm run build
|
|
74
|
+
logger.info("Running npm run build...");
|
|
75
|
+
execSync("npm run build", execOptions);
|
|
76
|
+
// Type-check the dist app after build
|
|
77
|
+
logger.info("Running type check on dist app...");
|
|
78
|
+
execSync("npx tsc --noEmit", execOptions);
|
|
79
|
+
logger.info("Build completed successfully");
|
|
80
|
+
return { success: true };
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
84
|
+
logger.error(`Failed to build dist app: ${errorMessage}`);
|
|
85
|
+
return { success: false };
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../src/nx-plugin/executors/build-dist-app/executor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,QAAQ,EAAwB,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAwB,MAAM,EAAE,MAAM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AAK,EAAE,CAAC;QAChB,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5E,MAAM,CAAC,KAAK,CAAC,6BAA6B,YAAY,EAAE,CAAC,CAAC;QAC1D,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC3B,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ExecutorContext } from "@nx/devkit";
|
|
2
|
+
import type { DevServerExecutorOptions } from "./schema";
|
|
3
|
+
/**
|
|
4
|
+
* Result of the executor
|
|
5
|
+
*/
|
|
6
|
+
export interface DevServerExecutorResult {
|
|
7
|
+
success: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Nx executor for starting the dev server
|
|
11
|
+
*
|
|
12
|
+
* This executor starts a Vite dev server for the UI Bundle.
|
|
13
|
+
* It runs npm install first, then starts the dev server asynchronously.
|
|
14
|
+
*
|
|
15
|
+
* @param options - Executor options
|
|
16
|
+
* @param context - Nx executor context
|
|
17
|
+
* @returns Async generator yielding executor results
|
|
18
|
+
*/
|
|
19
|
+
export default function runExecutor(options: DevServerExecutorOptions, context: ExecutorContext): AsyncGenerator<DevServerExecutorResult>;
|
|
20
|
+
//# sourceMappingURL=executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../../src/nx-plugin/executors/dev-server/executor.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,eAAe,EAAU,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAGzD;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACvC,OAAO,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;GASG;AACH,wBAA+B,WAAW,CACzC,OAAO,EAAE,wBAAwB,EACjC,OAAO,EAAE,eAAe,GACtB,cAAc,CAAC,uBAAuB,CAAC,CA0CzC"}
|