@vanilla-extract/integration
Advanced tools
Comparing version 0.0.0-vite-plugin-new-20231226032342 to 0.0.0-vite-plugin-new-20231228035644
@@ -366,13 +366,3 @@ 'use strict'; | ||
// Encode windows file paths as posix | ||
const normalizedPath = normalizePath(path.posix.relative(rootPath, filePath)); | ||
// If there's already a file scope set, replace it with the current file scope | ||
if (source.includes('@vanilla-extract/css/fileScope')) { | ||
source = source.replace(/setFileScope\(((\n|.)*?)\)/, `setFileScope("${normalizedPath}", "${packageName}")`); | ||
} | ||
// If there's an adapter already set, don't add another one | ||
if (source.includes('@vanilla-extract/css/adapter')) { | ||
return source; | ||
} | ||
const normalizedPath = normalizePath(path.relative(rootPath, filePath)); | ||
const { | ||
@@ -382,5 +372,5 @@ hasESM, | ||
} = mlly.detectSyntax(source); | ||
// If the file has already been transformed, don't add another file scope | ||
if (!source.includes('@vanilla-extract/css/fileScope')) { | ||
if (source.includes('@vanilla-extract/css/fileScope')) { | ||
source = source.replace(/setFileScope\(((\n|.)*?)\)/, `setFileScope("${normalizedPath}", "${packageName}")`); | ||
} else { | ||
if (hasESM && !isMixed) { | ||
@@ -402,4 +392,2 @@ source = outdent__default["default"](_t || (_t = _` | ||
} | ||
// Add the global adapter | ||
if (globalAdapterIdentifier) { | ||
@@ -739,3 +727,3 @@ const adapterImport = hasESM && !isMixed ? 'import * as __vanilla_css_adapter__ from "@vanilla-extract/css/adapter";' : 'const __vanilla_css_adapter__ = require("@vanilla-extract/css/adapter");'; | ||
// Before evaluating a file, reset the cache for it | ||
const moduleId = fileScope.filePath; | ||
const moduleId = normalizePath(fileScope.filePath); | ||
cssByModuleId.set(moduleId, []); | ||
@@ -751,3 +739,3 @@ classRegistrationsByModuleId.set(moduleId, { | ||
// error messages shown in older versions are the ones below. | ||
const moduleId = fileScope.filePath; | ||
const moduleId = normalizePath(fileScope.filePath); | ||
const cssObjs = cssByModuleId.get(moduleId) ?? []; | ||
@@ -761,3 +749,3 @@ cssByModuleId.set(moduleId, cssObjs); | ||
localClassNames.add(className); | ||
const moduleId = fileScope.filePath; | ||
const moduleId = normalizePath(fileScope.filePath); | ||
classRegistrationsByModuleId.get(moduleId).localClassNames.add(className); | ||
@@ -770,3 +758,3 @@ }, | ||
composedClassLists.push(composedClassList); | ||
const moduleId = fileScope.filePath; | ||
const moduleId = normalizePath(fileScope.filePath); | ||
classRegistrationsByModuleId.get(moduleId).composedClassLists.push(composedClassList); | ||
@@ -778,3 +766,3 @@ }, | ||
appendCss: (css, fileScope) => { | ||
const moduleId = fileScope.filePath; | ||
const moduleId = normalizePath(fileScope.filePath); | ||
const cssObjs = cssByModuleId.get(moduleId) ?? []; | ||
@@ -793,3 +781,3 @@ cssObjs.push(css); | ||
const fileExports = await runner.executeFile(filePath); | ||
const moduleId = filePath; | ||
const moduleId = normalizePath(filePath); | ||
const moduleNode = server.moduleGraph.getModuleById(moduleId); | ||
@@ -804,3 +792,4 @@ if (!moduleNode) { | ||
} = scanModule(moduleNode, root); | ||
for (const cssDepModuleId of cssDeps) { | ||
for (const cssDep of cssDeps) { | ||
const cssDepModuleId = normalizePath(cssDep); | ||
const cssObjs = cssByModuleId.get(cssDepModuleId); | ||
@@ -853,3 +842,3 @@ const cachedCss = cssCache.get(cssDepModuleId); | ||
const rootRelativePath = path.relative(root, filePath); | ||
const moduleId = rootRelativePath; | ||
const moduleId = normalizePath(rootRelativePath); | ||
const result = cssCache.get(moduleId); | ||
@@ -856,0 +845,0 @@ if (!result) { |
@@ -366,13 +366,3 @@ 'use strict'; | ||
// Encode windows file paths as posix | ||
const normalizedPath = normalizePath(path.posix.relative(rootPath, filePath)); | ||
// If there's already a file scope set, replace it with the current file scope | ||
if (source.includes('@vanilla-extract/css/fileScope')) { | ||
source = source.replace(/setFileScope\(((\n|.)*?)\)/, `setFileScope("${normalizedPath}", "${packageName}")`); | ||
} | ||
// If there's an adapter already set, don't add another one | ||
if (source.includes('@vanilla-extract/css/adapter')) { | ||
return source; | ||
} | ||
const normalizedPath = normalizePath(path.relative(rootPath, filePath)); | ||
const { | ||
@@ -382,5 +372,5 @@ hasESM, | ||
} = mlly.detectSyntax(source); | ||
// If the file has already been transformed, don't add another file scope | ||
if (!source.includes('@vanilla-extract/css/fileScope')) { | ||
if (source.includes('@vanilla-extract/css/fileScope')) { | ||
source = source.replace(/setFileScope\(((\n|.)*?)\)/, `setFileScope("${normalizedPath}", "${packageName}")`); | ||
} else { | ||
if (hasESM && !isMixed) { | ||
@@ -402,4 +392,2 @@ source = outdent__default["default"](_t || (_t = _` | ||
} | ||
// Add the global adapter | ||
if (globalAdapterIdentifier) { | ||
@@ -739,3 +727,3 @@ const adapterImport = hasESM && !isMixed ? 'import * as __vanilla_css_adapter__ from "@vanilla-extract/css/adapter";' : 'const __vanilla_css_adapter__ = require("@vanilla-extract/css/adapter");'; | ||
// Before evaluating a file, reset the cache for it | ||
const moduleId = fileScope.filePath; | ||
const moduleId = normalizePath(fileScope.filePath); | ||
cssByModuleId.set(moduleId, []); | ||
@@ -751,3 +739,3 @@ classRegistrationsByModuleId.set(moduleId, { | ||
// error messages shown in older versions are the ones below. | ||
const moduleId = fileScope.filePath; | ||
const moduleId = normalizePath(fileScope.filePath); | ||
const cssObjs = cssByModuleId.get(moduleId) ?? []; | ||
@@ -761,3 +749,3 @@ cssByModuleId.set(moduleId, cssObjs); | ||
localClassNames.add(className); | ||
const moduleId = fileScope.filePath; | ||
const moduleId = normalizePath(fileScope.filePath); | ||
classRegistrationsByModuleId.get(moduleId).localClassNames.add(className); | ||
@@ -770,3 +758,3 @@ }, | ||
composedClassLists.push(composedClassList); | ||
const moduleId = fileScope.filePath; | ||
const moduleId = normalizePath(fileScope.filePath); | ||
classRegistrationsByModuleId.get(moduleId).composedClassLists.push(composedClassList); | ||
@@ -778,3 +766,3 @@ }, | ||
appendCss: (css, fileScope) => { | ||
const moduleId = fileScope.filePath; | ||
const moduleId = normalizePath(fileScope.filePath); | ||
const cssObjs = cssByModuleId.get(moduleId) ?? []; | ||
@@ -793,3 +781,3 @@ cssObjs.push(css); | ||
const fileExports = await runner.executeFile(filePath); | ||
const moduleId = filePath; | ||
const moduleId = normalizePath(filePath); | ||
const moduleNode = server.moduleGraph.getModuleById(moduleId); | ||
@@ -804,3 +792,4 @@ if (!moduleNode) { | ||
} = scanModule(moduleNode, root); | ||
for (const cssDepModuleId of cssDeps) { | ||
for (const cssDep of cssDeps) { | ||
const cssDepModuleId = normalizePath(cssDep); | ||
const cssObjs = cssByModuleId.get(cssDepModuleId); | ||
@@ -853,3 +842,3 @@ const cachedCss = cssCache.get(cssDepModuleId); | ||
const rootRelativePath = path.relative(root, filePath); | ||
const moduleId = rootRelativePath; | ||
const moduleId = normalizePath(rootRelativePath); | ||
const result = cssCache.get(moduleId); | ||
@@ -856,0 +845,0 @@ if (!result) { |
{ | ||
"name": "@vanilla-extract/integration", | ||
"version": "0.0.0-vite-plugin-new-20231226032342", | ||
"version": "0.0.0-vite-plugin-new-20231228035644", | ||
"description": "Zero-runtime Stylesheets-in-TypeScript", | ||
@@ -5,0 +5,0 @@ "main": "dist/vanilla-extract-integration.cjs.js", |
63038
1776