zshy 0.0.6 → 0.0.7
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 +134 -85
- package/{out → dist}/index.cjs +119 -74
- package/{out → dist}/index.js +120 -75
- package/{out → dist}/utils.cjs +12 -18
- package/{out → dist}/utils.d.cts +1 -0
- package/{out → dist}/utils.d.ts +1 -0
- package/{out → dist}/utils.js +11 -18
- package/package.json +10 -9
- /package/{out → dist}/index.d.cts +0 -0
- /package/{out → dist}/index.d.ts +0 -0
package/{out → dist}/utils.js
RENAMED
|
@@ -4,6 +4,9 @@ import * as ts from "typescript";
|
|
|
4
4
|
export function formatForLog(data) {
|
|
5
5
|
return JSON.stringify(data, null, 2).split("\n").join("\n ");
|
|
6
6
|
}
|
|
7
|
+
export function emojiLog(_emoji, content, level = "log") {
|
|
8
|
+
console[level]("→ " + content);
|
|
9
|
+
}
|
|
7
10
|
// Get entry points using the same logic as esbuild.mts
|
|
8
11
|
export async function getEntryPoints(patterns) {
|
|
9
12
|
const results = [];
|
|
@@ -12,7 +15,7 @@ export async function getEntryPoints(patterns) {
|
|
|
12
15
|
ignore: ["**/*.d.ts"],
|
|
13
16
|
});
|
|
14
17
|
if (!pattern.endsWith("/*") && _results.length === 0) {
|
|
15
|
-
|
|
18
|
+
emojiLog("❌", `File does not exist: ${pattern}`, "error");
|
|
16
19
|
process.exit(1);
|
|
17
20
|
}
|
|
18
21
|
results.push(..._results);
|
|
@@ -39,7 +42,7 @@ export function readTsconfig(tsconfigPath) {
|
|
|
39
42
|
getCurrentDirectory: () => configDir,
|
|
40
43
|
}, configDir);
|
|
41
44
|
if (parsedConfig.errors.length > 0) {
|
|
42
|
-
|
|
45
|
+
emojiLog("❌", "Error parsing tsconfig.json:", "error");
|
|
43
46
|
for (const error of parsedConfig.errors) {
|
|
44
47
|
console.error(ts.formatDiagnostic(error, {
|
|
45
48
|
getCurrentDirectory: () => configDir,
|
|
@@ -50,13 +53,13 @@ export function readTsconfig(tsconfigPath) {
|
|
|
50
53
|
process.exit(1);
|
|
51
54
|
}
|
|
52
55
|
if (!parsedConfig.options) {
|
|
53
|
-
|
|
56
|
+
emojiLog("❌", "Error reading tsconfig.json#/compilerOptions", "error");
|
|
57
|
+
process.exit(1);
|
|
54
58
|
}
|
|
55
59
|
return parsedConfig.options;
|
|
56
60
|
}
|
|
57
61
|
export async function compileProject(config, entryPoints) {
|
|
58
62
|
// Deduplicate entry points before compilation
|
|
59
|
-
const uniqueEntryPoints = [...new Set(entryPoints)];
|
|
60
63
|
// Track files that would be written
|
|
61
64
|
const writtenFiles = [];
|
|
62
65
|
// Create compiler host
|
|
@@ -80,19 +83,9 @@ export async function compileProject(config, entryPoints) {
|
|
|
80
83
|
originalWriteFile(outputFileName, processedData, writeByteOrderMark, onError, sourceFiles);
|
|
81
84
|
}
|
|
82
85
|
};
|
|
83
|
-
if (config.verbose) {
|
|
84
|
-
console.log(`🗣️ Resolved entrypoints: ${formatForLog(uniqueEntryPoints)}`);
|
|
85
|
-
console.log(`🗣️ Resolved compilerOptions: ${formatForLog({
|
|
86
|
-
...config.compilerOptions,
|
|
87
|
-
// resolve enum values to strings for better logging
|
|
88
|
-
module: ts.ModuleKind[config.compilerOptions.module],
|
|
89
|
-
moduleResolution: ts.ModuleResolutionKind[config.compilerOptions.moduleResolution],
|
|
90
|
-
target: ts.ScriptTarget[config.compilerOptions.target],
|
|
91
|
-
})}`);
|
|
92
|
-
}
|
|
93
86
|
// Create the TypeScript program using unique entry points
|
|
94
87
|
const program = ts.createProgram({
|
|
95
|
-
rootNames:
|
|
88
|
+
rootNames: entryPoints,
|
|
96
89
|
options: config.compilerOptions,
|
|
97
90
|
host,
|
|
98
91
|
});
|
|
@@ -170,7 +163,7 @@ export async function compileProject(config, entryPoints) {
|
|
|
170
163
|
const errorCount = diagnostics.filter((d) => d.category === ts.DiagnosticCategory.Error).length;
|
|
171
164
|
const warningCount = diagnostics.filter((d) => d.category === ts.DiagnosticCategory.Warning).length;
|
|
172
165
|
if (errorCount > 0 || warningCount > 0) {
|
|
173
|
-
|
|
166
|
+
emojiLog("⚠️", `Found ${errorCount} error(s) and ${warningCount} warning(s)`, "warn");
|
|
174
167
|
console.log();
|
|
175
168
|
}
|
|
176
169
|
// Format diagnostics with color and context like tsc, keeping original order
|
|
@@ -191,7 +184,7 @@ export async function compileProject(config, entryPoints) {
|
|
|
191
184
|
afterDeclarations: [extensionRewriteTransformer],
|
|
192
185
|
});
|
|
193
186
|
if (emitResult.emitSkipped) {
|
|
194
|
-
|
|
187
|
+
emojiLog("❌", "Emit was skipped due to errors", "error");
|
|
195
188
|
}
|
|
196
189
|
else {
|
|
197
190
|
// console.log(`✅ Emitted ${config.jsExtension} and ${config.dtsExtension}
|
|
@@ -201,7 +194,7 @@ export async function compileProject(config, entryPoints) {
|
|
|
201
194
|
if (emitResult.diagnostics.length > 0) {
|
|
202
195
|
const emitErrors = emitResult.diagnostics.filter((d) => d.category === ts.DiagnosticCategory.Error);
|
|
203
196
|
const emitWarnings = emitResult.diagnostics.filter((d) => d.category === ts.DiagnosticCategory.Warning);
|
|
204
|
-
|
|
197
|
+
emojiLog("❌", `Found ${emitErrors.length} error(s) and ${emitWarnings.length} warning(s) during emit:`, "error");
|
|
205
198
|
console.log();
|
|
206
199
|
const formatHost = {
|
|
207
200
|
getCurrentDirectory: () => process.cwd(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zshy",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Gold-standard build tool for TypeScript libraries",
|
|
6
6
|
"keywords": [
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"type": "github",
|
|
32
32
|
"url": "https://github.com/sponsors/colinhacks"
|
|
33
33
|
},
|
|
34
|
-
"module": "./
|
|
35
|
-
"bin": "./
|
|
34
|
+
"module": "./dist/index.js",
|
|
35
|
+
"bin": "./dist/index.cjs",
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
38
38
|
"@biomejs/biome": "^2.0.5",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"arg": "^5.0.2",
|
|
51
51
|
"globby": "^14.1.0",
|
|
52
|
+
"string-width": "^7.2.0",
|
|
52
53
|
"table": "^6.9.0"
|
|
53
54
|
},
|
|
54
55
|
"scripts": {
|
|
@@ -65,17 +66,17 @@
|
|
|
65
66
|
"@zod/source"
|
|
66
67
|
]
|
|
67
68
|
},
|
|
68
|
-
"main": "./
|
|
69
|
-
"types": "./
|
|
69
|
+
"main": "./dist/index.cjs",
|
|
70
|
+
"types": "./dist/index.d.cts",
|
|
70
71
|
"exports": {
|
|
71
72
|
".": {
|
|
72
73
|
"@zod/source": "./src/index.ts",
|
|
73
|
-
"types": "./
|
|
74
|
-
"import": "./
|
|
75
|
-
"require": "./
|
|
74
|
+
"types": "./dist/index.d.cts",
|
|
75
|
+
"import": "./dist/index.js",
|
|
76
|
+
"require": "./dist/index.cjs"
|
|
76
77
|
}
|
|
77
78
|
},
|
|
78
79
|
"files": [
|
|
79
|
-
"
|
|
80
|
+
"dist"
|
|
80
81
|
]
|
|
81
82
|
}
|
|
File without changes
|
/package/{out → dist}/index.d.ts
RENAMED
|
File without changes
|