@salesforce/ui-bundle 12.17.0 → 12.18.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.
@@ -1,4 +1,4 @@
1
- const version = "12.17.0";
1
+ const version = "12.18.0";
2
2
  export {
3
3
  version
4
4
  };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+ export type { SingleFilePluginsOptions } from './single-file';
7
+ export { singleFilePlugins } from './single-file';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vite/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { singleFilePlugins } from "./single-file.js";
2
+ export {
3
+ singleFilePlugins
4
+ };
@@ -0,0 +1,16 @@
1
+ import { Plugin } from 'vite';
2
+ export interface SingleFilePluginsOptions {
3
+ /** Calling plugin package, used in error messages and the warning plugin name. */
4
+ owner: string;
5
+ /** The option that enabled single-file output, used in error messages. */
6
+ option: string;
7
+ }
8
+ /**
9
+ * The plugins for single-file output: the `public/` warning and singlefile, the
10
+ * latter scoped to `vite build` so its config hook (`base: "./"`) never touches
11
+ * the dev server. Required here rather than imported at the top because it's an
12
+ * optional peer. `T` lets the caller
13
+ * type the result with its own vite's `Plugin`, which may be a different copy.
14
+ */
15
+ export declare function singleFilePlugins<T = Plugin>({ owner, option }: SingleFilePluginsOptions): T[];
16
+ //# sourceMappingURL=single-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"single-file.d.ts","sourceRoot":"","sources":["../../src/vite/single-file.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAmCnC,MAAM,WAAW,wBAAwB;IACxC,kFAAkF;IAClF,KAAK,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,MAAM,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,GAAG,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,wBAAwB,GAAG,CAAC,EAAE,CAmB9F"}
@@ -0,0 +1,44 @@
1
+ import { existsSync, readdirSync, statSync } from "node:fs";
2
+ import { createRequire } from "node:module";
3
+ import path from "node:path";
4
+ const PACKAGE = "vite-plugin-singlefile";
5
+ function listFiles(dir) {
6
+ return readdirSync(dir, { recursive: true, encoding: "utf8" }).filter((file) => statSync(path.join(dir, file)).isFile()).map((file) => file.split(path.sep).join("/")).sort();
7
+ }
8
+ function warnPublicFiles(owner) {
9
+ let publicDir = "";
10
+ return {
11
+ name: `${owner}:single-file-public-warning`,
12
+ apply: "build",
13
+ configResolved(config) {
14
+ publicDir = config.build.copyPublicDir ? config.publicDir : "";
15
+ },
16
+ generateBundle() {
17
+ if (!publicDir || !existsSync(publicDir)) return;
18
+ const files = listFiles(publicDir);
19
+ if (files.length === 0) return;
20
+ this.warn(
21
+ `[singleFile] public/ files are copied as separate files, not inlined: ${files.join(", ")} — import them from src/ to inline them`
22
+ );
23
+ }
24
+ };
25
+ }
26
+ function singleFilePlugins({ owner, option }) {
27
+ let plugin;
28
+ try {
29
+ const { viteSingleFile } = createRequire(import.meta.url)(PACKAGE);
30
+ plugin = viteSingleFile();
31
+ } catch (error) {
32
+ throw new Error(
33
+ `${owner}: \`${option}\` requires \`${PACKAGE}\` (and vite >= 5.4.21), but it failed to load. Install it: npm install -D ${PACKAGE}`,
34
+ { cause: error }
35
+ );
36
+ }
37
+ if (!plugin || typeof plugin !== "object" || Array.isArray(plugin) || "then" in plugin) {
38
+ throw new Error(`${owner}: unsupported ${PACKAGE} version (expected a single plugin object).`);
39
+ }
40
+ return [warnPublicFiles(owner), { ...plugin, apply: "build" }];
41
+ }
42
+ export {
43
+ singleFilePlugins
44
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@salesforce/ui-bundle",
3
3
  "description": "Core package for Salesforce UI Bundles",
4
- "version": "12.17.0",
4
+ "version": "12.18.0",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",
@@ -24,6 +24,10 @@
24
24
  "types": "./dist/proxy/index.d.ts",
25
25
  "import": "./dist/proxy/index.js"
26
26
  },
27
+ "./vite": {
28
+ "types": "./dist/vite/index.d.ts",
29
+ "import": "./dist/vite/index.js"
30
+ },
27
31
  "./package.json": "./package.json"
28
32
  },
29
33
  "files": [
@@ -39,15 +43,28 @@
39
43
  },
40
44
  "dependencies": {
41
45
  "@salesforce/core": "^8.23.4",
42
- "@salesforce/platform-sdk": "^12.17.0",
46
+ "@salesforce/platform-sdk": "^12.18.0",
43
47
  "micromatch": "^4.0.8",
44
48
  "path-to-regexp": "^8.4.2"
45
49
  },
50
+ "peerDependencies": {
51
+ "vite": "^5.4.21 || ^6.0.0 || ^7.0.0 || ^8.0.0",
52
+ "vite-plugin-singlefile": "^2.3.4"
53
+ },
54
+ "peerDependenciesMeta": {
55
+ "vite": {
56
+ "optional": true
57
+ },
58
+ "vite-plugin-singlefile": {
59
+ "optional": true
60
+ }
61
+ },
46
62
  "devDependencies": {
47
63
  "@types/micromatch": "^4.0.10",
48
64
  "esbuild": "^0.28.1",
49
65
  "vite": "^7.3.5",
50
66
  "vite-plugin-dts": "^4.5.4",
67
+ "vite-plugin-singlefile": "^2.3.4",
51
68
  "vitest": "^4.1.11"
52
69
  },
53
70
  "engines": {