Skip to content

Commit

Permalink
use VirtualContentResult for top level function
Browse files Browse the repository at this point in the history
  • Loading branch information
mansona committed Feb 1, 2024
1 parent e04956b commit 45714c5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/core/src/virtual-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@ import { compile } from './js-handlebars';
const externalESPrefix = '/@embroider/ext-es/';
const externalCJSPrefix = '/@embroider/ext-cjs/';

export interface VirtualContentResult {
src: string;
watches: string[];
}

// Given a filename that was passed to your ModuleRequest's `virtualize()`,
// this produces the corresponding contents. It's a static, stateless function
// because we recognize that that process that did resolution might not be the
// same one that loads the content.
export function virtualContent(filename: string, resolver: Resolver): { src: string; watches: string[] } {
export function virtualContent(filename: string, resolver: Resolver): VirtualContentResult {
let cjsExtern = decodeVirtualExternalCJSModule(filename);
if (cjsExtern) {
return renderCJSExternalShim(cjsExtern);
Expand Down Expand Up @@ -56,11 +61,6 @@ export { {{#each names as |name|}}{{name}}, {{/each}} }
{{/if}}
`) as (params: { moduleName: string; default: boolean; names: string[] }) => string;

interface VirtualContentResult {
src: string;
watches: string[];
}

function renderESExternalShim({
moduleName,
exports,
Expand Down

0 comments on commit 45714c5

Please sign in to comment.