[ci] yarn format
This commit is contained in:
parent
3e8844fa87
commit
eecc996d7e
2 changed files with 29 additions and 17 deletions
|
@ -96,15 +96,15 @@ async function compile(config: AstroConfig, filename: string, source: string, vi
|
|||
|
||||
const compileResult: CompileResult = Object.create(transformResult, {
|
||||
rawCSSDeps: {
|
||||
value: rawCSSDeps
|
||||
}
|
||||
value: rawCSSDeps,
|
||||
},
|
||||
});
|
||||
|
||||
return compileResult;
|
||||
}
|
||||
|
||||
export function isCached(config: AstroConfig, filename: string) {
|
||||
return configCache.has(config) && (configCache.get(config)!).has(filename);
|
||||
return configCache.has(config) && configCache.get(config)!.has(filename);
|
||||
}
|
||||
|
||||
export function invalidateCompilation(config: AstroConfig, filename: string) {
|
||||
|
@ -114,7 +114,13 @@ export function invalidateCompilation(config: AstroConfig, filename: string) {
|
|||
}
|
||||
}
|
||||
|
||||
export async function cachedCompilation(config: AstroConfig, filename: string, source: string | null, viteTransform: TransformHook, opts: boolean | undefined): Promise<CompileResult> {
|
||||
export async function cachedCompilation(
|
||||
config: AstroConfig,
|
||||
filename: string,
|
||||
source: string | null,
|
||||
viteTransform: TransformHook,
|
||||
opts: boolean | undefined
|
||||
): Promise<CompileResult> {
|
||||
let cache: CompilationCache;
|
||||
if (!configCache.has(config)) {
|
||||
cache = new Map();
|
||||
|
|
|
@ -16,16 +16,22 @@ export async function trackCSSDependencies(this: RollupPluginContext, opts: Trac
|
|||
if (viteDevServer) {
|
||||
const mod = viteDevServer.moduleGraph.getModuleById(id);
|
||||
if (mod) {
|
||||
const cssDeps = (await Promise.all(Array.from(deps).map((spec) => {
|
||||
const cssDeps = (
|
||||
await Promise.all(
|
||||
Array.from(deps).map((spec) => {
|
||||
return this.resolve(spec, id);
|
||||
}))).filter(Boolean).map(dep => (dep as ResolvedId).id);
|
||||
})
|
||||
)
|
||||
)
|
||||
.filter(Boolean)
|
||||
.map((dep) => (dep as ResolvedId).id);
|
||||
|
||||
const { moduleGraph } = viteDevServer;
|
||||
// record deps in the module graph so edits to @import css can trigger
|
||||
// main import to hot update
|
||||
const depModules = new Set(mod.importedModules);
|
||||
for (const dep of cssDeps) {
|
||||
depModules.add(moduleGraph.createFileOnlyEntry(dep))
|
||||
depModules.add(moduleGraph.createFileOnlyEntry(dep));
|
||||
}
|
||||
|
||||
// Update the module graph, telling it about our CSS deps.
|
||||
|
|
Loading…
Add table
Reference in a new issue