@vanilla-extract/css
Advanced tools
Comparing version 0.0.0-perf-dev-prefix-20240820052603 to 0.0.0-perf-dev-prefix-20240821010729
@@ -10,2 +10,3 @@ 'use strict'; | ||
var fileScope_dist_vanillaExtractCssFileScope = require('../fileScope/dist/vanilla-extract-css-fileScope.browser.cjs.js'); | ||
var lruCache = require('lru-cache'); | ||
var _private = require('@vanilla-extract/private'); | ||
@@ -62,13 +63,8 @@ var cssesc = require('cssesc'); | ||
var forwardSlash = '/'.charCodeAt(0); | ||
var getLastSlashBeforeIndex = (path, index) => { | ||
var pathIndex = index - 1; | ||
while (pathIndex >= 0) { | ||
var codeUnit = path.charCodeAt(pathIndex); | ||
if (codeUnit === forwardSlash) { | ||
if (path[pathIndex] === '/') { | ||
return pathIndex; | ||
} | ||
// At this point, we know we either have a regular character or a lone surrogate, which is | ||
// valid in windows file paths | ||
pathIndex--; | ||
@@ -78,2 +74,3 @@ } | ||
}; | ||
/** | ||
@@ -85,29 +82,30 @@ * Assumptions: | ||
* be a file scope to begin with | ||
* | ||
* The LRU cache we use can't cache undefined/null values, so we opt to return an empty string, | ||
* rather than using a custom Symbol or something similar. | ||
*/ | ||
var _getFileAndDirFromPath = path => { | ||
var _getDebugFileName = path => { | ||
var file; | ||
var dir; | ||
var lastIndexOfDotCss = path.lastIndexOf('.css'); | ||
if (lastIndexOfDotCss === -1) { | ||
return; | ||
return ''; | ||
} | ||
var lastSlashIndex = getLastSlashBeforeIndex(path, lastIndexOfDotCss); | ||
file = path.slice(lastSlashIndex + 1, lastIndexOfDotCss); | ||
// There are no slashes, therefore theres no directory to extract | ||
if (lastSlashIndex === -1) { | ||
return { | ||
file: path.slice(0, lastIndexOfDotCss) | ||
}; | ||
return file; | ||
} | ||
var secondLastSlashIndex = getLastSlashBeforeIndex(path, lastSlashIndex - 1); | ||
// If secondLastSlashIndex is -1, it means that the path looks like `directory/file.css.ts`, | ||
// in which case dir will still be sliced starting at 0, which is what we want | ||
dir = path.slice(secondLastSlashIndex + 1, lastSlashIndex); | ||
file = path.slice(lastSlashIndex + 1, lastIndexOfDotCss); | ||
return { | ||
dir, | ||
file | ||
}; | ||
var dir = path.slice(secondLastSlashIndex + 1, lastSlashIndex); | ||
var debugFileName = file !== 'index' ? file : dir; | ||
return debugFileName; | ||
}; | ||
var memoizedGetFileAndDirFromPath = () => { | ||
var cache = new Map(); | ||
var memoizedGetDebugFileName = () => { | ||
var cache = new lruCache.LRUCache({ | ||
max: 500 | ||
}); | ||
return path => { | ||
@@ -118,3 +116,3 @@ var cachedResult = cache.get(path); | ||
} | ||
var result = _getFileAndDirFromPath(path); | ||
var result = _getDebugFileName(path); | ||
cache.set(path, result); | ||
@@ -124,3 +122,3 @@ return result; | ||
}; | ||
var getFileAndDirFromPath = memoizedGetFileAndDirFromPath(); | ||
var getDebugFileName = memoizedGetDebugFileName(); | ||
@@ -137,10 +135,7 @@ function getDevPrefix(_ref) { | ||
} = fileScope_dist_vanillaExtractCssFileScope.getFileScope(); | ||
var fileAndDir = getFileAndDirFromPath(filePath); | ||
if (fileAndDir) { | ||
var { | ||
dir, | ||
file | ||
} = fileAndDir; | ||
var part = (file !== 'index' ? file : dir) || file; | ||
parts.unshift(part); | ||
var _debugFileName = getDebugFileName(filePath); | ||
// debugFileName could be an empty string | ||
if (_debugFileName) { | ||
parts.unshift(_debugFileName); | ||
} | ||
@@ -147,0 +142,0 @@ } |
@@ -6,2 +6,3 @@ import { injectStyles } from '../injectStyles/dist/vanilla-extract-css-injectStyles.browser.esm.js'; | ||
import { getAndIncrementRefCounter, getFileScope, hasFileScope } from '../fileScope/dist/vanilla-extract-css-fileScope.browser.esm.js'; | ||
import { LRUCache } from 'lru-cache'; | ||
import { walkObject, get } from '@vanilla-extract/private'; | ||
@@ -50,13 +51,8 @@ import cssesc from 'cssesc'; | ||
var forwardSlash = '/'.charCodeAt(0); | ||
var getLastSlashBeforeIndex = (path, index) => { | ||
var pathIndex = index - 1; | ||
while (pathIndex >= 0) { | ||
var codeUnit = path.charCodeAt(pathIndex); | ||
if (codeUnit === forwardSlash) { | ||
if (path[pathIndex] === '/') { | ||
return pathIndex; | ||
} | ||
// At this point, we know we either have a regular character or a lone surrogate, which is | ||
// valid in windows file paths | ||
pathIndex--; | ||
@@ -66,2 +62,3 @@ } | ||
}; | ||
/** | ||
@@ -73,29 +70,30 @@ * Assumptions: | ||
* be a file scope to begin with | ||
* | ||
* The LRU cache we use can't cache undefined/null values, so we opt to return an empty string, | ||
* rather than using a custom Symbol or something similar. | ||
*/ | ||
var _getFileAndDirFromPath = path => { | ||
var _getDebugFileName = path => { | ||
var file; | ||
var dir; | ||
var lastIndexOfDotCss = path.lastIndexOf('.css'); | ||
if (lastIndexOfDotCss === -1) { | ||
return; | ||
return ''; | ||
} | ||
var lastSlashIndex = getLastSlashBeforeIndex(path, lastIndexOfDotCss); | ||
file = path.slice(lastSlashIndex + 1, lastIndexOfDotCss); | ||
// There are no slashes, therefore theres no directory to extract | ||
if (lastSlashIndex === -1) { | ||
return { | ||
file: path.slice(0, lastIndexOfDotCss) | ||
}; | ||
return file; | ||
} | ||
var secondLastSlashIndex = getLastSlashBeforeIndex(path, lastSlashIndex - 1); | ||
// If secondLastSlashIndex is -1, it means that the path looks like `directory/file.css.ts`, | ||
// in which case dir will still be sliced starting at 0, which is what we want | ||
dir = path.slice(secondLastSlashIndex + 1, lastSlashIndex); | ||
file = path.slice(lastSlashIndex + 1, lastIndexOfDotCss); | ||
return { | ||
dir, | ||
file | ||
}; | ||
var dir = path.slice(secondLastSlashIndex + 1, lastSlashIndex); | ||
var debugFileName = file !== 'index' ? file : dir; | ||
return debugFileName; | ||
}; | ||
var memoizedGetFileAndDirFromPath = () => { | ||
var cache = new Map(); | ||
var memoizedGetDebugFileName = () => { | ||
var cache = new LRUCache({ | ||
max: 500 | ||
}); | ||
return path => { | ||
@@ -106,3 +104,3 @@ var cachedResult = cache.get(path); | ||
} | ||
var result = _getFileAndDirFromPath(path); | ||
var result = _getDebugFileName(path); | ||
cache.set(path, result); | ||
@@ -112,3 +110,3 @@ return result; | ||
}; | ||
var getFileAndDirFromPath = memoizedGetFileAndDirFromPath(); | ||
var getDebugFileName = memoizedGetDebugFileName(); | ||
@@ -125,10 +123,7 @@ function getDevPrefix(_ref) { | ||
} = getFileScope(); | ||
var fileAndDir = getFileAndDirFromPath(filePath); | ||
if (fileAndDir) { | ||
var { | ||
dir, | ||
file | ||
} = fileAndDir; | ||
var part = (file !== 'index' ? file : dir) || file; | ||
parts.unshift(part); | ||
var _debugFileName = getDebugFileName(filePath); | ||
// debugFileName could be an empty string | ||
if (_debugFileName) { | ||
parts.unshift(_debugFileName); | ||
} | ||
@@ -135,0 +130,0 @@ } |
@@ -10,2 +10,3 @@ 'use strict'; | ||
var fileScope_dist_vanillaExtractCssFileScope = require('../fileScope/dist/vanilla-extract-css-fileScope.cjs.dev.js'); | ||
var lruCache = require('lru-cache'); | ||
var _private = require('@vanilla-extract/private'); | ||
@@ -62,13 +63,8 @@ var cssesc = require('cssesc'); | ||
var forwardSlash = '/'.charCodeAt(0); | ||
var getLastSlashBeforeIndex = (path, index) => { | ||
var pathIndex = index - 1; | ||
while (pathIndex >= 0) { | ||
var codeUnit = path.charCodeAt(pathIndex); | ||
if (codeUnit === forwardSlash) { | ||
if (path[pathIndex] === '/') { | ||
return pathIndex; | ||
} | ||
// At this point, we know we either have a regular character or a lone surrogate, which is | ||
// valid in windows file paths | ||
pathIndex--; | ||
@@ -78,2 +74,3 @@ } | ||
}; | ||
/** | ||
@@ -85,29 +82,30 @@ * Assumptions: | ||
* be a file scope to begin with | ||
* | ||
* The LRU cache we use can't cache undefined/null values, so we opt to return an empty string, | ||
* rather than using a custom Symbol or something similar. | ||
*/ | ||
var _getFileAndDirFromPath = path => { | ||
var _getDebugFileName = path => { | ||
var file; | ||
var dir; | ||
var lastIndexOfDotCss = path.lastIndexOf('.css'); | ||
if (lastIndexOfDotCss === -1) { | ||
return; | ||
return ''; | ||
} | ||
var lastSlashIndex = getLastSlashBeforeIndex(path, lastIndexOfDotCss); | ||
file = path.slice(lastSlashIndex + 1, lastIndexOfDotCss); | ||
// There are no slashes, therefore theres no directory to extract | ||
if (lastSlashIndex === -1) { | ||
return { | ||
file: path.slice(0, lastIndexOfDotCss) | ||
}; | ||
return file; | ||
} | ||
var secondLastSlashIndex = getLastSlashBeforeIndex(path, lastSlashIndex - 1); | ||
// If secondLastSlashIndex is -1, it means that the path looks like `directory/file.css.ts`, | ||
// in which case dir will still be sliced starting at 0, which is what we want | ||
dir = path.slice(secondLastSlashIndex + 1, lastSlashIndex); | ||
file = path.slice(lastSlashIndex + 1, lastIndexOfDotCss); | ||
return { | ||
dir, | ||
file | ||
}; | ||
var dir = path.slice(secondLastSlashIndex + 1, lastSlashIndex); | ||
var debugFileName = file !== 'index' ? file : dir; | ||
return debugFileName; | ||
}; | ||
var memoizedGetFileAndDirFromPath = () => { | ||
var cache = new Map(); | ||
var memoizedGetDebugFileName = () => { | ||
var cache = new lruCache.LRUCache({ | ||
max: 500 | ||
}); | ||
return path => { | ||
@@ -118,3 +116,3 @@ var cachedResult = cache.get(path); | ||
} | ||
var result = _getFileAndDirFromPath(path); | ||
var result = _getDebugFileName(path); | ||
cache.set(path, result); | ||
@@ -124,3 +122,3 @@ return result; | ||
}; | ||
var getFileAndDirFromPath = memoizedGetFileAndDirFromPath(); | ||
var getDebugFileName = memoizedGetDebugFileName(); | ||
@@ -137,10 +135,7 @@ function getDevPrefix(_ref) { | ||
} = fileScope_dist_vanillaExtractCssFileScope.getFileScope(); | ||
var fileAndDir = getFileAndDirFromPath(filePath); | ||
if (fileAndDir) { | ||
var { | ||
dir, | ||
file | ||
} = fileAndDir; | ||
var part = (file !== 'index' ? file : dir) || file; | ||
parts.unshift(part); | ||
var _debugFileName = getDebugFileName(filePath); | ||
// debugFileName could be an empty string | ||
if (_debugFileName) { | ||
parts.unshift(_debugFileName); | ||
} | ||
@@ -147,0 +142,0 @@ } |
@@ -10,2 +10,3 @@ 'use strict'; | ||
var fileScope_dist_vanillaExtractCssFileScope = require('../fileScope/dist/vanilla-extract-css-fileScope.cjs.prod.js'); | ||
var lruCache = require('lru-cache'); | ||
var _private = require('@vanilla-extract/private'); | ||
@@ -62,13 +63,8 @@ var cssesc = require('cssesc'); | ||
var forwardSlash = '/'.charCodeAt(0); | ||
var getLastSlashBeforeIndex = (path, index) => { | ||
var pathIndex = index - 1; | ||
while (pathIndex >= 0) { | ||
var codeUnit = path.charCodeAt(pathIndex); | ||
if (codeUnit === forwardSlash) { | ||
if (path[pathIndex] === '/') { | ||
return pathIndex; | ||
} | ||
// At this point, we know we either have a regular character or a lone surrogate, which is | ||
// valid in windows file paths | ||
pathIndex--; | ||
@@ -78,2 +74,3 @@ } | ||
}; | ||
/** | ||
@@ -85,29 +82,30 @@ * Assumptions: | ||
* be a file scope to begin with | ||
* | ||
* The LRU cache we use can't cache undefined/null values, so we opt to return an empty string, | ||
* rather than using a custom Symbol or something similar. | ||
*/ | ||
var _getFileAndDirFromPath = path => { | ||
var _getDebugFileName = path => { | ||
var file; | ||
var dir; | ||
var lastIndexOfDotCss = path.lastIndexOf('.css'); | ||
if (lastIndexOfDotCss === -1) { | ||
return; | ||
return ''; | ||
} | ||
var lastSlashIndex = getLastSlashBeforeIndex(path, lastIndexOfDotCss); | ||
file = path.slice(lastSlashIndex + 1, lastIndexOfDotCss); | ||
// There are no slashes, therefore theres no directory to extract | ||
if (lastSlashIndex === -1) { | ||
return { | ||
file: path.slice(0, lastIndexOfDotCss) | ||
}; | ||
return file; | ||
} | ||
var secondLastSlashIndex = getLastSlashBeforeIndex(path, lastSlashIndex - 1); | ||
// If secondLastSlashIndex is -1, it means that the path looks like `directory/file.css.ts`, | ||
// in which case dir will still be sliced starting at 0, which is what we want | ||
dir = path.slice(secondLastSlashIndex + 1, lastSlashIndex); | ||
file = path.slice(lastSlashIndex + 1, lastIndexOfDotCss); | ||
return { | ||
dir, | ||
file | ||
}; | ||
var dir = path.slice(secondLastSlashIndex + 1, lastSlashIndex); | ||
var debugFileName = file !== 'index' ? file : dir; | ||
return debugFileName; | ||
}; | ||
var memoizedGetFileAndDirFromPath = () => { | ||
var cache = new Map(); | ||
var memoizedGetDebugFileName = () => { | ||
var cache = new lruCache.LRUCache({ | ||
max: 500 | ||
}); | ||
return path => { | ||
@@ -118,3 +116,3 @@ var cachedResult = cache.get(path); | ||
} | ||
var result = _getFileAndDirFromPath(path); | ||
var result = _getDebugFileName(path); | ||
cache.set(path, result); | ||
@@ -124,3 +122,3 @@ return result; | ||
}; | ||
var getFileAndDirFromPath = memoizedGetFileAndDirFromPath(); | ||
var getDebugFileName = memoizedGetDebugFileName(); | ||
@@ -137,10 +135,7 @@ function getDevPrefix(_ref) { | ||
} = fileScope_dist_vanillaExtractCssFileScope.getFileScope(); | ||
var fileAndDir = getFileAndDirFromPath(filePath); | ||
if (fileAndDir) { | ||
var { | ||
dir, | ||
file | ||
} = fileAndDir; | ||
var part = (file !== 'index' ? file : dir) || file; | ||
parts.unshift(part); | ||
var _debugFileName = getDebugFileName(filePath); | ||
// debugFileName could be an empty string | ||
if (_debugFileName) { | ||
parts.unshift(_debugFileName); | ||
} | ||
@@ -147,0 +142,0 @@ } |
@@ -6,2 +6,3 @@ import { injectStyles } from '../injectStyles/dist/vanilla-extract-css-injectStyles.esm.js'; | ||
import { getAndIncrementRefCounter, getFileScope, hasFileScope } from '../fileScope/dist/vanilla-extract-css-fileScope.esm.js'; | ||
import { LRUCache } from 'lru-cache'; | ||
import { walkObject, get } from '@vanilla-extract/private'; | ||
@@ -50,13 +51,8 @@ import cssesc from 'cssesc'; | ||
var forwardSlash = '/'.charCodeAt(0); | ||
var getLastSlashBeforeIndex = (path, index) => { | ||
var pathIndex = index - 1; | ||
while (pathIndex >= 0) { | ||
var codeUnit = path.charCodeAt(pathIndex); | ||
if (codeUnit === forwardSlash) { | ||
if (path[pathIndex] === '/') { | ||
return pathIndex; | ||
} | ||
// At this point, we know we either have a regular character or a lone surrogate, which is | ||
// valid in windows file paths | ||
pathIndex--; | ||
@@ -66,2 +62,3 @@ } | ||
}; | ||
/** | ||
@@ -73,29 +70,30 @@ * Assumptions: | ||
* be a file scope to begin with | ||
* | ||
* The LRU cache we use can't cache undefined/null values, so we opt to return an empty string, | ||
* rather than using a custom Symbol or something similar. | ||
*/ | ||
var _getFileAndDirFromPath = path => { | ||
var _getDebugFileName = path => { | ||
var file; | ||
var dir; | ||
var lastIndexOfDotCss = path.lastIndexOf('.css'); | ||
if (lastIndexOfDotCss === -1) { | ||
return; | ||
return ''; | ||
} | ||
var lastSlashIndex = getLastSlashBeforeIndex(path, lastIndexOfDotCss); | ||
file = path.slice(lastSlashIndex + 1, lastIndexOfDotCss); | ||
// There are no slashes, therefore theres no directory to extract | ||
if (lastSlashIndex === -1) { | ||
return { | ||
file: path.slice(0, lastIndexOfDotCss) | ||
}; | ||
return file; | ||
} | ||
var secondLastSlashIndex = getLastSlashBeforeIndex(path, lastSlashIndex - 1); | ||
// If secondLastSlashIndex is -1, it means that the path looks like `directory/file.css.ts`, | ||
// in which case dir will still be sliced starting at 0, which is what we want | ||
dir = path.slice(secondLastSlashIndex + 1, lastSlashIndex); | ||
file = path.slice(lastSlashIndex + 1, lastIndexOfDotCss); | ||
return { | ||
dir, | ||
file | ||
}; | ||
var dir = path.slice(secondLastSlashIndex + 1, lastSlashIndex); | ||
var debugFileName = file !== 'index' ? file : dir; | ||
return debugFileName; | ||
}; | ||
var memoizedGetFileAndDirFromPath = () => { | ||
var cache = new Map(); | ||
var memoizedGetDebugFileName = () => { | ||
var cache = new LRUCache({ | ||
max: 500 | ||
}); | ||
return path => { | ||
@@ -106,3 +104,3 @@ var cachedResult = cache.get(path); | ||
} | ||
var result = _getFileAndDirFromPath(path); | ||
var result = _getDebugFileName(path); | ||
cache.set(path, result); | ||
@@ -112,3 +110,3 @@ return result; | ||
}; | ||
var getFileAndDirFromPath = memoizedGetFileAndDirFromPath(); | ||
var getDebugFileName = memoizedGetDebugFileName(); | ||
@@ -125,10 +123,7 @@ function getDevPrefix(_ref) { | ||
} = getFileScope(); | ||
var fileAndDir = getFileAndDirFromPath(filePath); | ||
if (fileAndDir) { | ||
var { | ||
dir, | ||
file | ||
} = fileAndDir; | ||
var part = (file !== 'index' ? file : dir) || file; | ||
parts.unshift(part); | ||
var _debugFileName = getDebugFileName(filePath); | ||
// debugFileName could be an empty string | ||
if (_debugFileName) { | ||
parts.unshift(_debugFileName); | ||
} | ||
@@ -135,0 +130,0 @@ } |
{ | ||
"name": "@vanilla-extract/css", | ||
"version": "0.0.0-perf-dev-prefix-20240820052603", | ||
"version": "0.0.0-perf-dev-prefix-20240821010729", | ||
"description": "Zero-runtime Stylesheets-in-TypeScript", | ||
@@ -126,2 +126,3 @@ "sideEffects": true, | ||
"deepmerge": "^4.2.2", | ||
"lru-cache": "^10.4.3", | ||
"media-query-parser": "^2.0.2", | ||
@@ -128,0 +129,0 @@ "modern-ahocorasick": "^1.0.0", |
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
328595
12
8593
+ Addedlru-cache@^10.4.3
+ Addedlru-cache@10.4.3(transitive)