@vanilla-extract/integration
Advanced tools
Comparing version 0.0.0-create-compiler-api-20232803013 to 0.0.0-create-compiler-api-2023282247
@@ -98,2 +98,2 @@ import { Adapter, FileScope } from '@vanilla-extract/css'; | ||
export { CompileOptions, CreateCompilerOptions, IdentifierOption, PackageInfo, addFileScope, compile, createCompiler, cssFileFilter, deserializeCss, getPackageInfo, getSourceFromVirtualCssFile, hash, parseFileScope, processVanillaFile, serializeCss, stringifyFileScope, transform, transformSync, vanillaExtractTransformPlugin, virtualCssFileFilter }; | ||
export { CompileOptions, Compiler, CreateCompilerOptions, IdentifierOption, PackageInfo, addFileScope, compile, createCompiler, cssFileFilter, deserializeCss, getPackageInfo, getSourceFromVirtualCssFile, hash, parseFileScope, processVanillaFile, serializeCss, stringifyFileScope, transform, transformSync, vanillaExtractTransformPlugin, virtualCssFileFilter }; |
@@ -300,3 +300,3 @@ 'use strict'; | ||
// .css.ts files but it's added anyway so we need to allow for it in the file match | ||
const cssFileFilter = /\.css\.(js|mjs|jsx|ts|tsx)(\?used)?$/; | ||
const cssFileFilter = /\.css\.(js|cjs|mjs|jsx|ts|tsx)(\?used)?$/; | ||
const virtualCssFileFilter = /\.vanilla\.css\?source=.*$/; | ||
@@ -501,7 +501,7 @@ | ||
const scanModule = (entryModule, root) => { | ||
let queue = [entryModule]; | ||
let cssDeps = new Set(); | ||
let watchFiles = new Set(); | ||
for (let moduleNode of queue) { | ||
let relativePath = moduleNode.id && path.relative(root, moduleNode.id); | ||
const queue = [entryModule]; | ||
const cssDeps = new Set(); | ||
const watchFiles = new Set(); | ||
for (const moduleNode of queue) { | ||
const relativePath = moduleNode.id && path.relative(root, moduleNode.id); | ||
if (relativePath) { | ||
@@ -513,3 +513,3 @@ cssDeps.add(relativePath); | ||
} | ||
for (let importedModule of moduleNode.importedModules) { | ||
for (const importedModule of moduleNode.importedModules) { | ||
queue.push(importedModule); | ||
@@ -520,3 +520,3 @@ } | ||
// This ensures the root module's styles are last in terms of CSS ordering | ||
let [head, ...tail] = cssDeps; | ||
const [head, ...tail] = cssDeps; | ||
return { | ||
@@ -532,7 +532,7 @@ cssDeps: [...tail, head], | ||
}) => { | ||
let pkg = getPackageInfo(root); | ||
let { | ||
const pkg = getPackageInfo(root); | ||
const { | ||
createServer | ||
} = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('vite')); }); | ||
let server = await createServer({ | ||
const server = await createServer({ | ||
root, | ||
@@ -554,3 +554,3 @@ server: { | ||
if (source.startsWith('@vanilla-extract/')) { | ||
let result = await this.resolve(source, importer, { | ||
const result = await this.resolve(source, importer, { | ||
skipSelf: true | ||
@@ -568,3 +568,3 @@ }); | ||
if (cssFileFilter.test(id)) { | ||
let filescopedCode = await transform({ | ||
const filescopedCode = await transform({ | ||
source: code, | ||
@@ -585,10 +585,10 @@ rootPath: root, | ||
await server.pluginContainer.buildStart({}); | ||
let { | ||
const { | ||
ViteNodeRunner | ||
} = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('vite-node/client')); }); | ||
let { | ||
const { | ||
ViteNodeServer | ||
} = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('vite-node/server')); }); | ||
let node = new ViteNodeServer(server); | ||
let runner = new ViteNodeRunner({ | ||
const node = new ViteNodeServer(server); | ||
const runner = new ViteNodeRunner({ | ||
root, | ||
@@ -618,3 +618,3 @@ base: server.config.base, | ||
let originalPrepareContext; | ||
let vitePromise = createViteServer({ | ||
const vitePromise = createViteServer({ | ||
root, | ||
@@ -634,4 +634,4 @@ identifiers, | ||
}); | ||
let cssCache = new Map(); | ||
let processVanillaFileCache = new Map(); | ||
const cssCache = new Map(); | ||
const processVanillaFileCache = new Map(); | ||
const classRegistrationsByFileScope = new Map(); | ||
@@ -641,3 +641,3 @@ return { | ||
var _options$outputCss; | ||
let { | ||
const { | ||
server, | ||
@@ -652,5 +652,5 @@ runner | ||
}).map(entry => entry.join('=')).join('|'); | ||
let cachedFile = processVanillaFileCache.get(cacheKey); | ||
const cachedFile = processVanillaFileCache.get(cacheKey); | ||
if (cachedFile) { | ||
let moduleNode = server.moduleGraph.getModuleById(filePath); | ||
const moduleNode = server.moduleGraph.getModuleById(filePath); | ||
if (cachedFile.lastInvalidationTimestamp === (moduleNode === null || moduleNode === void 0 ? void 0 : moduleNode.lastInvalidationTimestamp)) { | ||
@@ -660,6 +660,6 @@ return cachedFile.result; | ||
} | ||
let cssByFileScope = new Map(); | ||
let localClassNames = new Set(); | ||
let composedClassLists = []; | ||
let cssAdapter = { | ||
const cssByFileScope = new Map(); | ||
const localClassNames = new Set(); | ||
const composedClassLists = []; | ||
const cssAdapter = { | ||
getIdentOption: () => identifiers, | ||
@@ -674,4 +674,16 @@ onBeginFileScope: fileScope => { | ||
}, | ||
onEndFileScope: () => {}, | ||
onEndFileScope: ({ | ||
filePath | ||
}) => { | ||
var _cssByFileScope$get; | ||
// For backwards compatibility, ensure the cache is populated even if | ||
// a file didn't contain any CSS. This is to ensure that the only | ||
// error messages shown in older versions are the ones below. | ||
const cssObjs = (_cssByFileScope$get = cssByFileScope.get(filePath)) !== null && _cssByFileScope$get !== void 0 ? _cssByFileScope$get : []; | ||
cssByFileScope.set(filePath, cssObjs); | ||
}, | ||
registerClassName: (className, fileScope) => { | ||
if (!fileScope) { | ||
throw new Error('Your version of @vanilla-extract/css must be at least v1.10.0. Please update to a compatible version.'); | ||
} | ||
localClassNames.add(className); | ||
@@ -681,2 +693,5 @@ classRegistrationsByFileScope.get(fileScope.filePath).localClassNames.add(className); | ||
registerComposition: (composedClassList, fileScope) => { | ||
if (!fileScope) { | ||
throw new Error('Your version of @vanilla-extract/css must be at least v1.10.0. Please update to a compatible version.'); | ||
} | ||
composedClassLists.push(composedClassList); | ||
@@ -689,4 +704,4 @@ classRegistrationsByFileScope.get(fileScope.filePath).composedClassLists.push(composedClassList); | ||
appendCss: (css, fileScope) => { | ||
var _cssByFileScope$get; | ||
let fileScopeCss = (_cssByFileScope$get = cssByFileScope.get(fileScope.filePath)) !== null && _cssByFileScope$get !== void 0 ? _cssByFileScope$get : []; | ||
var _cssByFileScope$get2; | ||
const fileScopeCss = (_cssByFileScope$get2 = cssByFileScope.get(fileScope.filePath)) !== null && _cssByFileScope$get2 !== void 0 ? _cssByFileScope$get2 : []; | ||
fileScopeCss.push(css); | ||
@@ -696,3 +711,3 @@ cssByFileScope.set(fileScope.filePath, fileScopeCss); | ||
}; | ||
let { | ||
const { | ||
fileExports, | ||
@@ -710,16 +725,16 @@ cssImports, | ||
}; | ||
let fileExports = await runner.executeFile(filePath); | ||
let moduleNode = server.moduleGraph.getModuleById(filePath); | ||
const fileExports = await runner.executeFile(filePath); | ||
const moduleNode = server.moduleGraph.getModuleById(filePath); | ||
if (!moduleNode) { | ||
throw new Error(`Can't find ModuleNode for ${filePath}`); | ||
} | ||
let cssImports = []; | ||
let { | ||
const cssImports = []; | ||
const { | ||
cssDeps, | ||
watchFiles | ||
} = scanModule(moduleNode, root); | ||
for (let cssDepModuleId of cssDeps) { | ||
let cssObjs = cssByFileScope.get(cssDepModuleId); | ||
let cachedCss = cssCache.get(cssDepModuleId); | ||
let cachedClassRegistrations = classRegistrationsByFileScope.get(cssDepModuleId); | ||
for (const cssDepModuleId of cssDeps) { | ||
const cssObjs = cssByFileScope.get(cssDepModuleId); | ||
const cachedCss = cssCache.get(cssDepModuleId); | ||
const cachedClassRegistrations = classRegistrationsByFileScope.get(cssDepModuleId); | ||
if (!cssObjs && !cachedCss && !cachedClassRegistrations) { | ||
@@ -729,3 +744,3 @@ continue; | ||
if (cssObjs) { | ||
let css = transformCss.transformCss({ | ||
const css = transformCss.transformCss({ | ||
localClassNames: Array.from(localClassNames), | ||
@@ -755,3 +770,3 @@ composedClassLists, | ||
}); | ||
let result = { | ||
const result = { | ||
source: serializeVanillaModule(cssImports, fileExports, null // This compiler currently retains all composition classes | ||
@@ -770,4 +785,4 @@ ), | ||
filePath = path.isAbsolute(filePath) ? filePath : path.join(root, filePath); | ||
let rootRelativePath = path.relative(root, filePath); | ||
let result = cssCache.get(rootRelativePath); | ||
const rootRelativePath = path.relative(root, filePath); | ||
const result = cssCache.get(rootRelativePath); | ||
if (!result) { | ||
@@ -783,3 +798,3 @@ throw new Error(`No CSS for file: ${filePath}`); | ||
async close() { | ||
let { | ||
const { | ||
server | ||
@@ -786,0 +801,0 @@ } = await vitePromise; |
@@ -300,3 +300,3 @@ 'use strict'; | ||
// .css.ts files but it's added anyway so we need to allow for it in the file match | ||
const cssFileFilter = /\.css\.(js|mjs|jsx|ts|tsx)(\?used)?$/; | ||
const cssFileFilter = /\.css\.(js|cjs|mjs|jsx|ts|tsx)(\?used)?$/; | ||
const virtualCssFileFilter = /\.vanilla\.css\?source=.*$/; | ||
@@ -501,7 +501,7 @@ | ||
const scanModule = (entryModule, root) => { | ||
let queue = [entryModule]; | ||
let cssDeps = new Set(); | ||
let watchFiles = new Set(); | ||
for (let moduleNode of queue) { | ||
let relativePath = moduleNode.id && path.relative(root, moduleNode.id); | ||
const queue = [entryModule]; | ||
const cssDeps = new Set(); | ||
const watchFiles = new Set(); | ||
for (const moduleNode of queue) { | ||
const relativePath = moduleNode.id && path.relative(root, moduleNode.id); | ||
if (relativePath) { | ||
@@ -513,3 +513,3 @@ cssDeps.add(relativePath); | ||
} | ||
for (let importedModule of moduleNode.importedModules) { | ||
for (const importedModule of moduleNode.importedModules) { | ||
queue.push(importedModule); | ||
@@ -520,3 +520,3 @@ } | ||
// This ensures the root module's styles are last in terms of CSS ordering | ||
let [head, ...tail] = cssDeps; | ||
const [head, ...tail] = cssDeps; | ||
return { | ||
@@ -532,7 +532,7 @@ cssDeps: [...tail, head], | ||
}) => { | ||
let pkg = getPackageInfo(root); | ||
let { | ||
const pkg = getPackageInfo(root); | ||
const { | ||
createServer | ||
} = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('vite')); }); | ||
let server = await createServer({ | ||
const server = await createServer({ | ||
root, | ||
@@ -554,3 +554,3 @@ server: { | ||
if (source.startsWith('@vanilla-extract/')) { | ||
let result = await this.resolve(source, importer, { | ||
const result = await this.resolve(source, importer, { | ||
skipSelf: true | ||
@@ -568,3 +568,3 @@ }); | ||
if (cssFileFilter.test(id)) { | ||
let filescopedCode = await transform({ | ||
const filescopedCode = await transform({ | ||
source: code, | ||
@@ -585,10 +585,10 @@ rootPath: root, | ||
await server.pluginContainer.buildStart({}); | ||
let { | ||
const { | ||
ViteNodeRunner | ||
} = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('vite-node/client')); }); | ||
let { | ||
const { | ||
ViteNodeServer | ||
} = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('vite-node/server')); }); | ||
let node = new ViteNodeServer(server); | ||
let runner = new ViteNodeRunner({ | ||
const node = new ViteNodeServer(server); | ||
const runner = new ViteNodeRunner({ | ||
root, | ||
@@ -618,3 +618,3 @@ base: server.config.base, | ||
let originalPrepareContext; | ||
let vitePromise = createViteServer({ | ||
const vitePromise = createViteServer({ | ||
root, | ||
@@ -634,4 +634,4 @@ identifiers, | ||
}); | ||
let cssCache = new Map(); | ||
let processVanillaFileCache = new Map(); | ||
const cssCache = new Map(); | ||
const processVanillaFileCache = new Map(); | ||
const classRegistrationsByFileScope = new Map(); | ||
@@ -641,3 +641,3 @@ return { | ||
var _options$outputCss; | ||
let { | ||
const { | ||
server, | ||
@@ -652,5 +652,5 @@ runner | ||
}).map(entry => entry.join('=')).join('|'); | ||
let cachedFile = processVanillaFileCache.get(cacheKey); | ||
const cachedFile = processVanillaFileCache.get(cacheKey); | ||
if (cachedFile) { | ||
let moduleNode = server.moduleGraph.getModuleById(filePath); | ||
const moduleNode = server.moduleGraph.getModuleById(filePath); | ||
if (cachedFile.lastInvalidationTimestamp === (moduleNode === null || moduleNode === void 0 ? void 0 : moduleNode.lastInvalidationTimestamp)) { | ||
@@ -660,6 +660,6 @@ return cachedFile.result; | ||
} | ||
let cssByFileScope = new Map(); | ||
let localClassNames = new Set(); | ||
let composedClassLists = []; | ||
let cssAdapter = { | ||
const cssByFileScope = new Map(); | ||
const localClassNames = new Set(); | ||
const composedClassLists = []; | ||
const cssAdapter = { | ||
getIdentOption: () => identifiers, | ||
@@ -674,4 +674,16 @@ onBeginFileScope: fileScope => { | ||
}, | ||
onEndFileScope: () => {}, | ||
onEndFileScope: ({ | ||
filePath | ||
}) => { | ||
var _cssByFileScope$get; | ||
// For backwards compatibility, ensure the cache is populated even if | ||
// a file didn't contain any CSS. This is to ensure that the only | ||
// error messages shown in older versions are the ones below. | ||
const cssObjs = (_cssByFileScope$get = cssByFileScope.get(filePath)) !== null && _cssByFileScope$get !== void 0 ? _cssByFileScope$get : []; | ||
cssByFileScope.set(filePath, cssObjs); | ||
}, | ||
registerClassName: (className, fileScope) => { | ||
if (!fileScope) { | ||
throw new Error('Your version of @vanilla-extract/css must be at least v1.10.0. Please update to a compatible version.'); | ||
} | ||
localClassNames.add(className); | ||
@@ -681,2 +693,5 @@ classRegistrationsByFileScope.get(fileScope.filePath).localClassNames.add(className); | ||
registerComposition: (composedClassList, fileScope) => { | ||
if (!fileScope) { | ||
throw new Error('Your version of @vanilla-extract/css must be at least v1.10.0. Please update to a compatible version.'); | ||
} | ||
composedClassLists.push(composedClassList); | ||
@@ -689,4 +704,4 @@ classRegistrationsByFileScope.get(fileScope.filePath).composedClassLists.push(composedClassList); | ||
appendCss: (css, fileScope) => { | ||
var _cssByFileScope$get; | ||
let fileScopeCss = (_cssByFileScope$get = cssByFileScope.get(fileScope.filePath)) !== null && _cssByFileScope$get !== void 0 ? _cssByFileScope$get : []; | ||
var _cssByFileScope$get2; | ||
const fileScopeCss = (_cssByFileScope$get2 = cssByFileScope.get(fileScope.filePath)) !== null && _cssByFileScope$get2 !== void 0 ? _cssByFileScope$get2 : []; | ||
fileScopeCss.push(css); | ||
@@ -696,3 +711,3 @@ cssByFileScope.set(fileScope.filePath, fileScopeCss); | ||
}; | ||
let { | ||
const { | ||
fileExports, | ||
@@ -710,16 +725,16 @@ cssImports, | ||
}; | ||
let fileExports = await runner.executeFile(filePath); | ||
let moduleNode = server.moduleGraph.getModuleById(filePath); | ||
const fileExports = await runner.executeFile(filePath); | ||
const moduleNode = server.moduleGraph.getModuleById(filePath); | ||
if (!moduleNode) { | ||
throw new Error(`Can't find ModuleNode for ${filePath}`); | ||
} | ||
let cssImports = []; | ||
let { | ||
const cssImports = []; | ||
const { | ||
cssDeps, | ||
watchFiles | ||
} = scanModule(moduleNode, root); | ||
for (let cssDepModuleId of cssDeps) { | ||
let cssObjs = cssByFileScope.get(cssDepModuleId); | ||
let cachedCss = cssCache.get(cssDepModuleId); | ||
let cachedClassRegistrations = classRegistrationsByFileScope.get(cssDepModuleId); | ||
for (const cssDepModuleId of cssDeps) { | ||
const cssObjs = cssByFileScope.get(cssDepModuleId); | ||
const cachedCss = cssCache.get(cssDepModuleId); | ||
const cachedClassRegistrations = classRegistrationsByFileScope.get(cssDepModuleId); | ||
if (!cssObjs && !cachedCss && !cachedClassRegistrations) { | ||
@@ -729,3 +744,3 @@ continue; | ||
if (cssObjs) { | ||
let css = transformCss.transformCss({ | ||
const css = transformCss.transformCss({ | ||
localClassNames: Array.from(localClassNames), | ||
@@ -755,3 +770,3 @@ composedClassLists, | ||
}); | ||
let result = { | ||
const result = { | ||
source: serializeVanillaModule(cssImports, fileExports, null // This compiler currently retains all composition classes | ||
@@ -770,4 +785,4 @@ ), | ||
filePath = path.isAbsolute(filePath) ? filePath : path.join(root, filePath); | ||
let rootRelativePath = path.relative(root, filePath); | ||
let result = cssCache.get(rootRelativePath); | ||
const rootRelativePath = path.relative(root, filePath); | ||
const result = cssCache.get(rootRelativePath); | ||
if (!result) { | ||
@@ -783,3 +798,3 @@ throw new Error(`No CSS for file: ${filePath}`); | ||
async close() { | ||
let { | ||
const { | ||
server | ||
@@ -786,0 +801,0 @@ } = await vitePromise; |
{ | ||
"name": "@vanilla-extract/integration", | ||
"version": "0.0.0-create-compiler-api-20232803013", | ||
"version": "0.0.0-create-compiler-api-2023282247", | ||
"description": "Zero-runtime Stylesheets-in-TypeScript", | ||
@@ -20,3 +20,3 @@ "main": "dist/vanilla-extract-integration.cjs.js", | ||
"@vanilla-extract/babel-plugin-debug-ids": "^1.0.2", | ||
"@vanilla-extract/css": "^0.0.0-create-compiler-api-20232803013", | ||
"@vanilla-extract/css": "^0.0.0-create-compiler-api-2023282247", | ||
"esbuild": "0.17.6", | ||
@@ -23,0 +23,0 @@ "eval": "0.1.6", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61157
1645