@stencil/vitest 1.11.4 → 1.11.5

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/plugin.d.ts CHANGED
@@ -33,5 +33,7 @@ import type { Plugin } from 'vitest/config';
33
33
  * @param opts Optional configuration for the plugin
34
34
  * @returns a Vite plugin configuration object
35
35
  */
36
- export declare function stencilVitestPlugin(): Plugin;
36
+ export declare function stencilVitestPlugin(opts?: {
37
+ css?: boolean;
38
+ }): Plugin;
37
39
  //# sourceMappingURL=plugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAyF5C"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,GAAE;IAAE,GAAG,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,MAAM,CA8FxE"}
package/dist/plugin.js CHANGED
@@ -35,7 +35,7 @@ import { dirname, resolve } from 'node:path';
35
35
  * @param opts Optional configuration for the plugin
36
36
  * @returns a Vite plugin configuration object
37
37
  */
38
- export function stencilVitestPlugin() {
38
+ export function stencilVitestPlugin(opts = {}) {
39
39
  return {
40
40
  name: 'stencil-vitest-transform',
41
41
  enforce: 'pre',
@@ -43,7 +43,11 @@ export function stencilVitestPlugin() {
43
43
  if (id.includes('.css') && id.includes('tag=')) {
44
44
  const [relPath] = id.split('?');
45
45
  const query = id.slice(id.indexOf('?'));
46
- const resolved = resolve(dirname(importer), relPath);
46
+ // Strip virtual prefix from importer if present
47
+ const realImporter = importer?.startsWith('\0stencil-style:')
48
+ ? importer.slice('\0stencil-style:'.length).split('?')[0] + '.css'
49
+ : importer;
50
+ const resolved = resolve(dirname(realImporter), relPath);
47
51
  // Remove .css from virtual ID to prevent Vite's CSS plugin from hijacking the output
48
52
  return '\0stencil-style:' + resolved.replace(/\.css$/, '') + query;
49
53
  }
@@ -95,9 +99,10 @@ export function stencilVitestPlugin() {
95
99
  module: 'esm',
96
100
  proxy: null,
97
101
  sourceMap: false,
98
- style: 'static',
99
- styleImportData: 'queryparams',
102
+ style: opts.css ? 'static' : null,
103
+ styleImportData: opts.css ? 'queryparams' : null,
100
104
  target: 'es2022',
105
+ // Don't rewrite import paths — let Vite handle resolution via aliases
101
106
  transformAliasedImportPaths: false,
102
107
  });
103
108
  const errors = result.diagnostics?.filter((d) => d.level === 'error') ?? [];
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/stenciljs/vitest"
6
6
  },
7
- "version": "1.11.4",
7
+ "version": "1.11.5",
8
8
  "description": "First-class testing utilities for Stencil design systems with Vitest",
9
9
  "license": "MIT",
10
10
  "type": "module",
@@ -104,7 +104,7 @@
104
104
  "dependencies": {
105
105
  "jiti": "^2.6.1",
106
106
  "local-pkg": "^1.1.2",
107
- "vitest-environment-stencil": "1.11.4"
107
+ "vitest-environment-stencil": "1.11.5"
108
108
  },
109
109
  "devDependencies": {
110
110
  "@eslint/js": "^9.39.2",