@salesforce/angular-plugin-ui-bundle 12.5.1 → 12.5.3
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/bin/serve.js +15 -1
- package/dist/utils.d.ts +5 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +22 -0
- package/package.json +3 -3
package/dist/bin/serve.js
CHANGED
|
@@ -28,7 +28,7 @@ import { createRequire } from "node:module";
|
|
|
28
28
|
import { join } from "node:path";
|
|
29
29
|
import { pathToFileURL } from "node:url";
|
|
30
30
|
import { createApiVersionPlugin } from "../plugins/api-version.js";
|
|
31
|
-
import { getPort } from "../utils.js";
|
|
31
|
+
import { getAllowedHostsForCodeBuilder, getCodeBuilderBasePath, getPort } from "../utils.js";
|
|
32
32
|
const require = createRequire(import.meta.url);
|
|
33
33
|
// `--design` is a wrapper-only flag: consumed here, never passed to ng.
|
|
34
34
|
const designMode = process.argv.includes("--design");
|
|
@@ -58,6 +58,20 @@ catch {
|
|
|
58
58
|
process.exit(1);
|
|
59
59
|
}
|
|
60
60
|
const ngArgs = ["serve", `--define=${defineArg}`, `--port=${port}`];
|
|
61
|
+
// Code Builder: allowlist the proxy hostname so Vite accepts forwarded requests.
|
|
62
|
+
// Angular CLI exposes --allowed-hosts as [boolean] only, so passing a domain
|
|
63
|
+
// string fails. We use Vite's documented env var instead.
|
|
64
|
+
const codeBuilderProxyUrl = process.env.CODE_BUILDER_FRAMEWORK_PROXY_URI;
|
|
65
|
+
if (codeBuilderProxyUrl) {
|
|
66
|
+
const hosts = getAllowedHostsForCodeBuilder(codeBuilderProxyUrl);
|
|
67
|
+
if (hosts.length > 0) {
|
|
68
|
+
// Vite reads this env var at server startup and appends it to allowedHosts.
|
|
69
|
+
process.env.__VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS = hosts[0];
|
|
70
|
+
}
|
|
71
|
+
// Set Vite's `base` so assets are served under the Code Builder proxy prefix
|
|
72
|
+
const basePath = getCodeBuilderBasePath(codeBuilderProxyUrl, port);
|
|
73
|
+
ngArgs.push(`--serve-path=${basePath}`);
|
|
74
|
+
}
|
|
61
75
|
// Default mode: spawn ng in a child process (isolation + signal forwarding).
|
|
62
76
|
function spawnNgServe() {
|
|
63
77
|
const child = spawn(process.execPath, [ngPath, ...ngArgs], {
|
package/dist/utils.d.ts
CHANGED
|
@@ -7,6 +7,11 @@ export declare const DEFAULT_API_VERSION = "65.0";
|
|
|
7
7
|
export declare const DEFAULT_PORT = 5173;
|
|
8
8
|
export declare const DEFAULT_NAMESPACE = "c";
|
|
9
9
|
export declare function getPort(): number;
|
|
10
|
+
/**
|
|
11
|
+
* Extract allowed hostnames from a Code Builder proxy URL template.
|
|
12
|
+
* Returns the Code Builder domain suffix (dot-prefixed to match all subdomains).
|
|
13
|
+
*/
|
|
14
|
+
export declare function getAllowedHostsForCodeBuilder(proxyUrl: string | undefined): string[];
|
|
10
15
|
/** Extract path from Code Builder proxy URI. Same logic as vite-plugin-ui-bundle. */
|
|
11
16
|
export declare function getCodeBuilderBasePath(proxyUri: string, port: number): string;
|
|
12
17
|
/**
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,eAAO,MAAM,mBAAmB,SAAS,CAAC;AAE1C,eAAO,MAAM,YAAY,OAAO,CAAC;AAEjC,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC,wBAAgB,OAAO,IAAI,MAAM,CAEhC;AAED,qFAAqF;AACrF,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAQ7E;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAYnD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE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;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAEhE"}
|
package/dist/utils.js
CHANGED
|
@@ -11,6 +11,28 @@ export const DEFAULT_NAMESPACE = "c";
|
|
|
11
11
|
export function getPort() {
|
|
12
12
|
return parseInt(process.env.SF_UIBUNDLE_PORT || DEFAULT_PORT.toString(), 10);
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Extract allowed hostnames from a Code Builder proxy URL template.
|
|
16
|
+
* Returns the Code Builder domain suffix (dot-prefixed to match all subdomains).
|
|
17
|
+
*/
|
|
18
|
+
export function getAllowedHostsForCodeBuilder(proxyUrl) {
|
|
19
|
+
const hosts = [];
|
|
20
|
+
if (proxyUrl) {
|
|
21
|
+
try {
|
|
22
|
+
const url = new URL(proxyUrl.replace("{{port}}", "0"));
|
|
23
|
+
const hostname = url.hostname;
|
|
24
|
+
const firstDot = hostname.indexOf(".");
|
|
25
|
+
if (firstDot > 0) {
|
|
26
|
+
// e.g. ".pdx.002.sf.code-builder-stg.platform.salesforce.com"
|
|
27
|
+
hosts.push(hostname.substring(firstDot));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
// If URL parsing fails, don't add extra hosts
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return hosts;
|
|
35
|
+
}
|
|
14
36
|
/** Extract path from Code Builder proxy URI. Same logic as vite-plugin-ui-bundle. */
|
|
15
37
|
export function getCodeBuilderBasePath(proxyUri, port) {
|
|
16
38
|
try {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/angular-plugin-ui-bundle",
|
|
3
3
|
"description": "Angular CLI plugin for Salesforce UI Bundles",
|
|
4
|
-
"version": "12.5.
|
|
4
|
+
"version": "12.5.3",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"test:coverage": "vitest run --coverage"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@salesforce/ui-bundle": "^12.5.
|
|
33
|
-
"@salesforce/ui-design-mode": "^12.5.
|
|
32
|
+
"@salesforce/ui-bundle": "^12.5.3",
|
|
33
|
+
"@salesforce/ui-design-mode": "^12.5.3",
|
|
34
34
|
"chokidar": "^4.0.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|