@storm-software/esbuild 0.0.1 → 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 +9 -8
- package/dist/build.cjs +15 -0
- package/dist/build.cjs.map +1 -0
- package/dist/build.d.cts +14 -0
- package/dist/build.d.ts +14 -0
- package/dist/build.js +15 -0
- package/dist/build.js.map +1 -0
- package/dist/chunk-4ZPYEZJO.cjs +15 -0
- package/dist/chunk-4ZPYEZJO.cjs.map +1 -0
- package/dist/chunk-75SHW3Z4.cjs +320 -0
- package/dist/chunk-75SHW3Z4.cjs.map +1 -0
- package/dist/chunk-7U3F23ZZ.js +102 -0
- package/dist/chunk-7U3F23ZZ.js.map +1 -0
- package/dist/chunk-BF5W6GVP.cjs +53 -0
- package/dist/chunk-BF5W6GVP.cjs.map +1 -0
- package/dist/chunk-CMF37LBT.js +23 -0
- package/dist/chunk-CMF37LBT.js.map +1 -0
- package/dist/chunk-D5PRB2E2.cjs +40 -0
- package/dist/chunk-D5PRB2E2.cjs.map +1 -0
- package/dist/chunk-DFGHPRBD.cjs +29 -0
- package/dist/chunk-DFGHPRBD.cjs.map +1 -0
- package/dist/chunk-DRRPNILS.js +40 -0
- package/dist/chunk-DRRPNILS.js.map +1 -0
- package/dist/chunk-IDO67KEL.js +320 -0
- package/dist/chunk-IDO67KEL.js.map +1 -0
- package/dist/chunk-MUYXFAKB.cjs +1 -0
- package/dist/chunk-MUYXFAKB.cjs.map +1 -0
- package/dist/chunk-PRNPZZSV.cjs +23 -0
- package/dist/chunk-PRNPZZSV.cjs.map +1 -0
- package/dist/chunk-QBYHNHXL.js +127 -0
- package/dist/chunk-QBYHNHXL.js.map +1 -0
- package/dist/chunk-QNDLJ2W7.js +1 -0
- package/dist/chunk-QNDLJ2W7.js.map +1 -0
- package/dist/chunk-T5H2LBQA.cjs +127 -0
- package/dist/chunk-T5H2LBQA.cjs.map +1 -0
- package/dist/chunk-TTHABTDU.js +53 -0
- package/dist/chunk-TTHABTDU.js.map +1 -0
- package/dist/chunk-WCQVDF3K.js +14 -0
- package/dist/chunk-WCQVDF3K.js.map +1 -0
- package/dist/chunk-WGEGR3DF.cjs +14 -0
- package/dist/chunk-WGEGR3DF.cjs.map +1 -0
- package/dist/chunk-YQBU3FSL.js +29 -0
- package/dist/chunk-YQBU3FSL.js.map +1 -0
- package/dist/chunk-Z2M426LD.cjs +102 -0
- package/dist/chunk-Z2M426LD.cjs.map +1 -0
- package/dist/chunk-ZQ5NVDFP.js +15 -0
- package/dist/chunk-ZQ5NVDFP.js.map +1 -0
- package/dist/config.cjs +10 -0
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +15 -0
- package/dist/config.d.ts +15 -0
- package/dist/config.js +10 -0
- package/dist/config.js.map +1 -0
- package/dist/index.cjs +39 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +230 -0
- package/dist/index.d.ts +230 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/types.cjs +2 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +20 -0
- package/dist/types.d.ts +20 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +159 -3
- package/index.cjs +0 -19751
- package/index.js +0 -19748
- package/meta.cjs.json +0 -12657
- package/meta.esm.json +0 -12669
package/README.md
CHANGED
|
@@ -40,9 +40,10 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
|
|
|
40
40
|
|
|
41
41
|
<!-- START doctoc -->
|
|
42
42
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
43
|
+
|
|
43
44
|
## Table of Contents
|
|
44
45
|
|
|
45
|
-
- [Storm
|
|
46
|
+
- [Storm ESBuild Package](#storm-esbuild-package)
|
|
46
47
|
- [Installing](#installing)
|
|
47
48
|
- [Building](#building)
|
|
48
49
|
- [Running unit tests](#running-unit-tests)
|
|
@@ -63,23 +64,23 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
|
|
|
63
64
|
|
|
64
65
|
<!-- END header -->
|
|
65
66
|
|
|
66
|
-
# Storm
|
|
67
|
+
# Storm ESBuild Package
|
|
67
68
|
|
|
68
|
-
This package contains the
|
|
69
|
+
This package contains the ESBuild configuration for Storm Software projects.
|
|
69
70
|
|
|
70
71
|
## Installing
|
|
71
72
|
|
|
72
73
|
Using [pnpm](http://pnpm.io):
|
|
73
74
|
|
|
74
75
|
```bash
|
|
75
|
-
pnpm add -D @storm-software/
|
|
76
|
+
pnpm add -D @storm-software/esbuild
|
|
76
77
|
```
|
|
77
78
|
|
|
78
79
|
<details>
|
|
79
80
|
<summary>Using npm</summary>
|
|
80
81
|
|
|
81
82
|
```bash
|
|
82
|
-
npm install -D @storm-software/
|
|
83
|
+
npm install -D @storm-software/esbuild
|
|
83
84
|
```
|
|
84
85
|
|
|
85
86
|
</details>
|
|
@@ -88,18 +89,18 @@ npm install -D @storm-software/prettier
|
|
|
88
89
|
<summary>Using yarn</summary>
|
|
89
90
|
|
|
90
91
|
```bash
|
|
91
|
-
yarn add -D @storm-software/
|
|
92
|
+
yarn add -D @storm-software/esbuild
|
|
92
93
|
```
|
|
93
94
|
|
|
94
95
|
</details>
|
|
95
96
|
|
|
96
97
|
## Building
|
|
97
98
|
|
|
98
|
-
Run `nx build
|
|
99
|
+
Run `nx build esbuild` to build the library.
|
|
99
100
|
|
|
100
101
|
## Running unit tests
|
|
101
102
|
|
|
102
|
-
Run `nx test
|
|
103
|
+
Run `nx test esbuild` to execute the unit tests via [Jest](https://jestjs.io).
|
|
103
104
|
|
|
104
105
|
<!-- START footer -->
|
|
105
106
|
<!-- prettier-ignore-start -->
|
package/dist/build.cjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunk75SHW3Z4cjs = require('./chunk-75SHW3Z4.cjs');
|
|
4
|
+
require('./chunk-PRNPZZSV.cjs');
|
|
5
|
+
require('./chunk-BF5W6GVP.cjs');
|
|
6
|
+
require('./chunk-T5H2LBQA.cjs');
|
|
7
|
+
require('./chunk-D5PRB2E2.cjs');
|
|
8
|
+
require('./chunk-Z2M426LD.cjs');
|
|
9
|
+
require('./chunk-4ZPYEZJO.cjs');
|
|
10
|
+
require('./chunk-DFGHPRBD.cjs');
|
|
11
|
+
require('./chunk-WGEGR3DF.cjs');
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
exports.build = _chunk75SHW3Z4cjs.build;
|
|
15
|
+
//# sourceMappingURL=build.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/storm-ops/storm-ops/packages/esbuild/dist/build.cjs"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACF,wCAAC","file":"/home/runner/work/storm-ops/storm-ops/packages/esbuild/dist/build.cjs"}
|
package/dist/build.d.cts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as esbuild from 'esbuild';
|
|
2
|
+
import { ESBuildOptions, ESBuildResolvedOptions } from './types.cjs';
|
|
3
|
+
import '@nx/devkit';
|
|
4
|
+
import 'nx/src/utils/find-workspace-root';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Execution pipeline that applies a set of actions
|
|
8
|
+
*
|
|
9
|
+
* @param options - the build options
|
|
10
|
+
* @returns the build result
|
|
11
|
+
*/
|
|
12
|
+
declare function build(options: ESBuildOptions[]): Promise<(readonly [ESBuildResolvedOptions, esbuild.BuildResult<any>])[]>;
|
|
13
|
+
|
|
14
|
+
export { build };
|
package/dist/build.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as esbuild from 'esbuild';
|
|
2
|
+
import { ESBuildOptions, ESBuildResolvedOptions } from './types.js';
|
|
3
|
+
import '@nx/devkit';
|
|
4
|
+
import 'nx/src/utils/find-workspace-root';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Execution pipeline that applies a set of actions
|
|
8
|
+
*
|
|
9
|
+
* @param options - the build options
|
|
10
|
+
* @returns the build result
|
|
11
|
+
*/
|
|
12
|
+
declare function build(options: ESBuildOptions[]): Promise<(readonly [ESBuildResolvedOptions, esbuild.BuildResult<any>])[]>;
|
|
13
|
+
|
|
14
|
+
export { build };
|
package/dist/build.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
build
|
|
3
|
+
} from "./chunk-IDO67KEL.js";
|
|
4
|
+
import "./chunk-CMF37LBT.js";
|
|
5
|
+
import "./chunk-TTHABTDU.js";
|
|
6
|
+
import "./chunk-QBYHNHXL.js";
|
|
7
|
+
import "./chunk-DRRPNILS.js";
|
|
8
|
+
import "./chunk-7U3F23ZZ.js";
|
|
9
|
+
import "./chunk-ZQ5NVDFP.js";
|
|
10
|
+
import "./chunk-YQBU3FSL.js";
|
|
11
|
+
import "./chunk-WCQVDF3K.js";
|
|
12
|
+
export {
|
|
13
|
+
build
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkWGEGR3DFcjs = require('./chunk-WGEGR3DF.cjs');
|
|
4
|
+
|
|
5
|
+
// src/utilities/log.ts
|
|
6
|
+
var _consola = require('consola');
|
|
7
|
+
function writeLog(type, ...args) {
|
|
8
|
+
_consola.consola[type]("[Storm]", ...args);
|
|
9
|
+
}
|
|
10
|
+
_chunkWGEGR3DFcjs.__name.call(void 0, writeLog, "writeLog");
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
exports.writeLog = writeLog;
|
|
15
|
+
//# sourceMappingURL=chunk-4ZPYEZJO.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/storm-ops/storm-ops/packages/esbuild/dist/chunk-4ZPYEZJO.cjs","../src/utilities/log.ts"],"names":["writeLog","type","args","consola"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACaA,kCAAsC;AAQ/B,SAASA,QAAAA,CAASC,IAAAA,EAAAA,GAAkBC,IAAAA,EAAc;AACvDC,EAAAA,gBAAAA,CAAQF,IAAAA,CAAAA,CAAM,SAAA,EAAA,GAAcC,IAAAA,CAAAA;AAC9B;AAFgBF,sCAAAA,QAAAA,EAAAA,UAAAA,CAAAA;ADfhB;AACA;AACE;AACF,4BAAC","file":"/home/runner/work/storm-ops/storm-ops/packages/esbuild/dist/chunk-4ZPYEZJO.cjs","sourcesContent":[null,"/*-------------------------------------------------------------------\n\n ⚡ Storm Software - Storm Stack\n\n This code was released as part of the Storm Stack project. Storm Stack\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/storm-ops\n Documentation: https://stormsoftware.com/projects/storm-ops/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/storm-ops/license\n\n -------------------------------------------------------------------*/\n\nimport { type LogType, consola } from \"consola\";\n\n/**\n * Writes a log message to the console.\n *\n * @param type - The type of log message.\n * @param args - The arguments to log.\n */\nexport function writeLog(type: LogType, ...args: string[]) {\n consola[type](\"[Storm]\", ...args);\n}\n"]}
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
var _chunkPRNPZZSVcjs = require('./chunk-PRNPZZSV.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkBF5W6GVPcjs = require('./chunk-BF5W6GVP.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkT5H2LBQAcjs = require('./chunk-T5H2LBQA.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkD5PRB2E2cjs = require('./chunk-D5PRB2E2.cjs');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunkZ2M426LDcjs = require('./chunk-Z2M426LD.cjs');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var _chunk4ZPYEZJOcjs = require('./chunk-4ZPYEZJO.cjs');
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
var _chunkDFGHPRBDcjs = require('./chunk-DFGHPRBD.cjs');
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
var _chunkWGEGR3DFcjs = require('./chunk-WGEGR3DF.cjs');
|
|
25
|
+
|
|
26
|
+
// src/build.ts
|
|
27
|
+
var _node = require('@humanfs/node');
|
|
28
|
+
var _devkit = require('@nx/devkit');
|
|
29
|
+
var _buildtools = require('@storm-software/build-tools');
|
|
30
|
+
var _configtools = require('@storm-software/config-tools');
|
|
31
|
+
var _chokidar = require('chokidar');
|
|
32
|
+
var _estoolkit = require('es-toolkit');
|
|
33
|
+
var _compat = require('es-toolkit/compat');
|
|
34
|
+
var _esbuild = require('esbuild'); var esbuild = _interopRequireWildcard(_esbuild);
|
|
35
|
+
var _globby = require('globby');
|
|
36
|
+
var _findworkspaceroot = require('nx/src/utils/find-workspace-root');
|
|
37
|
+
|
|
38
|
+
// src/utilities/helpers.ts
|
|
39
|
+
function handleSync(fn) {
|
|
40
|
+
try {
|
|
41
|
+
return fn();
|
|
42
|
+
} catch (error_) {
|
|
43
|
+
return error_;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
_chunkWGEGR3DFcjs.__name.call(void 0, handleSync, "handleSync");
|
|
47
|
+
async function handleAsync(fn) {
|
|
48
|
+
try {
|
|
49
|
+
return await fn();
|
|
50
|
+
} catch (error_) {
|
|
51
|
+
return error_;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
_chunkWGEGR3DFcjs.__name.call(void 0, handleAsync, "handleAsync");
|
|
55
|
+
var handle = handleSync;
|
|
56
|
+
handle.async = handleAsync;
|
|
57
|
+
var skip = Symbol("skip");
|
|
58
|
+
function transduceSync(list, transformer) {
|
|
59
|
+
const transduced = [];
|
|
60
|
+
for (const [i, element_] of list.entries()) {
|
|
61
|
+
const transformed = transformer(element_, i);
|
|
62
|
+
if (transformed !== skip) {
|
|
63
|
+
transduced[transduced.length] = transformed;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return transduced;
|
|
67
|
+
}
|
|
68
|
+
_chunkWGEGR3DFcjs.__name.call(void 0, transduceSync, "transduceSync");
|
|
69
|
+
async function transduceAsync(list, transformer) {
|
|
70
|
+
const transduced = [];
|
|
71
|
+
await Promise.all(list.entries().map(async ([i, element_]) => {
|
|
72
|
+
const transformed = await transformer(element_, i);
|
|
73
|
+
if (transformed !== skip) {
|
|
74
|
+
transduced[transduced.length] = transformed;
|
|
75
|
+
}
|
|
76
|
+
}));
|
|
77
|
+
return transduced;
|
|
78
|
+
}
|
|
79
|
+
_chunkWGEGR3DFcjs.__name.call(void 0, transduceAsync, "transduceAsync");
|
|
80
|
+
var Filter = /* @__PURE__ */ _chunkWGEGR3DFcjs.__name.call(void 0, (filter) => (item) => {
|
|
81
|
+
return filter(item) ? item : skip;
|
|
82
|
+
}, "Filter");
|
|
83
|
+
var Mapper = /* @__PURE__ */ _chunkWGEGR3DFcjs.__name.call(void 0, (mapper) => (item) => {
|
|
84
|
+
return mapper(item);
|
|
85
|
+
}, "Mapper");
|
|
86
|
+
var transduce = transduceSync;
|
|
87
|
+
transduce.async = transduceAsync;
|
|
88
|
+
function pipeSync(fn, ...fns) {
|
|
89
|
+
return (...args) => {
|
|
90
|
+
let result = fn(...args);
|
|
91
|
+
for (let i = 0; result !== skip && i < fns.length; ++i) {
|
|
92
|
+
result = _optionalChain([fns, 'access', _ => _[i], 'optionalCall', _2 => _2(result)]);
|
|
93
|
+
}
|
|
94
|
+
return result;
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
_chunkWGEGR3DFcjs.__name.call(void 0, pipeSync, "pipeSync");
|
|
98
|
+
function pipeAsync(fn, ...fns) {
|
|
99
|
+
return async (...args) => {
|
|
100
|
+
let result = await fn(...args);
|
|
101
|
+
for (let i = 0; result !== skip && i < fns.length; ++i) {
|
|
102
|
+
result = await _optionalChain([fns, 'access', _3 => _3[i], 'optionalCall', _4 => _4(result)]);
|
|
103
|
+
}
|
|
104
|
+
return result;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
_chunkWGEGR3DFcjs.__name.call(void 0, pipeAsync, "pipeAsync");
|
|
108
|
+
var pipe = pipeSync;
|
|
109
|
+
pipe.async = pipeAsync;
|
|
110
|
+
|
|
111
|
+
// src/build.ts
|
|
112
|
+
var resolveOptions = /* @__PURE__ */ _chunkWGEGR3DFcjs.__name.call(void 0, async (options) => {
|
|
113
|
+
const projectRoot = options.projectRoot;
|
|
114
|
+
const workspaceRoot = _findworkspaceroot.findWorkspaceRoot.call(void 0, projectRoot);
|
|
115
|
+
if (!workspaceRoot) {
|
|
116
|
+
throw new Error("Cannot find Nx workspace root");
|
|
117
|
+
}
|
|
118
|
+
const nxJsonPath = _devkit.joinPathFragments.call(void 0, workspaceRoot.dir, "nx.json");
|
|
119
|
+
if (!await _node.hfs.isFile(nxJsonPath)) {
|
|
120
|
+
throw new Error("Cannot find Nx workspace configuration");
|
|
121
|
+
}
|
|
122
|
+
const projectGraph = await _devkit.createProjectGraphAsync.call(void 0, {
|
|
123
|
+
exitOnError: true
|
|
124
|
+
});
|
|
125
|
+
const projectJsonPath = _devkit.joinPathFragments.call(void 0, workspaceRoot.dir, projectRoot, "project.json");
|
|
126
|
+
if (!await _node.hfs.isFile(projectJsonPath)) {
|
|
127
|
+
throw new Error("Cannot find project.json configuration");
|
|
128
|
+
}
|
|
129
|
+
const projectJson = await _node.hfs.json(projectJsonPath);
|
|
130
|
+
const projectName = projectJson.name;
|
|
131
|
+
const projectConfigurations = _devkit.readProjectsConfigurationFromProjectGraph.call(void 0, projectGraph);
|
|
132
|
+
if (!_optionalChain([projectConfigurations, 'optionalAccess', _5 => _5.projects, 'optionalAccess', _6 => _6[projectName]])) {
|
|
133
|
+
throw new Error("The Build process failed because the project does not have a valid configuration in the project.json file. Check if the file exists in the root of the project.");
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
..._chunkD5PRB2E2cjs.DEFAULT_BUILD_OPTIONS,
|
|
137
|
+
format: "cjs",
|
|
138
|
+
outExtension: {
|
|
139
|
+
".js": ".js"
|
|
140
|
+
},
|
|
141
|
+
resolveExtensions: [
|
|
142
|
+
".ts",
|
|
143
|
+
".js",
|
|
144
|
+
".node"
|
|
145
|
+
],
|
|
146
|
+
mainFields: [
|
|
147
|
+
"module",
|
|
148
|
+
"main"
|
|
149
|
+
],
|
|
150
|
+
...options,
|
|
151
|
+
entryPoints: options.entryPoints || [
|
|
152
|
+
"./src/index.ts"
|
|
153
|
+
],
|
|
154
|
+
outdir: options.outdir || _devkit.joinPathFragments.call(void 0, workspaceRoot.dir, "dist", projectRoot),
|
|
155
|
+
plugins: [
|
|
156
|
+
..._nullishCoalesce(options.plugins, () => ( [])),
|
|
157
|
+
_chunkBF5W6GVPcjs.resolvePathsPlugin,
|
|
158
|
+
_chunkDFGHPRBDcjs.fixImportsPlugin,
|
|
159
|
+
_chunkT5H2LBQAcjs.tscPlugin.call(void 0, options.emitTypes),
|
|
160
|
+
_chunkPRNPZZSVcjs.onErrorPlugin
|
|
161
|
+
],
|
|
162
|
+
external: [
|
|
163
|
+
..._nullishCoalesce(options.external, () => ( []))
|
|
164
|
+
],
|
|
165
|
+
name: `${options.name || projectName}-${options.format || "cjs"}`,
|
|
166
|
+
projectConfigurations,
|
|
167
|
+
projectName,
|
|
168
|
+
projectGraph,
|
|
169
|
+
workspaceRoot,
|
|
170
|
+
sourceRoot: options.sourceRoot || _devkit.joinPathFragments.call(void 0, workspaceRoot.dir, projectRoot, "src")
|
|
171
|
+
};
|
|
172
|
+
}, "resolveOptions");
|
|
173
|
+
var generatePackageJson = /* @__PURE__ */ _chunkWGEGR3DFcjs.__name.call(void 0, async (options) => {
|
|
174
|
+
const config = await _configtools.loadStormConfig.call(void 0, );
|
|
175
|
+
const packageJsonPath = _devkit.joinPathFragments.call(void 0, options.projectRoot, "project.json");
|
|
176
|
+
if (!await _node.hfs.isFile(packageJsonPath)) {
|
|
177
|
+
throw new Error("Cannot find package.json configuration");
|
|
178
|
+
}
|
|
179
|
+
let packageJson = await _node.hfs.json(_devkit.joinPathFragments.call(void 0, options.workspaceRoot.dir, options.projectRoot, "package.json"));
|
|
180
|
+
if (!packageJson) {
|
|
181
|
+
throw new Error("Cannot find package.json configuration file");
|
|
182
|
+
}
|
|
183
|
+
packageJson = await _buildtools.addPackageDependencies.call(void 0, options.workspaceRoot.dir, options.projectRoot, options.projectName, packageJson);
|
|
184
|
+
packageJson = await _buildtools.addWorkspacePackageJsonFields.call(void 0, config, options.projectRoot, options.sourceRoot, options.projectName, false, packageJson);
|
|
185
|
+
let entryPoints = [
|
|
186
|
+
{
|
|
187
|
+
in: "./src/index.ts",
|
|
188
|
+
out: "./src/index.ts"
|
|
189
|
+
}
|
|
190
|
+
];
|
|
191
|
+
if (options.entryPoints) {
|
|
192
|
+
if (Array.isArray(options.entryPoints)) {
|
|
193
|
+
entryPoints = options.entryPoints.map((entryPoint) => typeof entryPoint === "string" ? {
|
|
194
|
+
in: entryPoint,
|
|
195
|
+
out: entryPoint
|
|
196
|
+
} : entryPoint);
|
|
197
|
+
} else {
|
|
198
|
+
entryPoints = Object.entries(options.entryPoints).map(([key, value]) => ({
|
|
199
|
+
in: key,
|
|
200
|
+
out: value
|
|
201
|
+
}));
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
for (const entryPoint of entryPoints) {
|
|
205
|
+
const split = entryPoint.out.split(".");
|
|
206
|
+
split.pop();
|
|
207
|
+
const entry = split.join(".").replaceAll("\\", "/");
|
|
208
|
+
packageJson.entry[`./${entry}`] ??= _buildtools.addPackageJsonExport.call(void 0, entry);
|
|
209
|
+
}
|
|
210
|
+
packageJson.entry["./package.json"] = "./package.json";
|
|
211
|
+
packageJson.entry["."] ??= _buildtools.addPackageJsonExport.call(void 0, "./src/index.ts");
|
|
212
|
+
packageJson.main = "./dist/index.cjs";
|
|
213
|
+
packageJson.module = "./dist/index.js";
|
|
214
|
+
packageJson.types = "./dist/index.d.ts";
|
|
215
|
+
await _devkit.writeJsonFile.call(void 0, _devkit.joinPathFragments.call(void 0, options.outdir, "package.json"), packageJson);
|
|
216
|
+
return options;
|
|
217
|
+
}, "generatePackageJson");
|
|
218
|
+
async function createOptions(options) {
|
|
219
|
+
return _estoolkit.flatten.call(void 0, await Promise.all(_compat.map.call(void 0, options, (options2) => [
|
|
220
|
+
// we defer it so that we don't trigger glob immediately
|
|
221
|
+
() => resolveOptions(options2)
|
|
222
|
+
])));
|
|
223
|
+
}
|
|
224
|
+
_chunkWGEGR3DFcjs.__name.call(void 0, createOptions, "createOptions");
|
|
225
|
+
async function computeOptions(options) {
|
|
226
|
+
return options();
|
|
227
|
+
}
|
|
228
|
+
_chunkWGEGR3DFcjs.__name.call(void 0, computeOptions, "computeOptions");
|
|
229
|
+
async function executeEsBuild(options) {
|
|
230
|
+
if (process.env.WATCH === "true") {
|
|
231
|
+
const context2 = await esbuild.context(_estoolkit.omit.call(void 0, options, [
|
|
232
|
+
"name",
|
|
233
|
+
"emitTypes",
|
|
234
|
+
"emitMetafile"
|
|
235
|
+
]));
|
|
236
|
+
watch(context2, options);
|
|
237
|
+
}
|
|
238
|
+
const build3 = await esbuild.build(_estoolkit.omit.call(void 0, options, [
|
|
239
|
+
"name",
|
|
240
|
+
"emitTypes",
|
|
241
|
+
"emitMetafile"
|
|
242
|
+
]));
|
|
243
|
+
if (build3.metafile && options.emitMetafile) {
|
|
244
|
+
const metafilePath = `${options.outdir}/${options.name}.meta.json`;
|
|
245
|
+
await _node.hfs.write(metafilePath, JSON.stringify(build3.metafile));
|
|
246
|
+
}
|
|
247
|
+
return [
|
|
248
|
+
options,
|
|
249
|
+
build3
|
|
250
|
+
];
|
|
251
|
+
}
|
|
252
|
+
_chunkWGEGR3DFcjs.__name.call(void 0, executeEsBuild, "executeEsBuild");
|
|
253
|
+
async function dependencyCheck(options) {
|
|
254
|
+
if (process.env.DEV === "true") return void 0;
|
|
255
|
+
if (process.env.CI && !process.env.BUILDKITE) return void 0;
|
|
256
|
+
const buildPromise = esbuild.build({
|
|
257
|
+
entryPoints: _globby.globbySync.call(void 0, "**/*.{j,t}s", {
|
|
258
|
+
// We don't check dependencies in ecosystem tests because tests are isolated from the build.
|
|
259
|
+
ignore: [
|
|
260
|
+
"./src/__tests__/**/*",
|
|
261
|
+
"./tests/e2e/**/*",
|
|
262
|
+
"./dist/**/*"
|
|
263
|
+
],
|
|
264
|
+
gitignore: true
|
|
265
|
+
}),
|
|
266
|
+
logLevel: "silent",
|
|
267
|
+
bundle: true,
|
|
268
|
+
write: false,
|
|
269
|
+
outdir: "out",
|
|
270
|
+
plugins: [
|
|
271
|
+
_chunkZ2M426LDcjs.depsCheckPlugin.call(void 0, options.bundle)
|
|
272
|
+
]
|
|
273
|
+
});
|
|
274
|
+
await buildPromise.catch(() => {
|
|
275
|
+
});
|
|
276
|
+
return void 0;
|
|
277
|
+
}
|
|
278
|
+
_chunkWGEGR3DFcjs.__name.call(void 0, dependencyCheck, "dependencyCheck");
|
|
279
|
+
async function build2(options) {
|
|
280
|
+
void transduce.async(options, dependencyCheck);
|
|
281
|
+
return transduce.async(await createOptions(options), pipe.async(computeOptions, generatePackageJson, executeEsBuild));
|
|
282
|
+
}
|
|
283
|
+
_chunkWGEGR3DFcjs.__name.call(void 0, build2, "build");
|
|
284
|
+
var watch = /* @__PURE__ */ _chunkWGEGR3DFcjs.__name.call(void 0, (context2, options) => {
|
|
285
|
+
if (process.env.WATCH !== "true") return context2;
|
|
286
|
+
const config = {
|
|
287
|
+
ignoreInitial: true,
|
|
288
|
+
useFsEvents: true,
|
|
289
|
+
ignored: [
|
|
290
|
+
"./src/__tests__/**/*",
|
|
291
|
+
"./package.json"
|
|
292
|
+
]
|
|
293
|
+
};
|
|
294
|
+
const changeWatcher = _chokidar.watch.call(void 0, [
|
|
295
|
+
"./src/**/*"
|
|
296
|
+
], config);
|
|
297
|
+
const fastRebuild = _estoolkit.debounce.call(void 0, async () => {
|
|
298
|
+
const timeBefore = Date.now();
|
|
299
|
+
const rebuildResult = await handle.async(() => {
|
|
300
|
+
return context2.rebuild();
|
|
301
|
+
});
|
|
302
|
+
if (rebuildResult instanceof Error) {
|
|
303
|
+
_chunk4ZPYEZJOcjs.writeLog.call(void 0, "error", rebuildResult.message);
|
|
304
|
+
}
|
|
305
|
+
_chunk4ZPYEZJOcjs.writeLog.call(void 0, "log", `${Date.now() - timeBefore}ms [${_nullishCoalesce(options.name, () => ( ""))}]`);
|
|
306
|
+
}, 10);
|
|
307
|
+
changeWatcher.on("change", fastRebuild);
|
|
308
|
+
return void 0;
|
|
309
|
+
}, "watch");
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
exports.handle = handle; exports.skip = skip; exports.Filter = Filter; exports.Mapper = Mapper; exports.transduce = transduce; exports.pipe = pipe; exports.build = build2;
|
|
320
|
+
//# sourceMappingURL=chunk-75SHW3Z4.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/storm-ops/storm-ops/packages/esbuild/dist/chunk-75SHW3Z4.cjs","../src/build.ts","../src/utilities/helpers.ts"],"names":["handleSync","fn","error_","handleAsync","handle","async","skip","Symbol","transduceSync","list","transformer","transduced","i","element_","entries","transformed","length","transduceAsync","Promise","all","map","Filter","filter","item","Mapper","mapper","transduce","pipeSync","fns","args","result","pipeAsync","pipe","resolveOptions","options","projectRoot","workspaceRoot","findWorkspaceRoot","Error","nxJsonPath","joinPathFragments","dir","hfs","isFile","projectGraph","createProjectGraphAsync","exitOnError","projectJsonPath","projectJson","json","projectName","name","projectConfigurations","readProjectsConfigurationFromProjectGraph","projects","DEFAULT_BUILD_OPTIONS","format","outExtension","resolveExtensions","mainFields","entryPoints","outdir","plugins","resolvePathsPlugin","fixImportsPlugin","tscPlugin","emitTypes","onErrorPlugin","external","sourceRoot","generatePackageJson","config","packageJsonPath","packageJson","Array","in","out","entryPoint","split","pop","entry","writeJsonFile","flatten","createOptions","computeOptions","process","context","build","metafilePath","executeEsBuild","buildPromise","ignore","gitignore","logLevel","bundle","depsCheckPlugin","undefined","dependencyCheck","watch","ignoreInitial","useFsEvents","ignored","changeWatcher","fastRebuild","timeBefore","rebuildResult","writeLog"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;A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AA;AACJ4B,IAAAA;AACAC,IAAAA;AACAC,IAAAA;AAAU,MAAA;AAAwB,MAAA;AD1D3B,IAAA;AC2DT,EAAA;AAGMC,EAAAA;AAA+B,IAAA;AAAe/B,EAAAA;AAG9CgC,EAAAA;AACEC,IAAAA;AAGAC,IAAAA;AACJ,MAAA;AACF,IAAA;AAEIA,IAAAA;AACFC,MAAAA;AACF,IAAA;AAEAA,IAAAA;AACC,EAAA;AAEHJ,EAAAA;AAEON,EAAAA;AA/BK;ADjCH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/storm-ops/storm-ops/packages/esbuild/dist/chunk-75SHW3Z4.cjs","sourcesContent":[null,"/*-------------------------------------------------------------------\n\n ⚡ Storm Software - Storm Stack\n\n This code was released as part of the Storm Stack project. Storm Stack\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/storm-ops\n Documentation: https://stormsoftware.com/projects/storm-ops/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/storm-ops/license\n\n -------------------------------------------------------------------*/\n\nimport { hfs } from \"@humanfs/node\";\nimport {\n createProjectGraphAsync,\n joinPathFragments,\n readProjectsConfigurationFromProjectGraph,\n writeJsonFile\n} from \"@nx/devkit\";\nimport {\n addPackageDependencies,\n addPackageJsonExport,\n addWorkspacePackageJsonFields\n} from \"@storm-software/build-tools\";\nimport { loadStormConfig } from \"@storm-software/config-tools\";\nimport { watch as createWatcher } from \"chokidar\";\nimport { debounce, flatten, omit } from \"es-toolkit\";\nimport { map } from \"es-toolkit/compat\";\nimport * as esbuild from \"esbuild\";\nimport { BuildContext } from \"esbuild\";\nimport { globbySync } from \"globby\";\nimport { findWorkspaceRoot } from \"nx/src/utils/find-workspace-root\";\nimport { DEFAULT_BUILD_OPTIONS } from \"./config\";\nimport { depsCheckPlugin } from \"./plugins/deps-check\";\nimport { fixImportsPlugin } from \"./plugins/fix-imports\";\nimport { onErrorPlugin } from \"./plugins/on-error\";\nimport { resolvePathsPlugin } from \"./plugins/resolve-paths\";\nimport { tscPlugin } from \"./plugins/tsc\";\nimport { ESBuildResolvedOptions, type ESBuildOptions } from \"./types\";\nimport { handle, pipe, transduce } from \"./utilities/helpers\";\nimport { writeLog } from \"./utilities/log\";\n\n/**\n * Apply defaults to the original build options\n *\n * @param options - the original build options\n * @returns the build options with defaults applied\n */\nconst resolveOptions = async (\n options: ESBuildOptions\n): Promise<ESBuildResolvedOptions> => {\n const projectRoot = options.projectRoot;\n\n const workspaceRoot = findWorkspaceRoot(projectRoot);\n if (!workspaceRoot) {\n throw new Error(\"Cannot find Nx workspace root\");\n }\n\n const nxJsonPath = joinPathFragments(workspaceRoot.dir, \"nx.json\");\n if (!(await hfs.isFile(nxJsonPath))) {\n throw new Error(\"Cannot find Nx workspace configuration\");\n }\n\n const projectGraph = await createProjectGraphAsync({\n exitOnError: true\n });\n\n const projectJsonPath = joinPathFragments(\n workspaceRoot.dir,\n projectRoot,\n \"project.json\"\n );\n if (!(await hfs.isFile(projectJsonPath))) {\n throw new Error(\"Cannot find project.json configuration\");\n }\n\n const projectJson = await hfs.json(projectJsonPath);\n const projectName = projectJson.name;\n\n const projectConfigurations =\n readProjectsConfigurationFromProjectGraph(projectGraph);\n if (!projectConfigurations?.projects?.[projectName]) {\n throw new Error(\n \"The Build process failed because the project does not have a valid configuration in the project.json file. Check if the file exists in the root of the project.\"\n );\n }\n\n // const packageJsonPath = joinPathFragments(projectRoot, \"project.json\");\n // if (!(await hfs.isFile(packageJsonPath))) {\n // throw new Error(\"Cannot find package.json configuration\");\n // }\n\n // const packageJson = await hfs.json(\n // joinPathFragments(workspaceRoot.dir, projectRoot, \"package.json\")\n // );\n\n return {\n ...DEFAULT_BUILD_OPTIONS,\n format: \"cjs\",\n outExtension: { \".js\": \".js\" },\n resolveExtensions: [\".ts\", \".js\", \".node\"],\n mainFields: [\"module\", \"main\"],\n ...options,\n entryPoints: options.entryPoints || [\"./src/index.ts\"],\n outdir:\n options.outdir ||\n joinPathFragments(workspaceRoot.dir, \"dist\", projectRoot),\n plugins: [\n ...(options.plugins ?? []),\n resolvePathsPlugin,\n fixImportsPlugin,\n tscPlugin(options.emitTypes),\n onErrorPlugin\n ],\n external: [...(options.external ?? [])],\n name: `${options.name || projectName}-${options.format || \"cjs\"}`,\n projectConfigurations,\n projectName,\n projectGraph,\n workspaceRoot,\n sourceRoot:\n options.sourceRoot ||\n joinPathFragments(workspaceRoot.dir, projectRoot, \"src\")\n };\n};\n\nconst generatePackageJson = async (options: ESBuildResolvedOptions) => {\n const config = await loadStormConfig();\n\n const packageJsonPath = joinPathFragments(\n options.projectRoot,\n \"project.json\"\n );\n if (!(await hfs.isFile(packageJsonPath))) {\n throw new Error(\"Cannot find package.json configuration\");\n }\n\n let packageJson = await hfs.json(\n joinPathFragments(\n options.workspaceRoot.dir,\n options.projectRoot,\n \"package.json\"\n )\n );\n if (!packageJson) {\n throw new Error(\"Cannot find package.json configuration file\");\n }\n\n packageJson = await addPackageDependencies(\n options.workspaceRoot.dir,\n options.projectRoot,\n options.projectName,\n packageJson\n );\n\n packageJson = await addWorkspacePackageJsonFields(\n config,\n options.projectRoot,\n options.sourceRoot,\n options.projectName,\n false,\n packageJson\n );\n\n let entryPoints = [{ in: \"./src/index.ts\", out: \"./src/index.ts\" }];\n if (options.entryPoints) {\n if (Array.isArray(options.entryPoints)) {\n entryPoints = (\n options.entryPoints as (string | { in: string; out: string })[]\n ).map(entryPoint =>\n typeof entryPoint === \"string\"\n ? { in: entryPoint, out: entryPoint }\n : entryPoint\n );\n } else {\n entryPoints = Object.entries(options.entryPoints).map(([key, value]) => ({\n in: key,\n out: value\n }));\n }\n }\n\n for (const entryPoint of entryPoints) {\n const split = entryPoint.out.split(\".\");\n split.pop();\n const entry = split.join(\".\").replaceAll(\"\\\\\", \"/\");\n\n packageJson.entry[`./${entry}`] ??= addPackageJsonExport(entry);\n }\n\n packageJson.entry[\"./package.json\"] = \"./package.json\";\n packageJson.entry[\".\"] ??= addPackageJsonExport(\"./src/index.ts\");\n\n packageJson.main = \"./dist/index.cjs\";\n packageJson.module = \"./dist/index.js\";\n packageJson.types = \"./dist/index.d.ts\";\n\n await writeJsonFile(\n joinPathFragments(options.outdir, \"package.json\"),\n packageJson\n );\n\n return options;\n};\n\n/**\n * Create two deferred builds for esm and cjs. The one follows the other:\n * - 1. The code gets compiled to an optimized tree-shaken esm output\n * - 2. We take that output and compile it to an optimized cjs output\n *\n * @param options - the original build options\n * @returns if options = [a, b], we get [a-esm, a-cjs, b-esm, b-cjs]\n */\nasync function createOptions(options: ESBuildOptions[]) {\n return flatten(\n await Promise.all(\n map(options, options => [\n // we defer it so that we don't trigger glob immediately\n () => resolveOptions(options)\n ])\n )\n );\n}\n\n/**\n * We only want to trigger the glob search once we are ready, and that is when\n * the previous build has finished. We get the build options from the deferred.\n */\nasync function computeOptions(\n options: () => Promise<ESBuildResolvedOptions>\n): Promise<ESBuildResolvedOptions> {\n return options();\n}\n\n// /**\n// * Extensions are not automatically by esbuild set for `options.outfile`. We\n// * look at the set `options.outExtension` and we add that to `options.outfile`.\n// */\n// function addExtensionFormat(options: ESBuildOptions) {\n// if (options.outfile && options.outExtension) {\n// const ext = options.outExtension[\".js\"];\n\n// options.outfile = `${options.outfile}${ext}`;\n// }\n\n// return options;\n// }\n\n// /**\n// * If we don't have `options.outfile`, we default `options.outdir`\n// */\n// function addDefaultOutDir(options: ESBuildOptions) {\n// if (options.outfile === undefined) {\n// options.outdir = getOutDir(options);\n// }\n\n// return options;\n// }\n\n/**\n * Execute esbuild with all the configurations we pass\n */\nasync function executeEsBuild(options: ESBuildResolvedOptions) {\n if (process.env.WATCH === \"true\") {\n const context = await esbuild.context(\n omit(options, [\"name\", \"emitTypes\", \"emitMetafile\"]) as any\n );\n\n watch(context, options);\n }\n\n const build = await esbuild.build(\n omit(options, [\"name\", \"emitTypes\", \"emitMetafile\"]) as any\n );\n\n if (build.metafile && options.emitMetafile) {\n const metafilePath = `${options.outdir}/${options.name}.meta.json`;\n await hfs.write(metafilePath, JSON.stringify(build.metafile));\n }\n\n return [options, build] as const;\n}\n\n/**\n * A blank esbuild run to do an analysis of our deps\n */\nasync function dependencyCheck(options: ESBuildResolvedOptions) {\n // we only check our dependencies for a full build\n if (process.env.DEV === \"true\") return undefined;\n // Only run on test and publish pipelines on Buildkite\n // Meaning we skip on GitHub Actions\n // Because it's slow and runs for each job, during setup, making each job slower\n if (process.env.CI && !process.env.BUILDKITE) return undefined;\n\n // we need to bundle everything to do the analysis\n const buildPromise = esbuild.build({\n entryPoints: globbySync(\"**/*.{j,t}s\", {\n // We don't check dependencies in ecosystem tests because tests are isolated from the build.\n ignore: [\"./src/__tests__/**/*\", \"./tests/e2e/**/*\", \"./dist/**/*\"],\n gitignore: true\n }),\n logLevel: \"silent\", // there will be errors\n bundle: true, // we bundle to get everything\n write: false, // no need to write for analysis\n outdir: \"out\",\n plugins: [depsCheckPlugin(options.bundle)]\n });\n\n // we absolutely don't care if it has any errors\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n await buildPromise.catch(() => {});\n\n return undefined;\n}\n\n/**\n * Execution pipeline that applies a set of actions\n *\n * @param options - the build options\n * @returns the build result\n */\nexport async function build(options: ESBuildOptions[]) {\n void transduce.async(options, dependencyCheck);\n\n return transduce.async(\n await createOptions(options),\n pipe.async(computeOptions, generatePackageJson, executeEsBuild)\n );\n}\n\n/**\n * Executes the build and rebuilds what is necessary\n *\n * @param context - the build context\n * @param options - the build options\n * @returns the build result\n */\nconst watch = (context: BuildContext, options: ESBuildResolvedOptions) => {\n if (process.env.WATCH !== \"true\") return context;\n\n // common chokidar options for the watchers\n const config = {\n ignoreInitial: true,\n useFsEvents: true,\n ignored: [\"./src/__tests__/**/*\", \"./package.json\"]\n };\n\n // prepare the incremental builds watcher\n const changeWatcher = createWatcher([\"./src/**/*\"], config);\n\n // triggers quick rebuild on file change\n const fastRebuild = debounce(async () => {\n const timeBefore = Date.now();\n\n // we handle possible rebuild exceptions\n const rebuildResult = await handle.async(() => {\n return context.rebuild();\n });\n\n if (rebuildResult instanceof Error) {\n writeLog(\"error\", rebuildResult.message);\n }\n\n writeLog(\"log\", `${Date.now() - timeBefore}ms [${options.name ?? \"\"}]`);\n }, 10);\n\n changeWatcher.on(\"change\", fastRebuild);\n\n return undefined;\n};\n\n// Utils ::::::::::::::::::::::::::::::::::::::::::::::::::\n\n// get the current project externals this helps to mark dependencies as external\n// by having convention in the package.json (dev = bundled, non-dev = external)\n// function getProjectExternals(options: ESBuildOptions) {\n// const pkg = require(`${process.cwd()}/package.json`);\n// const peerDeps = Object.keys(pkg.peerDependencies ?? {});\n// const regDeps = Object.keys(pkg.dependencies ?? {});\n\n// // when bundling, only the devDeps will be bundled\n// if (!process.env.IGNORE_EXTERNALS && options.bundle === true) {\n// return [...new Set([...peerDeps, ...regDeps])];\n// }\n\n// // otherwise, all the dependencies will be bundled\n// return [];\n// }\n","/*-------------------------------------------------------------------\n\n ⚡ Storm Software - Storm Stack\n\n This code was released as part of the Storm Stack project. Storm Stack\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/storm-ops\n Documentation: https://stormsoftware.com/projects/storm-ops/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/storm-ops/license\n\n -------------------------------------------------------------------*/\n\nfunction handleSync<R, E = Error>(fn: () => R): R | E {\n try {\n return fn();\n } catch (error_: unknown) {\n return error_ as E;\n }\n}\n\nasync function handleAsync<R, E = Error>(\n fn: () => Promise<R> | R\n): Promise<R | E> {\n try {\n return await fn();\n } catch (error_: unknown) {\n return error_ as E;\n }\n}\n\n/**\n * Executes a function, catches exceptions, and returns any outcome.\n * @param fn - to be executed\n */\nconst handle = handleSync as typeof handleSync & {\n async: typeof handleAsync;\n};\n\nhandle.async = handleAsync;\n\nexport { handle };\n\nconst skip = Symbol(\"skip\");\n\ntype SyncTransformer<I, R> = (item: I, key: number) => R | typeof skip;\ntype ASyncTransformer<I, R> = (\n item: I,\n key: number\n) => Promise<R | typeof skip>;\n\nfunction transduceSync<I, R>(\n list: Array<I>,\n transformer: SyncTransformer<I, R>\n) {\n const transduced = [] as R[];\n\n for (const [i, element_] of list.entries()) {\n const transformed = transformer(element_, i);\n\n if (transformed !== skip) {\n transduced[transduced.length] = transformed;\n }\n }\n\n return transduced;\n}\n\nasync function transduceAsync<I, R>(\n list: Array<I>,\n transformer: ASyncTransformer<I, R>\n) {\n const transduced = [] as R[];\n\n await Promise.all(\n list.entries().map(async ([i, element_]) => {\n const transformed = await transformer(element_, i);\n\n if (transformed !== skip) {\n transduced[transduced.length] = transformed;\n }\n })\n );\n\n return transduced;\n}\n\nconst Filter =\n <I>(filter: (item: I) => boolean) =>\n (item: I) => {\n return filter(item) ? item : (skip as never);\n };\n\nconst Mapper =\n <I, R>(mapper: (item: I) => R) =>\n (item: I) => {\n return mapper(item);\n };\n\n/**\n * Transducers enable efficient data processing. They allow the composition of\n * mappers and filters to be applied on a list. And this is applied in a single\n * pass, that's the efficient pipeline processing.\n *\n * (does not reduce at the same time)\n *\n * @see https://medium.com/javascript-scene/7985330fe73d\n *\n * @param list - to transform\n * @param transformer - to apply\n\n * @example\n * ```ts\n * const filterEven = Filter(<U>(unit: U) =>\n * typeof unit === 'number' ? !(unit % 2) : true,\n * )\n * const mapTimes2 = Mapper(<U>(unit: U) =>\n * typeof unit === 'number' ? unit * 2 : unit,\n * )\n * const mapString = Mapper(<U>(unit: U) => `${unit}`)\n *\n * const test0 = transduce(\n * [1, 2, 3, 4, 5, 6, 7, 'a'],\n * pipe(filterEven, mapTimes2, mapTimes2, mapString, filterEven),\n * )\n * ```\n */\nconst transduce = transduceSync as typeof transduceSync & {\n async: typeof transduceAsync;\n};\n\ntransduce.async = transduceAsync;\n\nexport { Filter, Mapper, skip, transduce };\n\ntype FunctionLike<P extends Array<any> = any, R = any> = (...args: P) => R;\ntype Await<P> = P extends Promise<infer A> ? A : P;\n\nfunction pipeSync(fn: FunctionLike, ...fns: FunctionLike[]) {\n return (...args: unknown[]) => {\n let result = fn(...args);\n\n for (let i = 0; result !== skip && i < fns.length; ++i) {\n result = fns[i]?.(result);\n }\n\n return result;\n };\n}\n\nfunction pipeAsync(fn: FunctionLike, ...fns: FunctionLike[]) {\n return async (...args: unknown[]) => {\n let result = await fn(...args);\n\n for (let i = 0; result !== skip && i < fns.length; ++i) {\n // eslint-disable-next-line no-await-in-loop\n result = await fns[i]?.(result);\n }\n\n return result;\n };\n}\n\n/**\n * Pipe the input and output of functions.\n *\n * @param fn - parameter-taking function\n * @param fns - subsequent piped functions\n * @returns\n */\nconst pipe = pipeSync as PipeMultiSync & {\n async: PipeMultiAsync;\n};\n\npipe.async = pipeAsync;\n\n// TODO: use the one from ts-toolbelt (broken atm since ts 4.1)\nexport declare type PipeMultiSync = {\n <R0, P extends any[]>(...fns: [FunctionLike<P, R0>]): FunctionLike<P, R0>;\n <R0, R1, P extends any[]>(\n ...fns: [FunctionLike<P, R0>, FunctionLike<[R0], R1>]\n ): FunctionLike<P, R1>;\n <R0, R1, R2, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[R0], R1>,\n FunctionLike<[R1], R2>\n ]\n ): FunctionLike<P, R2>;\n <R0, R1, R2, R3, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[R0], R1>,\n FunctionLike<[R1], R2>,\n FunctionLike<[R2], R3>\n ]\n ): FunctionLike<P, R3>;\n <R0, R1, R2, R3, R4, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[R0], R1>,\n FunctionLike<[R1], R2>,\n FunctionLike<[R2], R3>,\n FunctionLike<[R3], R4>\n ]\n ): FunctionLike<P, R4>;\n <R0, R1, R2, R3, R4, R5, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[R0], R1>,\n FunctionLike<[R1], R2>,\n FunctionLike<[R2], R3>,\n FunctionLike<[R3], R4>,\n FunctionLike<[R4], R5>\n ]\n ): FunctionLike<P, R5>;\n <R0, R1, R2, R3, R4, R5, R6, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[R0], R1>,\n FunctionLike<[R1], R2>,\n FunctionLike<[R2], R3>,\n FunctionLike<[R3], R4>,\n FunctionLike<[R4], R5>,\n FunctionLike<[R5], R6>\n ]\n ): FunctionLike<P, R6>;\n <R0, R1, R2, R3, R4, R5, R6, R7, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[R0], R1>,\n FunctionLike<[R1], R2>,\n FunctionLike<[R2], R3>,\n FunctionLike<[R3], R4>,\n FunctionLike<[R4], R5>,\n FunctionLike<[R5], R6>,\n FunctionLike<[R6], R7>\n ]\n ): FunctionLike<P, R7>;\n <R0, R1, R2, R3, R4, R5, R6, R7, R8, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[R0], R1>,\n FunctionLike<[R1], R2>,\n FunctionLike<[R2], R3>,\n FunctionLike<[R3], R4>,\n FunctionLike<[R4], R5>,\n FunctionLike<[R5], R6>,\n FunctionLike<[R6], R7>,\n FunctionLike<[R7], R8>\n ]\n ): FunctionLike<P, R8>;\n <R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[R0], R1>,\n FunctionLike<[R1], R2>,\n FunctionLike<[R2], R3>,\n FunctionLike<[R3], R4>,\n FunctionLike<[R4], R5>,\n FunctionLike<[R5], R6>,\n FunctionLike<[R6], R7>,\n FunctionLike<[R7], R8>,\n FunctionLike<[R8], R9>\n ]\n ): FunctionLike<P, R9>;\n};\n\nexport declare type PipeMultiAsync = {\n <R0, P extends any[]>(\n ...fns: [FunctionLike<P, R0>]\n ): FunctionLike<P, Promise<Await<R0>>>;\n <R0, R1, P extends any[]>(\n ...fns: [FunctionLike<P, R0>, FunctionLike<[Await<R0>], R1>]\n ): FunctionLike<P, Promise<Await<R1>>>;\n <R0, R1, R2, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[Await<R0>], R1>,\n FunctionLike<[Await<R1>], R2>\n ]\n ): FunctionLike<P, Promise<Await<R2>>>;\n <R0, R1, R2, R3, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[Await<R0>], R1>,\n FunctionLike<[Await<R1>], R2>,\n FunctionLike<[Await<R2>], R3>\n ]\n ): FunctionLike<P, Promise<Await<R3>>>;\n <R0, R1, R2, R3, R4, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[Await<R0>], R1>,\n FunctionLike<[Await<R1>], R2>,\n FunctionLike<[Await<R2>], R3>,\n FunctionLike<[Await<R3>], R4>\n ]\n ): FunctionLike<P, Promise<Await<R4>>>;\n <R0, R1, R2, R3, R4, R5, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[Await<R0>], R1>,\n FunctionLike<[Await<R1>], R2>,\n FunctionLike<[Await<R2>], R3>,\n FunctionLike<[Await<R3>], R4>,\n FunctionLike<[Await<R4>], R5>\n ]\n ): FunctionLike<P, Promise<Await<R5>>>;\n <R0, R1, R2, R3, R4, R5, R6, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[Await<R0>], R1>,\n FunctionLike<[Await<R1>], R2>,\n FunctionLike<[Await<R2>], R3>,\n FunctionLike<[Await<R3>], R4>,\n FunctionLike<[Await<R4>], R5>,\n FunctionLike<[Await<R5>], R6>\n ]\n ): FunctionLike<P, Promise<Await<R6>>>;\n <R0, R1, R2, R3, R4, R5, R6, R7, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[Await<R0>], R1>,\n FunctionLike<[Await<R1>], R2>,\n FunctionLike<[Await<R2>], R3>,\n FunctionLike<[Await<R3>], R4>,\n FunctionLike<[Await<R4>], R5>,\n FunctionLike<[Await<R5>], R6>,\n FunctionLike<[Await<R6>], R7>\n ]\n ): FunctionLike<P, Promise<Await<R7>>>;\n <R0, R1, R2, R3, R4, R5, R6, R7, R8, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[Await<R0>], R1>,\n FunctionLike<[Await<R1>], R2>,\n FunctionLike<[Await<R2>], R3>,\n FunctionLike<[Await<R3>], R4>,\n FunctionLike<[Await<R4>], R5>,\n FunctionLike<[Await<R5>], R6>,\n FunctionLike<[Await<R6>], R7>,\n FunctionLike<[Await<R7>], R8>\n ]\n ): FunctionLike<P, Promise<Await<R8>>>;\n <R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[Await<R0>], R1>,\n FunctionLike<[Await<R1>], R2>,\n FunctionLike<[Await<R2>], R3>,\n FunctionLike<[Await<R3>], R4>,\n FunctionLike<[Await<R4>], R5>,\n FunctionLike<[Await<R5>], R6>,\n FunctionLike<[Await<R6>], R7>,\n FunctionLike<[Await<R7>], R8>,\n FunctionLike<[Await<R8>], R9>\n ]\n ): FunctionLike<P, Promise<Await<R9>>>;\n};\n\nexport { pipe };\n"]}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import {
|
|
2
|
+
writeLog
|
|
3
|
+
} from "./chunk-ZQ5NVDFP.js";
|
|
4
|
+
import {
|
|
5
|
+
__name,
|
|
6
|
+
__require
|
|
7
|
+
} from "./chunk-WCQVDF3K.js";
|
|
8
|
+
|
|
9
|
+
// src/plugins/deps-check.ts
|
|
10
|
+
import { builtinModules } from "node:module";
|
|
11
|
+
import path from "node:path";
|
|
12
|
+
var unusedIgnore = [
|
|
13
|
+
// these are our dev dependencies
|
|
14
|
+
/@types\/.*?/,
|
|
15
|
+
/@typescript-eslint.*?/,
|
|
16
|
+
/eslint.*?/,
|
|
17
|
+
"esbuild",
|
|
18
|
+
"husky",
|
|
19
|
+
"is-ci",
|
|
20
|
+
"lint-staged",
|
|
21
|
+
"prettier",
|
|
22
|
+
"typescript",
|
|
23
|
+
"ts-node",
|
|
24
|
+
"ts-jest",
|
|
25
|
+
"@swc/core",
|
|
26
|
+
"@swc/jest",
|
|
27
|
+
"jest",
|
|
28
|
+
// these are missing 3rd party deps
|
|
29
|
+
"spdx-exceptions",
|
|
30
|
+
"spdx-license-ids",
|
|
31
|
+
// type-only, so it is not detected
|
|
32
|
+
"ts-toolbelt",
|
|
33
|
+
// these are indirectly used by build
|
|
34
|
+
"buffer"
|
|
35
|
+
];
|
|
36
|
+
var missingIgnore = [
|
|
37
|
+
".prisma",
|
|
38
|
+
"@prisma/client",
|
|
39
|
+
"ts-toolbelt"
|
|
40
|
+
];
|
|
41
|
+
var depsCheckPlugin = /* @__PURE__ */ __name((bundle) => ({
|
|
42
|
+
name: "storm:deps-check",
|
|
43
|
+
setup(build) {
|
|
44
|
+
const pkgJsonPath = path.join(process.cwd(), "package.json");
|
|
45
|
+
const pkgContents = __require(pkgJsonPath);
|
|
46
|
+
const regDependencies = Object.keys(pkgContents["dependencies"] ?? {});
|
|
47
|
+
const devDependencies = Object.keys(pkgContents["devDependencies"] ?? {});
|
|
48
|
+
const peerDependencies = Object.keys(pkgContents["peerDependencies"] ?? {});
|
|
49
|
+
const dependencies = [
|
|
50
|
+
...regDependencies,
|
|
51
|
+
...bundle ? devDependencies : []
|
|
52
|
+
];
|
|
53
|
+
const collectedDependencies = /* @__PURE__ */ new Set();
|
|
54
|
+
const onlyPackages = /^[^./](?!:)|^\.[^./]|^\.\.[^/]/;
|
|
55
|
+
build.onResolve({
|
|
56
|
+
filter: onlyPackages
|
|
57
|
+
}, (args) => {
|
|
58
|
+
if (args.importer.includes(process.cwd())) {
|
|
59
|
+
if (args.path[0] === "@") {
|
|
60
|
+
const [org, pkg] = args.path.split("/");
|
|
61
|
+
collectedDependencies.add(`${org}/${pkg}`);
|
|
62
|
+
} else {
|
|
63
|
+
const [pkg] = args.path.split("/");
|
|
64
|
+
collectedDependencies.add(pkg);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
external: true
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
build.onEnd(() => {
|
|
72
|
+
const unusedDependencies = [
|
|
73
|
+
...dependencies
|
|
74
|
+
].filter((dep) => {
|
|
75
|
+
return !collectedDependencies.has(dep) || builtinModules.includes(dep);
|
|
76
|
+
});
|
|
77
|
+
const missingDependencies = [
|
|
78
|
+
...collectedDependencies
|
|
79
|
+
].filter((dep) => {
|
|
80
|
+
return !dependencies.includes(dep) && !builtinModules.includes(dep);
|
|
81
|
+
});
|
|
82
|
+
const filteredUnusedDeps = unusedDependencies.filter((dep) => {
|
|
83
|
+
return !unusedIgnore.some((pattern) => dep.match(pattern));
|
|
84
|
+
});
|
|
85
|
+
const filteredMissingDeps = missingDependencies.filter((dep) => {
|
|
86
|
+
return !missingIgnore.some((pattern) => dep.match(pattern)) && !peerDependencies.includes(dep);
|
|
87
|
+
});
|
|
88
|
+
writeLog("warn", `unusedDependencies: ${JSON.stringify(filteredUnusedDeps)}`);
|
|
89
|
+
writeLog("warn", `missingDependencies: ${JSON.stringify(filteredMissingDeps)}`);
|
|
90
|
+
if (filteredMissingDeps.length > 0) {
|
|
91
|
+
throw new Error(`Missing dependencies detected - please install them:
|
|
92
|
+
${JSON.stringify(filteredMissingDeps)}
|
|
93
|
+
`);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}), "depsCheckPlugin");
|
|
98
|
+
|
|
99
|
+
export {
|
|
100
|
+
depsCheckPlugin
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=chunk-7U3F23ZZ.js.map
|