@storm-software/unbuild 0.20.0 → 0.21.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 +1 -1
- package/bin/unbuild.js +13665 -263
- package/bin/unbuild.mjs +13673 -271
- package/dist/build.js +9 -10
- package/dist/build.mjs +8 -9
- package/dist/{chunk-XI6ZXBUG.js → chunk-3KCZOJ2Q.js} +119 -135
- package/dist/{chunk-ZUXO7HQP.js → chunk-3OJD7CO4.js} +8 -5
- package/dist/chunk-AICX43E6.mjs +13496 -0
- package/dist/{chunk-I24R5RY2.mjs → chunk-AYFS4N2Z.mjs} +46 -62
- package/dist/chunk-AYRYNROK.js +27 -0
- package/dist/{chunk-5SOSUWM3.mjs → chunk-B5GGHMTB.mjs} +9 -8
- package/dist/chunk-BIZYEBW3.mjs +38 -0
- package/dist/chunk-DFIGNXGY.js +13496 -0
- package/dist/{chunk-34DH32EF.mjs → chunk-FDF3FMZP.mjs} +1 -1
- package/dist/{chunk-AH7CDDC4.mjs → chunk-IIVTCNH5.mjs} +6 -3
- package/dist/{chunk-FP34RJ2B.mjs → chunk-OG2CKJQU.mjs} +1 -1
- package/dist/{chunk-2CDKPC2J.js → chunk-OQPSH7GE.js} +9 -8
- package/dist/chunk-RCEWRXM5.js +38 -0
- package/dist/{chunk-LMAVRNZF.mjs → chunk-T5NKX2EJ.mjs} +5 -9
- package/dist/{chunk-QUQ5VOD7.js → chunk-WPOEGALQ.js} +3 -3
- package/dist/{chunk-JOAJEBTW.js → chunk-XEAFTDQ7.js} +2 -2
- package/dist/clean.js +3 -3
- package/dist/clean.mjs +2 -2
- package/dist/config.js +7 -8
- package/dist/config.mjs +6 -7
- package/dist/index.js +9 -10
- package/dist/index.mjs +8 -9
- package/package.json +1 -1
- package/dist/chunk-4REDJQMU.js +0 -35
- package/dist/chunk-ITLNJJHL.mjs +0 -65
- package/dist/chunk-KTRDC23G.mjs +0 -28
- package/dist/chunk-L73LP5QX.js +0 -31
- package/dist/chunk-TYJGNL6P.mjs +0 -35
- package/dist/chunk-V2LF4EEM.js +0 -28
- package/dist/chunk-YNOD6WE4.js +0 -65
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
clean
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IIVTCNH5.mjs";
|
|
4
4
|
import {
|
|
5
5
|
getDefaultBuildPlugins
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-T5NKX2EJ.mjs";
|
|
7
7
|
import {
|
|
8
8
|
loadConfig
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-AICX43E6.mjs";
|
|
10
10
|
import {
|
|
11
11
|
COLOR_KEYS,
|
|
12
12
|
LogLevel,
|
|
@@ -29,14 +29,13 @@ import {
|
|
|
29
29
|
writeSystem,
|
|
30
30
|
writeTrace,
|
|
31
31
|
writeWarning
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-B5GGHMTB.mjs";
|
|
33
33
|
import {
|
|
34
34
|
__name
|
|
35
35
|
} from "./chunk-LPEX4YW6.mjs";
|
|
36
36
|
|
|
37
37
|
// src/build.ts
|
|
38
|
-
import {
|
|
39
|
-
import { createProjectGraphAsync as createProjectGraphAsync3, readProjectsConfigurationFromProjectGraph as readProjectsConfigurationFromProjectGraph3, writeJsonFile } from "@nx/devkit";
|
|
38
|
+
import { readCachedProjectGraph as readCachedProjectGraph3, writeJsonFile } from "@nx/devkit";
|
|
40
39
|
import { getHelperDependency, HelperDependency } from "@nx/js";
|
|
41
40
|
import { calculateProjectBuildableDependencies as calculateProjectBuildableDependencies2 } from "@nx/js/src/utils/buildable-libs-utils";
|
|
42
41
|
|
|
@@ -54,39 +53,36 @@ import { stripIndents } from "@nx/devkit";
|
|
|
54
53
|
import { relative } from "path";
|
|
55
54
|
|
|
56
55
|
// ../build-tools/src/utilities/copy-assets.ts
|
|
57
|
-
import {
|
|
58
|
-
import { createProjectGraphAsync, readProjectsConfigurationFromProjectGraph } from "@nx/devkit";
|
|
56
|
+
import { readCachedProjectGraph, readProjectsConfigurationFromProjectGraph } from "@nx/devkit";
|
|
59
57
|
import { copyAssets as copyAssetsBase } from "@nx/js";
|
|
60
58
|
import { glob } from "glob";
|
|
61
|
-
|
|
62
|
-
// ../build-tools/src/utilities/read-nx-config.ts
|
|
63
|
-
import { hfs } from "@humanfs/node";
|
|
59
|
+
import { readFile as readFile2, writeFile } from "node:fs/promises";
|
|
64
60
|
|
|
65
61
|
// ../config-tools/src/config-file/get-config-file.ts
|
|
66
62
|
import { loadConfig as loadConfig2 } from "c12";
|
|
67
63
|
import defu from "defu";
|
|
68
64
|
var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, options = {}) => {
|
|
69
65
|
const workspacePath = filePath || findWorkspaceRoot(filePath);
|
|
70
|
-
let config = loadConfig2({
|
|
66
|
+
let config = await loadConfig2({
|
|
71
67
|
cwd: workspacePath,
|
|
72
68
|
packageJson: true,
|
|
73
69
|
name: fileName,
|
|
74
70
|
envName: fileName?.toUpperCase(),
|
|
75
71
|
jitiOptions: {
|
|
76
72
|
debug: false,
|
|
77
|
-
|
|
73
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "config")
|
|
78
74
|
},
|
|
79
75
|
...options
|
|
80
76
|
});
|
|
81
77
|
if (!config || Object.keys(config).length === 0) {
|
|
82
|
-
config = loadConfig2({
|
|
78
|
+
config = await loadConfig2({
|
|
83
79
|
cwd: workspacePath,
|
|
84
80
|
packageJson: true,
|
|
85
81
|
name: fileName,
|
|
86
82
|
envName: fileName?.toUpperCase(),
|
|
87
83
|
jitiOptions: {
|
|
88
84
|
debug: false,
|
|
89
|
-
|
|
85
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "config")
|
|
90
86
|
},
|
|
91
87
|
configFile: fileName,
|
|
92
88
|
...options
|
|
@@ -540,6 +536,8 @@ ${formatLogMessage(config)}`, config);
|
|
|
540
536
|
}, "loadStormConfig");
|
|
541
537
|
|
|
542
538
|
// ../build-tools/src/utilities/read-nx-config.ts
|
|
539
|
+
import { existsSync } from "node:fs";
|
|
540
|
+
import { readFile } from "node:fs/promises";
|
|
543
541
|
var readNxConfig = /* @__PURE__ */ __name(async (workspaceRoot) => {
|
|
544
542
|
let rootDir = workspaceRoot;
|
|
545
543
|
if (!rootDir) {
|
|
@@ -547,10 +545,11 @@ var readNxConfig = /* @__PURE__ */ __name(async (workspaceRoot) => {
|
|
|
547
545
|
rootDir = config.workspaceRoot;
|
|
548
546
|
}
|
|
549
547
|
const nxJsonPath = joinPaths(rootDir, "nx.json");
|
|
550
|
-
if (!
|
|
548
|
+
if (!existsSync(nxJsonPath)) {
|
|
551
549
|
throw new Error("Cannot find project.json configuration");
|
|
552
550
|
}
|
|
553
|
-
|
|
551
|
+
const configContent = await readFile(nxJsonPath, "utf8");
|
|
552
|
+
return JSON.parse(configContent);
|
|
554
553
|
}, "readNxConfig");
|
|
555
554
|
|
|
556
555
|
// ../build-tools/src/utilities/copy-assets.ts
|
|
@@ -585,14 +584,12 @@ var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, proje
|
|
|
585
584
|
});
|
|
586
585
|
}
|
|
587
586
|
const nxJson = readNxConfig(config.workspaceRoot);
|
|
588
|
-
const projectGraph =
|
|
589
|
-
exitOnError: true
|
|
590
|
-
});
|
|
587
|
+
const projectGraph = readCachedProjectGraph();
|
|
591
588
|
const projectsConfigurations = readProjectsConfigurationFromProjectGraph(projectGraph);
|
|
592
589
|
if (!projectsConfigurations?.projects?.[projectName]) {
|
|
593
590
|
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.");
|
|
594
591
|
}
|
|
595
|
-
const buildTarget = projectsConfigurations.projects[projectName]
|
|
592
|
+
const buildTarget = projectsConfigurations.projects[projectName].targets?.build;
|
|
596
593
|
if (!buildTarget) {
|
|
597
594
|
throw new Error(`The Build process failed because the project does not have a valid build target in the project.json file. Check if the file exists in the root of the project at ${joinPaths(projectRoot, "project.json")}`);
|
|
598
595
|
}
|
|
@@ -622,42 +619,30 @@ var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, proje
|
|
|
622
619
|
joinPaths(config.workspaceRoot, outputPath, "src/**/*.js"),
|
|
623
620
|
joinPaths(config.workspaceRoot, outputPath, "src/**/*.jsx")
|
|
624
621
|
]);
|
|
625
|
-
await Promise.allSettled(files.map(async (file) =>
|
|
622
|
+
await Promise.allSettled(files.map(async (file) => writeFile(file, `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
|
|
626
623
|
|
|
627
|
-
${await
|
|
624
|
+
${await readFile2(file, "utf8")}
|
|
628
625
|
|
|
629
626
|
${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`)));
|
|
630
627
|
}
|
|
631
628
|
}, "copyAssets");
|
|
632
629
|
|
|
633
630
|
// ../build-tools/src/utilities/generate-package-json.ts
|
|
634
|
-
import { hfs as hfs3 } from "@humanfs/node";
|
|
635
631
|
import { calculateProjectBuildableDependencies } from "@nx/js/src/utils/buildable-libs-utils";
|
|
636
632
|
import { Glob } from "glob";
|
|
637
|
-
import {
|
|
633
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
634
|
+
import { readFile as readFile3 } from "node:fs/promises";
|
|
635
|
+
import { readCachedProjectGraph as readCachedProjectGraph2 } from "nx/src/project-graph/project-graph";
|
|
638
636
|
var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projectRoot, projectName, packageJson) => {
|
|
639
|
-
const
|
|
640
|
-
exitOnError: true
|
|
641
|
-
});
|
|
642
|
-
const projectConfigurations = readProjectsConfigurationFromProjectGraph2(projectGraph);
|
|
643
|
-
if (!projectConfigurations?.projects?.[projectName]) {
|
|
644
|
-
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.");
|
|
645
|
-
}
|
|
646
|
-
const projectJsonPath = joinPaths(workspaceRoot, projectRoot, "project.json");
|
|
647
|
-
if (!await hfs3.isFile(projectJsonPath)) {
|
|
648
|
-
throw new Error("Cannot find project.json configuration");
|
|
649
|
-
}
|
|
650
|
-
if (!projectConfigurations?.projects?.[projectName]) {
|
|
651
|
-
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.");
|
|
652
|
-
}
|
|
653
|
-
const projectDependencies = calculateProjectBuildableDependencies(void 0, projectGraph, workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
|
|
637
|
+
const projectDependencies = calculateProjectBuildableDependencies(void 0, readCachedProjectGraph2(), workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
|
|
654
638
|
const localPackages = [];
|
|
655
639
|
for (const project of projectDependencies.dependencies.filter((dep) => dep.node.type === "lib" && dep.node.data.root !== projectRoot && dep.node.data.root !== workspaceRoot)) {
|
|
656
640
|
const projectNode = project.node;
|
|
657
641
|
if (projectNode.data.root) {
|
|
658
642
|
const projectPackageJsonPath = joinPaths(workspaceRoot, projectNode.data.root, "package.json");
|
|
659
|
-
if (
|
|
660
|
-
const
|
|
643
|
+
if (existsSync2(projectPackageJsonPath)) {
|
|
644
|
+
const projectPackageJsonContent = await readFile3(projectPackageJsonPath, "utf8");
|
|
645
|
+
const projectPackageJson = JSON.parse(projectPackageJsonContent);
|
|
661
646
|
if (projectPackageJson.private !== false) {
|
|
662
647
|
localPackages.push(projectPackageJson);
|
|
663
648
|
}
|
|
@@ -693,7 +678,8 @@ var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projec
|
|
|
693
678
|
}, "addPackageDependencies");
|
|
694
679
|
var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (config, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
|
|
695
680
|
const workspaceRoot = config.workspaceRoot ? config.workspaceRoot : findWorkspaceRoot();
|
|
696
|
-
const
|
|
681
|
+
const workspacePackageJsonContent = await readFile3(joinPaths(workspaceRoot, "package.json"), "utf8");
|
|
682
|
+
const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
|
|
697
683
|
packageJson.type ??= "module";
|
|
698
684
|
packageJson.sideEffects ??= false;
|
|
699
685
|
if (includeSrc === true) {
|
|
@@ -792,6 +778,8 @@ import { createTaskGraph, mapTargetDefaultsToDependencies } from "nx/src/tasks-r
|
|
|
792
778
|
|
|
793
779
|
// src/build.ts
|
|
794
780
|
import defu3 from "defu";
|
|
781
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
782
|
+
import { readFile as readFile4 } from "node:fs/promises";
|
|
795
783
|
import { relative as relative2 } from "node:path";
|
|
796
784
|
import { findWorkspaceRoot as findWorkspaceRoot2 } from "nx/src/utils/find-workspace-root";
|
|
797
785
|
import { build as unbuild } from "unbuild";
|
|
@@ -814,38 +802,34 @@ async function resolveOptions(options) {
|
|
|
814
802
|
options = defu3(options, configFile);
|
|
815
803
|
}
|
|
816
804
|
}
|
|
817
|
-
const projectGraph =
|
|
818
|
-
exitOnError: true
|
|
819
|
-
});
|
|
805
|
+
const projectGraph = readCachedProjectGraph3();
|
|
820
806
|
const projectJsonPath = joinPaths(config.workspaceRoot, projectRoot, "project.json");
|
|
821
|
-
if (!
|
|
807
|
+
if (!existsSync3(projectJsonPath)) {
|
|
822
808
|
throw new Error("Cannot find project.json configuration");
|
|
823
809
|
}
|
|
824
|
-
const
|
|
810
|
+
const projectJsonContent = await readFile4(projectJsonPath, "utf8");
|
|
811
|
+
const projectJson = JSON.parse(projectJsonContent);
|
|
825
812
|
const projectName = projectJson.name;
|
|
826
813
|
const packageJsonPath = joinPaths(workspaceRoot.dir, projectRoot, "package.json");
|
|
827
|
-
if (!
|
|
814
|
+
if (!existsSync3(packageJsonPath)) {
|
|
828
815
|
throw new Error("Cannot find package.json configuration");
|
|
829
816
|
}
|
|
830
|
-
const
|
|
817
|
+
const packageJsonContent = await readFile4(packageJsonPath, "utf8");
|
|
818
|
+
const packageJson = JSON.parse(packageJsonContent);
|
|
831
819
|
let tsconfig = options.tsconfig;
|
|
832
820
|
if (!tsconfig) {
|
|
833
821
|
tsconfig = joinPaths(workspaceRoot.dir, projectRoot, "tsconfig.json");
|
|
834
822
|
}
|
|
835
|
-
if (!
|
|
823
|
+
if (!existsSync3(tsconfig)) {
|
|
836
824
|
throw new Error("Cannot find tsconfig.json configuration");
|
|
837
825
|
}
|
|
838
826
|
let sourceRoot = projectJson.sourceRoot;
|
|
839
827
|
if (!sourceRoot) {
|
|
840
828
|
sourceRoot = joinPaths(projectRoot, "src");
|
|
841
829
|
}
|
|
842
|
-
if (!
|
|
830
|
+
if (!existsSync3(sourceRoot)) {
|
|
843
831
|
throw new Error("Cannot find sourceRoot directory");
|
|
844
832
|
}
|
|
845
|
-
const projectConfigurations = readProjectsConfigurationFromProjectGraph3(projectGraph);
|
|
846
|
-
if (!projectConfigurations?.projects?.[projectName]) {
|
|
847
|
-
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.");
|
|
848
|
-
}
|
|
849
833
|
const result = calculateProjectBuildableDependencies2(void 0, projectGraph, workspaceRoot.dir, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
|
|
850
834
|
let dependencies = result.dependencies;
|
|
851
835
|
const tsLibDependency = getHelperDependency(HelperDependency.tsc, tsconfig, dependencies, projectGraph, true);
|
|
@@ -966,21 +950,21 @@ async function resolveOptions(options) {
|
|
|
966
950
|
}
|
|
967
951
|
__name(resolveOptions, "resolveOptions");
|
|
968
952
|
async function generatePackageJson(options) {
|
|
969
|
-
if (options.generatePackageJson !== false &&
|
|
953
|
+
if (options.generatePackageJson !== false && existsSync3(joinPaths(options.projectRoot, "package.json"))) {
|
|
970
954
|
writeDebug(" \u270D\uFE0F Writing package.json file", options.config);
|
|
971
955
|
const stopwatch = getStopwatch("Write package.json file");
|
|
972
956
|
const packageJsonPath = joinPaths(options.projectRoot, "project.json");
|
|
973
|
-
if (!
|
|
957
|
+
if (!existsSync3(packageJsonPath)) {
|
|
974
958
|
throw new Error("Cannot find package.json configuration");
|
|
975
959
|
}
|
|
976
|
-
let
|
|
977
|
-
if (!
|
|
960
|
+
let packageJsonContent = await readFile4(joinPaths(options.config.workspaceRoot, options.projectRoot, "package.json"), "utf8");
|
|
961
|
+
if (!packageJsonContent) {
|
|
978
962
|
throw new Error("Cannot find package.json configuration file");
|
|
979
963
|
}
|
|
964
|
+
let packageJson = JSON.parse(packageJsonContent);
|
|
980
965
|
packageJson = await addPackageDependencies(options.config.workspaceRoot, options.projectRoot, options.projectName, packageJson);
|
|
981
966
|
packageJson = await addWorkspacePackageJsonFields(options.config, options.projectRoot, options.sourceRoot, options.projectName, false, packageJson);
|
|
982
|
-
|
|
983
|
-
await writeJsonFile(joinPaths(options.outDir, "package.json"), packageJson);
|
|
967
|
+
await writeJsonFile(joinPaths(options.outDir, "package.json"), await addPackageJsonExports(options.sourceRoot, packageJson));
|
|
984
968
|
stopwatch();
|
|
985
969
|
}
|
|
986
970
|
return options;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkDFIGNXGYjs = require('./chunk-DFIGNXGY.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkRCEWRXM5js = require('./chunk-RCEWRXM5.js');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkXEAFTDQ7js = require('./chunk-XEAFTDQ7.js');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkWPOEGALQjs = require('./chunk-WPOEGALQ.js');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunk3GQAWCBQjs = require('./chunk-3GQAWCBQ.js');
|
|
16
|
+
|
|
17
|
+
// src/config.ts
|
|
18
|
+
var getDefaultBuildPlugins = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, async (options, resolvedOptions) => Promise.all([
|
|
19
|
+
_chunkXEAFTDQ7js.analyzePlugin.call(void 0, options, resolvedOptions),
|
|
20
|
+
_chunkRCEWRXM5js.typeDefinitions.call(void 0, resolvedOptions.projectRoot),
|
|
21
|
+
_chunkDFIGNXGYjs.tscPlugin.call(void 0, options, resolvedOptions),
|
|
22
|
+
_chunkWPOEGALQjs.onErrorPlugin.call(void 0, options, resolvedOptions)
|
|
23
|
+
].map((plugin) => Promise.resolve(plugin))), "getDefaultBuildPlugins");
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
exports.getDefaultBuildPlugins = getDefaultBuildPlugins;
|
|
@@ -468,7 +468,8 @@ var CONSOLE_ICONS = {
|
|
|
468
468
|
[LogLevelLabel.INFO]: useIcon("\u2139", "i"),
|
|
469
469
|
[LogLevelLabel.SUCCESS]: useIcon("\u2714", "\u221A"),
|
|
470
470
|
[LogLevelLabel.DEBUG]: useIcon("\u{1F6E0}", "D"),
|
|
471
|
-
[LogLevelLabel.TRACE]: useIcon("\
|
|
471
|
+
[LogLevelLabel.TRACE]: useIcon("\u{1F6E0}", "T"),
|
|
472
|
+
[LogLevelLabel.ALL]: useIcon("\u2709", "\u2192")
|
|
472
473
|
};
|
|
473
474
|
|
|
474
475
|
// ../config-tools/src/logger/format-timestamp.ts
|
|
@@ -488,48 +489,48 @@ var getLogFn = /* @__PURE__ */ __name((logLevel = LogLevel.INFO, config = {}) =>
|
|
|
488
489
|
if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel || typeof logLevel === "string" && LogLevel.FATAL >= getLogLevel(logLevel)) {
|
|
489
490
|
return (message) => {
|
|
490
491
|
console.error(`
|
|
491
|
-
${_chalk.gray(formatTimestamp())} ${_chalk.
|
|
492
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.fatal ?? "#7d1a1a")(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
492
493
|
`);
|
|
493
494
|
};
|
|
494
495
|
}
|
|
495
496
|
if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel || typeof logLevel === "string" && LogLevel.ERROR >= getLogLevel(logLevel)) {
|
|
496
497
|
return (message) => {
|
|
497
498
|
console.error(`
|
|
498
|
-
${_chalk.gray(formatTimestamp())} ${_chalk.
|
|
499
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.danger ?? "#f85149")(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
499
500
|
`);
|
|
500
501
|
};
|
|
501
502
|
}
|
|
502
503
|
if (typeof logLevel === "number" && LogLevel.WARN >= logLevel || typeof logLevel === "string" && LogLevel.WARN >= getLogLevel(logLevel)) {
|
|
503
504
|
return (message) => {
|
|
504
505
|
console.warn(`
|
|
505
|
-
${_chalk.gray(formatTimestamp())} ${_chalk.
|
|
506
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.warning ?? "#e3b341")(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
506
507
|
`);
|
|
507
508
|
};
|
|
508
509
|
}
|
|
509
510
|
if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel || typeof logLevel === "string" && LogLevel.SUCCESS >= getLogLevel(logLevel)) {
|
|
510
511
|
return (message) => {
|
|
511
512
|
console.info(`
|
|
512
|
-
${_chalk.gray(formatTimestamp())} ${_chalk.
|
|
513
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.success ?? "#56d364")(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
513
514
|
`);
|
|
514
515
|
};
|
|
515
516
|
}
|
|
516
517
|
if (typeof logLevel === "number" && LogLevel.INFO >= logLevel || typeof logLevel === "string" && LogLevel.INFO >= getLogLevel(logLevel)) {
|
|
517
518
|
return (message) => {
|
|
518
519
|
console.info(`
|
|
519
|
-
${_chalk.gray(formatTimestamp())} ${_chalk.
|
|
520
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? "#58a6ff")(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
520
521
|
`);
|
|
521
522
|
};
|
|
522
523
|
}
|
|
523
524
|
if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel || typeof logLevel === "string" && LogLevel.TRACE >= getLogLevel(logLevel)) {
|
|
524
525
|
return (message) => {
|
|
525
526
|
console.debug(`
|
|
526
|
-
${_chalk.gray(formatTimestamp())} ${_chalk.
|
|
527
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
527
528
|
`);
|
|
528
529
|
};
|
|
529
530
|
}
|
|
530
531
|
return (message) => {
|
|
531
532
|
console.log(`
|
|
532
|
-
${_chalk.gray(formatTimestamp())} ${_chalk.
|
|
533
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
533
534
|
`);
|
|
534
535
|
};
|
|
535
536
|
}, "getLogFn");
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__name
|
|
3
|
+
} from "./chunk-LPEX4YW6.mjs";
|
|
4
|
+
|
|
5
|
+
// src/plugins/type-definitions.ts
|
|
6
|
+
import { relative } from "node:path";
|
|
7
|
+
function typeDefinitions(projectRoot) {
|
|
8
|
+
return {
|
|
9
|
+
name: "storm:dts-bundle",
|
|
10
|
+
async generateBundle(_opts, bundle) {
|
|
11
|
+
for (const file of Object.values(bundle)) {
|
|
12
|
+
if (file.type === "asset" || !file.isEntry || file.facadeModuleId == null) {
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
const hasDefaultExport = file.exports.includes("default");
|
|
16
|
+
const entrySourceFileName = relative(projectRoot, file.facadeModuleId);
|
|
17
|
+
const entrySourceDtsName = entrySourceFileName.replace(/\.[cm]?[jt]sx?$/, "");
|
|
18
|
+
const dtsFileName = file.fileName.replace(/\.[cm]?js$/, ".d.ts");
|
|
19
|
+
const relativeSourceDtsName = JSON.stringify("./" + entrySourceDtsName);
|
|
20
|
+
const dtsFileSource = hasDefaultExport ? `
|
|
21
|
+
export * from ${relativeSourceDtsName};
|
|
22
|
+
export { default } from ${relativeSourceDtsName};
|
|
23
|
+
` : `export * from ${relativeSourceDtsName};
|
|
24
|
+
`;
|
|
25
|
+
this.emitFile({
|
|
26
|
+
type: "asset",
|
|
27
|
+
fileName: dtsFileName,
|
|
28
|
+
source: dtsFileSource
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
__name(typeDefinitions, "typeDefinitions");
|
|
35
|
+
|
|
36
|
+
export {
|
|
37
|
+
typeDefinitions
|
|
38
|
+
};
|