@salesforce/vite-plugin-ui-bundle 11.37.0 → 11.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -3
- package/package.json +3 -3
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,KAAK,EAAqB,MAAM,EAAiB,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,KAAK,EAAqB,MAAM,EAAiB,MAAM,MAAM,CAAC;AAWrE,MAAM,WAAW,aAAa;IAC7B,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6BAA6B;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;OAKG;IACH,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC;CAClC;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,OAAO,GAAE,aAAkB,GAAG,MAAM,EAAE,CAwS5E"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,26 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
1
|
+
import fs, { readdirSync } from "node:fs";
|
|
2
2
|
import { loadManifest, getOrgInfo } from "@salesforce/ui-bundle/app";
|
|
3
3
|
import { createProxyHandler, injectLivePreviewScript } from "@salesforce/ui-bundle/proxy";
|
|
4
4
|
import { getRuntimeScriptContent } from "@salesforce/ui-design-mode/runtime";
|
|
5
5
|
import reactDesignTimeLocatorBabelPlugin from "@salesforce/ui-design-mode/source-locator/react";
|
|
6
|
+
import { basename } from "node:path";
|
|
6
7
|
const DEFAULT_PORT = 5173;
|
|
7
8
|
const DEFAULT_API_VERSION = "65.0";
|
|
9
|
+
const DEFAULT_NAMESPACE = "c";
|
|
10
|
+
function getAppName(rootPath) {
|
|
11
|
+
try {
|
|
12
|
+
const files = readdirSync(rootPath);
|
|
13
|
+
const metaFile = files.find((f) => f.endsWith(".uibundle-meta.xml"));
|
|
14
|
+
if (metaFile) {
|
|
15
|
+
return metaFile.replace(".uibundle-meta.xml", "");
|
|
16
|
+
}
|
|
17
|
+
} catch {
|
|
18
|
+
}
|
|
19
|
+
return basename(rootPath);
|
|
20
|
+
}
|
|
21
|
+
function getNamespace() {
|
|
22
|
+
return DEFAULT_NAMESPACE;
|
|
23
|
+
}
|
|
8
24
|
function getCodeBuilderBasePath(proxyUri, port) {
|
|
9
25
|
try {
|
|
10
26
|
const url = new URL(proxyUri.replace("{{port}}", port.toString()));
|
|
@@ -76,6 +92,10 @@ function uiBundlePlugin(options = {}) {
|
|
|
76
92
|
async configResolved(config) {
|
|
77
93
|
try {
|
|
78
94
|
const rootPath = config.root ?? process.cwd();
|
|
95
|
+
if (environment) {
|
|
96
|
+
environment.namespace = getNamespace();
|
|
97
|
+
environment.appName = getAppName(rootPath);
|
|
98
|
+
}
|
|
79
99
|
manifest = await loadManifest(`${rootPath}/ui-bundle.json`);
|
|
80
100
|
const target = getDevServerTarget(codeBuilderProxyUrl, config.server.port ?? DEFAULT_PORT);
|
|
81
101
|
proxyHandler = createProxyHandler(
|
|
@@ -150,10 +170,17 @@ function uiBundlePlugin(options = {}) {
|
|
|
150
170
|
attrs: { href: baseHref },
|
|
151
171
|
injectTo: "head-prepend"
|
|
152
172
|
});
|
|
153
|
-
const
|
|
173
|
+
const sfdcEnv = {
|
|
174
|
+
basePath: environment.basePath,
|
|
175
|
+
apiPath: environment.apiPath
|
|
176
|
+
};
|
|
177
|
+
if (environment.orgUrl) sfdcEnv.orgUrl = environment.orgUrl;
|
|
178
|
+
if (environment.namespace) sfdcEnv.namespace = environment.namespace;
|
|
179
|
+
if (environment.appName) sfdcEnv.appName = environment.appName;
|
|
180
|
+
const sfdcEnvLiteral = JSON.stringify(sfdcEnv).replace(/</g, "\\u003c");
|
|
154
181
|
tags.push({
|
|
155
182
|
tag: "script",
|
|
156
|
-
children: `(function() { globalThis.SFDC_ENV =
|
|
183
|
+
children: `(function() { globalThis.SFDC_ENV = ${sfdcEnvLiteral}; })();`,
|
|
157
184
|
injectTo: "body"
|
|
158
185
|
});
|
|
159
186
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/vite-plugin-ui-bundle",
|
|
3
3
|
"description": "Vite plugin for Salesforce UI Bundles",
|
|
4
|
-
"version": "11.
|
|
4
|
+
"version": "11.38.0",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@babel/core": "^7.29.6",
|
|
30
|
-
"@salesforce/ui-bundle": "^11.
|
|
31
|
-
"@salesforce/ui-design-mode": "11.
|
|
30
|
+
"@salesforce/ui-bundle": "^11.38.0",
|
|
31
|
+
"@salesforce/ui-design-mode": "11.38.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/babel__core": "^7.20.5",
|