@storm-software/config-tools 1.190.119 → 1.190.120

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 (114) hide show
  1. package/README.md +1 -1
  2. package/bin/config.cjs +20 -1532
  3. package/bin/config.js +19 -1527
  4. package/dist/config-file/get-config-file.cjs +80 -25
  5. package/dist/config-file/get-config-file.js +79 -24
  6. package/dist/config-file/index.cjs +1 -29
  7. package/dist/config-file/index.js +1 -29
  8. package/dist/create-storm-config.cjs +138 -26
  9. package/dist/create-storm-config.js +140 -28
  10. package/dist/env/get-env.cjs +221 -6
  11. package/dist/env/get-env.js +221 -6
  12. package/dist/env/index.cjs +2 -18
  13. package/dist/env/index.js +2 -18
  14. package/dist/env/set-env.cjs +383 -8
  15. package/dist/env/set-env.js +382 -7
  16. package/dist/get-config.cjs +28 -27
  17. package/dist/get-config.js +29 -28
  18. package/dist/index.cjs +7 -201
  19. package/dist/index.js +7 -201
  20. package/dist/logger/chalk.cjs +32 -4
  21. package/dist/logger/chalk.js +31 -3
  22. package/dist/logger/console-icons.cjs +15 -6
  23. package/dist/logger/console-icons.js +14 -5
  24. package/dist/logger/console.cjs +191 -37
  25. package/dist/logger/console.js +176 -22
  26. package/dist/logger/create-logger.cjs +25 -12
  27. package/dist/logger/create-logger.js +24 -11
  28. package/dist/logger/format-timestamp.cjs +4 -4
  29. package/dist/logger/format-timestamp.js +3 -3
  30. package/dist/logger/get-log-level.cjs +60 -7
  31. package/dist/logger/get-log-level.js +59 -6
  32. package/dist/logger/index.cjs +7 -61
  33. package/dist/logger/index.js +7 -61
  34. package/dist/logger/is-unicode-supported.cjs +10 -4
  35. package/dist/logger/is-unicode-supported.js +9 -3
  36. package/dist/types.cjs +25 -5
  37. package/dist/types.js +24 -4
  38. package/dist/utilities/apply-workspace-tokens.cjs +72 -9
  39. package/dist/utilities/apply-workspace-tokens.js +71 -8
  40. package/dist/utilities/colors.cjs +76 -7
  41. package/dist/utilities/colors.js +75 -6
  42. package/dist/utilities/correct-paths.cjs +231 -32
  43. package/dist/utilities/correct-paths.js +215 -16
  44. package/dist/utilities/file-path-utils.cjs +29 -7
  45. package/dist/utilities/file-path-utils.js +28 -6
  46. package/dist/utilities/find-up.cjs +21 -4
  47. package/dist/utilities/find-up.js +20 -3
  48. package/dist/utilities/find-workspace-root.cjs +74 -7
  49. package/dist/utilities/find-workspace-root.js +73 -6
  50. package/dist/utilities/get-default-config.cjs +90 -6
  51. package/dist/utilities/get-default-config.js +90 -6
  52. package/dist/utilities/index.cjs +9 -109
  53. package/dist/utilities/index.js +9 -109
  54. package/dist/utilities/process-handler.cjs +46 -11
  55. package/dist/utilities/process-handler.js +47 -12
  56. package/dist/utilities/run.cjs +34 -6
  57. package/dist/utilities/run.js +33 -5
  58. package/dist/utilities/toml.cjs +42 -24
  59. package/dist/utilities/toml.js +35 -17
  60. package/package.json +4 -4
  61. package/dist/chunk-24B36RDB.cjs +0 -81
  62. package/dist/chunk-27N3QEX5.js +0 -40
  63. package/dist/chunk-2AVLCXLT.js +0 -0
  64. package/dist/chunk-2RLMTBVZ.js +0 -233
  65. package/dist/chunk-2WBD2G3E.cjs +0 -38
  66. package/dist/chunk-3COHMHPU.cjs +0 -1
  67. package/dist/chunk-4Q45WJYQ.js +0 -165
  68. package/dist/chunk-5C7PIENF.js +0 -92
  69. package/dist/chunk-5J2SS4QU.js +0 -83
  70. package/dist/chunk-65SWKEHV.cjs +0 -1
  71. package/dist/chunk-6Y623TCS.cjs +0 -40
  72. package/dist/chunk-7PV6L7I7.cjs +0 -1
  73. package/dist/chunk-7QBTVNMR.cjs +0 -30
  74. package/dist/chunk-BDATZ3UB.cjs +0 -233
  75. package/dist/chunk-BZRTSWH4.cjs +0 -395
  76. package/dist/chunk-D3FRXXDE.js +0 -947
  77. package/dist/chunk-DTGT4OI3.cjs +0 -14
  78. package/dist/chunk-EC2KPWRG.cjs +0 -24
  79. package/dist/chunk-EENQN6N2.js +0 -40
  80. package/dist/chunk-ENI4UUSK.cjs +0 -35
  81. package/dist/chunk-FJNXECWU.js +0 -395
  82. package/dist/chunk-FMDVBSP6.cjs +0 -83
  83. package/dist/chunk-G2MK47WL.js +0 -14
  84. package/dist/chunk-HFS7WJVW.js +0 -81
  85. package/dist/chunk-HVVJHTFS.js +0 -36
  86. package/dist/chunk-IWD6YQKX.cjs +0 -1
  87. package/dist/chunk-IWQRXQ4N.cjs +0 -84
  88. package/dist/chunk-JK4TT5IV.js +0 -35
  89. package/dist/chunk-JWLDCEBZ.cjs +0 -70
  90. package/dist/chunk-JZAYHDV3.js +0 -8
  91. package/dist/chunk-KSMN3HSC.js +0 -38
  92. package/dist/chunk-L6UNTUC4.js +0 -0
  93. package/dist/chunk-LOY6ICHZ.cjs +0 -36
  94. package/dist/chunk-MBG2FTBL.cjs +0 -47
  95. package/dist/chunk-MQG74XF7.js +0 -102
  96. package/dist/chunk-MSAQEGBK.cjs +0 -92
  97. package/dist/chunk-NJFLUTGH.cjs +0 -25
  98. package/dist/chunk-PCYB64MB.cjs +0 -40
  99. package/dist/chunk-RALMUN5C.js +0 -30
  100. package/dist/chunk-RRKB32OH.js +0 -0
  101. package/dist/chunk-RUKM6FCF.js +0 -25
  102. package/dist/chunk-SIW7AXUG.js +0 -56
  103. package/dist/chunk-SLICWTO2.cjs +0 -165
  104. package/dist/chunk-SO3FWVXC.js +0 -84
  105. package/dist/chunk-SXPH7ILL.js +0 -70
  106. package/dist/chunk-T7YISGRS.cjs +0 -102
  107. package/dist/chunk-TZZRLM5J.cjs +0 -947
  108. package/dist/chunk-UJ77IBHD.cjs +0 -233
  109. package/dist/chunk-UKGRDKIH.js +0 -0
  110. package/dist/chunk-V3GMJ4TX.js +0 -233
  111. package/dist/chunk-WQJYIPSL.cjs +0 -8
  112. package/dist/chunk-YBVOKYAM.cjs +0 -56
  113. package/dist/chunk-YX4736HU.js +0 -47
  114. package/dist/chunk-ZFNAUMQS.js +0 -24
@@ -1,38 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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 _chunkBDATZ3UBcjs = require('./chunk-BDATZ3UB.cjs');
4
-
5
- // src/utilities/file-path-utils.ts
6
- var removeExtension = (filePath) => {
7
- const result = !filePath || (_optionalChain([filePath, 'optionalAccess', _ => _.match, 'call', _2 => _2(/./g)]) || []).length <= 1 ? "." : filePath.lastIndexOf(".") ? filePath.substring(0, filePath.lastIndexOf(".")) : filePath;
8
- if (result.startsWith("./")) {
9
- return result.substring(2);
10
- }
11
- if (result.startsWith(".") || result.startsWith("/")) {
12
- return result.substring(1);
13
- }
14
- return result;
15
- };
16
- function findFileName(filePath, { requireExtension, withExtension } = {}) {
17
- const result = _nullishCoalesce(_optionalChain([_chunkBDATZ3UBcjs.normalizeWindowsPath.call(void 0, filePath), 'optionalAccess', _3 => _3.split, 'call', _4 => _4(_optionalChain([filePath, 'optionalAccess', _5 => _5.includes, 'call', _6 => _6("\\")]) ? "\\" : "/"), 'optionalAccess', _7 => _7.pop, 'call', _8 => _8()]), () => ( ""));
18
- if (requireExtension === true && !result.includes(".")) {
19
- return "";
20
- }
21
- if (withExtension === false && result.includes(".")) {
22
- return result.split(".").slice(-1).join(".") || "";
23
- }
24
- return result;
25
- }
26
- function findFilePath(filePath) {
27
- const normalizedPath = _chunkBDATZ3UBcjs.normalizeWindowsPath.call(void 0, filePath);
28
- return normalizedPath.replace(
29
- findFileName(normalizedPath, { requireExtension: true }),
30
- ""
31
- );
32
- }
33
-
34
-
35
-
36
-
37
-
38
- exports.removeExtension = removeExtension; exports.findFileName = findFileName; exports.findFilePath = findFilePath;
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,165 +0,0 @@
1
- import {
2
- getConfigFile
3
- } from "./chunk-5C7PIENF.js";
4
- import {
5
- applyDefaultConfig,
6
- getPackageJsonConfig
7
- } from "./chunk-MQG74XF7.js";
8
- import {
9
- findWorkspaceRoot
10
- } from "./chunk-SO3FWVXC.js";
11
- import {
12
- formatLogMessage,
13
- writeTrace,
14
- writeWarning
15
- } from "./chunk-D3FRXXDE.js";
16
- import {
17
- setConfigEnv
18
- } from "./chunk-FJNXECWU.js";
19
- import {
20
- getConfigEnv,
21
- getExtensionEnv
22
- } from "./chunk-2RLMTBVZ.js";
23
- import {
24
- joinPaths
25
- } from "./chunk-V3GMJ4TX.js";
26
-
27
- // src/create-storm-config.ts
28
- import { workspaceConfigSchema } from "@storm-software/config/schema";
29
- import defu from "defu";
30
- import { existsSync } from "node:fs";
31
- var _extension_cache = /* @__PURE__ */ new WeakMap();
32
- var _static_cache = void 0;
33
- var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
34
- let result;
35
- if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
36
- let _workspaceRoot = workspaceRoot;
37
- if (!_workspaceRoot) {
38
- _workspaceRoot = findWorkspaceRoot();
39
- }
40
- const configEnv = getConfigEnv();
41
- const configFile = await getConfigFile(_workspaceRoot);
42
- if (!configFile) {
43
- if (!skipLogs) {
44
- writeWarning(
45
- "No Storm Workspace configuration file found in the current repository. Please ensure this is the expected behavior - you can add a `storm-workspace.json` file to the root of your workspace if it is not.\n",
46
- { logLevel: "all" }
47
- );
48
- }
49
- if (useDefault === false) {
50
- return void 0;
51
- }
52
- }
53
- const defaultConfig = await getPackageJsonConfig(_workspaceRoot);
54
- const configInput = defu(
55
- configEnv,
56
- configFile,
57
- defaultConfig
58
- );
59
- if (!configInput.variant) {
60
- configInput.variant = existsSync(joinPaths(_workspaceRoot, "nx.json")) || existsSync(joinPaths(_workspaceRoot, ".nx")) || existsSync(joinPaths(_workspaceRoot, "lerna.json")) || existsSync(joinPaths(_workspaceRoot, "turbo.json")) ? "monorepo" : "minimal";
61
- }
62
- try {
63
- const parseResult = await Promise.resolve(
64
- workspaceConfigSchema._zod.parse(
65
- { value: configInput, issues: [] },
66
- { async: true }
67
- )
68
- );
69
- result = applyDefaultConfig(parseResult.value);
70
- result.workspaceRoot ??= _workspaceRoot;
71
- } catch (error) {
72
- throw new Error(
73
- `Failed to parse Storm Workspace configuration${error?.message ? `: ${error.message}` : ""}
74
-
75
- Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${formatLogMessage(
76
- configInput
77
- )}`,
78
- {
79
- cause: error
80
- }
81
- );
82
- }
83
- } else {
84
- result = _static_cache.data;
85
- }
86
- if (schema && extensionName) {
87
- result.extensions = {
88
- ...result.extensions,
89
- [extensionName]: createConfigExtension(extensionName, schema)
90
- };
91
- }
92
- _static_cache = {
93
- timestamp: Date.now(),
94
- data: result
95
- };
96
- return result;
97
- };
98
- var createConfigExtension = (extensionName, schema) => {
99
- const extension_cache_key = { extensionName };
100
- if (_extension_cache.has(extension_cache_key)) {
101
- return _extension_cache.get(extension_cache_key);
102
- }
103
- let extension = getExtensionEnv(extensionName);
104
- if (schema) {
105
- extension = schema.parse(extension);
106
- }
107
- _extension_cache.set(extension_cache_key, extension);
108
- return extension;
109
- };
110
- var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
111
- const config = await createStormWorkspaceConfig(
112
- void 0,
113
- void 0,
114
- workspaceRoot,
115
- skipLogs,
116
- true
117
- );
118
- setConfigEnv(config);
119
- if (!skipLogs && !config.skipConfigLogging) {
120
- writeTrace(
121
- `\u2699\uFE0F Using Storm Workspace configuration:
122
- ${formatLogMessage(config)}`,
123
- config
124
- );
125
- }
126
- return config;
127
- };
128
- var tryLoadStormWorkspaceConfig = async (workspaceRoot, skipLogs = true, useDefault = false) => {
129
- try {
130
- const config = await createStormWorkspaceConfig(
131
- void 0,
132
- void 0,
133
- workspaceRoot,
134
- skipLogs,
135
- useDefault
136
- );
137
- if (!config) {
138
- return void 0;
139
- }
140
- setConfigEnv(config);
141
- if (!skipLogs && !config.skipConfigLogging) {
142
- writeTrace(
143
- `\u2699\uFE0F Using Storm Workspace configuration:
144
- ${formatLogMessage(config)}`,
145
- config
146
- );
147
- }
148
- return config;
149
- } catch (error) {
150
- if (!skipLogs) {
151
- writeWarning(
152
- `\u26A0\uFE0F Failed to load Storm Workspace configuration: ${error}`,
153
- { logLevel: "all" }
154
- );
155
- }
156
- return void 0;
157
- }
158
- };
159
-
160
- export {
161
- createStormWorkspaceConfig,
162
- createConfigExtension,
163
- loadStormWorkspaceConfig,
164
- tryLoadStormWorkspaceConfig
165
- };
@@ -1,92 +0,0 @@
1
- import {
2
- findWorkspaceRoot
3
- } from "./chunk-SO3FWVXC.js";
4
- import {
5
- writeTrace
6
- } from "./chunk-D3FRXXDE.js";
7
- import {
8
- joinPaths
9
- } from "./chunk-V3GMJ4TX.js";
10
-
11
- // src/config-file/get-config-file.ts
12
- import { loadConfig } from "c12";
13
- import defu from "defu";
14
- var getConfigFileByName = async (fileName, filePath, options = {}) => {
15
- const workspacePath = filePath || findWorkspaceRoot(filePath);
16
- const configs = await Promise.all([
17
- loadConfig({
18
- cwd: workspacePath,
19
- packageJson: true,
20
- name: fileName,
21
- envName: fileName?.toUpperCase(),
22
- jitiOptions: {
23
- debug: false,
24
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
25
- process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
26
- "jiti"
27
- )
28
- },
29
- ...options
30
- }),
31
- loadConfig({
32
- cwd: workspacePath,
33
- packageJson: true,
34
- name: fileName,
35
- envName: fileName?.toUpperCase(),
36
- jitiOptions: {
37
- debug: false,
38
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
39
- process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
40
- "jiti"
41
- )
42
- },
43
- configFile: fileName,
44
- ...options
45
- })
46
- ]);
47
- return defu(configs[0] ?? {}, configs[1] ?? {});
48
- };
49
- var getConfigFile = async (filePath, additionalFileNames = []) => {
50
- const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
51
- const result = await getConfigFileByName("storm-workspace", workspacePath);
52
- let config = result.config;
53
- const configFile = result.configFile;
54
- if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
55
- writeTrace(
56
- `Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`,
57
- {
58
- logLevel: "all"
59
- }
60
- );
61
- }
62
- if (additionalFileNames && additionalFileNames.length > 0) {
63
- const results = await Promise.all(
64
- additionalFileNames.map(
65
- (fileName) => getConfigFileByName(fileName, workspacePath)
66
- )
67
- );
68
- for (const result2 of results) {
69
- if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
70
- if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
71
- writeTrace(
72
- `Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`,
73
- {
74
- logLevel: "all"
75
- }
76
- );
77
- }
78
- config = defu(result2.config ?? {}, config ?? {});
79
- }
80
- }
81
- }
82
- if (!config || Object.keys(config).length === 0) {
83
- return void 0;
84
- }
85
- config.configFile = configFile;
86
- return config;
87
- };
88
-
89
- export {
90
- getConfigFileByName,
91
- getConfigFile
92
- };
@@ -1,83 +0,0 @@
1
- // src/utilities/colors.ts
2
- var DEFAULT_COLOR_CONFIG = {
3
- light: {
4
- background: "#fafafa",
5
- foreground: "#1d1e22",
6
- brand: "#1fb2a6",
7
- alternate: "#db2777",
8
- discovery: "#5C4EE5",
9
- success: "#087f5b",
10
- info: "#0550ae",
11
- debug: "#8afafc",
12
- warning: "#e3b341",
13
- danger: "#D8314A",
14
- fatal: "#51070f",
15
- performance: "#13c302",
16
- link: "#3fa6ff",
17
- positive: "#22c55e",
18
- negative: "#dc2626",
19
- gradient: ["#1fb2a6", "#db2777", "#5C4EE5"]
20
- },
21
- dark: {
22
- background: "#1e2124",
23
- foreground: "#cbd5e1",
24
- brand: "#2dd4bf",
25
- alternate: "#db2777",
26
- discovery: "#818cf8",
27
- success: "#10b981",
28
- info: "#58a6ff",
29
- debug: "#8afafc",
30
- warning: "#f3d371",
31
- danger: "#D8314A",
32
- fatal: "#a40e26",
33
- performance: "#80fd74",
34
- link: "#3fa6ff",
35
- positive: "#22c55e",
36
- negative: "#dc2626",
37
- gradient: ["#1fb2a6", "#db2777", "#818cf8"]
38
- }
39
- };
40
- function getColors(config) {
41
- if (!config?.colors || typeof config.colors !== "object" || !config.colors["dark"] && (!config.colors["base"] || typeof config.colors !== "object" || !config.colors["base"]?.["dark"])) {
42
- return DEFAULT_COLOR_CONFIG;
43
- }
44
- if (config.colors["base"]) {
45
- if (typeof config.colors["base"]["dark"] === "object") {
46
- return config.colors["base"]["dark"];
47
- } else if (config.colors["base"]["dark"] === "string") {
48
- return config.colors["base"];
49
- }
50
- }
51
- if (typeof config.colors["dark"] === "object") {
52
- return config.colors["dark"];
53
- }
54
- return config.colors ?? DEFAULT_COLOR_CONFIG;
55
- }
56
- function getColor(key, config) {
57
- const colors = getColors(config);
58
- const result = (typeof colors["dark"] === "object" ? colors["dark"][key] : colors[key]) || DEFAULT_COLOR_CONFIG["dark"][key] || DEFAULT_COLOR_CONFIG[key];
59
- if (result) {
60
- return result;
61
- }
62
- if (key === "link" || key === "debug") {
63
- return getColor("info", config);
64
- } else if (key === "fatal") {
65
- return getColor("danger", config);
66
- }
67
- return getColor("brand", config);
68
- }
69
- function getGradient(config) {
70
- const colors = getColors(config);
71
- const result = (typeof colors["dark"] === "object" ? colors["dark"].gradient : colors.gradient) || DEFAULT_COLOR_CONFIG["dark"].gradient;
72
- if (result && Array.isArray(result) && result.length > 0) {
73
- return result;
74
- }
75
- return void 0;
76
- }
77
-
78
- export {
79
- DEFAULT_COLOR_CONFIG,
80
- getColors,
81
- getColor,
82
- getGradient
83
- };
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,40 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/utilities/run.ts
2
- var _child_process = require('child_process');
3
- var LARGE_BUFFER = 1024 * 1e6;
4
- var run = (config, command, cwd = _nullishCoalesce(config.workspaceRoot, () => ( process.cwd())), stdio = "inherit", env = process.env) => {
5
- return _child_process.execSync.call(void 0, command, {
6
- cwd,
7
- env: {
8
- ...process.env,
9
- ...env,
10
- CLICOLOR: "true",
11
- FORCE_COLOR: "true"
12
- },
13
- windowsHide: true,
14
- stdio,
15
- maxBuffer: LARGE_BUFFER,
16
- killSignal: "SIGTERM",
17
- encoding: "utf8"
18
- });
19
- };
20
- var runAsync = (config, command, cwd = _nullishCoalesce(config.workspaceRoot, () => ( process.cwd())), env = process.env) => {
21
- return _child_process.exec.call(void 0, command, {
22
- cwd,
23
- env: {
24
- ...process.env,
25
- ...env,
26
- CLICOLOR: "true",
27
- FORCE_COLOR: "true"
28
- },
29
- windowsHide: true,
30
- maxBuffer: LARGE_BUFFER,
31
- killSignal: "SIGTERM",
32
- encoding: "utf8"
33
- });
34
- };
35
-
36
-
37
-
38
-
39
-
40
- exports.LARGE_BUFFER = LARGE_BUFFER; exports.run = run; exports.runAsync = runAsync;
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,30 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/types.ts
2
- var LogLevel = {
3
- SILENT: 0,
4
- FATAL: 10,
5
- ERROR: 20,
6
- WARN: 30,
7
- SUCCESS: 35,
8
- INFO: 40,
9
- PERFORMANCE: 50,
10
- DEBUG: 60,
11
- TRACE: 70,
12
- ALL: 100
13
- };
14
- var LogLevelLabel = {
15
- SILENT: "silent",
16
- FATAL: "fatal",
17
- ERROR: "error",
18
- WARN: "warn",
19
- SUCCESS: "success",
20
- INFO: "info",
21
- PERFORMANCE: "performance",
22
- DEBUG: "debug",
23
- TRACE: "trace",
24
- ALL: "all"
25
- };
26
-
27
-
28
-
29
-
30
- exports.LogLevel = LogLevel; exports.LogLevelLabel = LogLevelLabel;
@@ -1,233 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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; }// src/utilities/correct-paths.ts
2
- var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
3
- function normalizeWindowsPath(input = "") {
4
- if (!input) {
5
- return input;
6
- }
7
- return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
8
- }
9
- var _UNC_REGEX = /^[/\\]{2}/;
10
- var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
11
- var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
12
- var _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
13
- var _EXTNAME_RE = /.(\.[^./]+|\.)$/;
14
- var _PATH_ROOT_RE = /^[/\\]|^[a-zA-Z]:[/\\]/;
15
- var sep = "/";
16
- var correctPaths = function(path) {
17
- if (!path || path.length === 0) {
18
- return ".";
19
- }
20
- path = normalizeWindowsPath(path);
21
- const isUNCPath = _optionalChain([path, 'optionalAccess', _ => _.match, 'call', _2 => _2(_UNC_REGEX)]);
22
- const isPathAbsolute = isAbsolute(path);
23
- const trailingSeparator = path[path.length - 1] === "/";
24
- path = normalizeString(path, !isPathAbsolute);
25
- if (path.length === 0) {
26
- if (isPathAbsolute) {
27
- return "/";
28
- }
29
- return trailingSeparator ? "./" : ".";
30
- }
31
- if (trailingSeparator) {
32
- path += "/";
33
- }
34
- if (_DRIVE_LETTER_RE.test(path)) {
35
- path += "/";
36
- }
37
- if (isUNCPath) {
38
- if (!isPathAbsolute) {
39
- return `//./${path}`;
40
- }
41
- return `//${path}`;
42
- }
43
- return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
44
- };
45
- var joinPaths = function(...segments) {
46
- let path = "";
47
- for (const seg of segments) {
48
- if (!seg) {
49
- continue;
50
- }
51
- if (path.length > 0) {
52
- const pathTrailing = path[path.length - 1] === "/";
53
- const segLeading = seg[0] === "/";
54
- const both = pathTrailing && segLeading;
55
- if (both) {
56
- path += seg.slice(1);
57
- } else {
58
- path += pathTrailing || segLeading ? seg : `/${seg}`;
59
- }
60
- } else {
61
- path += seg;
62
- }
63
- }
64
- return correctPaths(path);
65
- };
66
- function cwd() {
67
- if (typeof process !== "undefined" && typeof process.cwd === "function") {
68
- return process.cwd().replace(/\\/g, "/");
69
- }
70
- return "/";
71
- }
72
- var resolve = function(...arguments_) {
73
- arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
74
- let resolvedPath = "";
75
- let resolvedAbsolute = false;
76
- for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
77
- const path = index >= 0 ? arguments_[index] : cwd();
78
- if (!path || path.length === 0) {
79
- continue;
80
- }
81
- resolvedPath = `${path}/${resolvedPath}`;
82
- resolvedAbsolute = isAbsolute(path);
83
- }
84
- resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
85
- if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
86
- return `/${resolvedPath}`;
87
- }
88
- return resolvedPath.length > 0 ? resolvedPath : ".";
89
- };
90
- function normalizeString(path, allowAboveRoot) {
91
- let res = "";
92
- let lastSegmentLength = 0;
93
- let lastSlash = -1;
94
- let dots = 0;
95
- let char = null;
96
- for (let index = 0; index <= path.length; ++index) {
97
- if (index < path.length) {
98
- char = path[index];
99
- } else if (char === "/") {
100
- break;
101
- } else {
102
- char = "/";
103
- }
104
- if (char === "/") {
105
- if (lastSlash === index - 1 || dots === 1) {
106
- } else if (dots === 2) {
107
- if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
108
- if (res.length > 2) {
109
- const lastSlashIndex = res.lastIndexOf("/");
110
- if (lastSlashIndex === -1) {
111
- res = "";
112
- lastSegmentLength = 0;
113
- } else {
114
- res = res.slice(0, lastSlashIndex);
115
- lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
116
- }
117
- lastSlash = index;
118
- dots = 0;
119
- continue;
120
- } else if (res.length > 0) {
121
- res = "";
122
- lastSegmentLength = 0;
123
- lastSlash = index;
124
- dots = 0;
125
- continue;
126
- }
127
- }
128
- if (allowAboveRoot) {
129
- res += res.length > 0 ? "/.." : "..";
130
- lastSegmentLength = 2;
131
- }
132
- } else {
133
- if (res.length > 0) {
134
- res += `/${path.slice(lastSlash + 1, index)}`;
135
- } else {
136
- res = path.slice(lastSlash + 1, index);
137
- }
138
- lastSegmentLength = index - lastSlash - 1;
139
- }
140
- lastSlash = index;
141
- dots = 0;
142
- } else if (char === "." && dots !== -1) {
143
- ++dots;
144
- } else {
145
- dots = -1;
146
- }
147
- }
148
- return res;
149
- }
150
- var isAbsolute = function(p) {
151
- return _IS_ABSOLUTE_RE.test(p);
152
- };
153
- var toNamespacedPath = function(p) {
154
- return normalizeWindowsPath(p);
155
- };
156
- var extname = function(p) {
157
- if (p === "..") return "";
158
- const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
159
- return match && match[1] || "";
160
- };
161
- var relative = function(from, to) {
162
- const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
163
- const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
164
- if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
165
- return _to.join("/");
166
- }
167
- const _fromCopy = [..._from];
168
- for (const segment of _fromCopy) {
169
- if (_to[0] !== segment) {
170
- break;
171
- }
172
- _from.shift();
173
- _to.shift();
174
- }
175
- return [..._from.map(() => ".."), ..._to].join("/");
176
- };
177
- var dirname = function(p) {
178
- const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
179
- if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) {
180
- segments[0] += "/";
181
- }
182
- return segments.join("/") || (isAbsolute(p) ? "/" : ".");
183
- };
184
- var format = function(p) {
185
- const ext = p.ext ? p.ext.startsWith(".") ? p.ext : `.${p.ext}` : "";
186
- const segments = [p.root, p.dir, _nullishCoalesce(p.base, () => ( (_nullishCoalesce(p.name, () => ( ""))) + ext))].filter(
187
- Boolean
188
- );
189
- return normalizeWindowsPath(
190
- p.root ? resolve(...segments) : segments.join("/")
191
- );
192
- };
193
- var basename = function(p, extension) {
194
- const segments = normalizeWindowsPath(p).split("/");
195
- let lastSegment = "";
196
- for (let i = segments.length - 1; i >= 0; i--) {
197
- const val = segments[i];
198
- if (val) {
199
- lastSegment = val;
200
- break;
201
- }
202
- }
203
- return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
204
- };
205
- var parse = function(p) {
206
- const root = _optionalChain([_PATH_ROOT_RE, 'access', _3 => _3.exec, 'call', _4 => _4(p), 'optionalAccess', _5 => _5[0], 'optionalAccess', _6 => _6.replace, 'call', _7 => _7(/\\/g, "/")]) || "";
207
- const base = basename(p);
208
- const extension = extname(base);
209
- return {
210
- root,
211
- dir: dirname(p),
212
- base,
213
- ext: extension,
214
- name: base.slice(0, base.length - extension.length)
215
- };
216
- };
217
-
218
-
219
-
220
-
221
-
222
-
223
-
224
-
225
-
226
-
227
-
228
-
229
-
230
-
231
-
232
-
233
- exports.normalizeWindowsPath = normalizeWindowsPath; exports.sep = sep; exports.correctPaths = correctPaths; exports.joinPaths = joinPaths; exports.resolve = resolve; exports.normalizeString = normalizeString; exports.isAbsolute = isAbsolute; exports.toNamespacedPath = toNamespacedPath; exports.extname = extname; exports.relative = relative; exports.dirname = dirname; exports.format = format; exports.basename = basename; exports.parse = parse;