Skip to content

Commit

Permalink
fix: inline server-entry-template code to fix esm mode
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanPiercey committed May 19, 2023
1 parent ce14fb6 commit d6dbbff
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
31 changes: 30 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Buffer } from "buffer";
import * as rollup from "rollup";
import { createHash } from "crypto";
import type * as Compiler from "@marko/compiler";
import getServerEntryTemplate from "./server-entry-template";

interface BaseOptions {
// Override the Marko compiler instance being used. (primarily for tools wrapping this module)
Expand Down Expand Up @@ -673,3 +672,33 @@ function isEmpty(obj: unknown) {

return true;
}

function getServerEntryTemplate(opts: {
runtimeId?: string | null;
manifestPath: string | false;
templatePath: string;
entryId: string;
}): string {
const templatePathStr = JSON.stringify(opts.templatePath);
return `import template from ${templatePathStr};
export * from ${templatePathStr};
$ const markoGlobal = out.global;
${
opts.runtimeId
? `$ markoGlobal.runtimeId = ${JSON.stringify(opts.runtimeId)};\n`
: ""
}${
opts.manifestPath
? `$ markoGlobal.__rollupManifest = ${JSON.stringify(
opts.manifestPath
)};\n`
: ""
}$ (markoGlobal.__rollupEntries || (markoGlobal.__rollupEntries = [])).push(${JSON.stringify(
opts.entryId
)});
<\${template} ...input/>
<init-components/>
<await-reorderer/>
`;
}
29 changes: 0 additions & 29 deletions src/server-entry-template.ts

This file was deleted.

0 comments on commit d6dbbff

Please sign in to comment.