@stencil/vitest 1.11.5 → 1.11.6

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":"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"}
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,CAgGxE"}
package/dist/plugin.js CHANGED
@@ -43,13 +43,14 @@ export function stencilVitestPlugin(opts = {}) {
43
43
  if (id.includes('.css') && id.includes('tag=')) {
44
44
  const [relPath] = id.split('?');
45
45
  const query = id.slice(id.indexOf('?'));
46
- // Strip virtual prefix from importer if present
47
46
  const realImporter = importer?.startsWith('\0stencil-style:')
48
47
  ? importer.slice('\0stencil-style:'.length).split('?')[0] + '.css'
49
48
  : importer;
50
- const resolved = resolve(dirname(realImporter), relPath);
51
- // Remove .css from virtual ID to prevent Vite's CSS plugin from hijacking the output
52
- return '\0stencil-style:' + resolved.replace(/\.css$/, '') + query;
49
+ // Resolve bare specifiers from node_modules, otherwise resolve relative to importer
50
+ const resolved = !relPath.startsWith('.') && !relPath.startsWith('/')
51
+ ? resolve(process.cwd(), 'node_modules', relPath.replace(/^~/, ''))
52
+ : resolve(dirname(realImporter), relPath);
53
+ return '\0stencil-style:' + resolved.replace(/\.css$/, '') + (query || '');
53
54
  }
54
55
  return null;
55
56
  },
@@ -63,15 +64,13 @@ export function stencilVitestPlugin(opts = {}) {
63
64
  },
64
65
  async transform(code, id) {
65
66
  if (id.startsWith('\0stencil-style:')) {
66
- // Reconstruct the original .css path for Stencil's transpiler (it uses extension to detect file type)
67
67
  const pathWithoutPrefix = id.slice('\0stencil-style:'.length);
68
68
  const [basePath, query] = pathWithoutPrefix.split('?');
69
69
  const originalPath = basePath + '.css' + (query ? '?' + query : '');
70
- const result = await transpile(code, { file: originalPath });
71
- return {
72
- code: result.code,
73
- map: null,
74
- };
70
+ const result = await transpile(code, {
71
+ file: originalPath,
72
+ });
73
+ return { code: result.code, map: null };
75
74
  }
76
75
  // Only transform .tsx files
77
76
  if (!id.endsWith('.tsx')) {
@@ -94,14 +93,14 @@ export function stencilVitestPlugin(opts = {}) {
94
93
  // 'customelement' appends a customElements.define() call so the component
95
94
  // self-registers the moment this module is imported — no loader needed.
96
95
  componentExport: 'customelement',
97
- componentMetadata: 'compilerstatic',
96
+ componentMetadata: 'runtimestatic',
98
97
  currentDirectory: process.cwd(),
99
98
  module: 'esm',
100
99
  proxy: null,
101
100
  sourceMap: false,
102
101
  style: opts.css ? 'static' : null,
103
102
  styleImportData: opts.css ? 'queryparams' : null,
104
- target: 'es2022',
103
+ target: 'es2017',
105
104
  // Don't rewrite import paths — let Vite handle resolution via aliases
106
105
  transformAliasedImportPaths: false,
107
106
  });
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.5",
7
+ "version": "1.11.6",
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.5"
107
+ "vitest-environment-stencil": "1.11.6"
108
108
  },
109
109
  "devDependencies": {
110
110
  "@eslint/js": "^9.39.2",