@t8/serve 0.1.10 → 0.1.11

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/index.js CHANGED
@@ -37,8 +37,9 @@ var import_node_util = require("node:util");
37
37
  var exec = (0, import_node_util.promisify)(import_node_child_process.exec);
38
38
  async function bundle({ path = "", bundle: options } = {}) {
39
39
  if (!options) return;
40
- let inputFile = (0, import_node_path.join)(path, options.input ?? "index.ts");
41
- let outputFile = (0, import_node_path.join)(path, "dist", options.output ?? "index.js");
40
+ let normalizedOptions = typeof options === "boolean" ? {} : options;
41
+ let inputFile = (0, import_node_path.join)(path, normalizedOptions.input ?? "index.ts");
42
+ let outputFile = (0, import_node_path.join)(path, "dist", normalizedOptions.output ?? "index.js");
42
43
  await (0, import_promises.rm)((0, import_node_path.join)(path, "dist"), { recursive: true, force: true });
43
44
  await exec(
44
45
  `npx esbuild ${inputFile} --outfile=${outputFile} --bundle --platform=neutral --log-level=warning`
package/dist/run.cjs CHANGED
@@ -14,8 +14,9 @@ var import_node_util = require("node:util");
14
14
  var exec = (0, import_node_util.promisify)(import_node_child_process.exec);
15
15
  async function bundle({ path = "", bundle: options } = {}) {
16
16
  if (!options) return;
17
- let inputFile = (0, import_node_path.join)(path, options.input ?? "index.ts");
18
- let outputFile = (0, import_node_path.join)(path, "dist", options.output ?? "index.js");
17
+ let normalizedOptions = typeof options === "boolean" ? {} : options;
18
+ let inputFile = (0, import_node_path.join)(path, normalizedOptions.input ?? "index.ts");
19
+ let outputFile = (0, import_node_path.join)(path, "dist", normalizedOptions.output ?? "index.js");
19
20
  await (0, import_promises.rm)((0, import_node_path.join)(path, "dist"), { recursive: true, force: true });
20
21
  await exec(
21
22
  `npx esbuild ${inputFile} --outfile=${outputFile} --bundle --platform=neutral --log-level=warning`
package/dist/run.mjs CHANGED
@@ -13,8 +13,9 @@ import { promisify } from "node:util";
13
13
  var exec = promisify(originalExec);
14
14
  async function bundle({ path = "", bundle: options } = {}) {
15
15
  if (!options) return;
16
- let inputFile = join(path, options.input ?? "index.ts");
17
- let outputFile = join(path, "dist", options.output ?? "index.js");
16
+ let normalizedOptions = typeof options === "boolean" ? {} : options;
17
+ let inputFile = join(path, normalizedOptions.input ?? "index.ts");
18
+ let outputFile = join(path, "dist", normalizedOptions.output ?? "index.js");
18
19
  await rm(join(path, "dist"), { recursive: true, force: true });
19
20
  await exec(
20
21
  `npx esbuild ${inputFile} --outfile=${outputFile} --bundle --platform=neutral --log-level=warning`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t8/serve",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "node",
package/src/Config.ts CHANGED
@@ -3,8 +3,10 @@ export type Config = {
3
3
  path?: string;
4
4
  dirs?: string[];
5
5
  spa?: boolean;
6
- bundle?: {
7
- input?: string;
8
- output?: string;
9
- };
6
+ bundle?:
7
+ | boolean
8
+ | {
9
+ input?: string;
10
+ output?: string;
11
+ };
10
12
  };
package/src/bundle.ts CHANGED
@@ -9,8 +9,11 @@ const exec = promisify(originalExec);
9
9
  export async function bundle({ path = "", bundle: options }: Config = {}) {
10
10
  if (!options) return;
11
11
 
12
- let inputFile = join(path, options.input ?? "index.ts");
13
- let outputFile = join(path, "dist", options.output ?? "index.js");
12
+ let normalizedOptions: Exclude<Config["bundle"], boolean | undefined> =
13
+ typeof options === "boolean" ? {} : options;
14
+
15
+ let inputFile = join(path, normalizedOptions.input ?? "index.ts");
16
+ let outputFile = join(path, "dist", normalizedOptions.output ?? "index.js");
14
17
 
15
18
  await rm(join(path, "dist"), { recursive: true, force: true });
16
19
  await exec(