@reliverse/dler 1.2.0 → 1.2.2
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 +43 -20
- package/bin/cli/args/init/cmd/index.js +66 -0
- package/bin/cli/args/init/{main.txt → init-mod.txt} +1 -1
- package/bin/cli/args/init/libs/reinit/reint-impl/{mod.txt → reinit-mod.txt} +5 -5
- package/bin/cli/args/init/libs/reinit/reint-impl/templates/t-license.js +1 -1
- package/bin/cli/args/inject/ts-expect-error.txt +3 -3
- package/bin/cli/args/{spells/mod.js → spell/spell-mod.js} +1 -1
- package/bin/cli/args/split/split-impl.js +117 -0
- package/bin/cli/args/split/split-mod.js +22 -113
- package/bin/cli/args/tools/index.js +1 -1
- package/bin/cli/args/tools/tools-impl.js +16 -16
- package/bin/cli.js +3 -2
- package/bin/init.js +8 -8
- package/bin/libs/cfg/cfg-default.js +1 -1
- package/bin/libs/sdk/sdk-impl/build/build-library.js +11 -11
- package/bin/libs/sdk/sdk-impl/build/build-regular.js +24 -14
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/auto.js +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/build.js +4 -7
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/watch.js +3 -3
- package/bin/libs/sdk/sdk-impl/library-flow.js +1 -1
- package/bin/libs/sdk/sdk-impl/pub/pub-library.js +9 -9
- package/bin/libs/sdk/sdk-impl/pub/pub-regular.js +4 -4
- package/bin/libs/sdk/sdk-impl/regular-flow.js +17 -11
- package/bin/libs/sdk/sdk-impl/{spells/spells-executors.js → spell/spell-executors.js} +1 -1
- package/bin/libs/sdk/sdk-impl/{spells/spells-main.js → spell/spell-mod.js} +3 -3
- package/bin/libs/sdk/sdk-impl/utils/tools/tools-impl.js +7 -7
- package/bin/libs/sdk/sdk-impl/utils/utils-build.js +3 -3
- package/bin/libs/sdk/sdk-impl/utils/utils-bump.js +4 -4
- package/bin/libs/sdk/sdk-impl/utils/utils-fs.js +2 -5
- package/bin/libs/sdk/sdk-impl/utils/utils-info.js +4 -4
- package/bin/libs/sdk/sdk-impl/utils/utils-jsr-json.js +4 -2
- package/bin/libs/sdk/sdk-impl/utils/utils-paths.js +6 -6
- package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-libs.js +8 -8
- package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-reg.js +16 -13
- package/bin/load.js +1 -1
- package/bin/tools.txt +1 -1
- package/package.json +12 -12
- package/bin/cli/args/split/split-main.js +0 -26
- package/bin/libs/cfg/cfg-main.js +0 -1
- /package/bin/cli/args/agg/{main.js → agg-mod.js} +0 -0
- /package/bin/cli/args/conv/{main.js → conv-mod.js} +0 -0
- /package/bin/cli/args/deps/{mod.js → deps-mod.js} +0 -0
- /package/bin/cli/args/init/libs/reinit/{reinit-main.js → reinit-mod.js} +0 -0
- /package/bin/cli/args/inject/{cli-mod.js → inject-mod.js} +0 -0
- /package/bin/cli/args/inject/{main.txt → inject-mod.txt} +0 -0
- /package/bin/cli/args/merger/{main.txt → merger-mod.txt} +0 -0
- /package/bin/cli/args/mono/{main.js → mono-mod.js} +0 -0
- /package/bin/libs/sdk/sdk-impl/{spells/spells-filesystem.js → spell/spell-filesystem.js} +0 -0
- /package/bin/libs/sdk/sdk-impl/{spells/spells-parser.js → spell/spell-parser.js} +0 -0
- /package/bin/libs/sdk/sdk-impl/{spells/spells-types.js → spell/spell-types.js} +0 -0
- /package/bin/libs/sdk/{sdk-main.js → sdk-mod.js} +0 -0
- /package/bin/{main.js → mod.js} +0 -0
package/bin/cli.js
CHANGED
|
@@ -18,7 +18,7 @@ export async function dler(isDev) {
|
|
|
18
18
|
config.commonPubPause = true;
|
|
19
19
|
config.bumpDisable = true;
|
|
20
20
|
relinka(
|
|
21
|
-
"
|
|
21
|
+
"log",
|
|
22
22
|
"Development mode: Publishing paused and version bumping disabled."
|
|
23
23
|
);
|
|
24
24
|
}
|
|
@@ -67,7 +67,8 @@ export async function dler(isDev) {
|
|
|
67
67
|
config.transpileStub,
|
|
68
68
|
config.transpileWatch,
|
|
69
69
|
config.distJsrGenTsconfig,
|
|
70
|
-
config.coreDeclarations
|
|
70
|
+
config.coreDeclarations,
|
|
71
|
+
{ coreDescription: config.coreDescription }
|
|
71
72
|
);
|
|
72
73
|
await processLibraryFlow(
|
|
73
74
|
timer,
|
package/bin/init.js
CHANGED
|
@@ -13,12 +13,12 @@ export async function initDlerConfig(isDev) {
|
|
|
13
13
|
const configContent = generateConfig(isDev);
|
|
14
14
|
await fs.outputFile(configPath, configContent, "utf-8");
|
|
15
15
|
relinka("success", `Config was created at ${configPath}`);
|
|
16
|
-
relinka("
|
|
16
|
+
relinka("log", "Edit this file to customize build and publish settings");
|
|
17
17
|
if (!isDev) {
|
|
18
|
-
relinka("
|
|
19
|
-
relinka("
|
|
18
|
+
relinka("log", "Please note: commonPubPause is set to true by default");
|
|
19
|
+
relinka("log", "When you're ready, run `dler` to build and publish");
|
|
20
20
|
} else {
|
|
21
|
-
relinka("
|
|
21
|
+
relinka("log", "When you're ready, run `bun pub` to build and publish");
|
|
22
22
|
}
|
|
23
23
|
process.exit(0);
|
|
24
24
|
} catch (error) {
|
|
@@ -30,7 +30,7 @@ export async function initDlerConfig(isDev) {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
function generateConfig(isDev) {
|
|
33
|
-
const importDefineConfigStatement = isDev ? `import { defineConfig } from "
|
|
33
|
+
const importDefineConfigStatement = isDev ? `import { defineConfig } from "./libs/cfg/cfg-mod.js";` : `import { defineConfig } from "@reliverse/dler-cfg";`;
|
|
34
34
|
const verboseValue = getValue(isDev, true, DEFAULT_CONFIG.commonVerbose);
|
|
35
35
|
const isCLIValue = getValue(isDev, true, DEFAULT_CONFIG.coreIsCLI);
|
|
36
36
|
const registryValue = getValue(
|
|
@@ -58,7 +58,7 @@ function generateConfig(isDev) {
|
|
|
58
58
|
libDeclarations: true,
|
|
59
59
|
libDescription: "@reliverse/dler defineConfig",
|
|
60
60
|
libDirName: "cfg",
|
|
61
|
-
libMainFile: "cfg/cfg-
|
|
61
|
+
libMainFile: "cfg/cfg-mod.ts",
|
|
62
62
|
libPkgKeepDeps: false,
|
|
63
63
|
libTranspileMinify: true,
|
|
64
64
|
},
|
|
@@ -66,7 +66,7 @@ function generateConfig(isDev) {
|
|
|
66
66
|
libDeclarations: true,
|
|
67
67
|
libDescription: "@reliverse/dler without cli",
|
|
68
68
|
libDirName: "sdk",
|
|
69
|
-
libMainFile: "sdk/sdk-
|
|
69
|
+
libMainFile: "sdk/sdk-mod.ts",
|
|
70
70
|
libPkgKeepDeps: true,
|
|
71
71
|
libTranspileMinify: true,
|
|
72
72
|
},
|
|
@@ -75,7 +75,7 @@ function generateConfig(isDev) {
|
|
|
75
75
|
// libDeclarations: true,
|
|
76
76
|
// libDescription: "@acme/cli defineConfig",
|
|
77
77
|
// libDirName: "libName",
|
|
78
|
-
// libMainFile: "libName/libName-
|
|
78
|
+
// libMainFile: "libName/libName-mod.ts",
|
|
79
79
|
// libPkgKeepDeps: true,
|
|
80
80
|
// libTranspileMinify: true,
|
|
81
81
|
// },
|
|
@@ -51,7 +51,7 @@ export async function library_buildLibrary(options) {
|
|
|
51
51
|
replacementMarker: REPLACEMENT_MARKER
|
|
52
52
|
};
|
|
53
53
|
try {
|
|
54
|
-
relinka("
|
|
54
|
+
relinka("log", `Running pre-build replacements for ${libName}...`);
|
|
55
55
|
replacedFiles = await preBuildReplacements(replacementConfig);
|
|
56
56
|
relinka("verbose", `Pre-build: ${replacedFiles.length} files modified.`);
|
|
57
57
|
await executeBuildTasks(options);
|
|
@@ -94,7 +94,7 @@ async function executeBuildTasks(options) {
|
|
|
94
94
|
`JSR build requested for ${libName} but 'options.jsr' is missing.`
|
|
95
95
|
);
|
|
96
96
|
}
|
|
97
|
-
relinka("
|
|
97
|
+
relinka("log", `Queueing JSR build for lib ${libName}...`);
|
|
98
98
|
buildTasks.push(() => library_buildJsrDist(options));
|
|
99
99
|
}
|
|
100
100
|
if (commonPubRegistry === "npm" || commonPubRegistry === "npm-jsr") {
|
|
@@ -103,7 +103,7 @@ async function executeBuildTasks(options) {
|
|
|
103
103
|
`NPM build requested for ${libName} but 'options.npm' is missing.`
|
|
104
104
|
);
|
|
105
105
|
}
|
|
106
|
-
relinka("
|
|
106
|
+
relinka("log", `Queueing NPM build for lib ${libName}...`);
|
|
107
107
|
buildTasks.push(() => library_buildNpmDist(options));
|
|
108
108
|
}
|
|
109
109
|
if (buildTasks.length === 0) {
|
|
@@ -114,11 +114,11 @@ async function executeBuildTasks(options) {
|
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
116
|
if (buildTasks.length > 1) {
|
|
117
|
-
relinka("
|
|
117
|
+
relinka("log", `Building lib ${libName} for NPM and JSR concurrently...`);
|
|
118
118
|
await pAll(buildTasks, { concurrency: CONCURRENCY_DEFAULT });
|
|
119
119
|
} else {
|
|
120
120
|
relinka(
|
|
121
|
-
"
|
|
121
|
+
"log",
|
|
122
122
|
`Building lib ${libName} for ${options.commonPubRegistry || "single target"}...`
|
|
123
123
|
);
|
|
124
124
|
const task = buildTasks[0];
|
|
@@ -137,7 +137,7 @@ async function library_buildJsrDist(options) {
|
|
|
137
137
|
const jsrOptions = options.jsr;
|
|
138
138
|
const { jsrOutDir, distJsrBuilder, distJsrOutFilesExt } = jsrOptions;
|
|
139
139
|
const targetType = "jsr";
|
|
140
|
-
relinka("
|
|
140
|
+
relinka("log", `[JSR] Initializing JSR build for ${libName}...`);
|
|
141
141
|
const libSourceDirResolved = path.resolve(PROJECT_ROOT, options.mainDir);
|
|
142
142
|
const entryFilePathResolved = path.resolve(libSourceDirResolved, libMainFile);
|
|
143
143
|
const outputDirRootResolved = path.resolve(PROJECT_ROOT, jsrOutDir);
|
|
@@ -192,7 +192,7 @@ async function library_buildNpmDist(options) {
|
|
|
192
192
|
const distJsrOutFilesExt = options.jsr?.distJsrOutFilesExt || "ts";
|
|
193
193
|
const targetType = "npm";
|
|
194
194
|
const distName = determineDistName(npmOutDir, false, libsList);
|
|
195
|
-
relinka("
|
|
195
|
+
relinka("log", `[NPM:${distName}] Initializing NPM build for ${libName}...`);
|
|
196
196
|
const coreEntrySrcDirResolved = path.resolve(PROJECT_ROOT, coreEntrySrcDir);
|
|
197
197
|
const outputDirRootResolved = path.resolve(PROJECT_ROOT, npmOutDir);
|
|
198
198
|
const outputDirBinResolved = path.resolve(
|
|
@@ -281,10 +281,10 @@ async function buildDistributionTarget(params) {
|
|
|
281
281
|
} = options;
|
|
282
282
|
const isJsr = targetType === "jsr";
|
|
283
283
|
const logPrefix = isJsr ? "[JSR]" : `[NPM:${determineDistName(path.relative(PROJECT_ROOT, outputDirRoot), false, libsList)}]`;
|
|
284
|
-
relinka("
|
|
284
|
+
relinka("log", `${logPrefix} Starting build target processing...`);
|
|
285
285
|
await ensuredir(outputDirRoot);
|
|
286
286
|
await ensuredir(outputDirBin);
|
|
287
|
-
relinka("
|
|
287
|
+
relinka("log", `${logPrefix} Using builder: ${builder}`);
|
|
288
288
|
const bundleRequest = {
|
|
289
289
|
builder,
|
|
290
290
|
entryPoint: entryFilePath,
|
|
@@ -319,7 +319,7 @@ async function buildDistributionTarget(params) {
|
|
|
319
319
|
libDirName
|
|
320
320
|
};
|
|
321
321
|
await library_performCommonBuildSteps(commonStepsParams);
|
|
322
|
-
relinka("
|
|
322
|
+
relinka("log", `${logPrefix} Completed build target processing.`);
|
|
323
323
|
}
|
|
324
324
|
async function library_bundleWithBuilder(params) {
|
|
325
325
|
const { builder, ...executorParams } = params;
|
|
@@ -777,7 +777,7 @@ async function preBuildReplacements(config) {
|
|
|
777
777
|
});
|
|
778
778
|
await fs.writeFile(filePath, updatedCode, "utf-8");
|
|
779
779
|
relinka(
|
|
780
|
-
"
|
|
780
|
+
"log",
|
|
781
781
|
`Applied pre-build replacement in ${path.relative(PROJECT_ROOT, filePath)}`
|
|
782
782
|
);
|
|
783
783
|
} else {
|
|
@@ -34,15 +34,15 @@ import {
|
|
|
34
34
|
import { regular_createPackageJSON } from "../utils/utils-pkg-json-reg.js";
|
|
35
35
|
import { createTSConfig } from "../utils/utils-tsconfig.js";
|
|
36
36
|
import { ensuredir } from "./bundlers/unified/utils.js";
|
|
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) {
|
|
38
|
-
relinka("
|
|
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
|
+
relinka("log", "Building JSR distribution...");
|
|
39
39
|
const coreEntrySrcDirResolved = path.resolve(PROJECT_ROOT, coreEntrySrcDir);
|
|
40
40
|
const coreEntryFilePath = path.join(coreEntrySrcDirResolved, coreEntryFile);
|
|
41
41
|
const distJsrDirNameResolved = path.resolve(PROJECT_ROOT, distJsrDirName);
|
|
42
42
|
const outDirBin = path.resolve(distJsrDirNameResolved, "bin");
|
|
43
43
|
await ensuredir(distJsrDirNameResolved);
|
|
44
44
|
await ensuredir(outDirBin);
|
|
45
|
-
relinka("
|
|
45
|
+
relinka("log", `Using JSR builder: ${distJsrBuilder}`);
|
|
46
46
|
await regular_bundleWithBuilder(distJsrBuilder, {
|
|
47
47
|
coreDeclarations,
|
|
48
48
|
outDir: outDirBin,
|
|
@@ -69,11 +69,18 @@ export async function regular_buildJsrDist(isDev, isJsr, coreIsCLI, coreEntrySrc
|
|
|
69
69
|
outDirBin,
|
|
70
70
|
outDirRoot: distJsrDirNameResolved,
|
|
71
71
|
rmDepsMode,
|
|
72
|
-
unifiedBundlerOutExt
|
|
72
|
+
unifiedBundlerOutExt,
|
|
73
|
+
coreDescription: config.coreDescription
|
|
73
74
|
});
|
|
74
75
|
await convertImportExtensionsJsToTs({ dirPath: outDirBin });
|
|
75
76
|
await renameTsxFiles(outDirBin);
|
|
76
|
-
await createJsrJSON(
|
|
77
|
+
await createJsrJSON(
|
|
78
|
+
distJsrDirNameResolved,
|
|
79
|
+
false,
|
|
80
|
+
void 0,
|
|
81
|
+
void 0,
|
|
82
|
+
config.coreDescription
|
|
83
|
+
);
|
|
77
84
|
if (coreIsCLI && isJsr && distJsrGenTsconfig) {
|
|
78
85
|
await createTSConfig(distJsrDirNameResolved, true);
|
|
79
86
|
}
|
|
@@ -81,20 +88,20 @@ export async function regular_buildJsrDist(isDev, isJsr, coreIsCLI, coreEntrySrc
|
|
|
81
88
|
const filesCount = await outDirBinFilesCount(outDirBin);
|
|
82
89
|
relinka(
|
|
83
90
|
"success",
|
|
84
|
-
`[${distJsrDirNameResolved}] Successfully created regular distribution: "dist-jsr" (${outDirBin}/
|
|
91
|
+
`[${distJsrDirNameResolved}] Successfully created regular distribution: "dist-jsr" (${outDirBin}/mod.ts) with (${filesCount} files (${prettyBytes(
|
|
85
92
|
dirSize
|
|
86
93
|
)}))`
|
|
87
94
|
);
|
|
88
95
|
}
|
|
89
|
-
export async function regular_buildNpmDist(isDev, coreEntrySrcDir, distNpmDirName, distNpmBuilder, coreEntryFile, unifiedBundlerOutExt, rmDepsMode, coreIsCLI, transpileTarget, transpileFormat, transpileSplitting, transpileMinify, transpileSourcemap, transpilePublicPath, transpileStub, transpileWatch, timer, coreDeclarations) {
|
|
90
|
-
relinka("
|
|
96
|
+
export async function regular_buildNpmDist(isDev, coreEntrySrcDir, distNpmDirName, distNpmBuilder, coreEntryFile, unifiedBundlerOutExt, rmDepsMode, coreIsCLI, transpileTarget, transpileFormat, transpileSplitting, transpileMinify, transpileSourcemap, transpilePublicPath, transpileStub, transpileWatch, timer, coreDeclarations, config) {
|
|
97
|
+
relinka("log", "Building NPM distribution...");
|
|
91
98
|
const coreEntrySrcDirResolved = path.resolve(PROJECT_ROOT, coreEntrySrcDir);
|
|
92
99
|
const coreEntryFilePath = path.join(coreEntrySrcDirResolved, coreEntryFile);
|
|
93
100
|
const distNpmDirNameResolved = path.resolve(PROJECT_ROOT, distNpmDirName);
|
|
94
101
|
const outDirBin = path.resolve(distNpmDirNameResolved, "bin");
|
|
95
102
|
await ensuredir(distNpmDirNameResolved);
|
|
96
103
|
await ensuredir(outDirBin);
|
|
97
|
-
relinka("
|
|
104
|
+
relinka("log", `Using NPM builder: ${distNpmBuilder}`);
|
|
98
105
|
await regular_bundleWithBuilder(distNpmBuilder, {
|
|
99
106
|
coreDeclarations,
|
|
100
107
|
outDir: outDirBin,
|
|
@@ -119,7 +126,8 @@ export async function regular_buildNpmDist(isDev, coreEntrySrcDir, distNpmDirNam
|
|
|
119
126
|
outDirBin,
|
|
120
127
|
outDirRoot: distNpmDirNameResolved,
|
|
121
128
|
rmDepsMode,
|
|
122
|
-
unifiedBundlerOutExt
|
|
129
|
+
unifiedBundlerOutExt,
|
|
130
|
+
coreDescription: config.coreDescription
|
|
123
131
|
});
|
|
124
132
|
const dirSize = await getDirectorySize(distNpmDirNameResolved, isDev);
|
|
125
133
|
const filesCount = await outDirBinFilesCount(outDirBin);
|
|
@@ -129,7 +137,7 @@ export async function regular_buildNpmDist(isDev, coreEntrySrcDir, distNpmDirNam
|
|
|
129
137
|
);
|
|
130
138
|
relinka(
|
|
131
139
|
"success",
|
|
132
|
-
`[${distNpmDirNameResolved}] Successfully created regular distribution: "dist-npm" (${outDirBin}/
|
|
140
|
+
`[${distNpmDirNameResolved}] Successfully created regular distribution: "dist-npm" (${outDirBin}/mod.js) with (${filesCount} files (${prettyBytes(
|
|
133
141
|
dirSize
|
|
134
142
|
)}))`
|
|
135
143
|
);
|
|
@@ -197,7 +205,7 @@ async function regular_bundleUsingBun(coreEntryFile, outDirBin, transpileTarget,
|
|
|
197
205
|
}
|
|
198
206
|
}
|
|
199
207
|
async function regular_bundleUsingJsr(src, dest) {
|
|
200
|
-
relinka("
|
|
208
|
+
relinka("log", `Starting regular_bundleUsingJsr: ${src} -> ${dest}`);
|
|
201
209
|
await ensuredir(path.dirname(dest));
|
|
202
210
|
const stats = await fs.stat(src);
|
|
203
211
|
if (!stats.isDirectory()) {
|
|
@@ -340,7 +348,8 @@ async function regular_performCommonBuildSteps({
|
|
|
340
348
|
outDirBin,
|
|
341
349
|
outDirRoot,
|
|
342
350
|
rmDepsMode,
|
|
343
|
-
unifiedBundlerOutExt
|
|
351
|
+
unifiedBundlerOutExt,
|
|
352
|
+
coreDescription
|
|
344
353
|
}) {
|
|
345
354
|
await convertImportPaths({
|
|
346
355
|
aliasPrefix: "~/",
|
|
@@ -358,7 +367,8 @@ async function regular_performCommonBuildSteps({
|
|
|
358
367
|
coreIsCLI,
|
|
359
368
|
unifiedBundlerOutExt,
|
|
360
369
|
rmDepsMode,
|
|
361
|
-
[]
|
|
370
|
+
[],
|
|
371
|
+
coreDescription
|
|
362
372
|
);
|
|
363
373
|
await copyRootFile(outDirRoot, ["README.md", "LICENSE"]);
|
|
364
374
|
if (isJsr) {
|
|
@@ -23,7 +23,7 @@ export const autoPreset = definePreset(() => {
|
|
|
23
23
|
ctx.options.declaration = res.dts ? "compatible" : false;
|
|
24
24
|
}
|
|
25
25
|
relinka(
|
|
26
|
-
"
|
|
26
|
+
"log",
|
|
27
27
|
"Automatically detected entries:",
|
|
28
28
|
ctx.options.entries.map(
|
|
29
29
|
(e) => e.input.replace(`${ctx.options.rootDir}/`, "").replace(/\/$/, "/*")
|
|
@@ -202,7 +202,7 @@ async function _build(rootDir, inputConfig, buildConfig, pkg, cleanedDirs, _tran
|
|
|
202
202
|
);
|
|
203
203
|
if (process.env.DEBUG) {
|
|
204
204
|
relinka(
|
|
205
|
-
"
|
|
205
|
+
"log",
|
|
206
206
|
`Root dir: ${options.rootDir}
|
|
207
207
|
Entries:
|
|
208
208
|
${options.entries.map((entry) => ` ${dumpObject(entry)}`).join("\n ")}
|
|
@@ -218,7 +218,7 @@ ${options.entries.map((entry) => ` ${dumpObject(entry)}`).join("\n ")}
|
|
|
218
218
|
}
|
|
219
219
|
cleanedDirs.push(dir);
|
|
220
220
|
relinka(
|
|
221
|
-
"
|
|
221
|
+
"log",
|
|
222
222
|
`Cleaning dist directory: \`./${relative(process.cwd(), dir)}\``
|
|
223
223
|
);
|
|
224
224
|
await rmdir(dir);
|
|
@@ -287,7 +287,7 @@ ${entry.modules.filter((m) => m.id.includes("node_modules")).sort((a, b) => (b.b
|
|
|
287
287
|
return ` \u{1F4E6} ${rPath(m.id)}${m.bytes ? ` (${prettyBytes(m.bytes)})` : ""}`;
|
|
288
288
|
}).join("\n")}`;
|
|
289
289
|
}
|
|
290
|
-
relinka("
|
|
290
|
+
relinka("log", entry.chunk ? line : line);
|
|
291
291
|
}
|
|
292
292
|
const elapsedTime = getElapsedPerfTime(timer);
|
|
293
293
|
const transpileFormattedTime = prettyMilliseconds(elapsedTime, {
|
|
@@ -295,15 +295,12 @@ ${entry.modules.filter((m) => m.id.includes("node_modules")).sort((a, b) => (b.b
|
|
|
295
295
|
});
|
|
296
296
|
relinka(
|
|
297
297
|
"info",
|
|
298
|
-
|
|
299
|
-
prettyBytes(ctx.buildEntries.reduce((a, e) => a + (e.bytes || 0), 0)),
|
|
300
|
-
`(build time: ${transpileFormattedTime})`
|
|
298
|
+
`\u03A3 Total dist size: ${prettyBytes(ctx.buildEntries.reduce((a, e) => a + (e.bytes || 0), 0))} (build time: ${transpileFormattedTime})`
|
|
301
299
|
);
|
|
302
300
|
}
|
|
303
301
|
validateDependencies(ctx);
|
|
304
302
|
validatePackage(pkg, rootDir, ctx);
|
|
305
303
|
await ctx.hooks.callHook("build:done", ctx);
|
|
306
|
-
relinka("info", "");
|
|
307
304
|
if (ctx.warnings.size > 0) {
|
|
308
305
|
relinka(
|
|
309
306
|
"warn",
|
|
@@ -12,7 +12,7 @@ export function rollupWatch(rollupOptions) {
|
|
|
12
12
|
inputs = Object.keys(rollupOptions.input || {});
|
|
13
13
|
}
|
|
14
14
|
relinka(
|
|
15
|
-
"
|
|
15
|
+
"log",
|
|
16
16
|
`[dler] [rollup] Starting watchers for entries: ${inputs.map((input) => `./${relative(process.cwd(), input)}`).join(", ")}`
|
|
17
17
|
);
|
|
18
18
|
relinka(
|
|
@@ -20,10 +20,10 @@ export function rollupWatch(rollupOptions) {
|
|
|
20
20
|
"[dler] [rollup] Watch mode is experimental and may be unstable"
|
|
21
21
|
);
|
|
22
22
|
transpileWatcher.on("change", (id, { event }) => {
|
|
23
|
-
relinka("
|
|
23
|
+
relinka("log", `${relative(".", id)} was ${event}d`);
|
|
24
24
|
});
|
|
25
25
|
transpileWatcher.on("restart", () => {
|
|
26
|
-
relinka("
|
|
26
|
+
relinka("log", "[dler] [rollup] Rebuilding bundle");
|
|
27
27
|
});
|
|
28
28
|
transpileWatcher.on("event", (event) => {
|
|
29
29
|
if (event.code === "END") {
|
|
@@ -57,7 +57,7 @@ function extractFolderName(libName, libConfig) {
|
|
|
57
57
|
export async function libraries_buildPublish(isDev, timer, libsList, distJsrDryRun, distJsrFailOnWarn, libsDirDist, libsDirSrc, commonPubPause, commonPubRegistry, unifiedBundlerOutExt, distNpmBuilder, coreEntrySrcDir, rmDepsMode, rmDepsPatterns, transpileEsbuild, transpileTarget, transpileFormat, transpileSplitting, transpileSourcemap, transpilePublicPath, distJsrBuilder, transpileStub, transpileWatch, distJsrOutFilesExt) {
|
|
58
58
|
relinka("verbose", "Starting libraries_buildPublish");
|
|
59
59
|
if (!libsList || Object.keys(libsList).length === 0) {
|
|
60
|
-
relinka("
|
|
60
|
+
relinka("log", "No lib configs found in config, skipping libs build.");
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
63
|
const libsEntries = Object.entries(libsList);
|
|
@@ -10,14 +10,14 @@ import {
|
|
|
10
10
|
export async function library_publishLibrary(commonPubRegistry, libName, npmOutDir, jsrOutDir, distJsrDryRun, distJsrFailOnWarn, distJsrAllowDirty, distJsrSlowTypes, isDev, timer) {
|
|
11
11
|
if (isDev) {
|
|
12
12
|
relinka(
|
|
13
|
-
"
|
|
13
|
+
"log",
|
|
14
14
|
`Skipping publishing for lib ${libName} in development mode`
|
|
15
15
|
);
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
18
|
switch (commonPubRegistry) {
|
|
19
19
|
case "jsr":
|
|
20
|
-
relinka("
|
|
20
|
+
relinka("log", `Publishing lib ${libName} to JSR only...`);
|
|
21
21
|
await library_pubToJsr(
|
|
22
22
|
jsrOutDir,
|
|
23
23
|
distJsrDryRun,
|
|
@@ -30,7 +30,7 @@ export async function library_publishLibrary(commonPubRegistry, libName, npmOutD
|
|
|
30
30
|
);
|
|
31
31
|
break;
|
|
32
32
|
case "npm":
|
|
33
|
-
relinka("
|
|
33
|
+
relinka("log", `Publishing lib ${libName} to NPM only...`);
|
|
34
34
|
await library_pubToNpm(
|
|
35
35
|
npmOutDir,
|
|
36
36
|
distJsrDryRun,
|
|
@@ -41,7 +41,7 @@ export async function library_publishLibrary(commonPubRegistry, libName, npmOutD
|
|
|
41
41
|
);
|
|
42
42
|
break;
|
|
43
43
|
case "npm-jsr": {
|
|
44
|
-
relinka("
|
|
44
|
+
relinka("log", `Publishing lib ${libName} to both NPM and JSR...`);
|
|
45
45
|
const publishTasks = [
|
|
46
46
|
() => library_pubToNpm(
|
|
47
47
|
npmOutDir,
|
|
@@ -67,7 +67,7 @@ export async function library_publishLibrary(commonPubRegistry, libName, npmOutD
|
|
|
67
67
|
}
|
|
68
68
|
default:
|
|
69
69
|
relinka(
|
|
70
|
-
"
|
|
70
|
+
"log",
|
|
71
71
|
`Registry "${commonPubRegistry}" not recognized for lib ${libName}. Skipping publishing for this lib.`
|
|
72
72
|
);
|
|
73
73
|
}
|
|
@@ -75,13 +75,13 @@ export async function library_publishLibrary(commonPubRegistry, libName, npmOutD
|
|
|
75
75
|
async function library_pubToJsr(libOutDir, distJsrDryRun, distJsrFailOnWarn, distJsrAllowDirty, distJsrSlowTypes, libName, isDev, timer) {
|
|
76
76
|
relinka("verbose", `Starting library_pubToJsr for lib: ${libName}`);
|
|
77
77
|
if (isDev) {
|
|
78
|
-
relinka("
|
|
78
|
+
relinka("log", `Skipping lib ${libName} JSR publish in development mode`);
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
81
|
try {
|
|
82
82
|
if (timer) pausePerfTimer(timer);
|
|
83
83
|
await withWorkingDirectory(libOutDir, async () => {
|
|
84
|
-
relinka("
|
|
84
|
+
relinka("log", `Publishing lib ${libName} to JSR from ${libOutDir}`);
|
|
85
85
|
const command = [
|
|
86
86
|
"bun x jsr publish",
|
|
87
87
|
distJsrDryRun ? "--dry-run" : "",
|
|
@@ -107,13 +107,13 @@ async function library_pubToJsr(libOutDir, distJsrDryRun, distJsrFailOnWarn, dis
|
|
|
107
107
|
async function library_pubToNpm(libOutDir, distJsrDryRun, distJsrFailOnWarn, libName, isDev, timer) {
|
|
108
108
|
relinka("verbose", `Starting library_pubToNpm for lib: ${libName}`);
|
|
109
109
|
if (isDev) {
|
|
110
|
-
relinka("
|
|
110
|
+
relinka("log", `Skipping lib ${libName} NPM publish in development mode`);
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
113
|
try {
|
|
114
114
|
if (timer) pausePerfTimer(timer);
|
|
115
115
|
await withWorkingDirectory(libOutDir, async () => {
|
|
116
|
-
relinka("
|
|
116
|
+
relinka("log", `Publishing lib ${libName} to NPM from ${libOutDir}`);
|
|
117
117
|
const command = ["bun publish", distJsrDryRun ? "--dry-run" : ""].filter(Boolean).join(" ");
|
|
118
118
|
await execaCommand(command, { stdio: "inherit" });
|
|
119
119
|
relinka(
|
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
export async function regular_pubToJsr(distJsrDryRun, distJsrFailOnWarn, isDev, commonPubPause, distJsrDirName, distJsrAllowDirty, distJsrSlowTypes, timer) {
|
|
11
11
|
try {
|
|
12
12
|
if (isDev) {
|
|
13
|
-
relinka("
|
|
13
|
+
relinka("log", "Skipping JSR publish in development mode");
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
if (!commonPubPause) {
|
|
17
|
-
relinka("
|
|
17
|
+
relinka("log", "Publishing to JSR...");
|
|
18
18
|
const distJsrDirNameResolved = path.resolve(PROJECT_ROOT, distJsrDirName);
|
|
19
19
|
if (timer) pausePerfTimer(timer);
|
|
20
20
|
await withWorkingDirectory(distJsrDirNameResolved, async () => {
|
|
@@ -43,11 +43,11 @@ export async function regular_pubToJsr(distJsrDryRun, distJsrFailOnWarn, isDev,
|
|
|
43
43
|
export async function regular_pubToNpm(distJsrDryRun, isDev, commonPubPause, distNpmDirName, timer) {
|
|
44
44
|
try {
|
|
45
45
|
if (isDev) {
|
|
46
|
-
relinka("
|
|
46
|
+
relinka("log", "Skipping NPM publish in development mode");
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
49
|
if (!commonPubPause) {
|
|
50
|
-
relinka("
|
|
50
|
+
relinka("log", "Publishing to NPM...");
|
|
51
51
|
const distNpmDirNameResolved = path.resolve(PROJECT_ROOT, distNpmDirName);
|
|
52
52
|
if (timer) pausePerfTimer(timer);
|
|
53
53
|
await withWorkingDirectory(distNpmDirNameResolved, async () => {
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
} from "./build/build-regular.js";
|
|
7
7
|
import { regular_pubToJsr, regular_pubToNpm } from "./pub/pub-regular.js";
|
|
8
8
|
import { CONCURRENCY_DEFAULT } from "./utils/utils-consts.js";
|
|
9
|
-
export async function processRegularFlow(timer, isDev, coreIsCLI, libsActMode, commonPubRegistry, coreEntrySrcDir, distNpmDirName, distNpmBuilder, coreEntryFile, distJsrDryRun, distJsrFailOnWarn, commonPubPause, distJsrDirName, distJsrBuilder, transpileTarget, transpileFormat, transpileSplitting, transpileMinify, transpileSourcemap, transpilePublicPath, distJsrAllowDirty, distJsrSlowTypes, unifiedBundlerOutExt, rmDepsMode, transpileStub, transpileWatch, distJsrGenTsconfig, coreDeclarations) {
|
|
9
|
+
export async function processRegularFlow(timer, isDev, coreIsCLI, libsActMode, commonPubRegistry, coreEntrySrcDir, distNpmDirName, distNpmBuilder, coreEntryFile, distJsrDryRun, distJsrFailOnWarn, commonPubPause, distJsrDirName, distJsrBuilder, transpileTarget, transpileFormat, transpileSplitting, transpileMinify, transpileSourcemap, transpilePublicPath, distJsrAllowDirty, distJsrSlowTypes, unifiedBundlerOutExt, rmDepsMode, transpileStub, transpileWatch, distJsrGenTsconfig, coreDeclarations, config) {
|
|
10
10
|
if (libsActMode !== "main-project-only" && libsActMode !== "main-and-libs") {
|
|
11
11
|
relinka(
|
|
12
|
-
"
|
|
12
|
+
"log",
|
|
13
13
|
"Skipping main project build/publish as libsActMode is set to 'libs-only'"
|
|
14
14
|
);
|
|
15
15
|
return;
|
|
@@ -17,7 +17,7 @@ export async function processRegularFlow(timer, isDev, coreIsCLI, libsActMode, c
|
|
|
17
17
|
switch (commonPubRegistry) {
|
|
18
18
|
case "jsr":
|
|
19
19
|
relinka(
|
|
20
|
-
"
|
|
20
|
+
"log",
|
|
21
21
|
"Initializing build process for main project to JSR only..."
|
|
22
22
|
);
|
|
23
23
|
await regular_buildJsrDist(
|
|
@@ -40,7 +40,8 @@ export async function processRegularFlow(timer, isDev, coreIsCLI, libsActMode, c
|
|
|
40
40
|
transpileStub,
|
|
41
41
|
transpileWatch,
|
|
42
42
|
distJsrGenTsconfig,
|
|
43
|
-
coreDeclarations
|
|
43
|
+
coreDeclarations,
|
|
44
|
+
config
|
|
44
45
|
);
|
|
45
46
|
if (!isDev) {
|
|
46
47
|
await regular_pubToJsr(
|
|
@@ -57,7 +58,7 @@ export async function processRegularFlow(timer, isDev, coreIsCLI, libsActMode, c
|
|
|
57
58
|
break;
|
|
58
59
|
case "npm":
|
|
59
60
|
relinka(
|
|
60
|
-
"
|
|
61
|
+
"log",
|
|
61
62
|
"Initializing build process for main project to NPM only..."
|
|
62
63
|
);
|
|
63
64
|
await regular_buildNpmDist(
|
|
@@ -78,7 +79,8 @@ export async function processRegularFlow(timer, isDev, coreIsCLI, libsActMode, c
|
|
|
78
79
|
transpileStub,
|
|
79
80
|
transpileWatch,
|
|
80
81
|
timer,
|
|
81
|
-
coreDeclarations
|
|
82
|
+
coreDeclarations,
|
|
83
|
+
config
|
|
82
84
|
);
|
|
83
85
|
if (!isDev) {
|
|
84
86
|
await regular_pubToNpm(
|
|
@@ -92,7 +94,7 @@ export async function processRegularFlow(timer, isDev, coreIsCLI, libsActMode, c
|
|
|
92
94
|
break;
|
|
93
95
|
case "npm-jsr": {
|
|
94
96
|
relinka(
|
|
95
|
-
"
|
|
97
|
+
"log",
|
|
96
98
|
"Initializing build process for main project to both NPM and JSR..."
|
|
97
99
|
);
|
|
98
100
|
const buildTasks = [
|
|
@@ -116,7 +118,8 @@ export async function processRegularFlow(timer, isDev, coreIsCLI, libsActMode, c
|
|
|
116
118
|
transpileStub,
|
|
117
119
|
transpileWatch,
|
|
118
120
|
distJsrGenTsconfig,
|
|
119
|
-
coreDeclarations
|
|
121
|
+
coreDeclarations,
|
|
122
|
+
config
|
|
120
123
|
),
|
|
121
124
|
() => regular_buildNpmDist(
|
|
122
125
|
isDev,
|
|
@@ -136,7 +139,8 @@ export async function processRegularFlow(timer, isDev, coreIsCLI, libsActMode, c
|
|
|
136
139
|
transpileStub,
|
|
137
140
|
transpileWatch,
|
|
138
141
|
timer,
|
|
139
|
-
coreDeclarations
|
|
142
|
+
coreDeclarations,
|
|
143
|
+
config
|
|
140
144
|
)
|
|
141
145
|
];
|
|
142
146
|
await pAll(buildTasks, { concurrency: CONCURRENCY_DEFAULT });
|
|
@@ -188,7 +192,8 @@ export async function processRegularFlow(timer, isDev, coreIsCLI, libsActMode, c
|
|
|
188
192
|
transpileStub,
|
|
189
193
|
transpileWatch,
|
|
190
194
|
timer,
|
|
191
|
-
coreDeclarations
|
|
195
|
+
coreDeclarations,
|
|
196
|
+
config
|
|
192
197
|
),
|
|
193
198
|
() => regular_buildJsrDist(
|
|
194
199
|
isDev,
|
|
@@ -210,7 +215,8 @@ export async function processRegularFlow(timer, isDev, coreIsCLI, libsActMode, c
|
|
|
210
215
|
transpileStub,
|
|
211
216
|
transpileWatch,
|
|
212
217
|
distJsrGenTsconfig,
|
|
213
|
-
coreDeclarations
|
|
218
|
+
coreDeclarations,
|
|
219
|
+
config
|
|
214
220
|
)
|
|
215
221
|
];
|
|
216
222
|
await pAll(fallbackBuildTasks, { concurrency: CONCURRENCY_DEFAULT });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as executors from "./
|
|
2
|
-
import * as fs from "./
|
|
3
|
-
import { extractSpellsFromFile } from "./
|
|
1
|
+
import * as executors from "./spell-executors.js";
|
|
2
|
+
import * as fs from "./spell-filesystem.js";
|
|
3
|
+
import { extractSpellsFromFile } from "./spell-parser.js";
|
|
4
4
|
export const executeSpell = async (spell, filePath, content) => {
|
|
5
5
|
if (spell.params.hooked) {
|
|
6
6
|
return {
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { relinka } from "@reliverse/relinka";
|
|
2
2
|
export function printUsage(isDev) {
|
|
3
|
-
relinka("
|
|
4
|
-
relinka("
|
|
5
|
-
relinka("
|
|
3
|
+
relinka("log", "====================");
|
|
4
|
+
relinka("log", "TOOLS USAGE EXAMPLES");
|
|
5
|
+
relinka("log", "====================");
|
|
6
6
|
relinka(
|
|
7
|
-
"
|
|
7
|
+
"log",
|
|
8
8
|
`${isDev ? "bun dev:agg" : "dler tools"} --tool agg --input <dir> --out <file> [options]`
|
|
9
9
|
);
|
|
10
10
|
if (isDev) {
|
|
11
11
|
relinka(
|
|
12
|
-
"
|
|
13
|
-
"bun dev:tools agg --input src/libs/sdk/sdk-impl --out src/libs/sdk/sdk-
|
|
12
|
+
"log",
|
|
13
|
+
"bun dev:tools agg --input src/libs/sdk/sdk-impl --out src/libs/sdk/sdk-mod.ts --recursive --named --strip src/libs/sdk"
|
|
14
14
|
);
|
|
15
15
|
} else {
|
|
16
16
|
relinka(
|
|
17
|
-
"
|
|
17
|
+
"log",
|
|
18
18
|
"dler tools --tool agg --input src/libs --out aggregator.ts --recursive --named"
|
|
19
19
|
);
|
|
20
20
|
}
|
|
@@ -51,7 +51,7 @@ export async function renameEntryFile(isJsr, outDirBin, originalEntryFileBasenam
|
|
|
51
51
|
if (isJsr) {
|
|
52
52
|
if (originalEntryFileBasename.endsWith(".ts")) {
|
|
53
53
|
sourceEntryBasename = originalEntryFileBasename;
|
|
54
|
-
targetEntryBasename = "
|
|
54
|
+
targetEntryBasename = "mod.ts";
|
|
55
55
|
} else {
|
|
56
56
|
sourceEntryBasename = `${originalBasenameNoExt}.${outputExt}`;
|
|
57
57
|
targetEntryBasename = `main.${outputExt}`;
|
|
@@ -91,10 +91,10 @@ export async function renameEntryFile(isJsr, outDirBin, originalEntryFileBasenam
|
|
|
91
91
|
}
|
|
92
92
|
if (sourceEntryPath !== targetEntryPath) {
|
|
93
93
|
await fs.rename(sourceEntryPath, targetEntryPath);
|
|
94
|
-
relinka("
|
|
94
|
+
relinka("log", `Renamed entry file to ${targetEntryPath}`);
|
|
95
95
|
} else {
|
|
96
96
|
relinka(
|
|
97
|
-
"
|
|
97
|
+
"log",
|
|
98
98
|
`Source entry file ${sourceEntryPath} already has the target name. Skipping rename.`
|
|
99
99
|
);
|
|
100
100
|
}
|