Skip to content

Commit

Permalink
chore: cleanup hasContentFlag
Browse files Browse the repository at this point in the history
  • Loading branch information
bholmesdev committed Apr 26, 2023
1 parent 0ee02c9 commit 4443690
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions packages/astro/src/content/vite-plugin-content-assets.ts
Expand Up @@ -20,12 +20,6 @@ import {
} from './consts.js';
import { hasContentFlag } from './utils.js';

// TODO: replace with `hasContentFlag`
function isPropagatedAsset(viteId: string): boolean {
const url = new URL(viteId, 'file://');
return url.searchParams.has(PROPAGATED_ASSET_FLAG);
}

export function astroContentAssetPropagationPlugin({
mode,
settings,
Expand Down Expand Up @@ -62,7 +56,7 @@ export function astroContentAssetPropagationPlugin({
}
},
load(id) {
if (isPropagatedAsset(id)) {
if (hasContentFlag(id, CONTENT_RENDER_FLAG)) {
const basePath = id.split('?')[0];
const code = `
function getMod() {
Expand All @@ -83,7 +77,7 @@ export function astroContentAssetPropagationPlugin({
},
async transform(code, id, options) {
if (!options?.ssr) return;
if (devModuleLoader && isPropagatedAsset(id)) {
if (devModuleLoader && hasContentFlag(id, CONTENT_RENDER_FLAG)) {
const basePath = id.split('?')[0];
if (!devModuleLoader.getModuleById(basePath)?.ssrModule) {
await devModuleLoader.import(basePath);
Expand Down

0 comments on commit 4443690

Please sign in to comment.