elegance-js 1.11.15 → 1.11.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/page_compiler.mjs +6 -12
- package/package.json +1 -1
package/dist/page_compiler.mjs
CHANGED
|
@@ -689,28 +689,22 @@ var buildPage = async (DIST_DIR2, directory, filePath, name) => {
|
|
|
689
689
|
if (isDynamicPage === true) {
|
|
690
690
|
await esbuild.build({
|
|
691
691
|
entryPoints: [filePath],
|
|
692
|
-
outfile:
|
|
693
|
-
// necessary because we're mutilating the original
|
|
692
|
+
outfile: filePath,
|
|
694
693
|
allowOverwrite: true,
|
|
695
|
-
// dont bundle because the origina build handles moduleresolution
|
|
696
694
|
bundle: false,
|
|
697
|
-
format: "
|
|
698
|
-
// Important
|
|
695
|
+
format: "esm",
|
|
699
696
|
plugins: [
|
|
700
697
|
{
|
|
701
|
-
name: "wrap-
|
|
698
|
+
name: "wrap-esm",
|
|
702
699
|
setup(build2) {
|
|
703
700
|
build2.onEnd(async () => {
|
|
704
701
|
const fs2 = await import("fs/promises");
|
|
705
702
|
const code = await fs2.readFile(build2.initialOptions.outfile, "utf8");
|
|
706
|
-
const wrapped = `export function construct() {
|
|
703
|
+
const wrapped = `export async function construct() {
|
|
707
704
|
const exports = {};
|
|
708
|
-
const
|
|
709
|
-
(function(exports, module) {
|
|
710
|
-
${code.split("\n").map((l) => " " + l).join("\n")}
|
|
711
|
-
})(exports, module);
|
|
705
|
+
${code.replace(/export\s+(const|let|var|function|class)\s+(\w+)/g, "exports.$2 = $2; $1 $2").split("\n").map((l) => " " + l).join("\n")}
|
|
712
706
|
|
|
713
|
-
return
|
|
707
|
+
return exports;
|
|
714
708
|
}
|
|
715
709
|
`;
|
|
716
710
|
await fs2.writeFile(build2.initialOptions.outfile, wrapped);
|