olum-compiler 1.6.1 → 1.6.3

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/README.md CHANGED
@@ -6,4 +6,4 @@
6
6
  </p>
7
7
 
8
8
  # Olum-Compiler
9
- See [Documentation](https://olumjs.github.io/docs)
9
+ See [Documentation](https://olumjs.top/docs)
package/bin/bundle.js CHANGED
@@ -99,6 +99,25 @@ async function bundle(bootAt) {
99
99
  build: {
100
100
  outDir,
101
101
  emptyOutDir: true,
102
+
103
+ assetsInlineLimit: 0,
104
+ rollupOptions: {
105
+ output: {
106
+ assetFileNames(info) {
107
+ const orig = (info.originalFileNames || [])[0];
108
+ const name = (info.names || [])[0] || "";
109
+ if (
110
+ orig &&
111
+ !orig.startsWith("..") &&
112
+ !path.isAbsolute(orig) &&
113
+ path.extname(orig) === path.extname(name)
114
+ ) {
115
+ return orig;
116
+ }
117
+ return "assets/[name]-[hash][extname]";
118
+ },
119
+ },
120
+ },
102
121
  },
103
122
  });
104
123
 
package/bin/index.js CHANGED
@@ -4,9 +4,10 @@ const spawn = require("../lib/cross-spawn");
4
4
  const script = process.argv[2];
5
5
 
6
6
  if (script == "dev") process.env.NODE_ENV = "development";
7
- else if (script == "build") process.env.NODE_ENV = "production";
7
+ else if (["build", "start"].includes(script))
8
+ process.env.NODE_ENV = "production";
8
9
 
9
- if (typeof script !== undefined && ["dev", "build"].includes(script)) {
10
+ if (typeof script !== undefined && ["dev", "build", "start"].includes(script)) {
10
11
  const result = spawn.sync("node", [path.resolve(__dirname, script + ".js")], {
11
12
  stdio: "inherit",
12
13
  });
package/bin/server.js CHANGED
@@ -40,7 +40,7 @@ function getPath(entry, url) {
40
40
  return null;
41
41
  }
42
42
 
43
- function serve(entry, port) {
43
+ function serve(entry, port, mode = "development") {
44
44
  return new Promise((resolve, reject) => {
45
45
  const PORT = Number(port || process.env.PORT || 3000);
46
46
 
@@ -60,8 +60,10 @@ function serve(entry, port) {
60
60
  }
61
61
  const dom = new jsdom.JSDOM(content.toString()).window.document;
62
62
  const html = dom.querySelector("html");
63
- const wsContent = handleWsFile();
64
- dom.body.insertAdjacentHTML("beforeend", wsContent);
63
+ if (mode == "development") {
64
+ const wsContent = handleWsFile();
65
+ dom.body.insertAdjacentHTML("beforeend", wsContent);
66
+ }
65
67
  res.writeHead(200, {
66
68
  "content-type": "text/html",
67
69
  "cache-control": "no-cache",
package/bin/start.js ADDED
@@ -0,0 +1,20 @@
1
+ const serve = require("./server");
2
+ const colors = require("../lib/colors");
3
+ const path = require("path");
4
+
5
+ const cwd = process.cwd();
6
+ const root = cwd.replace(/\/module$/, "");
7
+ const outDir = path.resolve(root, "dist");
8
+
9
+ serve(outDir, undefined, "production").then(({ server, PORT, log }) => {
10
+ const bootAt = Date.now();
11
+ server.on("error", (e) => {
12
+ if (e.code === "EADDRINUSE") server.listen(++PORT);
13
+ });
14
+ server.listen(PORT, () =>
15
+ console.log(
16
+ log.replace(/port \d+/, "port " + PORT),
17
+ colors("white", `(ready in ${Date.now() - bootAt}ms)`),
18
+ ),
19
+ );
20
+ });
package/lib/changes.txt CHANGED
@@ -0,0 +1,2 @@
1
+ change /home/eissapk/olum/template-compiler/src/page.html
2
+ change /home/eissapk/olum/template-compiler/src/page.html
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "olum-compiler",
3
- "version": "1.6.1",
3
+ "version": "1.6.3",
4
4
  "description": "A module for compiling/bundling olumjs projects",
5
5
  "main": "bin/index.js",
6
6
  "bin": {