@react-gnome/core
Version:
## Getting Started
34 lines (33 loc) • 1 kB
JavaScript
// src/utils/get-entrypoint.ts
import path from "path";
import {
getCustomPolyfillsImports,
getGlobalPolyfillsInmportPaths
} from "./get-polyfills.mjs";
import { getRuntimeInitImportPaths } from "./get-runtime-init.mjs";
function getEntrypoint(program) {
const userEntrypointPath = path.resolve(
program.cwd,
program.config.entrypoint
);
const lines = [];
lines.push("// Runtime initialization");
for (const initfile of getRuntimeInitImportPaths(program)) {
lines.push(`import ${JSON.stringify(initfile)};`);
}
lines.push("");
lines.push("// Register global polyfills");
for (const polyfill of getGlobalPolyfillsInmportPaths(program)) {
lines.push(`import ${JSON.stringify(polyfill)};`);
}
for (const customPolly of getCustomPolyfillsImports(program)) {
lines.push(customPolly);
}
lines.push("");
lines.push("// User entrypoint");
lines.push(`import ${JSON.stringify(userEntrypointPath)};`);
return lines.join("\n");
}
export {
getEntrypoint
};