[ci] yarn format
This commit is contained in:
parent
0ce86dfdf3
commit
6abea78ecd
2 changed files with 6 additions and 13 deletions
|
@ -73,7 +73,7 @@ export function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin {
|
||||||
delete viteCSSPost.generateBundle;
|
delete viteCSSPost.generateBundle;
|
||||||
|
|
||||||
// Move our plugin to be right before this one.
|
// Move our plugin to be right before this one.
|
||||||
const ourIndex = plugins.findIndex(p => p.name === PLUGIN_NAME);
|
const ourIndex = plugins.findIndex((p) => p.name === PLUGIN_NAME);
|
||||||
const ourPlugin = plugins[ourIndex];
|
const ourPlugin = plugins[ourIndex];
|
||||||
|
|
||||||
// Remove us from where we are now and place us right before the viteCSSPost plugin
|
// Remove us from where we are now and place us right before the viteCSSPost plugin
|
||||||
|
@ -147,22 +147,17 @@ export function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin {
|
||||||
|
|
||||||
// Delete CSS chunks so JS is not produced for them.
|
// Delete CSS chunks so JS is not produced for them.
|
||||||
generateBundle(opts, bundle) {
|
generateBundle(opts, bundle) {
|
||||||
if(pureCSSChunks.size) {
|
if (pureCSSChunks.size) {
|
||||||
const pureChunkFilenames = new Set([...pureCSSChunks].map((chunk) => chunk.fileName));
|
const pureChunkFilenames = new Set([...pureCSSChunks].map((chunk) => chunk.fileName));
|
||||||
const emptyChunkFiles = [...pureChunkFilenames]
|
const emptyChunkFiles = [...pureChunkFilenames]
|
||||||
.map((file) => path.basename(file))
|
.map((file) => path.basename(file))
|
||||||
.join('|')
|
.join('|')
|
||||||
.replace(/\./g, '\\.')
|
.replace(/\./g, '\\.');
|
||||||
const emptyChunkRE = new RegExp(
|
const emptyChunkRE = new RegExp(opts.format === 'es' ? `\\bimport\\s*"[^"]*(?:${emptyChunkFiles})";\n?` : `\\brequire\\(\\s*"[^"]*(?:${emptyChunkFiles})"\\);\n?`, 'g');
|
||||||
opts.format === 'es'
|
|
||||||
? `\\bimport\\s*"[^"]*(?:${emptyChunkFiles})";\n?`
|
|
||||||
: `\\brequire\\(\\s*"[^"]*(?:${emptyChunkFiles})"\\);\n?`,
|
|
||||||
'g'
|
|
||||||
)
|
|
||||||
|
|
||||||
for (const [chunkId, chunk] of Object.entries(bundle)) {
|
for (const [chunkId, chunk] of Object.entries(bundle)) {
|
||||||
if (chunk.type === 'chunk') {
|
if (chunk.type === 'chunk') {
|
||||||
if(pureCSSChunks.has(chunk)) {
|
if (pureCSSChunks.has(chunk)) {
|
||||||
// Delete pure CSS chunks, these are JavaScript chunks that only import
|
// Delete pure CSS chunks, these are JavaScript chunks that only import
|
||||||
// other CSS files, so are empty at the end of bundling.
|
// other CSS files, so are empty at the end of bundling.
|
||||||
delete bundle[chunkId];
|
delete bundle[chunkId];
|
||||||
|
@ -178,8 +173,6 @@ export function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { expect } from 'chai';
|
||||||
import cheerio from 'cheerio';
|
import cheerio from 'cheerio';
|
||||||
import { loadFixture } from './test-utils.js';
|
import { loadFixture } from './test-utils.js';
|
||||||
|
|
||||||
describe('Styles SSR', function() {
|
describe('Styles SSR', function () {
|
||||||
this.timeout(5000);
|
this.timeout(5000);
|
||||||
|
|
||||||
let fixture;
|
let fixture;
|
||||||
|
|
Loading…
Reference in a new issue