@salesforce/vite-plugin-webapp-experimental 1.78.0 → 1.79.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 +1 @@
1
- {"version":3,"file":"reactDesignTimeLocatorBabelPlugin.d.ts","sourceRoot":"","sources":["../../src/babel/reactDesignTimeLocatorBabelPlugin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,iCAAiC;;;iEAiCnB,GAAG,SAAS,GAAG;;CAmEjC,CAAC;AAEH,eAAe,iCAAiC,CAAC"}
1
+ {"version":3,"file":"reactDesignTimeLocatorBabelPlugin.d.ts","sourceRoot":"","sources":["../../src/babel/reactDesignTimeLocatorBabelPlugin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,iCAAiC;;;iEAiCnB,GAAG,SAAS,GAAG;;CAwEjC,CAAC;AAEH,eAAe,iCAAiC,CAAC"}
@@ -72,10 +72,15 @@ const reactDesignTimeLocatorBabelPlugin = declare((api) => {
72
72
  }
73
73
  if (!tagHead)
74
74
  return;
75
- // Ignore node_modules
76
75
  const filename = state?.file?.opts?.filename;
77
76
  if (!filename || filename.includes("node_modules"))
78
77
  return;
78
+ // Skip files matching excludePaths (e.g. shadcn components/ui/) so their
79
+ // internal elements don't get data-source-file. The root element still
80
+ // receives it from the usage site via props spread.
81
+ const excludePaths = state.opts?.excludePaths ?? [];
82
+ if (excludePaths.some((p) => filename.includes(p)))
83
+ return;
79
84
  // Analyze children for text metadata
80
85
  const children = path.node.children ?? [];
81
86
  const relevantChildren = children.filter((child) => {
package/dist/index.d.ts CHANGED
@@ -16,6 +16,13 @@ export interface PluginOptions {
16
16
  * - enabled when Vite `mode` is `"design"` (e.g. `vite --mode design`)
17
17
  */
18
18
  designMode?: boolean;
19
+ /**
20
+ * File path segments to exclude from design-time `data-source-file` injection.
21
+ * Files whose path contains any of these strings will be skipped entirely.
22
+ *
23
+ * @default ["/components/ui/"]
24
+ */
25
+ designModeExcludePaths?: string[];
19
26
  }
20
27
  export default function webappsPlugin(options?: PluginOptions): Plugin[];
21
28
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,MAAM,CAAC;AAWlD,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;CACrB;AAID,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,OAAO,GAAE,aAAkB,GAAG,MAAM,EAAE,CAuN3E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,MAAM,CAAC;AAWlD,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;AAID,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,OAAO,GAAE,aAAkB,GAAG,MAAM,EAAE,CA0N3E"}
package/dist/index.js CHANGED
@@ -162,6 +162,9 @@ export default function webappsPlugin(options = {}) {
162
162
  return null;
163
163
  if (filepath.includes("node_modules"))
164
164
  return null;
165
+ const excludePaths = options.designModeExcludePaths ?? ["/components/ui/"];
166
+ if (excludePaths.some((p) => filepath.includes(p)))
167
+ return null;
165
168
  const { transformAsync } = await import("@babel/core");
166
169
  const result = await transformAsync(code, {
167
170
  filename: filepath,
@@ -172,7 +175,7 @@ export default function webappsPlugin(options = {}) {
172
175
  sourceType: "module",
173
176
  plugins: isTsx ? ["jsx", "typescript"] : ["jsx"],
174
177
  },
175
- plugins: [reactDesignTimeLocatorBabelPlugin],
178
+ plugins: [[reactDesignTimeLocatorBabelPlugin, { excludePaths }]],
176
179
  });
177
180
  if (!result?.code)
178
181
  return null;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@salesforce/vite-plugin-webapp-experimental",
3
3
  "description": "[experimental] Vite plugin for Salesforce Web Applications",
4
- "version": "1.78.0",
4
+ "version": "1.79.0",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",
@@ -28,7 +28,7 @@
28
28
  "dependencies": {
29
29
  "@babel/core": "^7.28.4",
30
30
  "@babel/helper-plugin-utils": "^7.28.3",
31
- "@salesforce/webapp-experimental": "^1.78.0"
31
+ "@salesforce/webapp-experimental": "^1.79.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/babel__core": "^7.20.5",