elegance-js 2.1.17 → 2.1.19

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.
@@ -50,21 +50,20 @@ async function buildClient(DIST_DIR2) {
50
50
  let clientString = "window.__name = (func) => func; ";
51
51
  clientString += fs.readFileSync(clientPath, "utf-8");
52
52
  if (options.hotReload !== void 0) {
53
- clientString += `const watchServerPort = ${options.hotReload.port}`;
53
+ clientString += `const watchServerPort = ${options.hotReload.port};`;
54
54
  clientString += fs.readFileSync(watcherPath, "utf-8");
55
55
  }
56
- const transformedClient = await esbuild.transform(clientString, {
56
+ await esbuild.build({
57
57
  minify: options.environment === "production",
58
58
  drop: options.environment === "production" ? ["console", "debugger"] : void 0,
59
59
  keepNames: false,
60
+ bundle: true,
60
61
  format: "iife",
61
- platform: "node",
62
- loader: "ts"
62
+ entryPoints: [clientPath],
63
+ platform: "browser",
64
+ outfile: path.join(DIST_DIR2, "/client.js"),
65
+ loader: { ".ts": "ts" }
63
66
  });
64
- fs.writeFileSync(
65
- path.join(DIST_DIR2, "/client.js"),
66
- transformedClient.code
67
- );
68
67
  }
69
68
  ;
70
69
  function processOptionAsObjectAttribute(element, optionName, optionValue, objectAttributes) {
@@ -511,7 +510,9 @@ async function buildLayout(filePath, directory, generateDynamic = false) {
511
510
  const { pageContentHTML, metadataHTML } = result;
512
511
  function splitAround(str, sub) {
513
512
  const i = str.indexOf(sub);
514
- if (i === -1) throw new Error("substring does not exist in parent string");
513
+ if (i === -1) {
514
+ throw new Error(`Whilst layout ${directory}, the splitter could not be found. Make sure to use the "child" prop passed into the layout.`);
515
+ }
515
516
  return {
516
517
  startHTML: str.substring(0, i),
517
518
  endHTML: str.substring(i + sub.length)
@@ -519,7 +520,9 @@ async function buildLayout(filePath, directory, generateDynamic = false) {
519
520
  }
520
521
  function splitAt(str, sub) {
521
522
  const i = str.indexOf(sub) + sub.length;
522
- if (i === -1) throw new Error("substring does not exist in parent string");
523
+ if (i === -1) {
524
+ throw new Error(`Whilst layout ${directory}, the splitter could not be found. Make sure to use the "child" prop passed into the layout's head.`);
525
+ }
523
526
  return {
524
527
  startHTML: str.substring(0, i),
525
528
  endHTML: str.substring(i)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elegance-js",
3
- "version": "2.1.17",
3
+ "version": "2.1.19",
4
4
  "description": "Web-Framework",
5
5
  "type": "module",
6
6
  "bin": {