@reliverse/dler 1.7.11 → 1.7.12
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/bin/app/build/impl.js +2 -2
- package/bin/app/merge/cmd.d.ts +2 -9
- package/bin/app/merge/cmd.js +45 -34
- package/bin/app/mock/mock.js +1 -1
- package/bin/libs/sdk/sdk-impl/build/build-library.js +13 -18
- package/bin/libs/sdk/sdk-impl/build/build-regular.js +22 -30
- package/bin/libs/sdk/sdk-impl/cfg/info.js +1 -1
- package/bin/libs/sdk/sdk-impl/library-flow.js +2 -16
- package/bin/libs/sdk/sdk-impl/pub/pub-library.js +2 -9
- package/bin/libs/sdk/sdk-impl/pub/pub-regular.js +2 -14
- package/bin/libs/sdk/sdk-impl/utils/finalize.js +3 -3
- package/bin/libs/sdk/sdk-impl/utils/utils-error.d.ts +3 -2
- package/bin/libs/sdk/sdk-impl/utils/utils-error.js +10 -10
- package/bin/templates/App.css +31 -0
- package/bin/templates/App.tsx +21 -0
- package/bin/templates/DOCS.md +31 -0
- package/bin/templates/globals.css +27 -0
- package/bin/templates/hello/world.ts +1 -0
- package/bin/templates/index.html +12 -0
- package/bin/templates/main.tsx +11 -0
- package/package.json +2 -2
package/bin/app/build/impl.js
CHANGED
|
@@ -50,7 +50,7 @@ export async function dlerBuild(isDev, config) {
|
|
|
50
50
|
effectiveConfig.libsDirDist
|
|
51
51
|
);
|
|
52
52
|
} catch (error) {
|
|
53
|
-
handleDlerError(error
|
|
53
|
+
handleDlerError(error);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
export async function dlerPub(isDev, config) {
|
|
@@ -94,6 +94,6 @@ export async function dlerPub(isDev, config) {
|
|
|
94
94
|
effectiveConfig.libsDirDist
|
|
95
95
|
);
|
|
96
96
|
} catch (error) {
|
|
97
|
-
handleDlerError(error
|
|
97
|
+
handleDlerError(error);
|
|
98
98
|
}
|
|
99
99
|
}
|
package/bin/app/merge/cmd.d.ts
CHANGED
|
@@ -62,7 +62,6 @@ declare const _default: import("@reliverse/rempts").Command<{
|
|
|
62
62
|
increment: {
|
|
63
63
|
type: "boolean";
|
|
64
64
|
description: string;
|
|
65
|
-
default: false;
|
|
66
65
|
};
|
|
67
66
|
concurrency: {
|
|
68
67
|
type: "number";
|
|
@@ -77,17 +76,14 @@ declare const _default: import("@reliverse/rempts").Command<{
|
|
|
77
76
|
dryRun: {
|
|
78
77
|
type: "boolean";
|
|
79
78
|
description: string;
|
|
80
|
-
default: false;
|
|
81
79
|
};
|
|
82
80
|
backup: {
|
|
83
81
|
type: "boolean";
|
|
84
82
|
description: string;
|
|
85
|
-
default: false;
|
|
86
83
|
};
|
|
87
84
|
dedupe: {
|
|
88
85
|
type: "boolean";
|
|
89
86
|
description: string;
|
|
90
|
-
default: false;
|
|
91
87
|
};
|
|
92
88
|
header: {
|
|
93
89
|
type: "string";
|
|
@@ -100,19 +96,16 @@ declare const _default: import("@reliverse/rempts").Command<{
|
|
|
100
96
|
"select-files": {
|
|
101
97
|
type: "boolean";
|
|
102
98
|
description: string;
|
|
103
|
-
default: false;
|
|
104
99
|
};
|
|
105
100
|
interactive: {
|
|
106
101
|
type: "boolean";
|
|
107
102
|
description: string;
|
|
108
|
-
default: false;
|
|
109
103
|
};
|
|
110
104
|
"as-template": {
|
|
111
105
|
type: "boolean";
|
|
112
106
|
description: string;
|
|
113
|
-
default: false;
|
|
114
107
|
};
|
|
115
|
-
|
|
108
|
+
"custom-template-name": {
|
|
116
109
|
type: "string";
|
|
117
110
|
description: string;
|
|
118
111
|
};
|
|
@@ -124,11 +117,11 @@ declare const _default: import("@reliverse/rempts").Command<{
|
|
|
124
117
|
sourcemap: {
|
|
125
118
|
type: "boolean";
|
|
126
119
|
description: string;
|
|
127
|
-
default: false;
|
|
128
120
|
};
|
|
129
121
|
"update-template": {
|
|
130
122
|
type: "string";
|
|
131
123
|
description: string;
|
|
124
|
+
dependencies: string[];
|
|
132
125
|
};
|
|
133
126
|
}>;
|
|
134
127
|
export default _default;
|
package/bin/app/merge/cmd.js
CHANGED
|
@@ -2,7 +2,13 @@ import path from "@reliverse/pathkit";
|
|
|
2
2
|
import { glob } from "@reliverse/reglob";
|
|
3
3
|
import fs from "@reliverse/relifso";
|
|
4
4
|
import { relinka } from "@reliverse/relinka";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
defineCommand,
|
|
7
|
+
inputPrompt,
|
|
8
|
+
confirmPrompt,
|
|
9
|
+
multiselectPrompt,
|
|
10
|
+
defineArgs
|
|
11
|
+
} from "@reliverse/rempts";
|
|
6
12
|
import MagicString from "magic-string";
|
|
7
13
|
import { Bundle } from "magic-string";
|
|
8
14
|
import pMap from "p-map";
|
|
@@ -263,7 +269,7 @@ export default defineCommand({
|
|
|
263
269
|
version: "1.0.0",
|
|
264
270
|
description: "Merge text files with optional commented path header/footer, skips binaries/media, built for CI & interactive use. Supports copy-like patterns and advanced options."
|
|
265
271
|
},
|
|
266
|
-
args: {
|
|
272
|
+
args: defineArgs({
|
|
267
273
|
dev: { type: "boolean", description: "Generate template for development" },
|
|
268
274
|
s: { type: "array", description: "Input glob patterns" },
|
|
269
275
|
d: { type: "string", description: "Output file path or directory" },
|
|
@@ -311,8 +317,7 @@ export default defineCommand({
|
|
|
311
317
|
},
|
|
312
318
|
increment: {
|
|
313
319
|
type: "boolean",
|
|
314
|
-
description: "Attach an incrementing index to each output filename if set (default: false)"
|
|
315
|
-
default: false
|
|
320
|
+
description: "Attach an incrementing index to each output filename if set (default: false)"
|
|
316
321
|
},
|
|
317
322
|
concurrency: {
|
|
318
323
|
type: "number",
|
|
@@ -326,18 +331,15 @@ export default defineCommand({
|
|
|
326
331
|
},
|
|
327
332
|
dryRun: {
|
|
328
333
|
type: "boolean",
|
|
329
|
-
description: "Show what would be done, but don't write files"
|
|
330
|
-
default: false
|
|
334
|
+
description: "Show what would be done, but don't write files"
|
|
331
335
|
},
|
|
332
336
|
backup: {
|
|
333
337
|
type: "boolean",
|
|
334
|
-
description: "Backup output files before overwriting"
|
|
335
|
-
default: false
|
|
338
|
+
description: "Backup output files before overwriting"
|
|
336
339
|
},
|
|
337
340
|
dedupe: {
|
|
338
341
|
type: "boolean",
|
|
339
|
-
description: "Remove duplicate file contents in merge"
|
|
340
|
-
default: false
|
|
342
|
+
description: "Remove duplicate file contents in merge"
|
|
341
343
|
},
|
|
342
344
|
header: {
|
|
343
345
|
type: "string",
|
|
@@ -349,20 +351,17 @@ export default defineCommand({
|
|
|
349
351
|
},
|
|
350
352
|
"select-files": {
|
|
351
353
|
type: "boolean",
|
|
352
|
-
description: "Prompt for file selection before merging"
|
|
353
|
-
default: false
|
|
354
|
+
description: "Prompt for file selection before merging"
|
|
354
355
|
},
|
|
355
356
|
interactive: {
|
|
356
357
|
type: "boolean",
|
|
357
|
-
description: "Enable interactive mode with prompts (default: false)"
|
|
358
|
-
default: false
|
|
358
|
+
description: "Enable interactive mode with prompts (default: false)"
|
|
359
359
|
},
|
|
360
360
|
"as-template": {
|
|
361
361
|
type: "boolean",
|
|
362
|
-
description: "Generate a TypeScript file with MOCK_TEMPLATES structure"
|
|
363
|
-
default: false
|
|
362
|
+
description: "Generate a TypeScript file with MOCK_TEMPLATES structure"
|
|
364
363
|
},
|
|
365
|
-
|
|
364
|
+
"custom-template-name": {
|
|
366
365
|
type: "string",
|
|
367
366
|
description: "Custom template name when using --as-template"
|
|
368
367
|
},
|
|
@@ -373,15 +372,16 @@ export default defineCommand({
|
|
|
373
372
|
},
|
|
374
373
|
sourcemap: {
|
|
375
374
|
type: "boolean",
|
|
376
|
-
description: "Generate source map for the merged output"
|
|
377
|
-
default: false
|
|
375
|
+
description: "Generate source map for the merged output"
|
|
378
376
|
},
|
|
379
377
|
"update-template": {
|
|
380
378
|
type: "string",
|
|
381
|
-
description: "Update specific template in existing mock template file"
|
|
379
|
+
description: "Update specific template in existing mock template file",
|
|
380
|
+
dependencies: ["as-template"]
|
|
382
381
|
}
|
|
383
|
-
},
|
|
382
|
+
}),
|
|
384
383
|
async run({ args }) {
|
|
384
|
+
const customTemplateName = args["custom-template-name"];
|
|
385
385
|
try {
|
|
386
386
|
const timer = createPerfTimer();
|
|
387
387
|
const interactive = args.interactive ?? false;
|
|
@@ -476,7 +476,6 @@ export default defineCommand({
|
|
|
476
476
|
const footer = args.footer;
|
|
477
477
|
const selectFiles = args["select-files"] ?? false;
|
|
478
478
|
const asTemplate = args["as-template"] ?? false;
|
|
479
|
-
const customTemplateName = args.ctn;
|
|
480
479
|
let files = await collectFiles(include, ignore, recursive, sortBy);
|
|
481
480
|
if (files.length === 0) {
|
|
482
481
|
throw new Error("No text files matched given patterns (binary/media files are skipped)");
|
|
@@ -521,13 +520,11 @@ export default defineCommand({
|
|
|
521
520
|
const jsonContent = JSON.parse(fileContent);
|
|
522
521
|
if (fileName === "package.json") {
|
|
523
522
|
content = {
|
|
524
|
-
...jsonContent
|
|
525
|
-
__type: "PackageJson"
|
|
523
|
+
...jsonContent
|
|
526
524
|
};
|
|
527
525
|
} else if (fileName === "tsconfig.json") {
|
|
528
526
|
content = {
|
|
529
|
-
...jsonContent
|
|
530
|
-
__type: "TSConfig"
|
|
527
|
+
...jsonContent
|
|
531
528
|
};
|
|
532
529
|
} else {
|
|
533
530
|
content = jsonContent;
|
|
@@ -537,9 +534,17 @@ export default defineCommand({
|
|
|
537
534
|
content = fileContent;
|
|
538
535
|
type = "text";
|
|
539
536
|
}
|
|
540
|
-
} catch {
|
|
537
|
+
} catch (error) {
|
|
541
538
|
type = "binary";
|
|
539
|
+
if (asTemplate || args["update-template"]) {
|
|
540
|
+
relinka(
|
|
541
|
+
"warn",
|
|
542
|
+
`Skipped file "${relPath}" due to error: ${error instanceof Error ? error.message : "unknown error"}`
|
|
543
|
+
);
|
|
544
|
+
}
|
|
542
545
|
}
|
|
546
|
+
} else if (asTemplate || args["update-template"]) {
|
|
547
|
+
relinka("warn", `Skipped binary file "${relPath}"`);
|
|
543
548
|
}
|
|
544
549
|
templateData.config.files[relPath] = {
|
|
545
550
|
content,
|
|
@@ -604,13 +609,11 @@ export default defineCommand({
|
|
|
604
609
|
const jsonContent = JSON.parse(fileContent);
|
|
605
610
|
if (fileName === "package.json") {
|
|
606
611
|
content = {
|
|
607
|
-
...jsonContent
|
|
608
|
-
__type: "PackageJson"
|
|
612
|
+
...jsonContent
|
|
609
613
|
};
|
|
610
614
|
} else if (fileName === "tsconfig.json") {
|
|
611
615
|
content = {
|
|
612
|
-
...jsonContent
|
|
613
|
-
__type: "TSConfig"
|
|
616
|
+
...jsonContent
|
|
614
617
|
};
|
|
615
618
|
} else {
|
|
616
619
|
content = jsonContent;
|
|
@@ -620,9 +623,17 @@ export default defineCommand({
|
|
|
620
623
|
content = fileContent;
|
|
621
624
|
type = "text";
|
|
622
625
|
}
|
|
623
|
-
} catch {
|
|
626
|
+
} catch (error) {
|
|
624
627
|
type = "binary";
|
|
628
|
+
if (asTemplate || args["update-template"]) {
|
|
629
|
+
relinka(
|
|
630
|
+
"warn",
|
|
631
|
+
`Skipped file "${relPath}" due to error: ${error instanceof Error ? error.message : "unknown error"}`
|
|
632
|
+
);
|
|
633
|
+
}
|
|
625
634
|
}
|
|
635
|
+
} else if (asTemplate || args["update-template"]) {
|
|
636
|
+
relinka("warn", `Skipped binary file "${relPath}"`);
|
|
626
637
|
}
|
|
627
638
|
template.config.files[relPath] = {
|
|
628
639
|
content,
|
|
@@ -634,10 +645,10 @@ ${(() => {
|
|
|
634
645
|
const files2 = template.config.files;
|
|
635
646
|
if (!files2) return "";
|
|
636
647
|
const hasPackageJson = Object.values(files2).some(
|
|
637
|
-
(f) => f.type === "json" && f.content
|
|
648
|
+
(f) => f.type === "json" && f.content
|
|
638
649
|
);
|
|
639
650
|
const hasTSConfig = Object.values(files2).some(
|
|
640
|
-
(f) => f.type === "json" && f.content
|
|
651
|
+
(f) => f.type === "json" && f.content
|
|
641
652
|
);
|
|
642
653
|
if (!hasPackageJson && !hasTSConfig) return "";
|
|
643
654
|
const imports = [];
|
package/bin/app/mock/mock.js
CHANGED
|
@@ -59,7 +59,7 @@ export const REACT_DLER_TEMPLATE = {
|
|
|
59
59
|
type: "text"
|
|
60
60
|
},
|
|
61
61
|
"src/templates/App.tsx": {
|
|
62
|
-
content: 'import { useState } from "react";\nimport "./App.css";\n\nfunction App() {\n const [count, setCount] = useState(0);\n\n return (\n // @ts-expect-error mock\n <div className="App">\n {/* @ts-expect-error mock */}\n <h1>React TSX App</h1>\n {/* @ts-expect-error mock */}\n <div className="card">\n {/* @ts-expect-error mock */}\n <button onClick={() => setCount((count) => count + 1)}>count is {count}</button>\n </div>\n </div>\n );\n}\n\nexport default App;\n',
|
|
62
|
+
content: 'import { useState } from "react";\nimport "./App.css";\n\nfunction App() {\n const [count, setCount] = useState(0);\n\n return (\n // @ts-expect-error mock\n <div className="App">\n {/* @ts-expect-error mock */}\n <h1>React TSX App</h1>\n {/* @ts-expect-error mock */}\n <div className="card">\n {/* @ts-expect-error mock */}\n <button onClick={() => setCount((count: number) => count + 1)}>count is {count}</button>\n </div>\n </div>\n );\n}\n\nexport default App;\n',
|
|
63
63
|
type: "text"
|
|
64
64
|
},
|
|
65
65
|
"src/templates/DOCS.md": {
|
|
@@ -50,7 +50,7 @@ export async function library_buildLibrary(options) {
|
|
|
50
50
|
await executeBuildTasks(options);
|
|
51
51
|
} catch (err) {
|
|
52
52
|
const error = err instanceof Error ? err : new Error(String(err));
|
|
53
|
-
relinka("error", `Build process for ${libName} failed: ${error.message}
|
|
53
|
+
relinka("error", `Build process for ${libName} failed: ${error.message}`);
|
|
54
54
|
throw error;
|
|
55
55
|
} finally {
|
|
56
56
|
if (replacedFiles.length > 0) {
|
|
@@ -62,8 +62,7 @@ export async function library_buildLibrary(options) {
|
|
|
62
62
|
const error = revertError instanceof Error ? revertError : new Error(String(revertError));
|
|
63
63
|
relinka(
|
|
64
64
|
"error",
|
|
65
|
-
`CRITICAL: Failed to revert pre-build changes for ${libName}: ${error.message}. Source files may be left modified
|
|
66
|
-
error.stack
|
|
65
|
+
`CRITICAL: Failed to revert pre-build changes for ${libName}: ${error.message}. Source files may be left modified!`
|
|
67
66
|
);
|
|
68
67
|
}
|
|
69
68
|
} else {
|
|
@@ -352,13 +351,11 @@ async function library_bundleUsingJsrCopy(srcDir, destDir, libName) {
|
|
|
352
351
|
`[JSR Copy:${libName}] Completed copying library source from ${srcDir} to ${destDir}`
|
|
353
352
|
);
|
|
354
353
|
} catch (error) {
|
|
355
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
356
354
|
relinka(
|
|
357
355
|
"error",
|
|
358
|
-
`
|
|
359
|
-
error instanceof Error ? error.stack : void 0
|
|
356
|
+
`Failed to copy library source from ${srcDir} to ${destDir}: ${error instanceof Error ? error.message : String(error)}`
|
|
360
357
|
);
|
|
361
|
-
throw
|
|
358
|
+
throw error;
|
|
362
359
|
}
|
|
363
360
|
}
|
|
364
361
|
async function library_bundleUsingBun(entryPoint, outDirBin, libName, options) {
|
|
@@ -427,13 +424,11 @@ async function library_bundleUsingBun(entryPoint, outDirBin, libName, options) {
|
|
|
427
424
|
throw new Error(`[Bun:${libName}] Build process reported failure. Check logs.`);
|
|
428
425
|
}
|
|
429
426
|
} catch (error) {
|
|
430
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
431
427
|
relinka(
|
|
432
428
|
"error",
|
|
433
|
-
`
|
|
434
|
-
error instanceof Error ? error.stack : void 0
|
|
429
|
+
`Library build threw an error: ${error instanceof Error ? error.message : String(error)}`
|
|
435
430
|
);
|
|
436
|
-
throw
|
|
431
|
+
throw error;
|
|
437
432
|
}
|
|
438
433
|
}
|
|
439
434
|
async function library_bundleUsingUnified(entryPoint, outDirBin, builder, _sourceDirContext, options) {
|
|
@@ -499,13 +494,11 @@ async function library_bundleUsingUnified(entryPoint, outDirBin, builder, _sourc
|
|
|
499
494
|
`[Unified:${builder}] Library build completed in ${prettyMilliseconds(duration)}.`
|
|
500
495
|
);
|
|
501
496
|
} catch (error) {
|
|
502
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
503
497
|
relinka(
|
|
504
498
|
"error",
|
|
505
|
-
`
|
|
506
|
-
error instanceof Error ? error.stack : void 0
|
|
499
|
+
`Library build failed: ${error instanceof Error ? error.message : String(error)}`
|
|
507
500
|
);
|
|
508
|
-
throw
|
|
501
|
+
throw error;
|
|
509
502
|
}
|
|
510
503
|
}
|
|
511
504
|
async function library_performCommonBuildSteps(params) {
|
|
@@ -768,9 +761,11 @@ async function postBuildReplacements(replacedFiles) {
|
|
|
768
761
|
await fs.writeFile(record.filePath, record.originalContent, "utf8");
|
|
769
762
|
relinka("verbose", `Reverted changes in ${path.relative(PROJECT_ROOT, record.filePath)}`);
|
|
770
763
|
} catch (err) {
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
764
|
+
relinka(
|
|
765
|
+
"error",
|
|
766
|
+
`Failed to revert file ${record.filePath}: ${err instanceof Error ? err.message : String(err)}`
|
|
767
|
+
);
|
|
768
|
+
throw err;
|
|
774
769
|
}
|
|
775
770
|
});
|
|
776
771
|
try {
|
|
@@ -80,19 +80,19 @@ export async function regular_buildJsrDist(isDev, isJsr, coreIsCLI, coreEntrySrc
|
|
|
80
80
|
]);
|
|
81
81
|
}
|
|
82
82
|
await renameTsxFiles(outDirBin);
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
83
|
+
if (config.commonPubPause) {
|
|
84
|
+
const duration = getElapsedPerfTime(timer);
|
|
85
|
+
const transpileFormattedDuration = prettyMilliseconds(duration, {
|
|
86
|
+
verbose: true
|
|
87
|
+
});
|
|
88
|
+
relinka("success", `JSR distribution built in ${transpileFormattedDuration}`);
|
|
89
|
+
} else {
|
|
90
|
+
relinka("success", "JSR distribution built successfully");
|
|
91
|
+
}
|
|
88
92
|
} catch (error) {
|
|
89
93
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
90
94
|
relinka("error", `Failed to build JSR distribution: ${errorMessage}`);
|
|
91
|
-
|
|
92
|
-
if (error instanceof Error && error.stack) {
|
|
93
|
-
enhancedError.stack = error.stack;
|
|
94
|
-
}
|
|
95
|
-
throw enhancedError;
|
|
95
|
+
throw new Error(`JSR distribution build failed: ${errorMessage}`);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
export async function regular_buildNpmDist(isDev, coreIsCLI, coreEntrySrcDir, distNpmDirName, distNpmBuilder, coreEntryFile, unifiedBundlerOutExt, config, transpileTarget, transpileFormat, transpileSplitting, transpileMinify, transpileSourcemap, transpilePublicPath, transpileStub, transpileWatch, timer, coreDeclarations) {
|
|
@@ -136,19 +136,19 @@ export async function regular_buildNpmDist(isDev, coreIsCLI, coreEntrySrcDir, di
|
|
|
136
136
|
`${config.distJsrDirName}/**/templates`
|
|
137
137
|
]);
|
|
138
138
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
139
|
+
if (config.commonPubPause) {
|
|
140
|
+
const duration = getElapsedPerfTime(timer);
|
|
141
|
+
const transpileFormattedDuration = prettyMilliseconds(duration, {
|
|
142
|
+
verbose: true
|
|
143
|
+
});
|
|
144
|
+
relinka("success", `NPM distribution built in ${transpileFormattedDuration}`);
|
|
145
|
+
} else {
|
|
146
|
+
relinka("success", "NPM distribution built successfully");
|
|
147
|
+
}
|
|
144
148
|
} catch (error) {
|
|
145
149
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
146
150
|
relinka("error", `Failed to build NPM distribution: ${errorMessage}`);
|
|
147
|
-
|
|
148
|
-
if (error instanceof Error && error.stack) {
|
|
149
|
-
enhancedError.stack = error.stack;
|
|
150
|
-
}
|
|
151
|
-
throw enhancedError;
|
|
151
|
+
throw new Error(`NPM distribution build failed: ${errorMessage}`);
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
async function regular_bundleUsingBun(coreEntryFile, outDirBin, transpileTarget, transpileFormat, transpileSplitting, transpileMinify, transpileSourcemap, transpilePublicPath, timer) {
|
|
@@ -199,11 +199,7 @@ async function regular_bundleUsingBun(coreEntryFile, outDirBin, transpileTarget,
|
|
|
199
199
|
} catch (error) {
|
|
200
200
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
201
201
|
relinka("error", `Regular build failed while using bun bundler: ${errorMessage}`);
|
|
202
|
-
|
|
203
|
-
if (error instanceof Error && error.stack) {
|
|
204
|
-
enhancedError.stack = error.stack;
|
|
205
|
-
}
|
|
206
|
-
throw enhancedError;
|
|
202
|
+
throw new Error(`Regular bundle failed for ${outDirBin}: ${errorMessage}`);
|
|
207
203
|
}
|
|
208
204
|
}
|
|
209
205
|
async function regular_bundleUsingJsr(src, dest) {
|
|
@@ -284,11 +280,7 @@ async function regular_bundleUsingUnified(coreIsCLI, coreEntryFile, outDirBin, b
|
|
|
284
280
|
} catch (error) {
|
|
285
281
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
286
282
|
relinka("error", `Failed to bundle regular project using ${builder}: ${errorMessage}`);
|
|
287
|
-
|
|
288
|
-
if (error instanceof Error && error.stack) {
|
|
289
|
-
enhancedError.stack = error.stack;
|
|
290
|
-
}
|
|
291
|
-
throw enhancedError;
|
|
283
|
+
throw new Error(`Regular bundle failed for ${outDirBin}: ${errorMessage}`);
|
|
292
284
|
}
|
|
293
285
|
}
|
|
294
286
|
async function regular_bundleWithBuilder(builder, params) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import path from "@reliverse/pathkit";
|
|
2
2
|
import { relinka } from "@reliverse/relinka";
|
|
3
3
|
import pAll from "p-all";
|
|
4
|
+
import { resumePerfTimer } from "../sdk-mod.js";
|
|
4
5
|
import { library_buildLibrary } from "./build/build-library.js";
|
|
5
6
|
import { library_publishLibrary } from "./pub/pub-library.js";
|
|
6
7
|
import { CONCURRENCY_DEFAULT, PROJECT_ROOT } from "./utils/utils-consts.js";
|
|
@@ -138,9 +139,6 @@ export async function libraries_buildPublish(isDev, timer, libsList, distJsrDryR
|
|
|
138
139
|
"error",
|
|
139
140
|
`Failed to process library ${libName}: ${error instanceof Error ? error.message : String(error)}`
|
|
140
141
|
);
|
|
141
|
-
if (isDev && error instanceof Error) {
|
|
142
|
-
relinka("verbose", `Error details: ${error.stack}`);
|
|
143
|
-
}
|
|
144
142
|
throw error;
|
|
145
143
|
}
|
|
146
144
|
};
|
|
@@ -151,19 +149,7 @@ export async function libraries_buildPublish(isDev, timer, libsList, distJsrDryR
|
|
|
151
149
|
});
|
|
152
150
|
relinka("verbose", "Completed libraries_buildPublish");
|
|
153
151
|
} catch (error) {
|
|
154
|
-
if (
|
|
155
|
-
for (const individualError of error.errors) {
|
|
156
|
-
relinka(
|
|
157
|
-
"error",
|
|
158
|
-
`AggregateError: ${individualError instanceof Error ? individualError.message : String(individualError)}`
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
} else {
|
|
162
|
-
relinka(
|
|
163
|
-
"error",
|
|
164
|
-
`Unhandled error in libraries_buildPublish: ${error instanceof Error ? error.message : String(error)}`
|
|
165
|
-
);
|
|
166
|
-
}
|
|
152
|
+
if (timer) resumePerfTimer(timer);
|
|
167
153
|
throw error;
|
|
168
154
|
}
|
|
169
155
|
}
|
|
@@ -61,12 +61,7 @@ async function library_pubToJsr(libOutDir, distJsrDryRun, distJsrFailOnWarn, dis
|
|
|
61
61
|
distJsrAllowDirty ? "--allow-dirty" : "",
|
|
62
62
|
distJsrSlowTypes ? "--allow-slow-types" : ""
|
|
63
63
|
].filter(Boolean).join(" ");
|
|
64
|
-
|
|
65
|
-
await execaCommand(command, { stdio: "inherit" });
|
|
66
|
-
} catch (error) {
|
|
67
|
-
relinka("error", `Failed to publish lib ${libName} to JSR`, error);
|
|
68
|
-
throw error;
|
|
69
|
-
}
|
|
64
|
+
await execaCommand(command, { stdio: "inherit", reject: false });
|
|
70
65
|
relinka(
|
|
71
66
|
"success",
|
|
72
67
|
`Successfully ${distJsrDryRun ? "validated" : "published"} lib ${libName} to JSR registry`
|
|
@@ -75,7 +70,6 @@ async function library_pubToJsr(libOutDir, distJsrDryRun, distJsrFailOnWarn, dis
|
|
|
75
70
|
if (timer) resumePerfTimer(timer);
|
|
76
71
|
} catch (error) {
|
|
77
72
|
if (timer) resumePerfTimer(timer);
|
|
78
|
-
relinka("error", `Failed to publish lib ${libName} to JSR`, error);
|
|
79
73
|
throw error;
|
|
80
74
|
} finally {
|
|
81
75
|
relinka("verbose", `Exiting library_pubToJsr for lib: ${libName}`);
|
|
@@ -88,7 +82,7 @@ async function library_pubToNpm(libOutDir, distJsrDryRun, _distJsrFailOnWarn, li
|
|
|
88
82
|
await withWorkingDirectory(libOutDir, async () => {
|
|
89
83
|
relinka("log", `Publishing lib ${libName} to NPM from ${libOutDir}`);
|
|
90
84
|
const command = ["bun publish", distJsrDryRun ? "--dry-run" : ""].filter(Boolean).join(" ");
|
|
91
|
-
await execaCommand(command, { stdio: "inherit" });
|
|
85
|
+
await execaCommand(command, { stdio: "inherit", reject: false });
|
|
92
86
|
relinka(
|
|
93
87
|
"success",
|
|
94
88
|
`Successfully ${distJsrDryRun ? "validated" : "published"} lib ${libName} to NPM registry`
|
|
@@ -97,7 +91,6 @@ async function library_pubToNpm(libOutDir, distJsrDryRun, _distJsrFailOnWarn, li
|
|
|
97
91
|
if (timer) resumePerfTimer(timer);
|
|
98
92
|
} catch (error) {
|
|
99
93
|
if (timer) resumePerfTimer(timer);
|
|
100
|
-
relinka("error", `Failed to publish lib ${libName} to NPM`, error);
|
|
101
94
|
throw error;
|
|
102
95
|
} finally {
|
|
103
96
|
relinka("verbose", `Exiting library_pubToNpm for lib: ${libName}`);
|
|
@@ -19,12 +19,7 @@ export async function regular_pubToJsr(distJsrDryRun, distJsrFailOnWarn, _isDev,
|
|
|
19
19
|
distJsrSlowTypes ? "--allow-slow-types" : ""
|
|
20
20
|
].filter(Boolean).join(" ");
|
|
21
21
|
relinka("verbose", `Running publish command: ${command}`);
|
|
22
|
-
|
|
23
|
-
await execaCommand(command, { stdio: "inherit" });
|
|
24
|
-
} catch (error) {
|
|
25
|
-
relinka("error", `Failed to publish main project to JSR: ${error}`);
|
|
26
|
-
throw error;
|
|
27
|
-
}
|
|
22
|
+
await execaCommand(command, { stdio: "inherit", reject: false });
|
|
28
23
|
relinka(
|
|
29
24
|
"success",
|
|
30
25
|
`Successfully ${distJsrDryRun ? "validated" : "published"} to JSR registry`
|
|
@@ -34,7 +29,6 @@ export async function regular_pubToJsr(distJsrDryRun, distJsrFailOnWarn, _isDev,
|
|
|
34
29
|
}
|
|
35
30
|
} catch (error) {
|
|
36
31
|
if (timer) resumePerfTimer(timer);
|
|
37
|
-
relinka("error", "Failed to publish to JSR:", error);
|
|
38
32
|
throw error;
|
|
39
33
|
}
|
|
40
34
|
}
|
|
@@ -47,12 +41,7 @@ export async function regular_pubToNpm(distJsrDryRun, _isDev, commonPubPause, di
|
|
|
47
41
|
await withWorkingDirectory(distNpmDirNameResolved, async () => {
|
|
48
42
|
const command = ["bun publish", distJsrDryRun ? "--dry-run" : ""].filter(Boolean).join(" ");
|
|
49
43
|
relinka("verbose", `Running publish command: ${command}`);
|
|
50
|
-
|
|
51
|
-
await execaCommand(command, { stdio: "inherit" });
|
|
52
|
-
} catch (error) {
|
|
53
|
-
relinka("error", `Failed to publish main project to NPM: ${error}`);
|
|
54
|
-
throw error;
|
|
55
|
-
}
|
|
44
|
+
await execaCommand(command, { stdio: "inherit", reject: false });
|
|
56
45
|
relinka(
|
|
57
46
|
"success",
|
|
58
47
|
`Successfully ${distJsrDryRun ? "validated" : "published"} to NPM registry`
|
|
@@ -62,7 +51,6 @@ export async function regular_pubToNpm(distJsrDryRun, _isDev, commonPubPause, di
|
|
|
62
51
|
}
|
|
63
52
|
} catch (error) {
|
|
64
53
|
if (timer) resumePerfTimer(timer);
|
|
65
|
-
relinka("error", "Failed to publish to NPM:", error);
|
|
66
54
|
throw error;
|
|
67
55
|
}
|
|
68
56
|
}
|
|
@@ -17,12 +17,12 @@ export async function finalizeBuildPub(timer, commonPubPause, libsList, distNpmD
|
|
|
17
17
|
verbose: true
|
|
18
18
|
});
|
|
19
19
|
if (!commonPubPause) {
|
|
20
|
+
relinka("success", `\u{1F389} Build completed successfully (build time: ${transpileFormattedTime})`);
|
|
21
|
+
} else {
|
|
20
22
|
relinka(
|
|
21
23
|
"success",
|
|
22
|
-
`\u{1F389}
|
|
24
|
+
`\u{1F389} Test build completed successfully (build time: ${transpileFormattedTime})`
|
|
23
25
|
);
|
|
24
|
-
} else {
|
|
25
|
-
relinka("success", `\u{1F389} Test build completed successfully (in ${transpileFormattedTime})`);
|
|
26
26
|
relinka("info", "\u{1F4DD} Publish process is currently paused in your config file");
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { PerfTimer } from "../../sdk-types.js";
|
|
2
1
|
/**
|
|
3
2
|
* Handles errors during the build process.
|
|
3
|
+
* Provides clear error messages and avoids duplicate information.
|
|
4
|
+
* This is the single source of error logging in the application.
|
|
4
5
|
*/
|
|
5
|
-
export declare function handleDlerError(error: unknown
|
|
6
|
+
export declare function handleDlerError(error: unknown): never;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { re } from "@reliverse/relico";
|
|
1
2
|
import { relinka } from "@reliverse/relinka";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
relinka("verbose", `Error details: ${errorStack}`);
|
|
3
|
+
export function handleDlerError(error) {
|
|
4
|
+
let rootCause = "";
|
|
5
|
+
if (error instanceof Error) {
|
|
6
|
+
rootCause = error.message;
|
|
7
|
+
}
|
|
8
|
+
relinka("error", re.bold("Unexpected error happened:"));
|
|
9
|
+
if (rootCause) {
|
|
10
|
+
relinka("error", re.italic(rootCause));
|
|
11
|
+
}
|
|
12
12
|
process.exit(1);
|
|
13
13
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#root {
|
|
2
|
+
max-width: 1280px;
|
|
3
|
+
margin: 0 auto;
|
|
4
|
+
padding: 2rem;
|
|
5
|
+
text-align: center;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.card {
|
|
9
|
+
padding: 2em;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
button {
|
|
13
|
+
border-radius: 8px;
|
|
14
|
+
border: 1px solid transparent;
|
|
15
|
+
padding: 0.6em 1.2em;
|
|
16
|
+
font-size: 1em;
|
|
17
|
+
font-weight: 500;
|
|
18
|
+
font-family: inherit;
|
|
19
|
+
background-color: #1a1a1a;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
transition: border-color 0.25s;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
button:hover {
|
|
25
|
+
border-color: #646cff;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
button:focus,
|
|
29
|
+
button:focus-visible {
|
|
30
|
+
outline: 4px auto -webkit-focus-ring-color;
|
|
31
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import "./App.css";
|
|
3
|
+
|
|
4
|
+
function App() {
|
|
5
|
+
const [count, setCount] = useState(0);
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
// @ts-expect-error mock
|
|
9
|
+
<div className="App">
|
|
10
|
+
{/* @ts-expect-error mock */}
|
|
11
|
+
<h1>React TSX App</h1>
|
|
12
|
+
{/* @ts-expect-error mock */}
|
|
13
|
+
<div className="card">
|
|
14
|
+
{/* @ts-expect-error mock */}
|
|
15
|
+
<button onClick={() => setCount((count: number) => count + 1)}>count is {count}</button>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default App;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# React TSX Project
|
|
2
|
+
|
|
3
|
+
A modern React project with TypeScript and Vite.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- React 19 with TypeScript
|
|
8
|
+
- Vite for fast development and building
|
|
9
|
+
- Modern CSS with CSS modules support
|
|
10
|
+
- Hot Module Replacement (HMR)
|
|
11
|
+
- ESLint and Prettier configuration
|
|
12
|
+
|
|
13
|
+
## Getting Started
|
|
14
|
+
|
|
15
|
+
1. Install dependencies:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
2. Start development server:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm run dev
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
3. Build for production:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm run build
|
|
31
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
3
|
+
line-height: 1.5;
|
|
4
|
+
font-weight: 400;
|
|
5
|
+
|
|
6
|
+
color-scheme: light dark;
|
|
7
|
+
color: rgba(255, 255, 255, 0.87);
|
|
8
|
+
background-color: #242424;
|
|
9
|
+
|
|
10
|
+
font-synthesis: none;
|
|
11
|
+
text-rendering: optimizeLegibility;
|
|
12
|
+
-webkit-font-smoothing: antialiased;
|
|
13
|
+
-moz-osx-font-smoothing: grayscale;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
body {
|
|
17
|
+
margin: 0;
|
|
18
|
+
display: flex;
|
|
19
|
+
place-items: center;
|
|
20
|
+
min-width: 320px;
|
|
21
|
+
min-height: 100vh;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
h1 {
|
|
25
|
+
font-size: 3.2em;
|
|
26
|
+
line-height: 1.1;
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
console.log("Hello, world!");
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>React TSX App</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<div id="root"></div>
|
|
10
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
// @ts-expect-error mock
|
|
3
|
+
import ReactDOM from "react-dom/client";
|
|
4
|
+
import App from "./App";
|
|
5
|
+
import "./index.css";
|
|
6
|
+
|
|
7
|
+
ReactDOM.createRoot(document.getElementById("root")!).render(
|
|
8
|
+
<React.StrictMode>
|
|
9
|
+
<App />
|
|
10
|
+
</React.StrictMode>,
|
|
11
|
+
);
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"@reliverse/relico": "^1.1.2",
|
|
7
7
|
"@reliverse/relifso": "^1.4.5",
|
|
8
8
|
"@reliverse/relinka": "^1.4.7",
|
|
9
|
-
"@reliverse/rempts": "^1.7.
|
|
9
|
+
"@reliverse/rempts": "^1.7.18",
|
|
10
10
|
"@rollup/plugin-alias": "^5.1.1",
|
|
11
11
|
"@rollup/plugin-commonjs": "^28.0.3",
|
|
12
12
|
"@rollup/plugin-json": "^6.1.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"license": "MIT",
|
|
45
45
|
"name": "@reliverse/dler",
|
|
46
46
|
"type": "module",
|
|
47
|
-
"version": "1.7.
|
|
47
|
+
"version": "1.7.12",
|
|
48
48
|
"keywords": [
|
|
49
49
|
"reliverse",
|
|
50
50
|
"cli",
|