UNPKG

nuxt

Version:

Nuxt is a free and open-source framework with an intuitive and extendable way to create type-safe, performant and production-grade full-stack web applications and websites with Vue.js.

21 lines (20 loc) • 746 B
//#region src/runtime/server/renderer/dev-css.ts const QUERY_RE = /\?.*$/; const LEADING_RELATIVE_RE = /^(?:\.\.?\/)+/; /** * Whether a dev stylesheet belongs to one of the modules a render actually used. * * The dev CSS set is the builder's whole module graph, not a per-request subset, so * consumers that must not leak unrelated styles (islands) narrow it with the modules * Vue registered during their own render. */ function isStyleOfModule(file, modules) { const path = file.replace(QUERY_RE, ""); for (const mod of modules) { const normalized = mod.replace(LEADING_RELATIVE_RE, ""); if (normalized && (path === normalized || path.endsWith("/" + normalized))) return true; } return false; } //#endregion export { isStyleOfModule };