@vanilla-extract/css
Advanced tools
Comparing version 0.0.0-perf-dev-prefix-20240820044103 to 0.0.0-perf-dev-prefix-20240820052603
@@ -62,4 +62,4 @@ 'use strict'; | ||
var forwardSlash = '/'.charCodeAt(0); | ||
var getLastSlashBeforeIndex = (path, startingIndex) => { | ||
var pathIndex = startingIndex; | ||
var getLastSlashBeforeIndex = (path, index) => { | ||
var pathIndex = index - 1; | ||
while (pathIndex >= 0) { | ||
@@ -71,18 +71,2 @@ var codeUnit = path.charCodeAt(pathIndex); | ||
// UTF-16 surrogate pair handling | ||
// Check if codeUnit is a low surrogate | ||
if (codeUnit >= 0xdc00 && codeUnit <= 0xdfff) { | ||
// Ensure there's a previous character | ||
if (pathIndex > 0) { | ||
var maybeHighSurrogate = path.charCodeAt(pathIndex - 1); | ||
// Check if the previous code unit is a high surrogate | ||
if (maybeHighSurrogate >= 0xd800 && maybeHighSurrogate <= 0xdbff) { | ||
// Move past the high surrogate and continue | ||
pathIndex -= 2; | ||
continue; | ||
} | ||
} | ||
} | ||
// At this point, we know we either have a regular character or a lone surrogate, which is | ||
@@ -96,7 +80,7 @@ // valid in windows file paths | ||
* Assumptions: | ||
* - The path is always normalized to use posix file separators (see `addFileScope`) | ||
* - The path is always relative to the project root (see `addFileScope`) | ||
* - There's no need to validate the file extension as we know that we only run this function if the | ||
* path was inside a VE file | ||
* */ | ||
* - The path is always normalized to use posix file separators (/) (see `addFileScope`) | ||
* - The path is always relative to the project root, i.e. there will never be a leading slash (see `addFileScope`) | ||
* - As long as `.css` is there, we have a valid `.css.*` file path, because otherwise there wouldn't | ||
* be a file scope to begin with | ||
*/ | ||
var _getFileAndDirFromPath = path => { | ||
@@ -109,4 +93,3 @@ var file; | ||
} | ||
var i = lastIndexOfDotCss - 1; | ||
var lastSlashIndex = getLastSlashBeforeIndex(path, i); | ||
var lastSlashIndex = getLastSlashBeforeIndex(path, lastIndexOfDotCss); | ||
if (lastSlashIndex === -1) { | ||
@@ -118,5 +101,5 @@ return { | ||
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); | ||
@@ -132,4 +115,5 @@ file = path.slice(lastSlashIndex + 1, lastIndexOfDotCss); | ||
return path => { | ||
if (cache.has(path)) { | ||
return cache.get(path); | ||
var cachedResult = cache.get(path); | ||
if (cachedResult) { | ||
return cachedResult; | ||
} | ||
@@ -136,0 +120,0 @@ var result = _getFileAndDirFromPath(path); |
@@ -50,4 +50,4 @@ import { injectStyles } from '../injectStyles/dist/vanilla-extract-css-injectStyles.browser.esm.js'; | ||
var forwardSlash = '/'.charCodeAt(0); | ||
var getLastSlashBeforeIndex = (path, startingIndex) => { | ||
var pathIndex = startingIndex; | ||
var getLastSlashBeforeIndex = (path, index) => { | ||
var pathIndex = index - 1; | ||
while (pathIndex >= 0) { | ||
@@ -59,18 +59,2 @@ var codeUnit = path.charCodeAt(pathIndex); | ||
// UTF-16 surrogate pair handling | ||
// Check if codeUnit is a low surrogate | ||
if (codeUnit >= 0xdc00 && codeUnit <= 0xdfff) { | ||
// Ensure there's a previous character | ||
if (pathIndex > 0) { | ||
var maybeHighSurrogate = path.charCodeAt(pathIndex - 1); | ||
// Check if the previous code unit is a high surrogate | ||
if (maybeHighSurrogate >= 0xd800 && maybeHighSurrogate <= 0xdbff) { | ||
// Move past the high surrogate and continue | ||
pathIndex -= 2; | ||
continue; | ||
} | ||
} | ||
} | ||
// At this point, we know we either have a regular character or a lone surrogate, which is | ||
@@ -84,7 +68,7 @@ // valid in windows file paths | ||
* Assumptions: | ||
* - The path is always normalized to use posix file separators (see `addFileScope`) | ||
* - The path is always relative to the project root (see `addFileScope`) | ||
* - There's no need to validate the file extension as we know that we only run this function if the | ||
* path was inside a VE file | ||
* */ | ||
* - The path is always normalized to use posix file separators (/) (see `addFileScope`) | ||
* - The path is always relative to the project root, i.e. there will never be a leading slash (see `addFileScope`) | ||
* - As long as `.css` is there, we have a valid `.css.*` file path, because otherwise there wouldn't | ||
* be a file scope to begin with | ||
*/ | ||
var _getFileAndDirFromPath = path => { | ||
@@ -97,4 +81,3 @@ var file; | ||
} | ||
var i = lastIndexOfDotCss - 1; | ||
var lastSlashIndex = getLastSlashBeforeIndex(path, i); | ||
var lastSlashIndex = getLastSlashBeforeIndex(path, lastIndexOfDotCss); | ||
if (lastSlashIndex === -1) { | ||
@@ -106,5 +89,5 @@ return { | ||
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); | ||
@@ -120,4 +103,5 @@ file = path.slice(lastSlashIndex + 1, lastIndexOfDotCss); | ||
return path => { | ||
if (cache.has(path)) { | ||
return cache.get(path); | ||
var cachedResult = cache.get(path); | ||
if (cachedResult) { | ||
return cachedResult; | ||
} | ||
@@ -124,0 +108,0 @@ var result = _getFileAndDirFromPath(path); |
@@ -62,4 +62,4 @@ 'use strict'; | ||
var forwardSlash = '/'.charCodeAt(0); | ||
var getLastSlashBeforeIndex = (path, startingIndex) => { | ||
var pathIndex = startingIndex; | ||
var getLastSlashBeforeIndex = (path, index) => { | ||
var pathIndex = index - 1; | ||
while (pathIndex >= 0) { | ||
@@ -71,18 +71,2 @@ var codeUnit = path.charCodeAt(pathIndex); | ||
// UTF-16 surrogate pair handling | ||
// Check if codeUnit is a low surrogate | ||
if (codeUnit >= 0xdc00 && codeUnit <= 0xdfff) { | ||
// Ensure there's a previous character | ||
if (pathIndex > 0) { | ||
var maybeHighSurrogate = path.charCodeAt(pathIndex - 1); | ||
// Check if the previous code unit is a high surrogate | ||
if (maybeHighSurrogate >= 0xd800 && maybeHighSurrogate <= 0xdbff) { | ||
// Move past the high surrogate and continue | ||
pathIndex -= 2; | ||
continue; | ||
} | ||
} | ||
} | ||
// At this point, we know we either have a regular character or a lone surrogate, which is | ||
@@ -96,7 +80,7 @@ // valid in windows file paths | ||
* Assumptions: | ||
* - The path is always normalized to use posix file separators (see `addFileScope`) | ||
* - The path is always relative to the project root (see `addFileScope`) | ||
* - There's no need to validate the file extension as we know that we only run this function if the | ||
* path was inside a VE file | ||
* */ | ||
* - The path is always normalized to use posix file separators (/) (see `addFileScope`) | ||
* - The path is always relative to the project root, i.e. there will never be a leading slash (see `addFileScope`) | ||
* - As long as `.css` is there, we have a valid `.css.*` file path, because otherwise there wouldn't | ||
* be a file scope to begin with | ||
*/ | ||
var _getFileAndDirFromPath = path => { | ||
@@ -109,4 +93,3 @@ var file; | ||
} | ||
var i = lastIndexOfDotCss - 1; | ||
var lastSlashIndex = getLastSlashBeforeIndex(path, i); | ||
var lastSlashIndex = getLastSlashBeforeIndex(path, lastIndexOfDotCss); | ||
if (lastSlashIndex === -1) { | ||
@@ -118,5 +101,5 @@ return { | ||
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); | ||
@@ -132,4 +115,5 @@ file = path.slice(lastSlashIndex + 1, lastIndexOfDotCss); | ||
return path => { | ||
if (cache.has(path)) { | ||
return cache.get(path); | ||
var cachedResult = cache.get(path); | ||
if (cachedResult) { | ||
return cachedResult; | ||
} | ||
@@ -136,0 +120,0 @@ var result = _getFileAndDirFromPath(path); |
@@ -62,4 +62,4 @@ 'use strict'; | ||
var forwardSlash = '/'.charCodeAt(0); | ||
var getLastSlashBeforeIndex = (path, startingIndex) => { | ||
var pathIndex = startingIndex; | ||
var getLastSlashBeforeIndex = (path, index) => { | ||
var pathIndex = index - 1; | ||
while (pathIndex >= 0) { | ||
@@ -71,18 +71,2 @@ var codeUnit = path.charCodeAt(pathIndex); | ||
// UTF-16 surrogate pair handling | ||
// Check if codeUnit is a low surrogate | ||
if (codeUnit >= 0xdc00 && codeUnit <= 0xdfff) { | ||
// Ensure there's a previous character | ||
if (pathIndex > 0) { | ||
var maybeHighSurrogate = path.charCodeAt(pathIndex - 1); | ||
// Check if the previous code unit is a high surrogate | ||
if (maybeHighSurrogate >= 0xd800 && maybeHighSurrogate <= 0xdbff) { | ||
// Move past the high surrogate and continue | ||
pathIndex -= 2; | ||
continue; | ||
} | ||
} | ||
} | ||
// At this point, we know we either have a regular character or a lone surrogate, which is | ||
@@ -96,7 +80,7 @@ // valid in windows file paths | ||
* Assumptions: | ||
* - The path is always normalized to use posix file separators (see `addFileScope`) | ||
* - The path is always relative to the project root (see `addFileScope`) | ||
* - There's no need to validate the file extension as we know that we only run this function if the | ||
* path was inside a VE file | ||
* */ | ||
* - The path is always normalized to use posix file separators (/) (see `addFileScope`) | ||
* - The path is always relative to the project root, i.e. there will never be a leading slash (see `addFileScope`) | ||
* - As long as `.css` is there, we have a valid `.css.*` file path, because otherwise there wouldn't | ||
* be a file scope to begin with | ||
*/ | ||
var _getFileAndDirFromPath = path => { | ||
@@ -109,4 +93,3 @@ var file; | ||
} | ||
var i = lastIndexOfDotCss - 1; | ||
var lastSlashIndex = getLastSlashBeforeIndex(path, i); | ||
var lastSlashIndex = getLastSlashBeforeIndex(path, lastIndexOfDotCss); | ||
if (lastSlashIndex === -1) { | ||
@@ -118,5 +101,5 @@ return { | ||
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); | ||
@@ -132,4 +115,5 @@ file = path.slice(lastSlashIndex + 1, lastIndexOfDotCss); | ||
return path => { | ||
if (cache.has(path)) { | ||
return cache.get(path); | ||
var cachedResult = cache.get(path); | ||
if (cachedResult) { | ||
return cachedResult; | ||
} | ||
@@ -136,0 +120,0 @@ var result = _getFileAndDirFromPath(path); |
@@ -50,4 +50,4 @@ import { injectStyles } from '../injectStyles/dist/vanilla-extract-css-injectStyles.esm.js'; | ||
var forwardSlash = '/'.charCodeAt(0); | ||
var getLastSlashBeforeIndex = (path, startingIndex) => { | ||
var pathIndex = startingIndex; | ||
var getLastSlashBeforeIndex = (path, index) => { | ||
var pathIndex = index - 1; | ||
while (pathIndex >= 0) { | ||
@@ -59,18 +59,2 @@ var codeUnit = path.charCodeAt(pathIndex); | ||
// UTF-16 surrogate pair handling | ||
// Check if codeUnit is a low surrogate | ||
if (codeUnit >= 0xdc00 && codeUnit <= 0xdfff) { | ||
// Ensure there's a previous character | ||
if (pathIndex > 0) { | ||
var maybeHighSurrogate = path.charCodeAt(pathIndex - 1); | ||
// Check if the previous code unit is a high surrogate | ||
if (maybeHighSurrogate >= 0xd800 && maybeHighSurrogate <= 0xdbff) { | ||
// Move past the high surrogate and continue | ||
pathIndex -= 2; | ||
continue; | ||
} | ||
} | ||
} | ||
// At this point, we know we either have a regular character or a lone surrogate, which is | ||
@@ -84,7 +68,7 @@ // valid in windows file paths | ||
* Assumptions: | ||
* - The path is always normalized to use posix file separators (see `addFileScope`) | ||
* - The path is always relative to the project root (see `addFileScope`) | ||
* - There's no need to validate the file extension as we know that we only run this function if the | ||
* path was inside a VE file | ||
* */ | ||
* - The path is always normalized to use posix file separators (/) (see `addFileScope`) | ||
* - The path is always relative to the project root, i.e. there will never be a leading slash (see `addFileScope`) | ||
* - As long as `.css` is there, we have a valid `.css.*` file path, because otherwise there wouldn't | ||
* be a file scope to begin with | ||
*/ | ||
var _getFileAndDirFromPath = path => { | ||
@@ -97,4 +81,3 @@ var file; | ||
} | ||
var i = lastIndexOfDotCss - 1; | ||
var lastSlashIndex = getLastSlashBeforeIndex(path, i); | ||
var lastSlashIndex = getLastSlashBeforeIndex(path, lastIndexOfDotCss); | ||
if (lastSlashIndex === -1) { | ||
@@ -106,5 +89,5 @@ return { | ||
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); | ||
@@ -120,4 +103,5 @@ file = path.slice(lastSlashIndex + 1, lastIndexOfDotCss); | ||
return path => { | ||
if (cache.has(path)) { | ||
return cache.get(path); | ||
var cachedResult = cache.get(path); | ||
if (cachedResult) { | ||
return cachedResult; | ||
} | ||
@@ -124,0 +108,0 @@ var result = _getFileAndDirFromPath(path); |
{ | ||
"name": "@vanilla-extract/css", | ||
"version": "0.0.0-perf-dev-prefix-20240820044103", | ||
"version": "0.0.0-perf-dev-prefix-20240820052603", | ||
"description": "Zero-runtime Stylesheets-in-TypeScript", | ||
@@ -5,0 +5,0 @@ "sideEffects": true, |
328653
8623