@reliverse/dler 1.7.15 → 1.7.17
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 +164 -191
- package/bin/app/agg/run.js +2 -8
- package/bin/app/build/cmd.js +4 -4
- package/bin/app/build/impl.d.ts +2 -6
- package/bin/app/build/impl.js +2 -46
- package/bin/app/conv/cmd.d.ts +8 -33
- package/bin/app/conv/cmd.js +185 -163
- package/bin/app/copy/cmd.js +1 -1
- package/bin/app/init/init-impl.js +3 -3
- package/bin/app/init/init-types.d.ts +8 -8
- package/bin/app/merge/cmd.d.ts +17 -17
- package/bin/app/merge/cmd.js +70 -310
- package/bin/app/migrate/codemods/anything-bun.js +1 -1
- package/bin/app/migrate/codemods/fs-relifso.d.ts +2 -2
- package/bin/app/migrate/codemods/fs-relifso.js +1 -1
- package/bin/app/migrate/codemods/nodenext-bundler.d.ts +2 -2
- package/bin/app/migrate/codemods/nodenext-bundler.js +1 -1
- package/bin/app/migrate/codemods/path-pathkit.d.ts +2 -2
- package/bin/app/migrate/codemods/path-pathkit.js +1 -1
- package/bin/app/migrate/codemods/readdir-glob.d.ts +2 -2
- package/bin/app/migrate/codemods/readdir-glob.js +1 -1
- package/bin/app/mkdist/cmd.js +4 -2
- package/bin/app/pack/cmd.d.ts +44 -0
- package/bin/app/pack/cmd.js +313 -0
- package/bin/app/pub/cmd.js +4 -4
- package/bin/app/pub/impl.d.ts +7 -0
- package/bin/app/pub/impl.js +97 -0
- package/bin/app/rename/cmd.js +1 -1
- package/bin/app/spell/cmd.d.ts +14 -5
- package/bin/app/spell/cmd.js +33 -33
- package/bin/app/spell/old.js +0 -0
- package/bin/app/{mock → unpack}/cmd.d.ts +10 -14
- package/bin/app/unpack/cmd.js +200 -0
- package/bin/cli.js +2 -2
- package/bin/libs/cfg/cfg-mod.d.ts +69 -0
- package/bin/libs/cfg/cfg-mod.js +61 -0
- package/bin/libs/cfg/rse/rse-impl/rse-biome.d.ts +2 -0
- package/bin/libs/cfg/rse/rse-impl/rse-biome.js +34 -0
- package/bin/libs/cfg/rse/rse-impl/rse-consts.d.ts +35 -0
- package/bin/libs/cfg/rse/rse-impl/rse-consts.js +37 -0
- package/bin/libs/cfg/rse/rse-impl/rse-content.d.ts +14 -0
- package/bin/libs/cfg/rse/rse-impl/rse-content.js +15 -0
- package/bin/libs/cfg/rse/rse-impl/rse-core.d.ts +14 -0
- package/bin/libs/cfg/rse/rse-impl/rse-core.js +63 -0
- package/bin/libs/cfg/rse/rse-impl/rse-create.d.ts +36 -0
- package/bin/libs/cfg/rse/rse-impl/rse-create.js +254 -0
- package/bin/libs/cfg/rse/rse-impl/rse-def-utils.d.ts +6 -0
- package/bin/libs/cfg/rse/rse-impl/rse-def-utils.js +225 -0
- package/bin/libs/cfg/rse/rse-impl/rse-default.d.ts +3 -0
- package/bin/libs/cfg/rse/rse-impl/rse-default.js +155 -0
- package/bin/libs/cfg/rse/rse-impl/rse-define.d.ts +125 -0
- package/bin/libs/cfg/rse/rse-impl/rse-define.js +4 -0
- package/bin/libs/cfg/rse/rse-impl/rse-detect.d.ts +23 -0
- package/bin/libs/cfg/rse/rse-impl/rse-detect.js +347 -0
- package/bin/libs/cfg/rse/rse-impl/rse-gen-cfg.d.ts +3 -0
- package/bin/libs/cfg/rse/rse-impl/rse-gen-cfg.js +186 -0
- package/bin/libs/cfg/rse/rse-impl/rse-inject.d.ts +1 -0
- package/bin/libs/cfg/rse/rse-impl/rse-inject.js +57 -0
- package/bin/libs/cfg/rse/rse-impl/rse-migrate.d.ts +5 -0
- package/bin/libs/cfg/rse/rse-impl/rse-migrate.js +56 -0
- package/bin/libs/cfg/rse/rse-impl/rse-path.d.ts +11 -0
- package/bin/libs/cfg/rse/rse-impl/rse-path.js +33 -0
- package/bin/libs/cfg/rse/rse-impl/rse-prompts.d.ts +5 -0
- package/bin/libs/cfg/rse/rse-impl/rse-prompts.js +12 -0
- package/bin/libs/cfg/rse/rse-impl/rse-read.d.ts +11 -0
- package/bin/libs/cfg/rse/rse-impl/rse-read.js +84 -0
- package/bin/libs/cfg/rse/rse-impl/rse-repair.d.ts +16 -0
- package/bin/libs/cfg/rse/rse-impl/rse-repair.js +137 -0
- package/bin/libs/cfg/rse/rse-impl/rse-schema.d.ts +130 -0
- package/bin/libs/cfg/rse/rse-impl/rse-schema.js +444 -0
- package/bin/libs/cfg/rse/rse-impl/rse-types.d.ts +75 -0
- package/bin/libs/cfg/rse/rse-impl/rse-types.js +0 -0
- package/bin/libs/cfg/rse/rse-impl/rse-unstable.d.ts +11 -0
- package/bin/libs/cfg/rse/rse-impl/rse-unstable.js +41 -0
- package/bin/libs/cfg/rse/rse-impl/rse-update.d.ts +10 -0
- package/bin/libs/cfg/rse/rse-impl/rse-update.js +152 -0
- package/bin/libs/cfg/rse/rse-impl/rse-utils.d.ts +17 -0
- package/bin/libs/cfg/rse/rse-impl/rse-utils.js +86 -0
- package/bin/libs/cfg/rse/rse-mod.d.ts +20 -0
- package/bin/libs/cfg/rse/rse-mod.js +20 -0
- package/bin/libs/cfg/types.d.ts +533 -0
- package/bin/libs/cfg/types.js +0 -0
- package/bin/libs/sdk/sdk-impl/build/build-library.d.ts +5 -5
- package/bin/libs/sdk/sdk-impl/build/build-library.js +1 -174
- package/bin/libs/sdk/sdk-impl/build/build-regular.d.ts +2 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/build.js +287 -240
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/loaders/vue.d.ts +4 -4
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/make.d.ts +8 -5
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/make.js +199 -119
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/utils/spinner.d.ts +99 -0
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/utils/spinner.js +206 -0
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-mod.js +92 -46
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/plugins/raw.d.ts +2 -2
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/utils.d.ts +2 -2
- package/bin/libs/sdk/sdk-impl/config/default.d.ts +6 -0
- package/bin/libs/sdk/sdk-impl/{cfg → config}/default.js +8 -18
- package/bin/libs/sdk/sdk-impl/{cfg → config}/info.js +1 -1
- package/bin/libs/sdk/sdk-impl/{cfg → config}/init.js +53 -43
- package/bin/libs/sdk/sdk-impl/{cfg → config}/load.d.ts +2 -2
- package/bin/libs/sdk/sdk-impl/{cfg → config}/load.js +6 -6
- package/bin/libs/sdk/sdk-impl/config/types.d.ts +533 -0
- package/bin/libs/sdk/sdk-impl/config/types.js +0 -0
- package/bin/libs/sdk/sdk-impl/library-flow.d.ts +2 -1
- package/bin/libs/sdk/sdk-impl/pub/pub-library.js +7 -0
- package/bin/libs/sdk/sdk-impl/pub/pub-regular.js +4 -8
- package/bin/libs/sdk/sdk-impl/regular-flow.d.ts +2 -1
- package/bin/libs/sdk/sdk-impl/rules/reliverse/dler-config-health/dler-config-health.js +2 -2
- package/bin/libs/sdk/sdk-impl/rules/reliverse/missing-deps/deps-types.d.ts +6 -6
- package/bin/libs/sdk/sdk-impl/rules/reliverse/missing-deps/filesystem.js +1 -1
- package/bin/libs/sdk/sdk-impl/rules/reliverse/no-index-files/no-index-files.js +1 -1
- package/bin/libs/sdk/sdk-impl/rules/reliverse/self-include/self-include.js +2 -2
- package/bin/libs/sdk/sdk-impl/spell/applyMagicSpells.d.ts +38 -0
- package/bin/libs/sdk/sdk-impl/spell/applyMagicSpells.js +474 -0
- package/bin/libs/sdk/sdk-impl/spell/spells.d.ts +31 -0
- package/bin/libs/sdk/sdk-impl/spell/spells.js +85 -0
- package/bin/libs/sdk/sdk-impl/utils/binary.js +1 -1
- package/bin/libs/sdk/sdk-impl/utils/comments.d.ts +6 -0
- package/bin/libs/sdk/sdk-impl/utils/comments.js +41 -0
- package/bin/libs/sdk/sdk-impl/utils/finalize.d.ts +2 -1
- package/bin/libs/sdk/sdk-impl/utils/finalize.js +1 -0
- package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-constants.d.ts +6 -0
- package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-constants.js +7 -0
- package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-file-utils.d.ts +5 -0
- package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-file-utils.js +40 -0
- package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-types.d.ts +24 -0
- package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-types.js +0 -0
- package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pub-json-utils.d.ts +17 -0
- package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pub-json-utils.js +46 -0
- package/bin/libs/sdk/sdk-impl/utils/replacements.d.ts +0 -0
- package/bin/libs/sdk/sdk-impl/utils/replacements.js +0 -0
- package/bin/libs/sdk/sdk-impl/utils/resolve-cross-libs.d.ts +3 -0
- package/bin/libs/sdk/sdk-impl/utils/resolve-cross-libs.js +194 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-build.d.ts +1 -2
- package/bin/libs/sdk/sdk-impl/utils/utils-clean.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/utils/utils-deps.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/utils/utils-determine.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/utils/utils-error-cwd.d.ts +4 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-error-cwd.js +1 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-jsr-json.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/utils/utils-package-json-libraries.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/utils/utils-package-json-regular.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/utils/utils-security.d.ts +1 -3
- package/bin/libs/sdk/sdk-impl/utils/utils-security.js +11 -10
- package/bin/libs/sdk/sdk-mod.d.ts +1 -6
- package/bin/libs/sdk/sdk-mod.js +0 -31
- package/bin/libs/sdk/sdk-types.d.ts +39 -582
- package/bin/mod.d.ts +1 -1
- package/bin/mod.js +1 -1
- package/package.json +11 -4
- package/bin/app/mock/cmd.js +0 -284
- package/bin/app/mock/mock.d.ts +0 -11
- package/bin/app/mock/mock.js +0 -97
- package/bin/libs/sdk/sdk-impl/cfg/default.d.ts +0 -5
- package/bin/libs/sdk/sdk-impl/cfg/define.d.ts +0 -2
- package/bin/libs/sdk/sdk-impl/cfg/define.js +0 -4
- package/bin/libs/sdk/sdk-impl/spell/spell-executors.d.ts +0 -10
- package/bin/libs/sdk/sdk-impl/spell/spell-executors.js +0 -307
- package/bin/libs/sdk/sdk-impl/spell/spell-filesystem.d.ts +0 -7
- package/bin/libs/sdk/sdk-impl/spell/spell-filesystem.js +0 -74
- package/bin/libs/sdk/sdk-impl/spell/spell-mod.d.ts +0 -4
- package/bin/libs/sdk/sdk-impl/spell/spell-mod.js +0 -87
- package/bin/libs/sdk/sdk-impl/spell/spell-parser.d.ts +0 -4
- package/bin/libs/sdk/sdk-impl/spell/spell-parser.js +0 -58
- package/bin/libs/sdk/sdk-impl/spell/spell-types.d.ts +0 -60
- /package/bin/{libs/sdk/sdk-impl/spell/spell-types.js → app/spell/old.d.ts} +0 -0
- /package/bin/libs/sdk/sdk-impl/{cfg → config}/info.d.ts +0 -0
- /package/bin/libs/sdk/sdk-impl/{cfg → config}/init.d.ts +0 -0
|
@@ -6,7 +6,6 @@ import path, {
|
|
|
6
6
|
import fs from "@reliverse/relifso";
|
|
7
7
|
import { relinka } from "@reliverse/relinka";
|
|
8
8
|
import { build as bunBuild } from "bun";
|
|
9
|
-
import MagicString from "magic-string";
|
|
10
9
|
import pAll from "p-all";
|
|
11
10
|
import prettyBytes from "pretty-bytes";
|
|
12
11
|
import prettyMilliseconds from "pretty-ms";
|
|
@@ -32,42 +31,15 @@ import { createJsrJSON, renameTsxFiles } from "../utils/utils-jsr-json.js";
|
|
|
32
31
|
import { library_createPackageJSON } from "../utils/utils-package-json-libraries.js";
|
|
33
32
|
import { getElapsedPerfTime } from "../utils/utils-perf.js";
|
|
34
33
|
const BIN_DIR_NAME = "bin";
|
|
35
|
-
const REPLACEMENT_MARKER = "// dler-replace-me";
|
|
36
|
-
const TYPES_REPLACEMENT_PATH = "src/types.ts";
|
|
37
34
|
const ALIAS_PREFIX_TO_CONVERT = "~";
|
|
38
35
|
export async function library_buildLibrary(options) {
|
|
39
|
-
const { libName
|
|
40
|
-
let replacedFiles = [];
|
|
41
|
-
const replacementConfig = {
|
|
42
|
-
librarySrcDir: path.resolve(PROJECT_ROOT, mainDir),
|
|
43
|
-
replacementFilePath: path.resolve(PROJECT_ROOT, TYPES_REPLACEMENT_PATH),
|
|
44
|
-
replacementMarker: REPLACEMENT_MARKER
|
|
45
|
-
};
|
|
36
|
+
const { libName } = options;
|
|
46
37
|
try {
|
|
47
|
-
relinka("log", `Running pre-build replacements for ${libName}...`);
|
|
48
|
-
replacedFiles = await preBuildReplacements(replacementConfig);
|
|
49
|
-
relinka("verbose", `Pre-build: ${replacedFiles.length} files modified.`);
|
|
50
38
|
await executeBuildTasks(options);
|
|
51
39
|
} catch (err) {
|
|
52
40
|
const error = err instanceof Error ? err : new Error(String(err));
|
|
53
41
|
relinka("error", `Build process for ${libName} failed: ${error.message}`);
|
|
54
42
|
throw error;
|
|
55
|
-
} finally {
|
|
56
|
-
if (replacedFiles.length > 0) {
|
|
57
|
-
relinka("verbose", `Reverting ${replacedFiles.length} pre-build changes for ${libName}...`);
|
|
58
|
-
try {
|
|
59
|
-
await postBuildReplacements(replacedFiles);
|
|
60
|
-
relinka("verbose", `Done reverting changes for ${libName}.`);
|
|
61
|
-
} catch (revertError) {
|
|
62
|
-
const error = revertError instanceof Error ? revertError : new Error(String(revertError));
|
|
63
|
-
relinka(
|
|
64
|
-
"error",
|
|
65
|
-
`CRITICAL: Failed to revert pre-build changes for ${libName}: ${error.message}. Source files may be left modified!`
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
} else {
|
|
69
|
-
relinka("verbose", `No pre-build changes to revert for ${libName}.`);
|
|
70
|
-
}
|
|
71
43
|
}
|
|
72
44
|
}
|
|
73
45
|
async function executeBuildTasks(options) {
|
|
@@ -665,148 +637,3 @@ async function determineNpmSourceDirectory(libName, _mainFile, coreEntrySrcDirRe
|
|
|
665
637
|
);
|
|
666
638
|
return { libSpecificSrcDir, libDirName };
|
|
667
639
|
}
|
|
668
|
-
async function preBuildReplacements(config) {
|
|
669
|
-
const { librarySrcDir, replacementFilePath, replacementMarker } = config;
|
|
670
|
-
const replacedFiles = [];
|
|
671
|
-
if (!await fs.pathExists(replacementFilePath)) {
|
|
672
|
-
return [];
|
|
673
|
-
}
|
|
674
|
-
if (!await fs.pathExists(librarySrcDir)) {
|
|
675
|
-
relinka(
|
|
676
|
-
"warn",
|
|
677
|
-
`Library source directory for replacement scan not found: ${librarySrcDir}. Skipping pre-build replacements.`
|
|
678
|
-
);
|
|
679
|
-
return [];
|
|
680
|
-
}
|
|
681
|
-
relinka("verbose", `Reading replacement content from: ${replacementFilePath}`);
|
|
682
|
-
const replacementContent = await fs.readFile(replacementFilePath, "utf8");
|
|
683
|
-
const allFiles = [];
|
|
684
|
-
relinka("verbose", `Scanning for .ts/.tsx files in: ${librarySrcDir}`);
|
|
685
|
-
await collectTsFilesRecursively(librarySrcDir, allFiles);
|
|
686
|
-
relinka("verbose", `Found ${allFiles.length} potential files for replacement scan.`);
|
|
687
|
-
const escapedMarker = replacementMarker.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
688
|
-
const regex = new RegExp(`^.*${escapedMarker}\\s*$`, "gm");
|
|
689
|
-
for (const filePath of allFiles) {
|
|
690
|
-
try {
|
|
691
|
-
const originalCode = await fs.readFile(filePath, "utf8");
|
|
692
|
-
if (!originalCode.includes(replacementMarker)) {
|
|
693
|
-
continue;
|
|
694
|
-
}
|
|
695
|
-
const magic = new MagicString(originalCode);
|
|
696
|
-
let replacementOccurred = false;
|
|
697
|
-
let match;
|
|
698
|
-
while (true) {
|
|
699
|
-
match = regex.exec(originalCode);
|
|
700
|
-
if (match === null) break;
|
|
701
|
-
replacementOccurred = true;
|
|
702
|
-
const lineContent = match[0];
|
|
703
|
-
const matchStartIndex = match.index;
|
|
704
|
-
const matchEndIndex = matchStartIndex + lineContent.length;
|
|
705
|
-
let lineStartIndex = matchStartIndex;
|
|
706
|
-
while (lineStartIndex > 0 && originalCode[lineStartIndex - 1] !== "\n") {
|
|
707
|
-
lineStartIndex--;
|
|
708
|
-
}
|
|
709
|
-
let lineEndIndex = matchEndIndex;
|
|
710
|
-
while (lineEndIndex > lineStartIndex && lineEndIndex - 1 < originalCode.length && originalCode[lineEndIndex - 1] !== void 0 && originalCode[lineEndIndex - 1] !== null && typeof originalCode[lineEndIndex - 1] === "string" && /\s/.test(originalCode[lineEndIndex - 1])) {
|
|
711
|
-
lineEndIndex--;
|
|
712
|
-
}
|
|
713
|
-
if (lineEndIndex < originalCode.length && originalCode[lineEndIndex] === "\r")
|
|
714
|
-
lineEndIndex++;
|
|
715
|
-
if (lineEndIndex < originalCode.length && originalCode[lineEndIndex] === "\n")
|
|
716
|
-
lineEndIndex++;
|
|
717
|
-
relinka(
|
|
718
|
-
"verbose",
|
|
719
|
-
`Replacing line in ${path.relative(PROJECT_ROOT, filePath)} (range ${lineStartIndex}-${lineEndIndex})`
|
|
720
|
-
);
|
|
721
|
-
const contentToInsert = replacementContent.endsWith("\n") ? replacementContent : `${replacementContent}
|
|
722
|
-
`;
|
|
723
|
-
magic.overwrite(lineStartIndex, lineEndIndex, contentToInsert);
|
|
724
|
-
}
|
|
725
|
-
if (replacementOccurred) {
|
|
726
|
-
const updatedCode = magic.toString();
|
|
727
|
-
if (updatedCode !== originalCode) {
|
|
728
|
-
replacedFiles.push({
|
|
729
|
-
filePath,
|
|
730
|
-
newContent: updatedCode,
|
|
731
|
-
originalContent: originalCode
|
|
732
|
-
});
|
|
733
|
-
await fs.writeFile(filePath, updatedCode, "utf8");
|
|
734
|
-
relinka(
|
|
735
|
-
"info",
|
|
736
|
-
`Applied pre-build replacement in ${path.relative(PROJECT_ROOT, filePath)}`
|
|
737
|
-
);
|
|
738
|
-
} else {
|
|
739
|
-
relinka(
|
|
740
|
-
"verbose",
|
|
741
|
-
`Replacement marker found but content identical after processing ${filePath}. Skipping write.`
|
|
742
|
-
);
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
} catch (fileError) {
|
|
746
|
-
relinka(
|
|
747
|
-
"error",
|
|
748
|
-
`Failed processing file for replacement ${filePath}: ${fileError instanceof Error ? fileError.message : String(fileError)}`
|
|
749
|
-
);
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
return replacedFiles;
|
|
753
|
-
}
|
|
754
|
-
async function postBuildReplacements(replacedFiles) {
|
|
755
|
-
if (replacedFiles.length === 0) {
|
|
756
|
-
return;
|
|
757
|
-
}
|
|
758
|
-
relinka("verbose", `Reverting modifications in ${replacedFiles.length} files...`);
|
|
759
|
-
const revertTasks = replacedFiles.map((record) => async () => {
|
|
760
|
-
try {
|
|
761
|
-
await fs.writeFile(record.filePath, record.originalContent, "utf8");
|
|
762
|
-
relinka("verbose", `Reverted changes in ${path.relative(PROJECT_ROOT, record.filePath)}`);
|
|
763
|
-
} catch (err) {
|
|
764
|
-
relinka(
|
|
765
|
-
"error",
|
|
766
|
-
`Failed to revert file ${record.filePath}: ${err instanceof Error ? err.message : String(err)}`
|
|
767
|
-
);
|
|
768
|
-
throw err;
|
|
769
|
-
}
|
|
770
|
-
});
|
|
771
|
-
try {
|
|
772
|
-
await pAll(revertTasks, { concurrency: 1, stopOnError: false });
|
|
773
|
-
relinka("verbose", "Attempted revert for all modified files.");
|
|
774
|
-
} catch (aggregateError) {
|
|
775
|
-
relinka(
|
|
776
|
-
"error",
|
|
777
|
-
"One or more files failed to revert during post-build cleanup. Check preceding error logs.",
|
|
778
|
-
aggregateError instanceof Error ? aggregateError : void 0
|
|
779
|
-
);
|
|
780
|
-
throw aggregateError;
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
async function collectTsFilesRecursively(dir, fileList) {
|
|
784
|
-
try {
|
|
785
|
-
if (!await fs.pathExists(dir)) {
|
|
786
|
-
relinka("warn", `Directory not found for scanning: ${dir}`);
|
|
787
|
-
return;
|
|
788
|
-
}
|
|
789
|
-
if (!(await fs.stat(dir)).isDirectory()) {
|
|
790
|
-
relinka("warn", `Path is not a directory, cannot scan: ${dir}`);
|
|
791
|
-
return;
|
|
792
|
-
}
|
|
793
|
-
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
794
|
-
for (const entry of entries) {
|
|
795
|
-
const fullPath = path.join(dir, entry.name);
|
|
796
|
-
if (entry.isDirectory()) {
|
|
797
|
-
if (entry.name !== "node_modules" && !entry.name.startsWith("dist") && entry.name !== ".git" && entry.name !== ".svn" && entry.name !== ".hg" && entry.name !== ".turbo" && entry.name !== ".next" && entry.name !== ".nuxt") {
|
|
798
|
-
await collectTsFilesRecursively(fullPath, fileList);
|
|
799
|
-
}
|
|
800
|
-
} else if (entry.isFile() && /\.(ts|tsx)$/i.test(entry.name)) {
|
|
801
|
-
fileList.push(fullPath);
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
} catch (error) {
|
|
805
|
-
relinka(
|
|
806
|
-
"error",
|
|
807
|
-
`Failed to read directory during file collection: ${dir}`,
|
|
808
|
-
error instanceof Error ? error : void 0
|
|
809
|
-
);
|
|
810
|
-
throw error;
|
|
811
|
-
}
|
|
812
|
-
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { BundlerName, NpmOutExt, Sourcemap, transpileFormat, transpileTarget, DlerConfig
|
|
1
|
+
import type { BundlerName, NpmOutExt, Sourcemap, transpileFormat, transpileTarget, DlerConfig } from "../config/types.js";
|
|
2
|
+
import type { PerfTimer } from "../../sdk-types.js";
|
|
2
3
|
/**
|
|
3
4
|
* Builds a regular JSR distribution.
|
|
4
5
|
* - Copies the entire source directory if `distJsrBuilder` = "jsr"
|