@storm-software/esbuild 0.0.1 → 0.1.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.
@@ -0,0 +1,230 @@
1
+ export { build } from './build.js';
2
+ export { DEFAULT_BUILD_OPTIONS, adapterConfig } from './config.js';
3
+ export { ESBuildOptions, ESBuildResolvedOptions, ESBuildResult } from './types.js';
4
+ import { LogType } from 'consola';
5
+ import * as execa from 'execa';
6
+ import 'esbuild';
7
+ import '@nx/devkit';
8
+ import 'nx/src/utils/find-workspace-root';
9
+
10
+ declare function handleSync<R, E = Error>(fn: () => R): R | E;
11
+ declare function handleAsync<R, E = Error>(fn: () => Promise<R> | R): Promise<R | E>;
12
+ /**
13
+ * Executes a function, catches exceptions, and returns any outcome.
14
+ * @param fn - to be executed
15
+ */
16
+ declare const handle: typeof handleSync & {
17
+ async: typeof handleAsync;
18
+ };
19
+
20
+ declare const skip: unique symbol;
21
+ type SyncTransformer<I, R> = (item: I, key: number) => R | typeof skip;
22
+ type ASyncTransformer<I, R> = (item: I, key: number) => Promise<R | typeof skip>;
23
+ declare function transduceSync<I, R>(list: Array<I>, transformer: SyncTransformer<I, R>): R[];
24
+ declare function transduceAsync<I, R>(list: Array<I>, transformer: ASyncTransformer<I, R>): Promise<R[]>;
25
+ declare const Filter: <I>(filter: (item: I) => boolean) => (item: I) => I;
26
+ declare const Mapper: <I, R>(mapper: (item: I) => R) => (item: I) => R;
27
+ /**
28
+ * Transducers enable efficient data processing. They allow the composition of
29
+ * mappers and filters to be applied on a list. And this is applied in a single
30
+ * pass, that's the efficient pipeline processing.
31
+ *
32
+ * (does not reduce at the same time)
33
+ *
34
+ * @see https://medium.com/javascript-scene/7985330fe73d
35
+ *
36
+ * @param list - to transform
37
+ * @param transformer - to apply
38
+
39
+ * @example
40
+ * ```ts
41
+ * const filterEven = Filter(<U>(unit: U) =>
42
+ * typeof unit === 'number' ? !(unit % 2) : true,
43
+ * )
44
+ * const mapTimes2 = Mapper(<U>(unit: U) =>
45
+ * typeof unit === 'number' ? unit * 2 : unit,
46
+ * )
47
+ * const mapString = Mapper(<U>(unit: U) => `${unit}`)
48
+ *
49
+ * const test0 = transduce(
50
+ * [1, 2, 3, 4, 5, 6, 7, 'a'],
51
+ * pipe(filterEven, mapTimes2, mapTimes2, mapString, filterEven),
52
+ * )
53
+ * ```
54
+ */
55
+ declare const transduce: typeof transduceSync & {
56
+ async: typeof transduceAsync;
57
+ };
58
+
59
+ type FunctionLike<P extends Array<any> = any, R = any> = (...args: P) => R;
60
+ type Await<P> = P extends Promise<infer A> ? A : P;
61
+ /**
62
+ * Pipe the input and output of functions.
63
+ *
64
+ * @param fn - parameter-taking function
65
+ * @param fns - subsequent piped functions
66
+ * @returns
67
+ */
68
+ declare const pipe: PipeMultiSync & {
69
+ async: PipeMultiAsync;
70
+ };
71
+ declare type PipeMultiSync = {
72
+ <R0, P extends any[]>(...fns: [FunctionLike<P, R0>]): FunctionLike<P, R0>;
73
+ <R0, R1, P extends any[]>(...fns: [FunctionLike<P, R0>, FunctionLike<[R0], R1>]): FunctionLike<P, R1>;
74
+ <R0, R1, R2, P extends any[]>(...fns: [
75
+ FunctionLike<P, R0>,
76
+ FunctionLike<[R0], R1>,
77
+ FunctionLike<[R1], R2>
78
+ ]): FunctionLike<P, R2>;
79
+ <R0, R1, R2, R3, P extends any[]>(...fns: [
80
+ FunctionLike<P, R0>,
81
+ FunctionLike<[R0], R1>,
82
+ FunctionLike<[R1], R2>,
83
+ FunctionLike<[R2], R3>
84
+ ]): FunctionLike<P, R3>;
85
+ <R0, R1, R2, R3, R4, P extends any[]>(...fns: [
86
+ FunctionLike<P, R0>,
87
+ FunctionLike<[R0], R1>,
88
+ FunctionLike<[R1], R2>,
89
+ FunctionLike<[R2], R3>,
90
+ FunctionLike<[R3], R4>
91
+ ]): FunctionLike<P, R4>;
92
+ <R0, R1, R2, R3, R4, R5, P extends any[]>(...fns: [
93
+ FunctionLike<P, R0>,
94
+ FunctionLike<[R0], R1>,
95
+ FunctionLike<[R1], R2>,
96
+ FunctionLike<[R2], R3>,
97
+ FunctionLike<[R3], R4>,
98
+ FunctionLike<[R4], R5>
99
+ ]): FunctionLike<P, R5>;
100
+ <R0, R1, R2, R3, R4, R5, R6, P extends any[]>(...fns: [
101
+ FunctionLike<P, R0>,
102
+ FunctionLike<[R0], R1>,
103
+ FunctionLike<[R1], R2>,
104
+ FunctionLike<[R2], R3>,
105
+ FunctionLike<[R3], R4>,
106
+ FunctionLike<[R4], R5>,
107
+ FunctionLike<[R5], R6>
108
+ ]): FunctionLike<P, R6>;
109
+ <R0, R1, R2, R3, R4, R5, R6, R7, P extends any[]>(...fns: [
110
+ FunctionLike<P, R0>,
111
+ FunctionLike<[R0], R1>,
112
+ FunctionLike<[R1], R2>,
113
+ FunctionLike<[R2], R3>,
114
+ FunctionLike<[R3], R4>,
115
+ FunctionLike<[R4], R5>,
116
+ FunctionLike<[R5], R6>,
117
+ FunctionLike<[R6], R7>
118
+ ]): FunctionLike<P, R7>;
119
+ <R0, R1, R2, R3, R4, R5, R6, R7, R8, P extends any[]>(...fns: [
120
+ FunctionLike<P, R0>,
121
+ FunctionLike<[R0], R1>,
122
+ FunctionLike<[R1], R2>,
123
+ FunctionLike<[R2], R3>,
124
+ FunctionLike<[R3], R4>,
125
+ FunctionLike<[R4], R5>,
126
+ FunctionLike<[R5], R6>,
127
+ FunctionLike<[R6], R7>,
128
+ FunctionLike<[R7], R8>
129
+ ]): FunctionLike<P, R8>;
130
+ <R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, P extends any[]>(...fns: [
131
+ FunctionLike<P, R0>,
132
+ FunctionLike<[R0], R1>,
133
+ FunctionLike<[R1], R2>,
134
+ FunctionLike<[R2], R3>,
135
+ FunctionLike<[R3], R4>,
136
+ FunctionLike<[R4], R5>,
137
+ FunctionLike<[R5], R6>,
138
+ FunctionLike<[R6], R7>,
139
+ FunctionLike<[R7], R8>,
140
+ FunctionLike<[R8], R9>
141
+ ]): FunctionLike<P, R9>;
142
+ };
143
+ declare type PipeMultiAsync = {
144
+ <R0, P extends any[]>(...fns: [FunctionLike<P, R0>]): FunctionLike<P, Promise<Await<R0>>>;
145
+ <R0, R1, P extends any[]>(...fns: [FunctionLike<P, R0>, FunctionLike<[Await<R0>], R1>]): FunctionLike<P, Promise<Await<R1>>>;
146
+ <R0, R1, R2, P extends any[]>(...fns: [
147
+ FunctionLike<P, R0>,
148
+ FunctionLike<[Await<R0>], R1>,
149
+ FunctionLike<[Await<R1>], R2>
150
+ ]): FunctionLike<P, Promise<Await<R2>>>;
151
+ <R0, R1, R2, R3, P extends any[]>(...fns: [
152
+ FunctionLike<P, R0>,
153
+ FunctionLike<[Await<R0>], R1>,
154
+ FunctionLike<[Await<R1>], R2>,
155
+ FunctionLike<[Await<R2>], R3>
156
+ ]): FunctionLike<P, Promise<Await<R3>>>;
157
+ <R0, R1, R2, R3, R4, P extends any[]>(...fns: [
158
+ FunctionLike<P, R0>,
159
+ FunctionLike<[Await<R0>], R1>,
160
+ FunctionLike<[Await<R1>], R2>,
161
+ FunctionLike<[Await<R2>], R3>,
162
+ FunctionLike<[Await<R3>], R4>
163
+ ]): FunctionLike<P, Promise<Await<R4>>>;
164
+ <R0, R1, R2, R3, R4, R5, P extends any[]>(...fns: [
165
+ FunctionLike<P, R0>,
166
+ FunctionLike<[Await<R0>], R1>,
167
+ FunctionLike<[Await<R1>], R2>,
168
+ FunctionLike<[Await<R2>], R3>,
169
+ FunctionLike<[Await<R3>], R4>,
170
+ FunctionLike<[Await<R4>], R5>
171
+ ]): FunctionLike<P, Promise<Await<R5>>>;
172
+ <R0, R1, R2, R3, R4, R5, R6, P extends any[]>(...fns: [
173
+ FunctionLike<P, R0>,
174
+ FunctionLike<[Await<R0>], R1>,
175
+ FunctionLike<[Await<R1>], R2>,
176
+ FunctionLike<[Await<R2>], R3>,
177
+ FunctionLike<[Await<R3>], R4>,
178
+ FunctionLike<[Await<R4>], R5>,
179
+ FunctionLike<[Await<R5>], R6>
180
+ ]): FunctionLike<P, Promise<Await<R6>>>;
181
+ <R0, R1, R2, R3, R4, R5, R6, R7, P extends any[]>(...fns: [
182
+ FunctionLike<P, R0>,
183
+ FunctionLike<[Await<R0>], R1>,
184
+ FunctionLike<[Await<R1>], R2>,
185
+ FunctionLike<[Await<R2>], R3>,
186
+ FunctionLike<[Await<R3>], R4>,
187
+ FunctionLike<[Await<R4>], R5>,
188
+ FunctionLike<[Await<R5>], R6>,
189
+ FunctionLike<[Await<R6>], R7>
190
+ ]): FunctionLike<P, Promise<Await<R7>>>;
191
+ <R0, R1, R2, R3, R4, R5, R6, R7, R8, P extends any[]>(...fns: [
192
+ FunctionLike<P, R0>,
193
+ FunctionLike<[Await<R0>], R1>,
194
+ FunctionLike<[Await<R1>], R2>,
195
+ FunctionLike<[Await<R2>], R3>,
196
+ FunctionLike<[Await<R3>], R4>,
197
+ FunctionLike<[Await<R4>], R5>,
198
+ FunctionLike<[Await<R5>], R6>,
199
+ FunctionLike<[Await<R6>], R7>,
200
+ FunctionLike<[Await<R7>], R8>
201
+ ]): FunctionLike<P, Promise<Await<R8>>>;
202
+ <R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, P extends any[]>(...fns: [
203
+ FunctionLike<P, R0>,
204
+ FunctionLike<[Await<R0>], R1>,
205
+ FunctionLike<[Await<R1>], R2>,
206
+ FunctionLike<[Await<R2>], R3>,
207
+ FunctionLike<[Await<R3>], R4>,
208
+ FunctionLike<[Await<R4>], R5>,
209
+ FunctionLike<[Await<R5>], R6>,
210
+ FunctionLike<[Await<R6>], R7>,
211
+ FunctionLike<[Await<R7>], R8>,
212
+ FunctionLike<[Await<R8>], R9>
213
+ ]): FunctionLike<P, Promise<Await<R9>>>;
214
+ };
215
+
216
+ /**
217
+ * Writes a log message to the console.
218
+ *
219
+ * @param type - The type of log message.
220
+ * @param args - The arguments to log.
221
+ */
222
+ declare function writeLog(type: LogType, ...args: string[]): void;
223
+
224
+ declare function run(command: string): execa.ResultPromise<{
225
+ preferLocal: true;
226
+ shell: true;
227
+ stdio: "inherit";
228
+ }>;
229
+
230
+ export { Filter, Mapper, type PipeMultiAsync, type PipeMultiSync, handle, pipe, run, skip, transduce, writeLog };
package/dist/index.js ADDED
@@ -0,0 +1,38 @@
1
+ import {
2
+ Filter,
3
+ Mapper,
4
+ build,
5
+ handle,
6
+ pipe,
7
+ skip,
8
+ transduce
9
+ } from "./chunk-YGD5JBOH.js";
10
+ import "./chunk-RKSGVSXZ.js";
11
+ import "./chunk-4TW4ZA3I.js";
12
+ import {
13
+ run
14
+ } from "./chunk-5JHKW6MG.js";
15
+ import {
16
+ DEFAULT_BUILD_OPTIONS,
17
+ adapterConfig
18
+ } from "./chunk-ELGZJRET.js";
19
+ import "./chunk-GGNOJ77I.js";
20
+ import "./chunk-PCGRI6Z6.js";
21
+ import {
22
+ writeLog
23
+ } from "./chunk-YIAZ64WG.js";
24
+ import "./chunk-LVDPGHWK.js";
25
+ import "./chunk-3GQAWCBQ.js";
26
+ export {
27
+ DEFAULT_BUILD_OPTIONS,
28
+ Filter,
29
+ Mapper,
30
+ adapterConfig,
31
+ build,
32
+ handle,
33
+ pipe,
34
+ run,
35
+ skip,
36
+ transduce,
37
+ writeLog
38
+ };
package/dist/types.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";require('./chunk-SFZRYJZ2.cjs');
@@ -0,0 +1,19 @@
1
+ import { ProjectGraph, ProjectsConfigurations } from '@nx/devkit';
2
+ import * as esbuild from 'esbuild';
3
+ import { WorkspaceTypeAndRoot } from 'nx/src/utils/find-workspace-root';
4
+
5
+ type ESBuildOptions = Omit<esbuild.BuildOptions, "outbase" | "outfile"> & {
6
+ projectRoot: string;
7
+ name?: string;
8
+ emitTypes?: boolean;
9
+ emitMetafile?: boolean;
10
+ };
11
+ type ESBuildResult = esbuild.BuildResult;
12
+ type ESBuildResolvedOptions = ESBuildOptions & Required<Pick<ESBuildOptions, "name" | "outdir">> & {
13
+ workspaceRoot: WorkspaceTypeAndRoot;
14
+ projectName: string;
15
+ projectGraph: ProjectGraph;
16
+ projectConfigurations: ProjectsConfigurations;
17
+ };
18
+
19
+ export type { ESBuildOptions, ESBuildResolvedOptions, ESBuildResult };
@@ -0,0 +1,19 @@
1
+ import { ProjectGraph, ProjectsConfigurations } from '@nx/devkit';
2
+ import * as esbuild from 'esbuild';
3
+ import { WorkspaceTypeAndRoot } from 'nx/src/utils/find-workspace-root';
4
+
5
+ type ESBuildOptions = Omit<esbuild.BuildOptions, "outbase" | "outfile"> & {
6
+ projectRoot: string;
7
+ name?: string;
8
+ emitTypes?: boolean;
9
+ emitMetafile?: boolean;
10
+ };
11
+ type ESBuildResult = esbuild.BuildResult;
12
+ type ESBuildResolvedOptions = ESBuildOptions & Required<Pick<ESBuildOptions, "name" | "outdir">> & {
13
+ workspaceRoot: WorkspaceTypeAndRoot;
14
+ projectName: string;
15
+ projectGraph: ProjectGraph;
16
+ projectConfigurations: ProjectsConfigurations;
17
+ };
18
+
19
+ export type { ESBuildOptions, ESBuildResolvedOptions, ESBuildResult };
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ import "./chunk-GGNOJ77I.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/esbuild",
3
- "version": "0.0.1",
3
+ "version": "0.1.0",
4
4
  "type": "module",
5
5
  "description": "A package containing `esbuild` utilities for building Storm Software libraries and applications",
6
6
  "repository": {
@@ -8,7 +8,151 @@
8
8
  "url": "https://github.com/storm-software/storm-ops.git",
9
9
  "directory": "packages/esbuild"
10
10
  },
11
+ "homepage": "https://stormsoftware.com",
12
+ "bugs": {
13
+ "url": "https://github.com/storm-software/storm-ops/issues",
14
+ "email": "support@stormsoftware.com"
15
+ },
16
+ "author": {
17
+ "name": "Storm Software",
18
+ "email": "contact@stormsoftware.com",
19
+ "url": "https://stormsoftware.com"
20
+ },
21
+ "maintainers": [
22
+ {
23
+ "name": "Storm Software",
24
+ "email": "contact@stormsoftware.com",
25
+ "url": "https://stormsoftware.com"
26
+ },
27
+ {
28
+ "name": "Pat Sullivan",
29
+ "email": "admin@stormsoftware.com",
30
+ "url": "https://patsullivan.org"
31
+ }
32
+ ],
33
+ "contributors": [
34
+ {
35
+ "name": "Storm Software",
36
+ "email": "contact@stormsoftware.com",
37
+ "url": "https://stormsoftware.com"
38
+ }
39
+ ],
40
+ "funding": {
41
+ "type": "github",
42
+ "url": "https://github.com/sponsors/storm-software"
43
+ },
44
+ "license": "Apache-2.0",
11
45
  "private": false,
46
+ "packageManager": "pnpm@9.10.0",
47
+ "engines": {
48
+ "node": ">=22.4.0",
49
+ "pnpm": ">=9.10.0"
50
+ },
51
+ "main": "./dist/index.cjs",
52
+ "module": "./dist/index.js",
53
+ "exports": {
54
+ "./package.json": "./package.json",
55
+ "./index": {
56
+ "import": {
57
+ "types": "./dist/index.d.ts",
58
+ "default": "./dist/index.js"
59
+ },
60
+ "require": {
61
+ "types": "./dist/index.d.cts",
62
+ "default": "./dist/index.cjs"
63
+ },
64
+ "default": {
65
+ "types": "./dist/index.d.ts",
66
+ "default": "./dist/index.js"
67
+ }
68
+ },
69
+ "./build": {
70
+ "import": {
71
+ "types": "./dist/build.d.ts",
72
+ "default": "./dist/build.js"
73
+ },
74
+ "require": {
75
+ "types": "./dist/build.d.cts",
76
+ "default": "./dist/build.cjs"
77
+ },
78
+ "default": {
79
+ "types": "./dist/build.d.ts",
80
+ "default": "./dist/build.js"
81
+ }
82
+ },
83
+ "./config": {
84
+ "import": {
85
+ "types": "./dist/config.d.ts",
86
+ "default": "./dist/config.js"
87
+ },
88
+ "require": {
89
+ "types": "./dist/config.d.cts",
90
+ "default": "./dist/config.cjs"
91
+ },
92
+ "default": {
93
+ "types": "./dist/config.d.ts",
94
+ "default": "./dist/config.js"
95
+ }
96
+ },
97
+ "./types": {
98
+ "import": {
99
+ "types": "./dist/types.d.ts",
100
+ "default": "./dist/types.js"
101
+ },
102
+ "require": {
103
+ "types": "./dist/types.d.cts",
104
+ "default": "./dist/types.cjs"
105
+ },
106
+ "default": {
107
+ "types": "./dist/types.d.ts",
108
+ "default": "./dist/types.js"
109
+ }
110
+ },
111
+ "./plugins/*": {
112
+ "import": {
113
+ "types": "./dist/plugins/*.d.ts",
114
+ "default": "./dist/plugins/*.js"
115
+ },
116
+ "require": {
117
+ "types": "./dist/plugins/*.d.cts",
118
+ "default": "./dist/plugins/*.cjs"
119
+ },
120
+ "default": {
121
+ "types": "./dist/plugins/*.d.ts",
122
+ "default": "./dist/plugins/*.js"
123
+ }
124
+ },
125
+ ".": {
126
+ "import": {
127
+ "types": "./dist/index.d.ts",
128
+ "default": "./dist/index.js"
129
+ },
130
+ "require": {
131
+ "types": "./dist/index.d.cts",
132
+ "default": "./dist/index.cjs"
133
+ },
134
+ "default": {
135
+ "types": "./dist/index.d.ts",
136
+ "default": "./dist/index.js"
137
+ }
138
+ }
139
+ },
140
+ "types": "./dist/index.d.ts",
141
+ "files": [
142
+ "dist/**/*"
143
+ ],
144
+ "keywords": [
145
+ "storm",
146
+ "storm-ops",
147
+ "storm-stack",
148
+ "acidic",
149
+ "cyclone-ui",
150
+ "nextjs",
151
+ "graphql",
152
+ "sullivanpj",
153
+ "open-system",
154
+ "monorepo"
155
+ ],
12
156
  "peerDependencies": {
13
157
  "@microsoft/api-extractor": "^7.48.1",
14
158
  "@nx/devkit": "^20.2.2",
@@ -61,9 +205,11 @@
61
205
  "esbuild": "^0.24.0",
62
206
  "nx": "^20.2.2",
63
207
  "spdx-exceptions": "^2.5.0",
64
- "spdx-license-ids": "^3.0.20"
208
+ "spdx-license-ids": "^3.0.20",
209
+ "tsup": "^8.3.5"
65
210
  },
66
211
  "publishConfig": {
67
212
  "access": "public"
68
- }
213
+ },
214
+ "sideEffects": false
69
215
  }