@reliverse/dler 1.3.6 → 1.4.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.
- package/README.md +1 -0
- package/bin/app/agg/cmd.d.ts +34 -0
- package/bin/app/agg/cmd.js +44 -3
- package/bin/app/agg/impl.d.ts +2 -1
- package/bin/app/agg/impl.js +94 -33
- package/bin/app/cmds.d.ts +34 -0
- package/bin/app/deps/cmd.js +1 -1
- package/bin/app/deps/impl/analyzer.d.ts +1 -1
- package/bin/app/deps/impl/filesystem.d.ts +1 -1
- package/bin/app/deps/impl/filesystem.js +1 -1
- package/bin/app/deps/impl/formatter.d.ts +1 -1
- package/bin/app/deps/impl/formatter.js +0 -1
- package/bin/app/deps/impl/parser.d.ts +1 -1
- package/bin/app/inject/expect/impl.js +2 -2
- package/bin/app/merge/cmd.d.ts +44 -0
- package/bin/app/merge/{cmd.txt → cmd.js} +79 -141
- package/bin/app/relifso/cmd.js +1 -1
- package/bin/app/relifso/init/cmd.js +3 -3
- package/bin/app/relifso/init/{impl/mod.d.ts → init-impl.d.ts} +6 -1
- package/bin/app/relifso/init/{impl/mod.js → init-impl.js} +6 -4
- package/bin/app/relifso/init/{impl/types.d.ts → init-types.d.ts} +1 -1
- package/bin/app/relifso/init/{impl/templates → templates}/t-license.js +0 -4
- package/bin/app/relifso/init/{impl/templates → templates}/t-readme.js +0 -18
- package/bin/app/rempts/init/cmd/cmd.js +2 -4
- package/bin/app/rempts/init/cmds/cmd.js +2 -2
- package/bin/app/rempts/migrate/cmd.js +1 -1
- package/bin/app/rempts/migrate/impl/commander.js +0 -1
- package/bin/app/split/cmd.d.ts +21 -3
- package/bin/app/split/cmd.js +41 -0
- package/bin/app/split/impl.d.ts +0 -7
- package/bin/app/split/impl.js +2 -23
- package/bin/default.d.ts +1 -1
- package/bin/default.js +2 -1
- package/bin/impl.js +12 -6
- package/bin/init.js +2 -11
- package/bin/libs/sdk/sdk-impl/build/build-library.js +38 -22
- package/bin/libs/sdk/sdk-impl/build/build-regular.js +40 -25
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/auto.d.ts +2 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/auto.js +4 -2
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/build.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/build.js +1 -2
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/copy/copy.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/copy/copy.js +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist.js +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/build.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/build.js +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/config.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/config.js +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/plugins/cjs.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/plugins/cjs.js +0 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/plugins/esbuild.d.ts +1 -11
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/plugins/esbuild.js +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/plugins/shebang.js +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/stub.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/stub.js +7 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/utils.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/watch.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/watch.js +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/untyped/index.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/untyped/index.js +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/utils.d.ts +1 -2
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/utils.js +3 -5
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/validate.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/validate.js +1 -1
- package/bin/libs/sdk/sdk-impl/library-flow.d.ts +2 -2
- package/bin/libs/sdk/sdk-impl/library-flow.js +8 -6
- package/bin/libs/sdk/sdk-impl/pub/pub-regular.js +1 -1
- package/bin/libs/sdk/sdk-impl/spell/spell-executors.js +1 -1
- package/bin/libs/sdk/sdk-impl/spell/spell-filesystem.js +2 -2
- package/bin/libs/sdk/sdk-impl/utils/tools/tools-agg.js +2 -2
- package/bin/libs/sdk/sdk-impl/utils/utils-build.js +2 -2
- package/bin/libs/sdk/sdk-impl/utils/utils-bump.d.ts +83 -3
- package/bin/libs/sdk/sdk-impl/utils/utils-bump.js +382 -213
- package/bin/libs/sdk/sdk-impl/utils/utils-clean.d.ts +6 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-clean.js +34 -2
- package/bin/libs/sdk/sdk-impl/utils/utils-consts.js +1 -1
- package/bin/libs/sdk/sdk-impl/utils/utils-deps.js +1 -1
- package/bin/libs/sdk/sdk-impl/utils/utils-fs.js +2 -2
- package/bin/libs/sdk/sdk-impl/utils/utils-jsr-json.js +2 -2
- package/bin/libs/sdk/sdk-impl/utils/utils-misc.d.ts +7 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-misc.js +7 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-libs.js +2 -2
- package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-reg.js +2 -2
- package/bin/libs/sdk/sdk-impl/utils/utils-tsconfig.js +2 -2
- package/bin/libs/sdk/sdk-mod.d.ts +3 -10
- package/bin/libs/sdk/sdk-mod.js +1 -11
- package/bin/libs/sdk/sdk-types.d.ts +329 -13
- package/bin/load.js +1 -1
- package/bin/mod.d.ts +2 -48
- package/package.json +14 -15
- package/bin/app/relifso/init/impl/utils.d.ts +0 -5
- package/bin/app/relifso/init/impl/utils.js +0 -3
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/copy/types.d.ts +0 -9
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/types.d.ts +0 -15
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/types.d.ts +0 -95
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/types.js +0 -0
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/types.d.ts +0 -176
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/types.js +0 -6
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/untyped/types.d.ts +0 -23
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/untyped/types.js +0 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-paths.d.ts +0 -55
- package/bin/libs/sdk/sdk-impl/utils/utils-paths.js +0 -667
- package/bin/types.d.ts +0 -475
- package/bin/types.js +0 -0
- /package/bin/app/deps/impl/{types.d.ts → deps-types.d.ts} +0 -0
- /package/bin/app/deps/impl/{types.js → deps-types.js} +0 -0
- /package/bin/app/{relifso/init/impl/types.js → migrate/cmd.d.ts} +0 -0
- /package/bin/{libs/sdk/sdk-impl/build/bundlers/unified/copy/types.js → app/migrate/cmd.js} +0 -0
- /package/bin/app/relifso/init/{impl/const.d.ts → init-const.d.ts} +0 -0
- /package/bin/app/relifso/init/{impl/const.js → init-const.js} +0 -0
- /package/bin/{libs/sdk/sdk-impl/build/bundlers/unified/mkdist/types.js → app/relifso/init/init-types.js} +0 -0
- /package/bin/app/relifso/init/{impl/templates → templates}/t-gitignore.d.ts +0 -0
- /package/bin/app/relifso/init/{impl/templates → templates}/t-gitignore.js +0 -0
- /package/bin/app/relifso/init/{impl/templates → templates}/t-license.d.ts +0 -0
- /package/bin/app/relifso/init/{impl/templates → templates}/t-readme.d.ts +0 -0
package/bin/default.js
CHANGED
package/bin/impl.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import path from "@reliverse/pathkit";
|
|
2
|
+
import fs from "@reliverse/relifso";
|
|
3
3
|
import { processLibraryFlow } from "./libs/sdk/sdk-impl/library-flow.js";
|
|
4
4
|
import { processRegularFlow } from "./libs/sdk/sdk-impl/regular-flow.js";
|
|
5
5
|
import { bumpHandler } from "./libs/sdk/sdk-impl/utils/utils-bump.js";
|
|
@@ -28,7 +28,8 @@ export async function dlerBuild(isDev) {
|
|
|
28
28
|
config.bumpMode,
|
|
29
29
|
config.bumpDisable,
|
|
30
30
|
pausePublishing,
|
|
31
|
-
config.bumpFilter
|
|
31
|
+
config.bumpFilter,
|
|
32
|
+
config.bumpSet
|
|
32
33
|
);
|
|
33
34
|
}
|
|
34
35
|
await processRegularFlow(
|
|
@@ -90,7 +91,9 @@ export async function dlerBuild(isDev) {
|
|
|
90
91
|
config.distJsrBuilder,
|
|
91
92
|
config.transpileStub,
|
|
92
93
|
config.transpileWatch,
|
|
93
|
-
config.distJsrOutFilesExt
|
|
94
|
+
config.distJsrOutFilesExt,
|
|
95
|
+
config.distJsrAllowDirty,
|
|
96
|
+
config.distJsrSlowTypes
|
|
94
97
|
);
|
|
95
98
|
await finalizeBuild(
|
|
96
99
|
timer,
|
|
@@ -122,7 +125,8 @@ export async function dlerPub(isDev) {
|
|
|
122
125
|
config.bumpMode,
|
|
123
126
|
config.bumpDisable,
|
|
124
127
|
config.commonPubPause,
|
|
125
|
-
config.bumpFilter
|
|
128
|
+
config.bumpFilter,
|
|
129
|
+
config.bumpSet
|
|
126
130
|
);
|
|
127
131
|
}
|
|
128
132
|
await processRegularFlow(
|
|
@@ -184,7 +188,9 @@ export async function dlerPub(isDev) {
|
|
|
184
188
|
config.distJsrBuilder,
|
|
185
189
|
config.transpileStub,
|
|
186
190
|
config.transpileWatch,
|
|
187
|
-
config.distJsrOutFilesExt
|
|
191
|
+
config.distJsrOutFilesExt,
|
|
192
|
+
config.distJsrAllowDirty,
|
|
193
|
+
config.distJsrSlowTypes
|
|
188
194
|
);
|
|
189
195
|
await finalizeBuild(
|
|
190
196
|
timer,
|
package/bin/init.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import path from "@reliverse/pathkit";
|
|
2
|
+
import fs from "@reliverse/relifso";
|
|
1
3
|
import { relinka } from "@reliverse/relinka";
|
|
2
|
-
import fs from "fs-extra";
|
|
3
|
-
import path from "pathe";
|
|
4
4
|
import { readPackageJSON } from "pkg-types";
|
|
5
5
|
import { DEFAULT_CONFIG } from "./default.js";
|
|
6
6
|
const CONFIG_FILENAME = ".config/dler.ts";
|
|
@@ -92,7 +92,6 @@ function generateConfig(isDev, pkgDescription) {
|
|
|
92
92
|
// },
|
|
93
93
|
}`;
|
|
94
94
|
const configTemplate = `${importDefineConfigStatement}
|
|
95
|
-
|
|
96
95
|
/**
|
|
97
96
|
* Reliverse Bundler Configuration
|
|
98
97
|
* Hover over a field to see more details
|
|
@@ -103,12 +102,10 @@ export default defineConfig({
|
|
|
103
102
|
bumpDisable: ${DEFAULT_CONFIG.bumpDisable},
|
|
104
103
|
bumpFilter: ${JSON.stringify(DEFAULT_CONFIG.bumpFilter)},
|
|
105
104
|
bumpMode: "${DEFAULT_CONFIG.bumpMode}",
|
|
106
|
-
|
|
107
105
|
// Common configuration
|
|
108
106
|
commonPubPause: ${pausePublishValue},
|
|
109
107
|
commonPubRegistry: "${registryValue}",
|
|
110
108
|
commonVerbose: ${verboseValue},
|
|
111
|
-
|
|
112
109
|
// Core configuration
|
|
113
110
|
coreDeclarations: ${DEFAULT_CONFIG.coreDeclarations},
|
|
114
111
|
coreDescription: ${JSON.stringify(coreDescriptionValue)},
|
|
@@ -116,7 +113,6 @@ export default defineConfig({
|
|
|
116
113
|
coreEntrySrcDir: "${DEFAULT_CONFIG.coreEntrySrcDir}",
|
|
117
114
|
coreBuildOutDir: "${DEFAULT_CONFIG.coreBuildOutDir}",
|
|
118
115
|
${coreIsCLI}
|
|
119
|
-
|
|
120
116
|
// JSR-only config
|
|
121
117
|
distJsrAllowDirty: ${DEFAULT_CONFIG.distJsrAllowDirty},
|
|
122
118
|
distJsrBuilder: "${DEFAULT_CONFIG.distJsrBuilder}",
|
|
@@ -127,13 +123,11 @@ export default defineConfig({
|
|
|
127
123
|
distJsrGenTsconfig: ${DEFAULT_CONFIG.distJsrGenTsconfig},
|
|
128
124
|
distJsrOutFilesExt: "${DEFAULT_CONFIG.distJsrOutFilesExt}",
|
|
129
125
|
distJsrSlowTypes: ${DEFAULT_CONFIG.distJsrSlowTypes},
|
|
130
|
-
|
|
131
126
|
// NPM-only config
|
|
132
127
|
distNpmBuilder: "${DEFAULT_CONFIG.distNpmBuilder}",
|
|
133
128
|
distNpmCopyRootFiles: ${JSON.stringify(DEFAULT_CONFIG.distNpmCopyRootFiles)},
|
|
134
129
|
distNpmDirName: "${DEFAULT_CONFIG.distNpmDirName}",
|
|
135
130
|
distNpmOutFilesExt: "${DEFAULT_CONFIG.distNpmOutFilesExt}",
|
|
136
|
-
|
|
137
131
|
// Libraries Dler Plugin
|
|
138
132
|
// Publish specific dirs as separate packages
|
|
139
133
|
// This feature is experimental at the moment
|
|
@@ -142,15 +136,12 @@ export default defineConfig({
|
|
|
142
136
|
libsDirDist: "${DEFAULT_CONFIG.libsDirDist}",
|
|
143
137
|
libsDirSrc: "${DEFAULT_CONFIG.libsDirSrc}",
|
|
144
138
|
libsList: ${libsObject},
|
|
145
|
-
|
|
146
139
|
// Logger setup
|
|
147
140
|
logsFileName: "${DEFAULT_CONFIG.logsFileName}",
|
|
148
141
|
logsFreshFile: ${DEFAULT_CONFIG.logsFreshFile},
|
|
149
|
-
|
|
150
142
|
// Dependency filtering
|
|
151
143
|
rmDepsMode: "${DEFAULT_CONFIG.rmDepsMode}",
|
|
152
144
|
rmDepsPatterns: ${JSON.stringify(DEFAULT_CONFIG.rmDepsPatterns)},
|
|
153
|
-
|
|
154
145
|
// Build setup
|
|
155
146
|
transpileEsbuild: "${DEFAULT_CONFIG.transpileEsbuild}",
|
|
156
147
|
transpileFormat: "${DEFAULT_CONFIG.transpileFormat}",
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
+
import path, {
|
|
2
|
+
convertImportsAliasToRelative,
|
|
3
|
+
convertImportsExt,
|
|
4
|
+
stripPathSegmentsInDirectory
|
|
5
|
+
} from "@reliverse/pathkit";
|
|
6
|
+
import fs from "@reliverse/relifso";
|
|
1
7
|
import { relinka } from "@reliverse/relinka";
|
|
2
8
|
import { build as bunBuild } from "bun";
|
|
3
|
-
import fs from "fs-extra";
|
|
4
9
|
import MagicString from "magic-string";
|
|
5
10
|
import pAll from "p-all";
|
|
6
|
-
import path from "pathe";
|
|
7
11
|
import prettyBytes from "pretty-bytes";
|
|
8
12
|
import prettyMilliseconds from "pretty-ms";
|
|
9
13
|
import { unifiedBuild } from "./bundlers/unified/build.js";
|
|
10
|
-
import { ensuredir } from "./bundlers/unified/utils.js";
|
|
11
14
|
import {
|
|
12
15
|
getBunSourcemapOption,
|
|
13
16
|
getUnifiedSourcemapOption,
|
|
14
17
|
renameEntryFile
|
|
15
18
|
} from "../utils/utils-build.js";
|
|
19
|
+
import { removeLogInternalCalls } from "../utils/utils-clean.js";
|
|
16
20
|
import {
|
|
17
21
|
CONCURRENCY_DEFAULT,
|
|
18
22
|
PROJECT_ROOT,
|
|
@@ -29,10 +33,6 @@ import {
|
|
|
29
33
|
createJsrJSON,
|
|
30
34
|
renameTsxFiles
|
|
31
35
|
} from "../utils/utils-jsr-json.js";
|
|
32
|
-
import {
|
|
33
|
-
convertImportExtensionsJsToTs,
|
|
34
|
-
convertImportPaths
|
|
35
|
-
} from "../utils/utils-paths.js";
|
|
36
36
|
import {
|
|
37
37
|
getElapsedPerfTime
|
|
38
38
|
} from "../utils/utils-perf.js";
|
|
@@ -41,7 +41,7 @@ const BIN_DIR_NAME = "bin";
|
|
|
41
41
|
const REPLACEMENT_MARKER = "// dler-replace-me";
|
|
42
42
|
const FILES_TO_COPY_ROOT = ["README.md", "LICENSE"];
|
|
43
43
|
const TYPES_REPLACEMENT_PATH = "src/types.ts";
|
|
44
|
-
const ALIAS_PREFIX_TO_CONVERT = "
|
|
44
|
+
const ALIAS_PREFIX_TO_CONVERT = "~";
|
|
45
45
|
export async function library_buildLibrary(options) {
|
|
46
46
|
const { libName, mainDir } = options;
|
|
47
47
|
let replacedFiles = [];
|
|
@@ -166,7 +166,6 @@ async function library_buildJsrDist(options) {
|
|
|
166
166
|
"verbose",
|
|
167
167
|
`[JSR] Performing JSR-specific transformations in ${outputDirBinResolved}`
|
|
168
168
|
);
|
|
169
|
-
await convertImportExtensionsJsToTs({ dirPath: outputDirBinResolved });
|
|
170
169
|
await renameTsxFiles(outputDirBinResolved);
|
|
171
170
|
await createJsrJSON(
|
|
172
171
|
outputDirRootResolved,
|
|
@@ -285,8 +284,8 @@ async function library_buildDistributionTarget(params) {
|
|
|
285
284
|
const isJsr = targetType === "jsr";
|
|
286
285
|
const logPrefix = isJsr ? "[JSR]" : `[NPM:${determineDistName(path.relative(PROJECT_ROOT, outputDirRoot), false, libsList)}]`;
|
|
287
286
|
relinka("log", `${logPrefix} Starting build target processing...`);
|
|
288
|
-
await
|
|
289
|
-
await
|
|
287
|
+
await fs.ensureDir(outputDirRoot);
|
|
288
|
+
await fs.ensureDir(outputDirBin);
|
|
290
289
|
relinka("log", `${logPrefix} Using builder: ${builder}`);
|
|
291
290
|
const bundleRequest = {
|
|
292
291
|
builder,
|
|
@@ -378,10 +377,9 @@ async function library_bundleUsingJsrCopy(srcDir, destDir, libName) {
|
|
|
378
377
|
"verbose",
|
|
379
378
|
`[JSR Copy:${libName}] Starting copy: ${srcDir} -> ${destDir}`
|
|
380
379
|
);
|
|
381
|
-
await
|
|
380
|
+
await fs.ensureDir(destDir);
|
|
382
381
|
try {
|
|
383
|
-
|
|
384
|
-
await fs.copy(srcDir, destDir, copyOptions);
|
|
382
|
+
await fs.copy(srcDir, destDir, { overwrite: true });
|
|
385
383
|
relinka(
|
|
386
384
|
"success",
|
|
387
385
|
`[JSR Copy:${libName}] Completed copying library source from ${srcDir} to ${destDir}`
|
|
@@ -581,6 +579,7 @@ async function library_performCommonBuildSteps(params) {
|
|
|
581
579
|
);
|
|
582
580
|
}
|
|
583
581
|
relinka("verbose", `${logPrefix} Created package.json.`);
|
|
582
|
+
await removeLogInternalCalls(outDirBin);
|
|
584
583
|
if (deleteFiles) {
|
|
585
584
|
await deleteSpecificFiles(outDirBin);
|
|
586
585
|
relinka(
|
|
@@ -598,15 +597,32 @@ async function library_performCommonBuildSteps(params) {
|
|
|
598
597
|
"verbose",
|
|
599
598
|
`${logPrefix} Converting alias paths in ${outDirBin}, stripping: [${stripSegments.join(", ")}]`
|
|
600
599
|
);
|
|
601
|
-
relinka("
|
|
602
|
-
await
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
600
|
+
relinka("info", `[${libName}] Stripping segments`);
|
|
601
|
+
await stripPathSegmentsInDirectory({
|
|
602
|
+
targetDir: outDirBin,
|
|
603
|
+
segmentsToStrip: 2,
|
|
604
|
+
alias: ALIAS_PREFIX_TO_CONVERT
|
|
605
|
+
});
|
|
606
|
+
relinka(
|
|
607
|
+
"info",
|
|
608
|
+
`[${libName}] Performing alias path conversion in ${outDirBin}`
|
|
609
|
+
);
|
|
610
|
+
await convertImportsAliasToRelative({
|
|
611
|
+
targetDir: outDirBin,
|
|
612
|
+
aliasToReplace: ALIAS_PREFIX_TO_CONVERT,
|
|
613
|
+
pathExtFilter: "js"
|
|
609
614
|
});
|
|
615
|
+
if (isJsr) {
|
|
616
|
+
relinka(
|
|
617
|
+
"info",
|
|
618
|
+
`[${libName}] Performing paths ext conversion in ${outDirBin} (from js to ts)`
|
|
619
|
+
);
|
|
620
|
+
await convertImportsExt({
|
|
621
|
+
targetDir: outDirBin,
|
|
622
|
+
extFrom: "js",
|
|
623
|
+
extTo: "ts"
|
|
624
|
+
});
|
|
625
|
+
}
|
|
610
626
|
relinka("verbose", `${logPrefix} Renaming entry file in ${outDirBin}.`);
|
|
611
627
|
await renameEntryFile(
|
|
612
628
|
isJsr,
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import path, {
|
|
2
|
+
convertImportsAliasToRelative,
|
|
3
|
+
convertImportsExt
|
|
4
|
+
} from "@reliverse/pathkit";
|
|
5
|
+
import fs from "@reliverse/relifso";
|
|
1
6
|
import { relinka } from "@reliverse/relinka";
|
|
2
7
|
import { build as bunBuild } from "bun";
|
|
3
|
-
import fs from "fs-extra";
|
|
4
|
-
import path from "pathe";
|
|
5
8
|
import prettyBytes from "pretty-bytes";
|
|
6
9
|
import prettyMilliseconds from "pretty-ms";
|
|
7
10
|
import { unifiedBuild } from "./bundlers/unified/build.js";
|
|
@@ -9,6 +12,7 @@ import {
|
|
|
9
12
|
getBunSourcemapOption,
|
|
10
13
|
getUnifiedSourcemapOption
|
|
11
14
|
} from "../utils/utils-build.js";
|
|
15
|
+
import { removeLogInternalCalls } from "../utils/utils-clean.js";
|
|
12
16
|
import {
|
|
13
17
|
CONCURRENCY_DEFAULT,
|
|
14
18
|
PROJECT_ROOT,
|
|
@@ -24,16 +28,12 @@ import {
|
|
|
24
28
|
createJsrJSON,
|
|
25
29
|
renameTsxFiles
|
|
26
30
|
} from "../utils/utils-jsr-json.js";
|
|
27
|
-
import {
|
|
28
|
-
convertImportExtensionsJsToTs,
|
|
29
|
-
convertImportPaths
|
|
30
|
-
} from "../utils/utils-paths.js";
|
|
31
31
|
import {
|
|
32
32
|
getElapsedPerfTime
|
|
33
33
|
} from "../utils/utils-perf.js";
|
|
34
34
|
import { regular_createPackageJSON } from "../utils/utils-pkg-json-reg.js";
|
|
35
35
|
import { createTSConfig } from "../utils/utils-tsconfig.js";
|
|
36
|
-
|
|
36
|
+
const ALIAS_PREFIX_TO_CONVERT = "~";
|
|
37
37
|
export async function regular_buildJsrDist(isDev, isJsr, coreIsCLI, coreEntrySrcDir, distJsrDirName, distJsrBuilder, coreEntryFile, transpileTarget, transpileFormat, transpileSplitting, transpileMinify, transpileSourcemap, transpilePublicPath, unifiedBundlerOutExt, rmDepsMode, timer, transpileStub, transpileWatch, distJsrGenTsconfig, coreDeclarations, config) {
|
|
38
38
|
relinka("log", "Building JSR distribution...");
|
|
39
39
|
const coreEntrySrcDirResolved = path.resolve(PROJECT_ROOT, coreEntrySrcDir);
|
|
@@ -43,8 +43,8 @@ export async function regular_buildJsrDist(isDev, isJsr, coreIsCLI, coreEntrySrc
|
|
|
43
43
|
distJsrDirNameResolved,
|
|
44
44
|
config.coreBuildOutDir || "bin"
|
|
45
45
|
);
|
|
46
|
-
await
|
|
47
|
-
await
|
|
46
|
+
await fs.ensureDir(distJsrDirNameResolved);
|
|
47
|
+
await fs.ensureDir(outDirBin);
|
|
48
48
|
relinka("log", `Using JSR builder: ${distJsrBuilder}`);
|
|
49
49
|
await regular_bundleWithBuilder(distJsrBuilder, {
|
|
50
50
|
coreDeclarations,
|
|
@@ -76,7 +76,6 @@ export async function regular_buildJsrDist(isDev, isJsr, coreIsCLI, coreEntrySrc
|
|
|
76
76
|
coreDescription: config.coreDescription,
|
|
77
77
|
coreBuildOutDir: config.coreBuildOutDir
|
|
78
78
|
});
|
|
79
|
-
await convertImportExtensionsJsToTs({ dirPath: outDirBin });
|
|
80
79
|
await renameTsxFiles(outDirBin);
|
|
81
80
|
await createJsrJSON(
|
|
82
81
|
distJsrDirNameResolved,
|
|
@@ -105,8 +104,8 @@ export async function regular_buildNpmDist(isDev, coreEntrySrcDir, distNpmDirNam
|
|
|
105
104
|
distNpmDirNameResolved,
|
|
106
105
|
config.coreBuildOutDir || "bin"
|
|
107
106
|
);
|
|
108
|
-
await
|
|
109
|
-
await
|
|
107
|
+
await fs.ensureDir(distNpmDirNameResolved);
|
|
108
|
+
await fs.ensureDir(outDirBin);
|
|
110
109
|
relinka("log", `Using NPM builder: ${distNpmBuilder}`);
|
|
111
110
|
await regular_bundleWithBuilder(distNpmBuilder, {
|
|
112
111
|
coreDeclarations,
|
|
@@ -209,21 +208,24 @@ async function regular_bundleUsingBun(coreEntryFile, outDirBin, transpileTarget,
|
|
|
209
208
|
}
|
|
210
209
|
async function regular_bundleUsingJsr(src, dest) {
|
|
211
210
|
relinka("log", `Starting regular_bundleUsingJsr: ${src} -> ${dest}`);
|
|
212
|
-
await
|
|
211
|
+
await fs.ensureDir(path.dirname(dest));
|
|
213
212
|
const stats = await fs.stat(src);
|
|
214
213
|
if (!stats.isDirectory()) {
|
|
215
214
|
throw new Error(
|
|
216
|
-
"
|
|
215
|
+
"Please provide path to directory instead of path to file when using 'jsr' builder."
|
|
217
216
|
);
|
|
218
217
|
}
|
|
219
218
|
try {
|
|
220
|
-
await fs.copy(src, dest);
|
|
219
|
+
await fs.copy(src, dest, { overwrite: true });
|
|
221
220
|
relinka("verbose", `Copied directory from ${src} to ${dest}`);
|
|
222
|
-
relinka(
|
|
221
|
+
relinka(
|
|
222
|
+
"success",
|
|
223
|
+
`Completed regular bundling via 'jsr' builder`
|
|
224
|
+
// `${successCount} files processed, ${changedCount} modified`,
|
|
225
|
+
);
|
|
223
226
|
} catch (error) {
|
|
224
227
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
225
|
-
|
|
226
|
-
await fs.copy(src, dest);
|
|
228
|
+
throw new Error(errorMessage);
|
|
227
229
|
}
|
|
228
230
|
}
|
|
229
231
|
async function regular_bundleUsingUnified(coreEntryFile, outDirBin, builder, unifiedBundlerOutExt, coreEntrySrcDir, transpileStub, transpileWatch, transpileTarget, transpileMinify, transpileSourcemap, timer, coreDeclarations) {
|
|
@@ -359,14 +361,27 @@ async function regular_performCommonBuildSteps({
|
|
|
359
361
|
coreBuildOutDir
|
|
360
362
|
}) {
|
|
361
363
|
relinka("log", `Performing common build steps in ${outDirBin} (regular)`);
|
|
362
|
-
relinka(
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
364
|
+
relinka(
|
|
365
|
+
"info",
|
|
366
|
+
`[${isJsr ? "dist-jsr" : "dist-npm"}] Performing alias path conversion in ${outDirBin}`
|
|
367
|
+
);
|
|
368
|
+
await convertImportsAliasToRelative({
|
|
369
|
+
targetDir: outDirBin,
|
|
370
|
+
aliasToReplace: ALIAS_PREFIX_TO_CONVERT,
|
|
371
|
+
pathExtFilter: "js"
|
|
369
372
|
});
|
|
373
|
+
if (isJsr) {
|
|
374
|
+
relinka(
|
|
375
|
+
"info",
|
|
376
|
+
`[dist-jsr] Performing paths ext conversion in ${outDirBin} (from js to ts)`
|
|
377
|
+
);
|
|
378
|
+
await convertImportsExt({
|
|
379
|
+
targetDir: outDirBin,
|
|
380
|
+
extFrom: "js",
|
|
381
|
+
extTo: "ts"
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
await removeLogInternalCalls(outDirBin);
|
|
370
385
|
if (deleteFiles) {
|
|
371
386
|
await deleteSpecificFiles(outDirBin);
|
|
372
387
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { join, normalize, resolve } from "@reliverse/pathkit";
|
|
1
2
|
import { relinka } from "@reliverse/relinka";
|
|
2
3
|
import { existsSync } from "node:fs";
|
|
3
|
-
import { join, normalize, resolve } from "pathe";
|
|
4
|
-
import { definePreset } from "./types.js";
|
|
5
4
|
import { extractExportFilenames, listRecursively, warn } from "./utils.js";
|
|
5
|
+
export function definePreset(preset) {
|
|
6
|
+
return preset;
|
|
7
|
+
}
|
|
6
8
|
export const autoPreset = definePreset(() => {
|
|
7
9
|
return {
|
|
8
10
|
hooks: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UnifiedBuildConfig } from "
|
|
1
|
+
import type { UnifiedBuildConfig } from "../../../../sdk-types.js";
|
|
2
2
|
export declare function unifiedBuild(isLib: boolean, rootDir: string, inputConfig: UnifiedBuildConfig & {
|
|
3
3
|
config?: string;
|
|
4
4
|
showOutLog?: boolean;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { isAbsolute, normalize, relative, resolve } from "@reliverse/pathkit";
|
|
1
2
|
import { relinka } from "@reliverse/relinka";
|
|
2
3
|
import { defu } from "defu";
|
|
3
4
|
import { createHooks } from "hookable";
|
|
4
5
|
import { createJiti } from "jiti";
|
|
5
6
|
import { promises as fsp } from "node:fs";
|
|
6
7
|
import Module from "node:module";
|
|
7
|
-
import { isAbsolute, normalize, relative, resolve } from "pathe";
|
|
8
8
|
import prettyBytes from "pretty-bytes";
|
|
9
9
|
import prettyMilliseconds from "pretty-ms";
|
|
10
10
|
import { glob } from "tinyglobby";
|
|
@@ -310,7 +310,6 @@ ${entry.modules.filter((m) => m.id.includes("node_modules")).sort((a, b) => (b.b
|
|
|
310
310
|
relinka(
|
|
311
311
|
"warn",
|
|
312
312
|
`Build is done with some warnings:
|
|
313
|
-
|
|
314
313
|
${[...ctx.warnings].map((msg) => `- ${msg}`).join("\n")}`
|
|
315
314
|
);
|
|
316
315
|
if (ctx.options.failOnWarn) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { BuildContext } from "
|
|
1
|
+
import type { BuildContext } from "../../../../../sdk-types.js";
|
|
2
2
|
export declare function copyBuild(ctx: BuildContext): Promise<void>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { BuildContext } from "
|
|
1
|
+
import type { BuildContext } from "../../../../../sdk-types.js";
|
|
2
2
|
export declare function mkdistBuild(ctx: BuildContext): Promise<void>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { BuildContext } from "
|
|
1
|
+
import type { BuildContext } from "../../../../../sdk-types.js";
|
|
2
2
|
export declare function rollupBuild(ctx: BuildContext): Promise<void>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { BuildContext, RollupOptions } from "
|
|
1
|
+
import type { BuildContext, RollupOptions } from "../../../../../sdk-types.js";
|
|
2
2
|
export declare function getRollupOptions(ctx: BuildContext): RollupOptions;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Plugin } from "rollup";
|
|
2
|
-
import type { BuildContext } from "
|
|
2
|
+
import type { BuildContext } from "../../../../../../sdk-types.js";
|
|
3
3
|
export declare function cjsPlugin(): Plugin;
|
|
4
4
|
export declare function fixCJSExportTypePlugin(ctx: BuildContext): Plugin;
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
import type { FilterPattern } from "@rollup/pluginutils";
|
|
2
|
-
import type { CommonOptions, Loader } from "esbuild";
|
|
3
1
|
import type { Plugin } from "rollup";
|
|
4
|
-
|
|
5
|
-
exclude?: FilterPattern;
|
|
6
|
-
include?: FilterPattern;
|
|
7
|
-
/**
|
|
8
|
-
* Map extension to transpileEsbuild loader
|
|
9
|
-
* Note that each entry (the extension) needs to start with a dot
|
|
10
|
-
*/
|
|
11
|
-
loaders?: Record<string, false | Loader>;
|
|
12
|
-
};
|
|
2
|
+
import type { EsbuildOptions } from "../../../../../../sdk-types.js";
|
|
13
3
|
export declare function esbuild(options: EsbuildOptions): Plugin;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { BuildContext } from "
|
|
1
|
+
import type { BuildContext } from "../../../../../sdk-types.js";
|
|
2
2
|
export declare function rollupStub(ctx: BuildContext): Promise<void>;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
basename,
|
|
3
|
+
dirname,
|
|
4
|
+
extname,
|
|
5
|
+
relative,
|
|
6
|
+
resolve
|
|
7
|
+
} from "@reliverse/pathkit";
|
|
1
8
|
import { fileURLToPath, resolveModuleExportNames, resolvePath } from "mlly";
|
|
2
9
|
import { promises as fsp } from "node:fs";
|
|
3
10
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
4
|
-
import { basename, dirname, extname, relative, resolve } from "pathe";
|
|
5
11
|
import { warn } from "../utils.js";
|
|
6
12
|
import { getShebang, makeExecutable } from "./plugins/shebang.js";
|
|
7
13
|
import { DEFAULT_EXTENSIONS, resolveAliases } from "./utils.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PreRenderedChunk } from "rollup";
|
|
2
|
-
import type { BuildContext } from "
|
|
2
|
+
import type { BuildContext } from "../../../../../sdk-types.js";
|
|
3
3
|
export declare const DEFAULT_EXTENSIONS: string[];
|
|
4
4
|
export declare function getChunkFilename(ctx: BuildContext, chunk: PreRenderedChunk, ext: string): string;
|
|
5
5
|
export declare function resolveAliases(ctx: BuildContext): Record<string, string>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { RollupOptions } from "
|
|
1
|
+
import type { RollupOptions } from "../../../../../sdk-types.js";
|
|
2
2
|
export declare function rollupWatch(rollupOptions: RollupOptions): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { relative } from "@reliverse/pathkit";
|
|
1
2
|
import { relinka } from "@reliverse/relinka";
|
|
2
|
-
import { relative } from "pathe";
|
|
3
3
|
import { watch as _rollupWatch } from "rollup";
|
|
4
4
|
export function rollupWatch(rollupOptions) {
|
|
5
5
|
const transpileWatcher = _rollupWatch(rollupOptions);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { BuildContext } from "
|
|
1
|
+
import type { BuildContext } from "../../../../../sdk-types.js";
|
|
2
2
|
export declare function typesBuild(ctx: BuildContext): Promise<void>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { resolve } from "@reliverse/pathkit";
|
|
1
2
|
import { relinka } from "@reliverse/relinka";
|
|
2
3
|
import { createJiti } from "jiti";
|
|
3
4
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
4
|
-
import { resolve } from "pathe";
|
|
5
5
|
import { pascalCase } from "scule";
|
|
6
6
|
import {
|
|
7
7
|
generateMarkdown,
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { PackageJson } from "pkg-types";
|
|
2
|
-
import type { BuildContext, BuildPreset, UnifiedBuildConfig } from "
|
|
2
|
+
import type { BuildContext, BuildPreset, UnifiedBuildConfig } from "../../../../sdk-types.js";
|
|
3
3
|
type OutputDescriptor = {
|
|
4
4
|
file: string;
|
|
5
5
|
type?: "cjs" | "esm";
|
|
6
6
|
};
|
|
7
7
|
export declare function arrayIncludes(arr: (RegExp | string)[], searchElement: string): boolean;
|
|
8
8
|
export declare function dumpObject(obj: Record<string, any>): string;
|
|
9
|
-
export declare function ensuredir(path: string): Promise<void>;
|
|
10
9
|
export declare function extractExportFilenames(exports: PackageJson["exports"], conditions?: string[]): OutputDescriptor[];
|
|
11
10
|
export declare function getpkg(id?: string): string;
|
|
12
11
|
export declare function inferPkgExternals(pkg: PackageJson): (RegExp | string)[];
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { resolve } from "@reliverse/pathkit";
|
|
2
|
+
import fs from "@reliverse/relifso";
|
|
1
3
|
import { relinka } from "@reliverse/relinka";
|
|
2
4
|
import { createJiti } from "jiti";
|
|
3
5
|
import { readdirSync, statSync } from "node:fs";
|
|
4
6
|
import fsp from "node:fs/promises";
|
|
5
|
-
import { dirname, resolve } from "pathe";
|
|
6
7
|
import { autoPreset } from "./auto.js";
|
|
7
8
|
export function arrayIncludes(arr, searchElement) {
|
|
8
9
|
return arr.some(
|
|
@@ -12,9 +13,6 @@ export function arrayIncludes(arr, searchElement) {
|
|
|
12
13
|
export function dumpObject(obj) {
|
|
13
14
|
return `{ ${Object.keys(obj).map((key) => `${key}: ${JSON.stringify(obj[key])}`).join(", ")} }`;
|
|
14
15
|
}
|
|
15
|
-
export async function ensuredir(path) {
|
|
16
|
-
await fsp.mkdir(dirname(path), { recursive: true });
|
|
17
|
-
}
|
|
18
16
|
export function extractExportFilenames(exports, conditions = []) {
|
|
19
17
|
if (!exports) {
|
|
20
18
|
return [];
|
|
@@ -102,7 +100,7 @@ export async function rmdir(dir) {
|
|
|
102
100
|
});
|
|
103
101
|
}
|
|
104
102
|
export async function symlink(from, to, force = true) {
|
|
105
|
-
await
|
|
103
|
+
await fs.ensureDir(to);
|
|
106
104
|
if (force) {
|
|
107
105
|
await fsp.unlink(to).catch(() => {
|
|
108
106
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { PackageJson } from "pkg-types";
|
|
2
|
-
import type { BuildContext } from "
|
|
2
|
+
import type { BuildContext } from "../../../../sdk-types.js";
|
|
3
3
|
export declare function validateDependencies(ctx: BuildContext): void;
|
|
4
4
|
export declare function validatePackage(pkg: PackageJson, rootDir: string, ctx: BuildContext): void;
|