@vanilla-extract/rollup-plugin
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -8,2 +8,7 @@ 'use strict'; | ||
const { | ||
relative, | ||
normalize, | ||
dirname | ||
} = path.posix; | ||
function vanillaExtractPlugin({ | ||
@@ -41,3 +46,3 @@ identifiers, | ||
return integration.processVanillaFile({ | ||
const output = await integration.processVanillaFile({ | ||
source, | ||
@@ -47,2 +52,8 @@ filePath, | ||
}); | ||
return { | ||
code: output, | ||
map: { | ||
mappings: '' | ||
} | ||
}; | ||
}, | ||
@@ -78,2 +89,4 @@ | ||
renderChunk(code, chunkInfo) { | ||
var _chunkInfo$map; | ||
// For all imports in this chunk that we have emitted files for... | ||
@@ -87,9 +100,13 @@ const importsToReplace = chunkInfo.imports.filter(fileName => emittedFiles.get(fileName)); | ||
const chunkPath = path.dirname(chunkInfo.fileName); | ||
return importsToReplace.reduce((codeResult, importPath) => { | ||
const chunkPath = dirname(chunkInfo.fileName); | ||
const output = importsToReplace.reduce((codeResult, importPath) => { | ||
const assetId = emittedFiles.get(importPath); | ||
const assetName = this.getFileName(assetId); | ||
const fixedImportPath = `./${path.normalize(path.relative(chunkPath, assetName))}`; | ||
const fixedImportPath = `./${normalize(relative(chunkPath, assetName))}`; | ||
return codeResult.replace(importPath, fixedImportPath); | ||
}, code); | ||
return { | ||
code: output, | ||
map: (_chunkInfo$map = chunkInfo.map) !== null && _chunkInfo$map !== void 0 ? _chunkInfo$map : null | ||
}; | ||
} | ||
@@ -96,0 +113,0 @@ |
@@ -8,2 +8,7 @@ 'use strict'; | ||
const { | ||
relative, | ||
normalize, | ||
dirname | ||
} = path.posix; | ||
function vanillaExtractPlugin({ | ||
@@ -40,3 +45,3 @@ identifiers, | ||
return integration.processVanillaFile({ | ||
const output = await integration.processVanillaFile({ | ||
source, | ||
@@ -46,2 +51,8 @@ filePath, | ||
}); | ||
return { | ||
code: output, | ||
map: { | ||
mappings: '' | ||
} | ||
}; | ||
}, | ||
@@ -77,2 +88,4 @@ | ||
renderChunk(code, chunkInfo) { | ||
var _chunkInfo$map; | ||
// For all imports in this chunk that we have emitted files for... | ||
@@ -86,9 +99,13 @@ const importsToReplace = chunkInfo.imports.filter(fileName => emittedFiles.get(fileName)); | ||
const chunkPath = path.dirname(chunkInfo.fileName); | ||
return importsToReplace.reduce((codeResult, importPath) => { | ||
const chunkPath = dirname(chunkInfo.fileName); | ||
const output = importsToReplace.reduce((codeResult, importPath) => { | ||
const assetId = emittedFiles.get(importPath); | ||
const assetName = this.getFileName(assetId); | ||
const fixedImportPath = `./${path.normalize(path.relative(chunkPath, assetName))}`; | ||
const fixedImportPath = `./${normalize(relative(chunkPath, assetName))}`; | ||
return codeResult.replace(importPath, fixedImportPath); | ||
}, code); | ||
return { | ||
code: output, | ||
map: (_chunkInfo$map = chunkInfo.map) !== null && _chunkInfo$map !== void 0 ? _chunkInfo$map : null | ||
}; | ||
} | ||
@@ -95,0 +112,0 @@ |
import { cssFileFilter, compile, processVanillaFile, virtualCssFileFilter, getSourceFromVirtualCssFile } from '@vanilla-extract/integration'; | ||
import { dirname, normalize, relative } from 'path'; | ||
import { posix } from 'path'; | ||
const { | ||
relative, | ||
normalize, | ||
dirname | ||
} = posix; | ||
function vanillaExtractPlugin({ | ||
@@ -36,3 +41,3 @@ identifiers, | ||
return processVanillaFile({ | ||
const output = await processVanillaFile({ | ||
source, | ||
@@ -42,2 +47,8 @@ filePath, | ||
}); | ||
return { | ||
code: output, | ||
map: { | ||
mappings: '' | ||
} | ||
}; | ||
}, | ||
@@ -73,2 +84,4 @@ | ||
renderChunk(code, chunkInfo) { | ||
var _chunkInfo$map; | ||
// For all imports in this chunk that we have emitted files for... | ||
@@ -83,3 +96,3 @@ const importsToReplace = chunkInfo.imports.filter(fileName => emittedFiles.get(fileName)); | ||
const chunkPath = dirname(chunkInfo.fileName); | ||
return importsToReplace.reduce((codeResult, importPath) => { | ||
const output = importsToReplace.reduce((codeResult, importPath) => { | ||
const assetId = emittedFiles.get(importPath); | ||
@@ -90,2 +103,6 @@ const assetName = this.getFileName(assetId); | ||
}, code); | ||
return { | ||
code: output, | ||
map: (_chunkInfo$map = chunkInfo.map) !== null && _chunkInfo$map !== void 0 ? _chunkInfo$map : null | ||
}; | ||
} | ||
@@ -92,0 +109,0 @@ |
{ | ||
"name": "@vanilla-extract/rollup-plugin", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Zero-runtime Stylesheets-in-TypeScript", | ||
@@ -23,3 +23,3 @@ "main": "dist/vanilla-extract-rollup-plugin.cjs.js", | ||
"@rollup/plugin-json": "^4.1.0", | ||
"@vanilla-extract/css": "^1.7.0", | ||
"@vanilla-extract/css": "^1.7.1", | ||
"esbuild": "^0.11.16", | ||
@@ -26,0 +26,0 @@ "rollup": "^2.7.0", |
39765
285