@storm-software/esbuild 0.52.20 → 0.53.1

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.
Files changed (65) hide show
  1. package/README.md +2 -1
  2. package/bin/esbuild.cjs +1 -1
  3. package/dist/assets.cjs +3 -6
  4. package/dist/assets.js +2 -5
  5. package/dist/build.cjs +9 -12
  6. package/dist/build.js +8 -11
  7. package/dist/chunk-3RG5ZIWI.js +10 -0
  8. package/dist/{chunk-GRCBCRT3.cjs → chunk-BXCOVK3I.cjs} +4 -9
  9. package/dist/{chunk-JUYIXFPA.cjs → chunk-CRFWMPZN.cjs} +13 -20
  10. package/dist/{chunk-FE36AM5O.js → chunk-CZC4I6SL.js} +5 -12
  11. package/dist/{chunk-YEL4SZSU.js → chunk-D4DSKI5N.js} +9 -17
  12. package/dist/{chunk-MEWZGWK3.cjs → chunk-DJNFLJSO.cjs} +6 -13
  13. package/dist/chunk-GGNOJ77I.js +0 -0
  14. package/dist/{chunk-UNIT3DUA.js → chunk-MTZGYTJP.js} +3 -10
  15. package/dist/{chunk-U4FGDMUR.cjs → chunk-MYIRPP4C.cjs} +4 -11
  16. package/dist/chunk-OBGZSXTJ.cjs +10 -0
  17. package/dist/{chunk-OOJQKVMY.cjs → chunk-P3PATQE5.cjs} +19 -27
  18. package/dist/chunk-SFZRYJZ2.cjs +1 -0
  19. package/dist/{chunk-FFM36UWY.js → chunk-SJ6BFZTX.js} +8 -12
  20. package/dist/{chunk-ZSMWNUMF.js → chunk-TTW7MNRE.js} +1 -8
  21. package/dist/chunk-V7AFF6GW.cjs +25 -0
  22. package/dist/{chunk-DEU6FC3P.cjs → chunk-XAUXKCOD.cjs} +21 -25
  23. package/dist/{chunk-QPLYTZHZ.js → chunk-XKSMSRQZ.js} +2 -7
  24. package/dist/chunk-ZH5YCT67.js +25 -0
  25. package/dist/clean.cjs +3 -4
  26. package/dist/clean.js +2 -3
  27. package/dist/config.cjs +3 -6
  28. package/dist/config.js +2 -5
  29. package/dist/context.cjs +4 -7
  30. package/dist/context.js +3 -6
  31. package/dist/index.cjs +10 -18
  32. package/dist/index.js +9 -17
  33. package/dist/package-json.cjs +3 -6
  34. package/dist/package-json.js +2 -5
  35. package/dist/plugins/deps-check.cjs +6 -8
  36. package/dist/plugins/deps-check.js +6 -8
  37. package/dist/plugins/resolve-paths.cjs +12 -38
  38. package/dist/plugins/resolve-paths.js +4 -30
  39. package/dist/tsup.cjs +3 -5
  40. package/dist/tsup.js +2 -4
  41. package/dist/types.cjs +1 -2
  42. package/dist/types.js +1 -2
  43. package/dist/watch.cjs +5 -9
  44. package/dist/watch.js +4 -8
  45. package/package.json +8 -8
  46. package/assets/cjs_shims.js +0 -11
  47. package/assets/esm_shims.js +0 -9
  48. package/dist/chunk-2C3MWYHH.cjs +0 -47
  49. package/dist/chunk-7SWZ2ZGX.cjs +0 -135
  50. package/dist/chunk-AFLE3LVA.js +0 -1906
  51. package/dist/chunk-B3BJCWKI.cjs +0 -2687
  52. package/dist/chunk-BYH4XDRH.cjs +0 -6
  53. package/dist/chunk-ETBYMZ46.cjs +0 -6
  54. package/dist/chunk-GZSSIGNC.cjs +0 -153
  55. package/dist/chunk-HFWPMK44.cjs +0 -325
  56. package/dist/chunk-IVZEDCLS.js +0 -6
  57. package/dist/chunk-JBXDZTFM.js +0 -135
  58. package/dist/chunk-JZ25TPTY.cjs +0 -42
  59. package/dist/chunk-KT4NC6CJ.js +0 -325
  60. package/dist/chunk-OKPZK64Q.cjs +0 -1906
  61. package/dist/chunk-TWFEYLU4.cjs +0 -352
  62. package/dist/chunk-VGC3FXLU.cjs +0 -203
  63. package/dist/chunk-Z7VDLMOZ.js +0 -54
  64. package/dist/chunk-ZFVQ4LC4.js +0 -2718
  65. package/dist/rollup.cjs +0 -6906
@@ -1,6 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// package.json
2
- var version = "8.4.0";
3
-
4
-
5
-
6
- exports.version = version;
@@ -1,6 +0,0 @@
1
- "use strict";
2
-
3
- var _chunk2C3MWYHHcjs = require('./chunk-2C3MWYHH.cjs');
4
-
5
- // src/types.ts
6
- _chunk2C3MWYHHcjs.init_cjs_shims.call(void 0, );
@@ -1,153 +0,0 @@
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; } }
2
-
3
- var _chunkBYH4XDRHjs = require('./chunk-BYH4XDRH.cjs');
4
-
5
-
6
- var _chunkTWFEYLU4js = require('./chunk-TWFEYLU4.cjs');
7
-
8
- // src/cli-main.ts
9
- var _cac = require('cac');
10
-
11
- // node_modules/.pnpm/flat@6.0.1/node_modules/flat/index.js
12
- function isBuffer(obj) {
13
- return obj && obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
14
- }
15
- function keyIdentity(key) {
16
- return key;
17
- }
18
- function flatten(target, opts) {
19
- opts = opts || {};
20
- const delimiter = opts.delimiter || ".";
21
- const maxDepth = opts.maxDepth;
22
- const transformKey = opts.transformKey || keyIdentity;
23
- const output = {};
24
- function step(object, prev, currentDepth) {
25
- currentDepth = currentDepth || 1;
26
- Object.keys(object).forEach(function(key) {
27
- const value = object[key];
28
- const isarray = opts.safe && Array.isArray(value);
29
- const type = Object.prototype.toString.call(value);
30
- const isbuffer = isBuffer(value);
31
- const isobject = type === "[object Object]" || type === "[object Array]";
32
- const newKey = prev ? prev + delimiter + transformKey(key) : transformKey(key);
33
- if (!isarray && !isbuffer && isobject && Object.keys(value).length && (!opts.maxDepth || currentDepth < maxDepth)) {
34
- return step(value, newKey, currentDepth + 1);
35
- }
36
- output[newKey] = value;
37
- });
38
- }
39
- step(target);
40
- return output;
41
- }
42
-
43
- // src/cli-main.ts
44
- function ensureArray(input) {
45
- return Array.isArray(input) ? input : input.split(",");
46
- }
47
- async function main(options = {}) {
48
- const cli = _cac.cac.call(void 0, "tsup");
49
- cli.command("[...files]", "Bundle files", {
50
- ignoreOptionDefaultValue: true
51
- }).option("--entry.* <file>", "Use a key-value pair as entry files").option("-d, --out-dir <dir>", "Output directory", { default: "dist" }).option("--format <format>", 'Bundle format, "cjs", "iife", "esm"', {
52
- default: "cjs"
53
- }).option("--minify [terser]", "Minify bundle").option("--minify-whitespace", "Minify whitespace").option("--minify-identifiers", "Minify identifiers").option("--minify-syntax", "Minify syntax").option(
54
- "--keep-names",
55
- "Keep original function and class names in minified code"
56
- ).option("--target <target>", 'Bundle target, "es20XX" or "esnext"', {
57
- default: "es2017"
58
- }).option(
59
- "--legacy-output",
60
- "Output different formats to different folder instead of using different extensions"
61
- ).option("--dts [entry]", "Generate declaration file").option("--dts-resolve", "Resolve externals types used for d.ts files").option("--dts-only", "Emit declaration files only").option(
62
- "--experimental-dts [entry]",
63
- "Generate declaration file (experimental)"
64
- ).option(
65
- "--sourcemap [inline]",
66
- "Generate external sourcemap, or inline source: --sourcemap inline"
67
- ).option(
68
- "--watch [path]",
69
- 'Watch mode, if path is not specified, it watches the current folder ".". Repeat "--watch" for more than one path'
70
- ).option("--ignore-watch <path>", "Ignore custom paths in watch mode").option(
71
- "--onSuccess <command>",
72
- "Execute command after successful build, specially useful for watch mode"
73
- ).option("--env.* <value>", "Define compile-time env variables").option(
74
- "--inject <file>",
75
- "Replace a global variable with an import from another file"
76
- ).option("--define.* <value>", "Define compile-time constants").option(
77
- "--external <name>",
78
- "Mark specific packages / package.json (dependencies and peerDependencies) as external"
79
- ).option("--global-name <name>", "Global variable name for iife format").option("--jsxFactory <jsxFactory>", "Name of JSX factory function", {
80
- default: "React.createElement"
81
- }).option("--jsxFragment <jsxFragment>", "Name of JSX fragment function", {
82
- default: "React.Fragment"
83
- }).option("--replaceNodeEnv", "Replace process.env.NODE_ENV").option("--no-splitting", "Disable code splitting").option("--clean", "Clean output directory").option(
84
- "--silent",
85
- 'Suppress non-error logs (excluding "onSuccess" process output)'
86
- ).option("--pure <express>", "Mark specific expressions as pure").option("--metafile", "Emit esbuild metafile (a JSON file)").option("--platform <platform>", "Target platform", {
87
- default: "node"
88
- }).option("--loader <ext=loader>", "Specify the loader for a file extension").option("--tsconfig <filename>", "Use a custom tsconfig").option("--config <filename>", "Use a custom config file").option("--no-config", "Disable config file").option("--shims", "Enable cjs and esm shims").option("--inject-style", "Inject style tag to document head").option(
89
- "--treeshake [strategy]",
90
- 'Using Rollup for treeshaking instead, "recommended" or "smallest" or "safest"'
91
- ).option("--publicDir [dir]", "Copy public directory to output directory").option(
92
- "--killSignal <signal>",
93
- 'Signal to kill child process, "SIGTERM" or "SIGKILL"'
94
- ).option("--cjsInterop", "Enable cjs interop").action(async (files, flags) => {
95
- const { build } = await Promise.resolve().then(() => _interopRequireWildcard(require("./index.js")));
96
- Object.assign(options, {
97
- ...flags
98
- });
99
- if (!options.entry && files.length > 0) {
100
- options.entry = files.map(_chunkTWFEYLU4js.slash);
101
- }
102
- if (flags.format) {
103
- const format = ensureArray(flags.format);
104
- options.format = format;
105
- }
106
- if (flags.external) {
107
- const external = ensureArray(flags.external);
108
- options.external = external;
109
- }
110
- if (flags.target) {
111
- options.target = flags.target.includes(",") ? flags.target.split(",") : flags.target;
112
- }
113
- if (flags.dts || flags.dtsResolve || flags.dtsOnly) {
114
- options.dts = {};
115
- if (typeof flags.dts === "string") {
116
- options.dts.entry = flags.dts;
117
- }
118
- if (flags.dtsResolve) {
119
- options.dts.resolve = flags.dtsResolve;
120
- }
121
- if (flags.dtsOnly) {
122
- options.dts.only = true;
123
- }
124
- }
125
- if (flags.inject) {
126
- const inject = ensureArray(flags.inject);
127
- options.inject = inject;
128
- }
129
- if (flags.define) {
130
- const define = flatten(flags.define);
131
- options.define = define;
132
- }
133
- if (flags.loader) {
134
- const loader = ensureArray(flags.loader);
135
- options.loader = loader.reduce((result, item) => {
136
- const parts = item.split("=");
137
- return {
138
- ...result,
139
- [parts[0]]: parts[1]
140
- };
141
- }, {});
142
- }
143
- await build(options);
144
- });
145
- cli.help();
146
- cli.version(_chunkBYH4XDRHjs.version);
147
- cli.parse(process.argv, { run: false });
148
- await cli.runMatchedCommand();
149
- }
150
-
151
-
152
-
153
- exports.main = main;
@@ -1,325 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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 _chunk2C3MWYHHcjs = require('./chunk-2C3MWYHH.cjs');
4
-
5
- // ../config-tools/src/logger/console.ts
6
- _chunk2C3MWYHHcjs.init_cjs_shims.call(void 0, );
7
-
8
- // ../config-tools/src/types.ts
9
- _chunk2C3MWYHHcjs.init_cjs_shims.call(void 0, );
10
- var LogLevel = {
11
- SILENT: 0,
12
- FATAL: 10,
13
- ERROR: 20,
14
- WARN: 30,
15
- SUCCESS: 35,
16
- INFO: 40,
17
- DEBUG: 60,
18
- TRACE: 70,
19
- ALL: 100
20
- };
21
- var LogLevelLabel = {
22
- SILENT: "silent",
23
- FATAL: "fatal",
24
- ERROR: "error",
25
- WARN: "warn",
26
- SUCCESS: "success",
27
- INFO: "info",
28
- DEBUG: "debug",
29
- TRACE: "trace",
30
- ALL: "all"
31
- };
32
-
33
- // ../config-tools/src/utilities/colors.ts
34
- _chunk2C3MWYHHcjs.init_cjs_shims.call(void 0, );
35
- var DEFAULT_COLOR_CONFIG = {
36
- light: {
37
- background: "#fafafa",
38
- foreground: "#1d1e22",
39
- brand: "#1fb2a6",
40
- alternate: "#db2777",
41
- help: "#5C4EE5",
42
- success: "#087f5b",
43
- info: "#0550ae",
44
- warning: "#e3b341",
45
- danger: "#D8314A",
46
- fatal: "#51070f",
47
- link: "#3fa6ff",
48
- positive: "#22c55e",
49
- negative: "#dc2626",
50
- gradient: ["#1fb2a6", "#db2777", "#5C4EE5"]
51
- },
52
- dark: {
53
- background: "#1d1e22",
54
- foreground: "#cbd5e1",
55
- brand: "#2dd4bf",
56
- alternate: "#db2777",
57
- help: "#818cf8",
58
- success: "#10b981",
59
- info: "#58a6ff",
60
- warning: "#f3d371",
61
- danger: "#D8314A",
62
- fatal: "#a40e26",
63
- link: "#3fa6ff",
64
- positive: "#22c55e",
65
- negative: "#dc2626",
66
- gradient: ["#1fb2a6", "#db2777", "#818cf8"]
67
- }
68
- };
69
-
70
- // ../config-tools/src/logger/chalk.ts
71
- _chunk2C3MWYHHcjs.init_cjs_shims.call(void 0, );
72
- var _chalk2 = require('chalk'); var _chalk3 = _interopRequireDefault(_chalk2);
73
- var chalkDefault = {
74
- hex: (_) => (message) => message,
75
- bgHex: (_) => ({
76
- whiteBright: (message) => message,
77
- white: (message) => message
78
- }),
79
- white: (message) => message,
80
- whiteBright: (message) => message,
81
- gray: (message) => message,
82
- bold: {
83
- hex: (_) => (message) => message,
84
- bgHex: (_) => ({
85
- whiteBright: (message) => message,
86
- white: (message) => message
87
- }),
88
- whiteBright: (message) => message,
89
- white: (message) => message
90
- },
91
- dim: {
92
- hex: (_) => (message) => message,
93
- gray: (message) => message
94
- }
95
- };
96
- var getChalk = () => {
97
- let _chalk = _chalk3.default;
98
- if (!_optionalChain([_chalk, 'optionalAccess', _2 => _2.hex]) || !_optionalChain([_chalk, 'optionalAccess', _3 => _3.bold, 'optionalAccess', _4 => _4.hex]) || !_optionalChain([_chalk, 'optionalAccess', _5 => _5.bgHex]) || !_optionalChain([_chalk, 'optionalAccess', _6 => _6.whiteBright]) || !_optionalChain([_chalk, 'optionalAccess', _7 => _7.white])) {
99
- _chalk = chalkDefault;
100
- }
101
- return _chalk;
102
- };
103
-
104
- // ../config-tools/src/logger/console-icons.ts
105
- _chunk2C3MWYHHcjs.init_cjs_shims.call(void 0, );
106
-
107
- // ../config-tools/src/logger/is-unicode-supported.ts
108
- _chunk2C3MWYHHcjs.init_cjs_shims.call(void 0, );
109
- function isUnicodeSupported() {
110
- if (process.platform !== "win32") {
111
- return process.env.TERM !== "linux";
112
- }
113
- return Boolean(process.env.WT_SESSION) || // Windows Terminal
114
- Boolean(process.env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
115
- process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
116
- process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERM === "rxvt-unicode" || process.env.TERM === "rxvt-unicode-256color" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
117
- }
118
-
119
- // ../config-tools/src/logger/console-icons.ts
120
- var useIcon = (c, fallback) => isUnicodeSupported() ? c : fallback;
121
- var CONSOLE_ICONS = {
122
- [LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
123
- [LogLevelLabel.FATAL]: useIcon("\u{1F480}", "\xD7"),
124
- [LogLevelLabel.WARN]: useIcon("\u26A0", "\u203C"),
125
- [LogLevelLabel.INFO]: useIcon("\u2139", "i"),
126
- [LogLevelLabel.SUCCESS]: useIcon("\u2714", "\u221A"),
127
- [LogLevelLabel.DEBUG]: useIcon("\u{1F6E0}", "D"),
128
- [LogLevelLabel.TRACE]: useIcon("\u{1F6E0}", "T"),
129
- [LogLevelLabel.ALL]: useIcon("\u2709", "\u2192")
130
- };
131
-
132
- // ../config-tools/src/logger/format-timestamp.ts
133
- _chunk2C3MWYHHcjs.init_cjs_shims.call(void 0, );
134
- var formatTimestamp = (date = /* @__PURE__ */ new Date()) => {
135
- return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
136
- };
137
-
138
- // ../config-tools/src/logger/get-log-level.ts
139
- _chunk2C3MWYHHcjs.init_cjs_shims.call(void 0, );
140
- var getLogLevel = (label) => {
141
- switch (label) {
142
- case "all":
143
- return LogLevel.ALL;
144
- case "trace":
145
- return LogLevel.TRACE;
146
- case "debug":
147
- return LogLevel.DEBUG;
148
- case "info":
149
- return LogLevel.INFO;
150
- case "warn":
151
- return LogLevel.WARN;
152
- case "error":
153
- return LogLevel.ERROR;
154
- case "fatal":
155
- return LogLevel.FATAL;
156
- case "silent":
157
- return LogLevel.SILENT;
158
- default:
159
- return LogLevel.INFO;
160
- }
161
- };
162
- var getLogLevelLabel = (logLevel = LogLevel.INFO) => {
163
- if (logLevel >= LogLevel.ALL) {
164
- return LogLevelLabel.ALL;
165
- }
166
- if (logLevel >= LogLevel.TRACE) {
167
- return LogLevelLabel.TRACE;
168
- }
169
- if (logLevel >= LogLevel.DEBUG) {
170
- return LogLevelLabel.DEBUG;
171
- }
172
- if (logLevel >= LogLevel.INFO) {
173
- return LogLevelLabel.INFO;
174
- }
175
- if (logLevel >= LogLevel.WARN) {
176
- return LogLevelLabel.WARN;
177
- }
178
- if (logLevel >= LogLevel.ERROR) {
179
- return LogLevelLabel.ERROR;
180
- }
181
- if (logLevel >= LogLevel.FATAL) {
182
- return LogLevelLabel.FATAL;
183
- }
184
- if (logLevel <= LogLevel.SILENT) {
185
- return LogLevelLabel.SILENT;
186
- }
187
- return LogLevelLabel.INFO;
188
- };
189
-
190
- // ../config-tools/src/logger/console.ts
191
- var getLogFn = (logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
192
- const colors = !_optionalChain([config, 'access', _8 => _8.colors, 'optionalAccess', _9 => _9.dark]) && !_optionalChain([config, 'access', _10 => _10.colors, 'optionalAccess', _11 => _11["base"]]) && !_optionalChain([config, 'access', _12 => _12.colors, 'optionalAccess', _13 => _13["base"], 'optionalAccess', _14 => _14.dark]) ? DEFAULT_COLOR_CONFIG : _optionalChain([config, 'access', _15 => _15.colors, 'optionalAccess', _16 => _16.dark]) && typeof config.colors.dark === "string" ? config.colors : _optionalChain([config, 'access', _17 => _17.colors, 'optionalAccess', _18 => _18["base"], 'optionalAccess', _19 => _19.dark]) && typeof config.colors["base"].dark === "string" ? config.colors["base"].dark : _optionalChain([config, 'access', _20 => _20.colors, 'optionalAccess', _21 => _21["base"]]) ? _optionalChain([config, 'access', _22 => _22.colors, 'optionalAccess', _23 => _23["base"]]) : DEFAULT_COLOR_CONFIG;
193
- const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
194
- if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
195
- return (_) => {
196
- };
197
- }
198
- if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
199
- return (message) => {
200
- console.error(
201
- `
202
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.fatal, () => ( DEFAULT_COLOR_CONFIG.dark.fatal)))(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
203
- `
204
- );
205
- };
206
- }
207
- if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
208
- return (message) => {
209
- console.error(
210
- `
211
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.danger, () => ( DEFAULT_COLOR_CONFIG.dark.danger)))(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
212
- `
213
- );
214
- };
215
- }
216
- if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
217
- return (message) => {
218
- console.warn(
219
- `
220
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.warning, () => ( DEFAULT_COLOR_CONFIG.dark.warning)))(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
221
- `
222
- );
223
- };
224
- }
225
- if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
226
- return (message) => {
227
- console.info(
228
- `
229
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.success, () => ( DEFAULT_COLOR_CONFIG.dark.success)))(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
230
- `
231
- );
232
- };
233
- }
234
- if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
235
- return (message) => {
236
- console.info(
237
- `
238
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.info, () => ( DEFAULT_COLOR_CONFIG.dark.info)))(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
239
- `
240
- );
241
- };
242
- }
243
- if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
244
- return (message) => {
245
- console.debug(
246
- `
247
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.info, () => ( DEFAULT_COLOR_CONFIG.dark.info)))(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
248
- `
249
- );
250
- };
251
- }
252
- if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
253
- return (message) => {
254
- console.debug(
255
- `
256
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.info, () => ( DEFAULT_COLOR_CONFIG.dark.info)))(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
257
- `
258
- );
259
- };
260
- }
261
- return (message) => {
262
- console.log(
263
- `
264
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.brand, () => ( DEFAULT_COLOR_CONFIG.dark.brand)))(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
265
- `
266
- );
267
- };
268
- };
269
- var writeFatal = (message, config) => getLogFn(LogLevel.FATAL, config)(message);
270
- var writeError = (message, config) => getLogFn(LogLevel.ERROR, config)(message);
271
- var writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message);
272
- var writeSuccess = (message, config) => getLogFn(LogLevel.SUCCESS, config)(message);
273
- var writeDebug = (message, config) => getLogFn(LogLevel.DEBUG, config)(message);
274
- var writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
275
- var getStopwatch = (name) => {
276
- const start = process.hrtime();
277
- return () => {
278
- const end = process.hrtime(start);
279
- console.info(
280
- `
281
- > \u23F1\uFE0F The${name ? ` ${name}` : ""} process took ${Math.round(
282
- end[0] * 1e3 + end[1] / 1e6
283
- )}ms to complete
284
- `
285
- );
286
- };
287
- };
288
- var MAX_DEPTH = 4;
289
- var formatLogMessage = (message, options = {}, depth = 0) => {
290
- if (depth > MAX_DEPTH) {
291
- return "<max depth>";
292
- }
293
- const prefix = _nullishCoalesce(options.prefix, () => ( "-"));
294
- const skip = _nullishCoalesce(options.skip, () => ( []));
295
- return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
296
- ${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, { prefix: `${prefix}-`, skip }, depth + 1)}`).join("\n")}` : typeof message === "object" ? `
297
- ${Object.keys(message).filter((key) => !skip.includes(key)).map(
298
- (key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(
299
- message[key],
300
- { prefix: `${prefix}-`, skip },
301
- depth + 1
302
- ) : message[key]}`
303
- ).join("\n")}` : message;
304
- };
305
- var _isFunction = (value) => {
306
- try {
307
- return value instanceof Function || typeof value === "function" || !!(_optionalChain([value, 'optionalAccess', _24 => _24.constructor]) && _optionalChain([value, 'optionalAccess', _25 => _25.call]) && _optionalChain([value, 'optionalAccess', _26 => _26.apply]));
308
- } catch (e) {
309
- return false;
310
- }
311
- };
312
-
313
-
314
-
315
-
316
-
317
-
318
-
319
-
320
-
321
-
322
-
323
-
324
-
325
- exports.LogLevel = LogLevel; exports.getLogLevel = getLogLevel; exports.getLogLevelLabel = getLogLevelLabel; exports.writeFatal = writeFatal; exports.writeError = writeError; exports.writeWarning = writeWarning; exports.writeSuccess = writeSuccess; exports.writeDebug = writeDebug; exports.writeTrace = writeTrace; exports.getStopwatch = getStopwatch; exports.formatLogMessage = formatLogMessage;
@@ -1,6 +0,0 @@
1
- import {
2
- init_esm_shims
3
- } from "./chunk-Z7VDLMOZ.js";
4
-
5
- // src/types.ts
6
- init_esm_shims();
@@ -1,135 +0,0 @@
1
- import {
2
- init_esm_shims
3
- } from "./chunk-Z7VDLMOZ.js";
4
-
5
- // ../config-tools/src/utilities/correct-paths.ts
6
- init_esm_shims();
7
- var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
8
- function normalizeWindowsPath(input = "") {
9
- if (!input) {
10
- return input;
11
- }
12
- return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
13
- }
14
- var _UNC_REGEX = /^[/\\]{2}/;
15
- var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
16
- var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
17
- var correctPaths = function(path) {
18
- if (!path || path.length === 0) {
19
- return ".";
20
- }
21
- path = normalizeWindowsPath(path);
22
- const isUNCPath = path?.match(_UNC_REGEX);
23
- const isPathAbsolute = isAbsolute(path);
24
- const trailingSeparator = path[path.length - 1] === "/";
25
- path = normalizeString(path, !isPathAbsolute);
26
- if (path.length === 0) {
27
- if (isPathAbsolute) {
28
- return "/";
29
- }
30
- return trailingSeparator ? "./" : ".";
31
- }
32
- if (trailingSeparator) {
33
- path += "/";
34
- }
35
- if (_DRIVE_LETTER_RE.test(path)) {
36
- path += "/";
37
- }
38
- if (isUNCPath) {
39
- if (!isPathAbsolute) {
40
- return `//./${path}`;
41
- }
42
- return `//${path}`;
43
- }
44
- return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
45
- };
46
- var joinPaths = function(...segments) {
47
- let path = "";
48
- for (const seg of segments) {
49
- if (!seg) {
50
- continue;
51
- }
52
- if (path.length > 0) {
53
- const pathTrailing = path[path.length - 1] === "/";
54
- const segLeading = seg[0] === "/";
55
- const both = pathTrailing && segLeading;
56
- if (both) {
57
- path += seg.slice(1);
58
- } else {
59
- path += pathTrailing || segLeading ? seg : `/${seg}`;
60
- }
61
- } else {
62
- path += seg;
63
- }
64
- }
65
- return correctPaths(path);
66
- };
67
- function normalizeString(path, allowAboveRoot) {
68
- let res = "";
69
- let lastSegmentLength = 0;
70
- let lastSlash = -1;
71
- let dots = 0;
72
- let char = null;
73
- for (let index = 0; index <= path.length; ++index) {
74
- if (index < path.length) {
75
- char = path[index];
76
- } else if (char === "/") {
77
- break;
78
- } else {
79
- char = "/";
80
- }
81
- if (char === "/") {
82
- if (lastSlash === index - 1 || dots === 1) {
83
- } else if (dots === 2) {
84
- if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
85
- if (res.length > 2) {
86
- const lastSlashIndex = res.lastIndexOf("/");
87
- if (lastSlashIndex === -1) {
88
- res = "";
89
- lastSegmentLength = 0;
90
- } else {
91
- res = res.slice(0, lastSlashIndex);
92
- lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
93
- }
94
- lastSlash = index;
95
- dots = 0;
96
- continue;
97
- } else if (res.length > 0) {
98
- res = "";
99
- lastSegmentLength = 0;
100
- lastSlash = index;
101
- dots = 0;
102
- continue;
103
- }
104
- }
105
- if (allowAboveRoot) {
106
- res += res.length > 0 ? "/.." : "..";
107
- lastSegmentLength = 2;
108
- }
109
- } else {
110
- if (res.length > 0) {
111
- res += `/${path.slice(lastSlash + 1, index)}`;
112
- } else {
113
- res = path.slice(lastSlash + 1, index);
114
- }
115
- lastSegmentLength = index - lastSlash - 1;
116
- }
117
- lastSlash = index;
118
- dots = 0;
119
- } else if (char === "." && dots !== -1) {
120
- ++dots;
121
- } else {
122
- dots = -1;
123
- }
124
- }
125
- return res;
126
- }
127
- var isAbsolute = function(p) {
128
- return _IS_ABSOLUTE_RE.test(p);
129
- };
130
-
131
- export {
132
- normalizeWindowsPath,
133
- correctPaths,
134
- joinPaths
135
- };
@@ -1,42 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/errors.ts
2
- var _worker_threads = require('worker_threads');
3
- var _picocolors = require('picocolors'); var _picocolors2 = _interopRequireDefault(_picocolors);
4
- var PrettyError = class extends Error {
5
- constructor(message) {
6
- super(message);
7
- this.name = this.constructor.name;
8
- if (typeof Error.captureStackTrace === "function") {
9
- Error.captureStackTrace(this, this.constructor);
10
- } else {
11
- this.stack = new Error(message).stack;
12
- }
13
- }
14
- };
15
- function handleError(error) {
16
- if (error.loc) {
17
- console.error(
18
- _picocolors2.default.bold(
19
- _picocolors2.default.red(
20
- `Error parsing: ${error.loc.file}:${error.loc.line}:${error.loc.column}`
21
- )
22
- )
23
- );
24
- }
25
- if (error.frame) {
26
- console.error(_picocolors2.default.red(error.message));
27
- console.error(_picocolors2.default.dim(error.frame));
28
- } else if (error instanceof PrettyError) {
29
- console.error(_picocolors2.default.red(error.message));
30
- } else {
31
- console.error(_picocolors2.default.red(error.stack));
32
- }
33
- process.exitCode = 1;
34
- if (!_worker_threads.isMainThread && _worker_threads.parentPort) {
35
- _worker_threads.parentPort.postMessage("error");
36
- }
37
- }
38
-
39
-
40
-
41
-
42
- exports.PrettyError = PrettyError; exports.handleError = handleError;