@yohs/esbuild-utils 0.2.0

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 ADDED
@@ -0,0 +1,43 @@
1
+ # @yohs/esbuild-utils
2
+
3
+ Reusable esbuild helpers that make it easier to bootstrap local dev flows:
4
+
5
+ - Opinionated runners that keep long-lived processes in sync with esbuild outputs
6
+ - Quality-of-life plugins (clear console, custom logging, persistent spinner)
7
+
8
+ ## Quick start
9
+
10
+ ```bash
11
+ pnpm add -D @yohs/esbuild-utils
12
+ ```
13
+
14
+ ```ts
15
+ import { clearConsolePlugin, runFunctionsPlugin } from '@yohs/esbuild-utils'
16
+
17
+ export default {
18
+ plugins: [
19
+ clearConsolePlugin,
20
+ runFunctionsPlugin({
21
+ target: 'handler',
22
+ signatureType: 'cloudevent',
23
+ port: 5012,
24
+ }),
25
+ ],
26
+ }
27
+ ```
28
+
29
+ > ℹ️ Console / CLI helpers (`animation`, `args-serialize`, `run-npx`) now live in [`@yohs/node-utils`](https://github.com/YLS-/ts-utils/tree/main/packages/node-utils) and are **no longer** re-exported from this package. Import them directly from `@yohs/node-utils/*` if you still need them alongside these plugins.
30
+
31
+ > ⚠️ The `runFunctionsPlugin` depends on [`@yohs/gcp-utils`](https://github.com/YLS-/ts-utils/tree/main/packages/gcp-utils) for its Functions Framework runner. Install it alongside this package when you need that plugin.
32
+
33
+ ## Available entry-points
34
+
35
+ - `@yohs/esbuild-utils` – re-exports everything in this package
36
+ - `@yohs/esbuild-utils/plugins` – bundled access to every plugin helper
37
+
38
+ ## Scripts
39
+
40
+ - `pnpm build` – emits ESM modules and d.ts files via **tsdown**
41
+ - `pnpm test` – runs the vitest suite
42
+ - `pnpm lint` / `pnpm typecheck` – local validation helpers
43
+
@@ -0,0 +1,30 @@
1
+ import { createRequire } from "node:module";
2
+
3
+ //#region rolldown:runtime
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
13
+ key = keys[i];
14
+ if (!__hasOwnProp.call(to, key) && key !== except) {
15
+ __defProp(to, key, {
16
+ get: ((k) => from[k]).bind(null, key),
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ }
21
+ }
22
+ return to;
23
+ };
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
25
+ value: mod,
26
+ enumerable: true
27
+ }) : target, mod));
28
+
29
+ //#endregion
30
+ export { };
@@ -0,0 +1,10 @@
1
+ //#region ../gcp-utils/src/functions/run-functions.d.ts
2
+ interface FunctionsOptions {
3
+ source: string;
4
+ target: string;
5
+ signatureType: 'http' | 'event' | 'cloudevent';
6
+ port: number;
7
+ }
8
+ //#endregion
9
+ export { FunctionsOptions };
10
+ //# sourceMappingURL=run-functions.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-functions.d.mts","names":[],"sources":["../../../../../gcp-utils/src/functions/run-functions.ts"],"sourcesContent":[],"mappings":";AAEiB,UAAA,gBAAA,CAAgB"}
@@ -0,0 +1,5 @@
1
+ import { clearConsolePlugin } from "./plugins/clear-console.mjs";
2
+ import { customLoggingPlugin } from "./plugins/custom-logging.mjs";
3
+ import { ProcessPluginOptions, runProcessPlugin } from "./plugins/run-process.mjs";
4
+ import { RunFunctionsPluginOptions, runFunctionsPlugin } from "./plugins/run-functions.mjs";
5
+ export { ProcessPluginOptions, RunFunctionsPluginOptions, clearConsolePlugin, customLoggingPlugin, runFunctionsPlugin, runProcessPlugin };
package/dist/index.mjs ADDED
@@ -0,0 +1,6 @@
1
+ import { clearConsolePlugin } from "./plugins/clear-console.mjs";
2
+ import { customLoggingPlugin } from "./plugins/custom-logging.mjs";
3
+ import { runProcessPlugin } from "./plugins/run-process.mjs";
4
+ import { runFunctionsPlugin } from "./plugins/run-functions.mjs";
5
+
6
+ export { clearConsolePlugin, customLoggingPlugin, runFunctionsPlugin, runProcessPlugin };
@@ -0,0 +1,8 @@
1
+ import { ResultPromise } from "execa";
2
+
3
+ //#region ../node-utils/src/process/run-npx.d.ts
4
+
5
+ type ExecaChildProcess = ResultPromise;
6
+ //#endregion
7
+ export { ExecaChildProcess };
8
+ //# sourceMappingURL=run-npx.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-npx.d.mts","names":[],"sources":["../../../../../node-utils/src/process/run-npx.ts"],"sourcesContent":[],"mappings":";;;;KA4CY,iBAAA,GAAoB"}
@@ -0,0 +1,7 @@
1
+ import { Plugin } from "esbuild";
2
+
3
+ //#region src/plugins/clear-console.d.ts
4
+ declare const clearConsolePlugin: Plugin;
5
+ //#endregion
6
+ export { clearConsolePlugin };
7
+ //# sourceMappingURL=clear-console.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clear-console.d.mts","names":[],"sources":["../../src/plugins/clear-console.ts"],"sourcesContent":[],"mappings":";;;cAEa,oBAAoB"}
@@ -0,0 +1,13 @@
1
+ //#region src/plugins/clear-console.ts
2
+ const clearConsolePlugin = {
3
+ name: "clear-console",
4
+ setup(build) {
5
+ build.onStart(() => {
6
+ console.clear();
7
+ });
8
+ }
9
+ };
10
+
11
+ //#endregion
12
+ export { clearConsolePlugin };
13
+ //# sourceMappingURL=clear-console.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clear-console.mjs","names":["clearConsolePlugin: Plugin"],"sources":["../../src/plugins/clear-console.ts"],"sourcesContent":["import type { Plugin } from 'esbuild'\n\nexport const clearConsolePlugin: Plugin = {\n\tname: 'clear-console',\n\tsetup(build) {\n\t\tbuild.onStart(() => {\n\t\t\tconsole.clear()\n\t\t})\n\t},\n}\n\n"],"mappings":";AAEA,MAAaA,qBAA6B;CACzC,MAAM;CACN,MAAM,OAAO;AACZ,QAAM,cAAc;AACnB,WAAQ,OAAO;IACd;;CAEH"}
@@ -0,0 +1,7 @@
1
+ import { Plugin } from "esbuild";
2
+
3
+ //#region src/plugins/custom-logging.d.ts
4
+ declare const customLoggingPlugin: Plugin;
5
+ //#endregion
6
+ export { customLoggingPlugin };
7
+ //# sourceMappingURL=custom-logging.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-logging.d.mts","names":[],"sources":["../../src/plugins/custom-logging.ts"],"sourcesContent":[],"mappings":";;;cAGa,qBAAqB"}
@@ -0,0 +1,35 @@
1
+ import { getWatchMode, startPersistentSpinner, startSpinner, stopPersistentSpinner, stopSpinner, updateStatus } from "@yohs/node-utils/console";
2
+
3
+ //#region src/plugins/custom-logging.ts
4
+ const customLoggingPlugin = {
5
+ name: "custom-logging",
6
+ setup(build) {
7
+ build.onStart(() => {
8
+ updateStatus("Building...");
9
+ if (getWatchMode()) startPersistentSpinner();
10
+ else startSpinner("Building TypeScript files");
11
+ });
12
+ build.onEnd((result) => {
13
+ if (getWatchMode()) stopPersistentSpinner();
14
+ else stopSpinner();
15
+ if (result.errors.length === 0) {
16
+ const warnings = result.warnings.length;
17
+ updateStatus(`Build successful${warnings > 0 ? ` (${warnings} warnings)` : ""}`);
18
+ if (getWatchMode()) startPersistentSpinner();
19
+ } else {
20
+ console.log(`❌ Build failed with ${result.errors.length} error(s)`);
21
+ result.errors.forEach((error, index) => {
22
+ console.log(` ${index + 1}. ${error.text}`);
23
+ });
24
+ if (getWatchMode()) {
25
+ updateStatus("Build failed - watching for changes...");
26
+ startPersistentSpinner();
27
+ }
28
+ }
29
+ });
30
+ }
31
+ };
32
+
33
+ //#endregion
34
+ export { customLoggingPlugin };
35
+ //# sourceMappingURL=custom-logging.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-logging.mjs","names":["customLoggingPlugin: Plugin"],"sources":["../../src/plugins/custom-logging.ts"],"sourcesContent":["import type { Plugin } from 'esbuild'\nimport { getWatchMode, startPersistentSpinner, startSpinner, stopPersistentSpinner, stopSpinner, updateStatus } from '@yohs/node-utils/console'\n\nexport const customLoggingPlugin: Plugin = {\n\tname: 'custom-logging',\n\tsetup(build) {\n\t\tbuild.onStart(() => {\n\t\t\tupdateStatus('Building...')\n\t\t\tif (getWatchMode()) startPersistentSpinner()\n\t\t\telse startSpinner('Building TypeScript files')\n\t\t})\n\n\t\tbuild.onEnd((result) => {\n\t\t\tif (getWatchMode()) stopPersistentSpinner()\n\t\t\telse stopSpinner()\n\n\t\t\tif (result.errors.length === 0) {\n\t\t\t\tconst warnings = result.warnings.length\n\t\t\t\tconst warningText = warnings > 0 ? ` (${warnings} warnings)` : ''\n\t\t\t\tupdateStatus(`Build successful${warningText}`)\n\n\t\t\t\tif (getWatchMode()) startPersistentSpinner()\n\t\t\t} else {\n\t\t\t\tconsole.log(`❌ Build failed with ${result.errors.length} error(s)`)\n\t\t\t\tresult.errors.forEach((error, index) => {\n\t\t\t\t\tconsole.log(` ${index + 1}. ${error.text}`)\n\t\t\t\t})\n\n\t\t\t\tif (getWatchMode()) {\n\t\t\t\t\tupdateStatus('Build failed - watching for changes...')\n\t\t\t\t\tstartPersistentSpinner()\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t},\n}\n\n"],"mappings":";;;AAGA,MAAaA,sBAA8B;CAC1C,MAAM;CACN,MAAM,OAAO;AACZ,QAAM,cAAc;AACnB,gBAAa,cAAc;AAC3B,OAAI,cAAc,CAAE,yBAAwB;OACvC,cAAa,4BAA4B;IAC7C;AAEF,QAAM,OAAO,WAAW;AACvB,OAAI,cAAc,CAAE,wBAAuB;OACtC,cAAa;AAElB,OAAI,OAAO,OAAO,WAAW,GAAG;IAC/B,MAAM,WAAW,OAAO,SAAS;AAEjC,iBAAa,mBADO,WAAW,IAAI,KAAK,SAAS,cAAc,KACjB;AAE9C,QAAI,cAAc,CAAE,yBAAwB;UACtC;AACN,YAAQ,IAAI,uBAAuB,OAAO,OAAO,OAAO,WAAW;AACnE,WAAO,OAAO,SAAS,OAAO,UAAU;AACvC,aAAQ,IAAI,MAAM,QAAQ,EAAE,IAAI,MAAM,OAAO;MAC5C;AAEF,QAAI,cAAc,EAAE;AACnB,kBAAa,yCAAyC;AACtD,6BAAwB;;;IAGzB;;CAEH"}
@@ -0,0 +1,10 @@
1
+ import { ProcessPluginOptions } from "./run-process.mjs";
2
+ import { FunctionsOptions } from "../gcp-utils/src/functions/run-functions.mjs";
3
+ import { Plugin } from "esbuild";
4
+
5
+ //#region src/plugins/run-functions.d.ts
6
+ type RunFunctionsPluginOptions = Omit<ProcessPluginOptions, 'runner'> & Omit<FunctionsOptions, 'source'>;
7
+ declare const runFunctionsPlugin: (options: RunFunctionsPluginOptions) => Plugin;
8
+ //#endregion
9
+ export { RunFunctionsPluginOptions, runFunctionsPlugin };
10
+ //# sourceMappingURL=run-functions.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-functions.d.mts","names":[],"sources":["../../src/plugins/run-functions.ts"],"sourcesContent":[],"mappings":";;;;;KA8BY,yBAAA,GACX,KAAK,kCACL,KAAK;cAEO,8BAA+B,8BAA4B"}
@@ -0,0 +1,26 @@
1
+ import { runProcessPlugin } from "./run-process.mjs";
2
+ import { createRequire } from "node:module";
3
+
4
+ //#region src/plugins/run-functions.ts
5
+ const requireModule = createRequire(import.meta.url);
6
+ let cachedRunner;
7
+ const resolveRunFunctions = () => {
8
+ if (cachedRunner) return cachedRunner;
9
+ try {
10
+ cachedRunner = requireModule("@yohs/gcp-utils/functions").runFunctions;
11
+ return cachedRunner;
12
+ } catch (error) {
13
+ throw new Error("runFunctionsPlugin requires @yohs/gcp-utils. Install it in your project to enable this plugin.", { cause: error instanceof Error ? error : void 0 });
14
+ }
15
+ };
16
+ const runFunctionsPlugin = (options) => runProcessPlugin({
17
+ ...options,
18
+ runner: (filePath) => resolveRunFunctions()({
19
+ ...options,
20
+ source: filePath
21
+ })
22
+ });
23
+
24
+ //#endregion
25
+ export { runFunctionsPlugin };
26
+ //# sourceMappingURL=run-functions.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-functions.mjs","names":["cachedRunner: FunctionsProcessFactory | undefined"],"sources":["../../src/plugins/run-functions.ts"],"sourcesContent":["import { createRequire } from 'node:module'\nimport type { Plugin } from 'esbuild'\nimport { runProcessPlugin, type ProcessPluginOptions } from './run-process'\n\n// Functions framework process factory\nimport type { FunctionsOptions, FunctionsProcessFactory } from '@yohs/gcp-utils/functions'\n\n// lazy require\nconst requireModule = createRequire(import.meta.url)\nlet cachedRunner: FunctionsProcessFactory | undefined\n\nconst resolveRunFunctions = (): FunctionsProcessFactory => {\n\tif (cachedRunner) {\n\t\treturn cachedRunner\n\t}\n\n\ttry {\n\t\tconst mod = requireModule('@yohs/gcp-utils/functions') as {\n\t\t\trunFunctions: FunctionsProcessFactory\n\t\t}\n\n\t\tcachedRunner = mod.runFunctions\n\t\treturn cachedRunner\n\t} catch (error) {\n\t\tthrow new Error('runFunctionsPlugin requires @yohs/gcp-utils. Install it in your project to enable this plugin.',\n\t\t\t{ cause: error instanceof Error ? error : undefined },\n\t\t)\n\t}\n}\n\nexport type RunFunctionsPluginOptions =\n\tOmit<ProcessPluginOptions, 'runner'> &\n\tOmit<FunctionsOptions, 'source'>\n\nexport const runFunctionsPlugin = (options: RunFunctionsPluginOptions): Plugin =>\n\trunProcessPlugin({\n\t\t...options,\n\t\trunner: (filePath) => resolveRunFunctions()({ ...options, source: filePath }),\n\t})\n\nexport type { FunctionsOptions } from '@yohs/gcp-utils/functions'\n"],"mappings":";;;;AAQA,MAAM,gBAAgB,cAAc,OAAO,KAAK,IAAI;AACpD,IAAIA;AAEJ,MAAM,4BAAqD;AAC1D,KAAI,aACH,QAAO;AAGR,KAAI;AAKH,iBAJY,cAAc,4BAA4B,CAInC;AACnB,SAAO;UACC,OAAO;AACf,QAAM,IAAI,MAAM,kGACf,EAAE,OAAO,iBAAiB,QAAQ,QAAQ,QAAW,CACrD;;;AAQH,MAAa,sBAAsB,YAClC,iBAAiB;CAChB,GAAG;CACH,SAAS,aAAa,qBAAqB,CAAC;EAAE,GAAG;EAAS,QAAQ;EAAU,CAAC;CAC7E,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { ExecaChildProcess } from "../node-utils/src/process/run-npx.mjs";
2
+ import { styleText } from "node:util";
3
+ import { Plugin } from "esbuild";
4
+
5
+ //#region src/plugins/run-process.d.ts
6
+ type StyleFormat = Parameters<typeof styleText>[0];
7
+ interface ProcessPluginOptions {
8
+ runner: (filePath: string) => ExecaChildProcess;
9
+ label?: string;
10
+ labelStyle?: StyleFormat;
11
+ }
12
+ type ProcessPluginFactory = (options: ProcessPluginOptions) => Plugin;
13
+ declare const runProcessPlugin: ProcessPluginFactory;
14
+ //#endregion
15
+ export { ProcessPluginOptions, runProcessPlugin };
16
+ //# sourceMappingURL=run-process.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-process.d.mts","names":[],"sources":["../../src/plugins/run-process.ts"],"sourcesContent":[],"mappings":";;;;;KACK,WAAA,GAAc,kBAAkB;UAOpB,oBAAA;EAPZ,MAAA,EAAA,CAAA,QAAW,EAAA,MAAqB,EAAA,GAQN,iBARF;EAOZ,KAAA,CAAA,EAAA,MAAA;EAOL,UAAA,CAAA,EAJE,WAIkB;AAEhC;KAFY,oBAAA,aAAiC,yBAAyB;cAEzD,kBAAkB"}
@@ -0,0 +1,54 @@
1
+ import { updateStatus } from "@yohs/node-utils/console";
2
+ import { styleText } from "node:util";
3
+
4
+ //#region src/plugins/run-process.ts
5
+ const runProcessPlugin = (options) => {
6
+ const { runner, label, labelStyle } = options;
7
+ function makeLabel(msg) {
8
+ return `${label ? `${styleText(labelStyle ?? "white", label)} ` : ""}${msg}`;
9
+ }
10
+ const setup = (build) => {
11
+ let currentProcess = null;
12
+ build.onEnd(async (result) => {
13
+ if (result.errors.length > 0) return;
14
+ if (currentProcess) {
15
+ updateStatus(makeLabel("restarting..."));
16
+ currentProcess.kill("SIGTERM");
17
+ currentProcess = null;
18
+ await new Promise((resolve) => setTimeout(resolve, 100));
19
+ }
20
+ try {
21
+ updateStatus(makeLabel("starting..."));
22
+ currentProcess = runner(build.initialOptions.outfile || "dist/index.js");
23
+ currentProcess.on("spawn", () => {
24
+ updateStatus(makeLabel("watching for changes..."));
25
+ });
26
+ currentProcess.on("error", (error) => {
27
+ console.error(makeLabel("failed to start:"), error.message);
28
+ updateStatus(makeLabel("failed to start"));
29
+ });
30
+ currentProcess.on("exit", (code) => {
31
+ if (code !== 0) updateStatus(makeLabel(`exited with code ${code}`));
32
+ });
33
+ } catch (error) {
34
+ const err = error;
35
+ console.error(makeLabel("failed to start:"), err.message);
36
+ updateStatus(makeLabel("failed to start"));
37
+ }
38
+ });
39
+ process.on("exit", () => {
40
+ if (currentProcess) {
41
+ updateStatus(makeLabel("shutting down..."));
42
+ currentProcess.kill("SIGTERM");
43
+ }
44
+ });
45
+ };
46
+ return {
47
+ name: "run-process",
48
+ setup
49
+ };
50
+ };
51
+
52
+ //#endregion
53
+ export { runProcessPlugin };
54
+ //# sourceMappingURL=run-process.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-process.mjs","names":["runProcessPlugin: ProcessPluginFactory","currentProcess: ExecaChildProcess | null"],"sources":["../../src/plugins/run-process.ts"],"sourcesContent":["import { styleText } from 'node:util'\ntype StyleFormat = Parameters<typeof styleText>[0]\nimport type { ExecaChildProcess } from '@yohs/node-utils/process'\nimport { updateStatus } from '@yohs/node-utils/console'\n\n// ESbuild\nimport type { Plugin, PluginBuild } from 'esbuild'\n\nexport interface ProcessPluginOptions {\n\trunner: (filePath: string) => ExecaChildProcess\n\tlabel?: string\n\tlabelStyle?: StyleFormat\n}\n\n\nexport type ProcessPluginFactory = (options: ProcessPluginOptions) => Plugin\n\nexport const runProcessPlugin: ProcessPluginFactory = (options: ProcessPluginOptions): Plugin => {\n\tconst { runner, label, labelStyle } = options\n\n\tfunction makeLabel(msg: string): string {\n\t\tconst style: StyleFormat = labelStyle ?? 'white'\n\t\tconst prefix = label ? `${styleText(style, label)} ` : ''\n\t\treturn `${prefix}${msg}`\n\t}\n\n\tconst setup = (build: PluginBuild) => {\n\t\tlet currentProcess: ExecaChildProcess | null = null\n\n\t\tbuild.onEnd(async (result) => {\n\t\t\tif (result.errors.length > 0) return\n\n\t\t\tif (currentProcess) {\n\t\t\t\tupdateStatus(makeLabel('restarting...'))\n\t\t\t\tcurrentProcess.kill('SIGTERM')\n\t\t\t\tcurrentProcess = null\n\t\t\t\tawait new Promise((resolve) => setTimeout(resolve, 100))\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tupdateStatus(makeLabel('starting...'))\n\t\t\t\tcurrentProcess = runner(build.initialOptions.outfile || 'dist/index.js')\n\n\t\t\t\tcurrentProcess.on('spawn', () => {\n\t\t\t\t\tupdateStatus(makeLabel('watching for changes...'))\n\t\t\t\t})\n\n\t\t\t\tcurrentProcess.on('error', (error) => {\n\t\t\t\t\tconsole.error(makeLabel('failed to start:'), error.message)\n\t\t\t\t\tupdateStatus(makeLabel('failed to start'))\n\t\t\t\t})\n\n\t\t\t\tcurrentProcess.on('exit', (code) => {\n\t\t\t\t\tif (code !== 0) {\n\t\t\t\t\t\tupdateStatus(makeLabel(`exited with code ${code}`))\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t} catch (error) {\n\t\t\t\tconst err = error as Error\n\t\t\t\tconsole.error(makeLabel('failed to start:'), err.message)\n\t\t\t\tupdateStatus(makeLabel('failed to start'))\n\t\t\t}\n\t\t})\n\n\t\tprocess.on('exit', () => {\n\t\t\tif (currentProcess) {\n\t\t\t\tupdateStatus(makeLabel('shutting down...'))\n\t\t\t\tcurrentProcess.kill('SIGTERM')\n\t\t\t}\n\t\t})\n\t}\n\n\tconst plugin: Plugin = { name: 'run-process', setup }\n\treturn plugin\n}\n\n"],"mappings":";;;;AAiBA,MAAaA,oBAA0C,YAA0C;CAChG,MAAM,EAAE,QAAQ,OAAO,eAAe;CAEtC,SAAS,UAAU,KAAqB;AAGvC,SAAO,GADQ,QAAQ,GAAG,UADC,cAAc,SACE,MAAM,CAAC,KAAK,KACpC;;CAGpB,MAAM,SAAS,UAAuB;EACrC,IAAIC,iBAA2C;AAE/C,QAAM,MAAM,OAAO,WAAW;AAC7B,OAAI,OAAO,OAAO,SAAS,EAAG;AAE9B,OAAI,gBAAgB;AACnB,iBAAa,UAAU,gBAAgB,CAAC;AACxC,mBAAe,KAAK,UAAU;AAC9B,qBAAiB;AACjB,UAAM,IAAI,SAAS,YAAY,WAAW,SAAS,IAAI,CAAC;;AAGzD,OAAI;AACH,iBAAa,UAAU,cAAc,CAAC;AACtC,qBAAiB,OAAO,MAAM,eAAe,WAAW,gBAAgB;AAExE,mBAAe,GAAG,eAAe;AAChC,kBAAa,UAAU,0BAA0B,CAAC;MACjD;AAEF,mBAAe,GAAG,UAAU,UAAU;AACrC,aAAQ,MAAM,UAAU,mBAAmB,EAAE,MAAM,QAAQ;AAC3D,kBAAa,UAAU,kBAAkB,CAAC;MACzC;AAEF,mBAAe,GAAG,SAAS,SAAS;AACnC,SAAI,SAAS,EACZ,cAAa,UAAU,oBAAoB,OAAO,CAAC;MAEnD;YACM,OAAO;IACf,MAAM,MAAM;AACZ,YAAQ,MAAM,UAAU,mBAAmB,EAAE,IAAI,QAAQ;AACzD,iBAAa,UAAU,kBAAkB,CAAC;;IAE1C;AAEF,UAAQ,GAAG,cAAc;AACxB,OAAI,gBAAgB;AACnB,iBAAa,UAAU,mBAAmB,CAAC;AAC3C,mBAAe,KAAK,UAAU;;IAE9B;;AAIH,QADuB;EAAE,MAAM;EAAe;EAAO"}
@@ -0,0 +1,5 @@
1
+ import { clearConsolePlugin } from "./plugins/clear-console.mjs";
2
+ import { customLoggingPlugin } from "./plugins/custom-logging.mjs";
3
+ import { ProcessPluginOptions, runProcessPlugin } from "./plugins/run-process.mjs";
4
+ import { RunFunctionsPluginOptions, runFunctionsPlugin } from "./plugins/run-functions.mjs";
5
+ export { type ProcessPluginOptions, type RunFunctionsPluginOptions, clearConsolePlugin, customLoggingPlugin, runFunctionsPlugin, runProcessPlugin };
@@ -0,0 +1,6 @@
1
+ import { clearConsolePlugin } from "./plugins/clear-console.mjs";
2
+ import { customLoggingPlugin } from "./plugins/custom-logging.mjs";
3
+ import { runProcessPlugin } from "./plugins/run-process.mjs";
4
+ import { runFunctionsPlugin } from "./plugins/run-functions.mjs";
5
+
6
+ export { clearConsolePlugin, customLoggingPlugin, runFunctionsPlugin, runProcessPlugin };
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@yohs/esbuild-utils",
3
+ "version": "0.2.0",
4
+ "description": "Reusable esbuild plugins, runners, and CLI helpers",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "engines": {
8
+ "node": ">=20"
9
+ },
10
+ "main": "./dist/index.mjs",
11
+ "module": "./dist/index.mjs",
12
+ "types": "./dist/index.d.mts",
13
+ "exports": {
14
+ ".": "./dist/index.mjs",
15
+ "./plugins": "./dist/plugins.mjs",
16
+ "./package.json": "./package.json"
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "README.md"
21
+ ],
22
+ "sideEffects": false,
23
+ "dependencies": {
24
+ "chalk": "^5.6.2",
25
+ "@yohs/node-utils": "0.2.0"
26
+ },
27
+ "peerDependencies": {
28
+ "esbuild": "^0.24.0",
29
+ "@yohs/gcp-utils": "0.1.1"
30
+ },
31
+ "peerDependenciesMeta": {
32
+ "@yohs/gcp-utils": {
33
+ "optional": true
34
+ }
35
+ },
36
+ "devDependencies": {
37
+ "esbuild": "^0.24.0",
38
+ "rimraf": "^6.1.2",
39
+ "tsdown": "^0.16.6",
40
+ "typescript": "^5.9.3",
41
+ "@yohs/gcp-utils": "0.1.1"
42
+ },
43
+ "publishConfig": {
44
+ "access": "public"
45
+ },
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "https://github.com/YLS-/ts-utils.git",
49
+ "directory": "packages/esbuild-utils"
50
+ },
51
+ "homepage": "https://github.com/YLS-/ts-utils/tree/main/packages/esbuild-utils",
52
+ "bugs": {
53
+ "url": "https://github.com/YLS-/ts-utils/issues"
54
+ },
55
+ "scripts": {
56
+ "clean": "rimraf dist",
57
+ "build": "tsdown",
58
+ "typecheck": "tsc --noEmit",
59
+ "lint": "eslint 'src/**/*.{ts,tsx}'",
60
+ "test": "vitest run"
61
+ }
62
+ }