@salesforce/vite-plugin-ui-bundle 11.56.4 → 11.57.1

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.
@@ -1,12 +1,37 @@
1
1
  import { Plugin } from 'vite';
2
2
  import { DesignPluginOptions } from './design';
3
3
  import { BasePathResolver } from './env';
4
- export interface CorePluginOptions extends DesignPluginOptions {
5
- /** Salesforce org alias */
6
- orgAlias?: string;
4
+ /** Options shared by both org-backed and UI-only (disabled) modes. */
5
+ interface CorePluginSharedOptions extends DesignPluginOptions {
7
6
  /** Enable verbose logging */
8
7
  debug?: boolean;
9
8
  }
9
+ /**
10
+ * Core plugin options, modeled as a discriminated union on
11
+ * {@link CorePluginOptions.disableOrgProxy} so that org-identity inputs
12
+ * (`orgAlias`) are a **compile error** in UI-only preview mode — you cannot pass
13
+ * an org identity to a plugin that is not allowed to reach an org.
14
+ *
15
+ * - `disableOrgProxy: true` — UI-only preview kill-switch. The plugin loads no
16
+ * org credential (skips `getOrgInfo`/token/default-org resolution) and builds
17
+ * the proxy handler in **UI-only mode** (`ProxyOptions.uiOnly`, no `orgInfo`),
18
+ * so the handler itself returns an explicit `403` for its org-data routes
19
+ * instead of proxying them — org-route definitions live in one place. The API
20
+ * version falls back to {@link DEFAULT_API_VERSION}; the HTML-shell injection
21
+ * (`<base>` + `SFDC_ENV`) is unaffected. `orgAlias` is disallowed.
22
+ * - `disableOrgProxy` absent/`false` — full org-backed behavior (unchanged for
23
+ * existing consumers); `orgAlias` selects the Salesforce org.
24
+ */
25
+ export type CorePluginOptions = CorePluginSharedOptions & ({
26
+ /** UI-only preview kill-switch (see {@link CorePluginOptions}). */
27
+ disableOrgProxy: true;
28
+ /** Disallowed in UI-only mode — the plugin loads no org identity. */
29
+ orgAlias?: never;
30
+ } | {
31
+ disableOrgProxy?: false;
32
+ /** Salesforce org alias */
33
+ orgAlias?: string;
34
+ });
10
35
  /**
11
36
  * Optional hooks a specialized entry (e.g. `./site`) can inject into the shared
12
37
  * core. `resolveBasePath` runs per index.html request to fold a language into
@@ -23,4 +48,5 @@ export interface CoreHooks {
23
48
  * lives here. The only seam is {@link CoreHooks.resolveBasePath}.
24
49
  */
25
50
  export declare function createCorePlugins(options?: CorePluginOptions, hooks?: CoreHooks): Plugin[];
51
+ export {};
26
52
  //# sourceMappingURL=createCorePlugins.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createCorePlugins.d.ts","sourceRoot":"","sources":["../../src/core/createCorePlugins.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAA6B,MAAM,EAAiB,MAAM,MAAM,CAAC;AAU7E,OAAO,EAAsB,KAAK,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EAAkC,KAAK,gBAAgB,EAAoB,MAAM,OAAO,CAAC;AAEhG,MAAM,WAAW,iBAAkB,SAAQ,mBAAmB;IAC7D,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6BAA6B;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACzB,eAAe,CAAC,EAAE,gBAAgB,CAAC;CACnC;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAChC,OAAO,GAAE,iBAAsB,EAC/B,KAAK,GAAE,SAAc,GACnB,MAAM,EAAE,CAuKV"}
1
+ {"version":3,"file":"createCorePlugins.d.ts","sourceRoot":"","sources":["../../src/core/createCorePlugins.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAA6B,MAAM,EAAiB,MAAM,MAAM,CAAC;AAU7E,OAAO,EAAsB,KAAK,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EAAkC,KAAK,gBAAgB,EAAoB,MAAM,OAAO,CAAC;AAEhG,sEAAsE;AACtE,UAAU,uBAAwB,SAAQ,mBAAmB;IAC5D,6BAA6B;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,GACtD,CACG;IACA,mEAAmE;IACnE,eAAe,EAAE,IAAI,CAAC;IACtB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,KAAK,CAAC;CAChB,GACD;IACA,eAAe,CAAC,EAAE,KAAK,CAAC;IACxB,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACjB,CACH,CAAC;AAEH;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACzB,eAAe,CAAC,EAAE,gBAAgB,CAAC;CACnC;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAChC,OAAO,GAAE,iBAAsB,EAC/B,KAAK,GAAE,SAAc,GACnB,MAAM,EAAE,CAqLV"}
@@ -176,7 +176,10 @@ function buildEnvTags(html, env, originalUrl, resolveBasePath = identityResolver
176
176
  function createCorePlugins(options = {}, hooks = {}) {
177
177
  const resolveBasePath = hooks.resolveBasePath ?? identityResolver;
178
178
  const proxyOptions = {
179
- debug: options.debug ?? false
179
+ debug: options.debug ?? false,
180
+ // UI-only preview: the handler itself 403s org-data routes (built with no
181
+ // orgInfo). Org-route definitions stay centralized in the proxy handler.
182
+ uiOnly: !!options.disableOrgProxy
180
183
  };
181
184
  let orgInfo;
182
185
  let manifest;
@@ -187,15 +190,17 @@ function createCorePlugins(options = {}, hooks = {}) {
187
190
  name: "@salesforce/vite-plugin-ui-bundle:core",
188
191
  enforce: "pre",
189
192
  async config(_config, env) {
190
- let version;
191
- try {
192
- orgInfo = await getOrgInfo(options.orgAlias);
193
- version = orgInfo?.apiVersion || DEFAULT_API_VERSION;
194
- if (options.debug) {
195
- console.log(`[ui-bundle-plugin] Using Salesforce API version: ${version}`);
193
+ let version = DEFAULT_API_VERSION;
194
+ if (!options.disableOrgProxy) {
195
+ try {
196
+ orgInfo = await getOrgInfo(options.orgAlias);
197
+ version = orgInfo?.apiVersion || DEFAULT_API_VERSION;
198
+ if (options.debug) {
199
+ console.log(`[ui-bundle-plugin] Using Salesforce API version: ${version}`);
200
+ }
201
+ } catch {
202
+ version = DEFAULT_API_VERSION;
196
203
  }
197
- } catch {
198
- version = DEFAULT_API_VERSION;
199
204
  }
200
205
  codeBuilderProxyUrl = process.env.CODE_BUILDER_FRAMEWORK_PROXY_URI;
201
206
  const isCodeBuilder = !!codeBuilderProxyUrl;
package/dist/index.d.ts CHANGED
@@ -3,8 +3,8 @@ import { CorePluginOptions } from './core/createCorePlugins';
3
3
  export type { BasePathResolver, Environment } from './core/env';
4
4
  export type { CorePluginOptions, CoreHooks } from './core/createCorePlugins';
5
5
  /**
6
- * Options for the generic UI-bundle plugin: `orgAlias`, `debug`, `designMode`,
7
- * and `designModeExcludePaths`.
6
+ * Options for the generic UI-bundle plugin: `orgAlias`, `debug`, `disableOrgProxy`,
7
+ * `designMode`, and `designModeExcludePaths`.
8
8
  */
9
9
  export type PluginOptions = CorePluginOptions;
10
10
  /**
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c as createCorePlugins } from "./createCorePlugins-C2ODv7o-.js";
1
+ import { c as createCorePlugins } from "./createCorePlugins-C_Z1vwrT.js";
2
2
  function uiBundlePlugin(options = {}) {
3
3
  return createCorePlugins(options);
4
4
  }
@@ -1,4 +1,4 @@
1
- import { c as createCorePlugins } from "../createCorePlugins-C2ODv7o-.js";
1
+ import { c as createCorePlugins } from "../createCorePlugins-C_Z1vwrT.js";
2
2
  function resolveLanguageFromUrl(url, supported) {
3
3
  const [defaultLang, ...nonDefault] = supported;
4
4
  if (defaultLang === void 0) return void 0;
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.56.4",
4
+ "version": "11.57.1",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",
@@ -31,8 +31,8 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@babel/core": "^7.29.6",
34
- "@salesforce/ui-bundle": "^11.56.4",
35
- "@salesforce/ui-design-mode": "11.56.4"
34
+ "@salesforce/ui-bundle": "^11.57.1",
35
+ "@salesforce/ui-design-mode": "11.57.1"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/babel__core": "^7.20.5",