Skip to content

Commit 8293230

Browse files
committed
feat: specify source map format
1 parent bc0f660 commit 8293230

File tree

6 files changed

+15
-10
lines changed

6 files changed

+15
-10
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ Mach also allows you to create nested instruments, enabling you to bundle MSFS A
2727
- `-m, --minify` minify bundle code
2828
- `-s, --skip-simulator-package` skips writing simulator package templates
2929
- `-t, --output-metafile` output `build_meta.json` file to bundles directory
30-
- `-u, --output-sourcemaps` append sourcemaps to the end of bundle files
30+
- `-p, --sourcemaps` generate inline sourcemaps
31+
- `-p, --sourcemaps [linked | external | inline | both]` generate sourcemaps (see https://esbuild.github.io/api/#sourcemap for details on options)
3132
- `-v, --verbose` output additional build information
3233

3334
#### `mach build [options]`

index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import fs from "node:fs";
99
import path from "node:path";
1010
import chalk from "chalk";
11-
import { Command } from "commander";
11+
import { Command, Option } from "commander";
1212
import dotenv from "dotenv";
1313
// @ts-ignore FIXME: remove the ignore when/if https://github.com/antitoxic/import-single-ts/pull/7 is merged
1414
import { importSingleTs } from "import-single-ts";
@@ -46,7 +46,11 @@ const commandWithOptions = (name: string) =>
4646
.option("-m, --minify", "minify bundle code")
4747
.option("-s, --skip-simulator-package", "skips writing simulator package templates")
4848
.option("-t, --output-metafile", "output `build_meta.json` file to bundles directory")
49-
.option("-u, --output-sourcemaps", "append sourcemaps to the end of bundle files")
49+
.addOption(
50+
new Option("-p, --sourcemaps [type]", "generate sourcemaps")
51+
.choices(["linked", "external", "inline", "both"])
52+
.preset("inline"),
53+
)
5054
.option("-v, --verbose", "output additional build information")
5155
.hook("preAction", async (_thisCommand, actionCommand) => {
5256
signale.info(`Welcome to ${chalk.cyanBright("Mach")}, v${version}`);

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@synaptic-simulations/mach",
3-
"version": "1.3.0-rc3",
3+
"version": "1.3.0-rc4",
44
"description": "The last MSFS instrument bundler you'll ever need.",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",

src/esbuild.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function getBuildOptions(args: MachArgs, instrument: Instrument): BuildOptions {
1919
target: "es2017",
2020
logLevel: "silent",
2121
logOverride: args.werror ? ESBUILD_ERRORS : undefined,
22-
sourcemap: args.outputSourcemaps ? "inline" : undefined,
22+
sourcemap: args.sourcemaps,
2323
minify: args.minify,
2424

2525
...args.config.esbuild,

src/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ export interface MachArgs {
9191
verbose?: boolean;
9292
/** Output `build_meta.json` file to bundle directory. */
9393
outputMetafile?: boolean;
94-
/** Append JS source maps to end of bundles. */
95-
outputSourcemaps?: boolean;
94+
/** Generate source maps. */
95+
sourcemaps?: "linked" | "external" | "inline" | "both";
9696
/** Skip writing simulator package files. */
9797
skipSimulatorPackage?: boolean;
9898
}
@@ -155,7 +155,7 @@ export const MachArgsSchema = z.object({
155155
minify: z.boolean().optional(),
156156
verbose: z.boolean().optional(),
157157
outputMetafile: z.boolean().optional(),
158-
outputSourcemaps: z.boolean().optional(),
158+
sourcemaps: z.enum(["linked", "external", "inline", "both"]).optional(),
159159
skipSimulatorPackage: z.boolean().optional(),
160160
});
161161

0 commit comments

Comments
 (0)