tkeron 4.0.0-beta.17 → 4.0.0-beta.18
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/changelog.md +25 -0
- package/package.json +1 -1
- package/src/build.ts +3 -11
- package/src/develop.ts +6 -23
- package/src/init.ts +1 -1
- package/src/initWrapper.ts +2 -2
- package/src/processCom.ts +3 -4
- package/src/processComTs.ts +3 -4
- package/src/processPre.ts +1 -1
- package/tests/test-helpers.ts +2 -2
package/changelog.md
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
# v4.0.0-beta.18
|
|
2
|
+
|
|
3
|
+
## Code Quality & Architecture
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
- **Fixed**: Removed `process.exit()` from library code (`build.ts`, `develop.ts`, `init.ts`) — errors now propagate via `throw`, letting wrappers handle exit
|
|
8
|
+
- **Fixed**: Moved `reloadClients` Set inside `develop()` to prevent shared state across multiple server instances
|
|
9
|
+
- **Fixed**: Removed `await` on synchronous `path.resolve()` calls in `build.ts` and `develop.ts`
|
|
10
|
+
- **Fixed**: `log.error()` called without arguments in `processPre.ts` — now passes empty string
|
|
11
|
+
|
|
12
|
+
### Code Style
|
|
13
|
+
|
|
14
|
+
- **Changed**: Converted all `function` declarations to arrow functions (`initWrapper`, `processComponents`, `processComponentsTs`)
|
|
15
|
+
- **Removed**: Comments in source code (`processCom.ts`, `processComTs.ts`)
|
|
16
|
+
- **Removed**: Dead re-export of `setupSigintHandler` from `develop.ts`
|
|
17
|
+
|
|
18
|
+
### Tests
|
|
19
|
+
|
|
20
|
+
- **Fixed**: TS2532 errors in `getBuildResult.test.ts` (proper handling of possibly undefined values)
|
|
21
|
+
- **Updated**: Tests adapted to new error propagation (no more `process.exit` mocking in library tests)
|
|
22
|
+
- **Removed**: Redundant/dead test cases for removed behavior
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
1
26
|
# v4.0.0-beta.17
|
|
2
27
|
|
|
3
28
|
## MCP Server Updates
|
package/package.json
CHANGED
package/src/build.ts
CHANGED
|
@@ -24,10 +24,10 @@ export const build = async (options: BuildOptions) => {
|
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
const source =
|
|
27
|
+
const source = resolve(options.sourceDir || "websrc");
|
|
28
28
|
const target = options.targetDir
|
|
29
|
-
?
|
|
30
|
-
:
|
|
29
|
+
? resolve(options.targetDir)
|
|
30
|
+
: resolve(dirname(source), "web");
|
|
31
31
|
|
|
32
32
|
const sourceParent = dirname(source);
|
|
33
33
|
const tempDir = join(
|
|
@@ -67,14 +67,6 @@ export const build = async (options: BuildOptions) => {
|
|
|
67
67
|
`\n💡 Tip: Create the directory first, check the path, or run 'tk init' to create a new project.`,
|
|
68
68
|
);
|
|
69
69
|
log.error(` Expected: ${source}\n`);
|
|
70
|
-
process.exit(1);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (
|
|
74
|
-
error.message &&
|
|
75
|
-
error.message.includes("must contain at least one hyphen")
|
|
76
|
-
) {
|
|
77
|
-
process.exit(1);
|
|
78
70
|
}
|
|
79
71
|
|
|
80
72
|
throw error;
|
package/src/develop.ts
CHANGED
|
@@ -13,8 +13,6 @@ export interface TkeronDevOptions {
|
|
|
13
13
|
logger?: Logger;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
const reloadClients = new Set<ReadableStreamDefaultController>();
|
|
17
|
-
|
|
18
16
|
export interface DevelopServer {
|
|
19
17
|
stop: () => Promise<void>;
|
|
20
18
|
port: number;
|
|
@@ -28,6 +26,8 @@ export const develop = async (
|
|
|
28
26
|
throw new Error("Invalid options provided for develop");
|
|
29
27
|
}
|
|
30
28
|
|
|
29
|
+
const reloadClients = new Set<ReadableStreamDefaultController>();
|
|
30
|
+
|
|
31
31
|
const {
|
|
32
32
|
port = 3000,
|
|
33
33
|
host = "localhost",
|
|
@@ -36,28 +36,13 @@ export const develop = async (
|
|
|
36
36
|
logger: log = defaultLogger,
|
|
37
37
|
} = options;
|
|
38
38
|
|
|
39
|
-
const source =
|
|
39
|
+
const source = resolve(sourceDir || "websrc");
|
|
40
40
|
const target = outputDir
|
|
41
|
-
?
|
|
42
|
-
:
|
|
41
|
+
? resolve(outputDir)
|
|
42
|
+
: resolve(dirname(source), "web");
|
|
43
43
|
|
|
44
44
|
log.log("🔨 Building project...");
|
|
45
|
-
|
|
46
|
-
await build({ sourceDir: source, targetDir: target, logger: log });
|
|
47
|
-
} catch (error: any) {
|
|
48
|
-
if (error.code === "ENOENT") {
|
|
49
|
-
const actualSourceDir = sourceDir || "websrc";
|
|
50
|
-
log.error(
|
|
51
|
-
`\n❌ Error: Source directory "${actualSourceDir}" does not exist.`,
|
|
52
|
-
);
|
|
53
|
-
log.error(
|
|
54
|
-
`\n💡 Tip: Create the directory first, check the path, or run 'tk init' to create a new project.`,
|
|
55
|
-
);
|
|
56
|
-
log.error(` Expected: ${source}\n`);
|
|
57
|
-
process.exit(1);
|
|
58
|
-
}
|
|
59
|
-
throw error;
|
|
60
|
-
}
|
|
45
|
+
await build({ sourceDir: source, targetDir: target, logger: log });
|
|
61
46
|
log.log("✅ Build complete!");
|
|
62
47
|
|
|
63
48
|
const server = Bun.serve({
|
|
@@ -182,5 +167,3 @@ export const develop = async (
|
|
|
182
167
|
host: server.hostname ?? host,
|
|
183
168
|
};
|
|
184
169
|
};
|
|
185
|
-
|
|
186
|
-
export { setupSigintHandler } from "./setupSigintHandler";
|
package/src/init.ts
CHANGED
package/src/initWrapper.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface InitWrapperOptions {
|
|
|
9
9
|
[key: string]: any;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export async
|
|
12
|
+
export const initWrapper = async (options: InitWrapperOptions) => {
|
|
13
13
|
const log = options?.logger || defaultLogger;
|
|
14
14
|
|
|
15
15
|
if (!options || typeof options !== "object") {
|
|
@@ -60,4 +60,4 @@ export async function initWrapper(options: InitWrapperOptions) {
|
|
|
60
60
|
}
|
|
61
61
|
process.exit(1);
|
|
62
62
|
}
|
|
63
|
-
}
|
|
63
|
+
};
|
package/src/processCom.ts
CHANGED
|
@@ -60,14 +60,14 @@ export const processCom = async (
|
|
|
60
60
|
return hasChanges;
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
async
|
|
63
|
+
const processComponents = async (
|
|
64
64
|
element: any,
|
|
65
65
|
currentDir: string,
|
|
66
66
|
rootDir: string,
|
|
67
67
|
componentStack: string[],
|
|
68
68
|
depth: number = 0,
|
|
69
69
|
log: Logger = silentLogger,
|
|
70
|
-
): Promise<boolean> {
|
|
70
|
+
): Promise<boolean> => {
|
|
71
71
|
let hasChanges = false;
|
|
72
72
|
const MAX_DEPTH = 50;
|
|
73
73
|
if (depth > MAX_DEPTH) {
|
|
@@ -183,7 +183,6 @@ async function processComponents(
|
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
// Recursively process child elements
|
|
187
186
|
const childChanged = await processComponents(
|
|
188
187
|
child,
|
|
189
188
|
currentDir,
|
|
@@ -196,4 +195,4 @@ async function processComponents(
|
|
|
196
195
|
}
|
|
197
196
|
|
|
198
197
|
return hasChanges;
|
|
199
|
-
}
|
|
198
|
+
};
|
package/src/processComTs.ts
CHANGED
|
@@ -61,7 +61,7 @@ export const processComTs = async (
|
|
|
61
61
|
return hasChanges;
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
-
async
|
|
64
|
+
const processComponentsTs = async (
|
|
65
65
|
element: any,
|
|
66
66
|
currentDir: string,
|
|
67
67
|
rootDir: string,
|
|
@@ -69,7 +69,7 @@ async function processComponentsTs(
|
|
|
69
69
|
depth: number = 0,
|
|
70
70
|
log: Logger = silentLogger,
|
|
71
71
|
options: ProcessComTsOptions = {},
|
|
72
|
-
): Promise<boolean> {
|
|
72
|
+
): Promise<boolean> => {
|
|
73
73
|
let hasChanges = false;
|
|
74
74
|
const MAX_DEPTH = 50;
|
|
75
75
|
if (depth > MAX_DEPTH) {
|
|
@@ -251,7 +251,6 @@ ${codeWithoutImports}
|
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
-
// Recursively process child elements
|
|
255
254
|
const childChanged = await processComponentsTs(
|
|
256
255
|
child,
|
|
257
256
|
currentDir,
|
|
@@ -265,4 +264,4 @@ ${codeWithoutImports}
|
|
|
265
264
|
}
|
|
266
265
|
|
|
267
266
|
return hasChanges;
|
|
268
|
-
}
|
|
267
|
+
};
|
package/src/processPre.ts
CHANGED
package/tests/test-helpers.ts
CHANGED
|
@@ -11,7 +11,7 @@ const hashString = (str: string): number => {
|
|
|
11
11
|
for (let i = 0; i < str.length; i++) {
|
|
12
12
|
const char = str.charCodeAt(i);
|
|
13
13
|
hash = (hash << 5) - hash + char;
|
|
14
|
-
hash = hash & hash;
|
|
14
|
+
hash = hash & hash;
|
|
15
15
|
}
|
|
16
16
|
return Math.abs(hash);
|
|
17
17
|
};
|
|
@@ -22,7 +22,7 @@ export const getTestResources = (
|
|
|
22
22
|
testName: string,
|
|
23
23
|
): { port: number; dir: string } => {
|
|
24
24
|
const hash = hashString(testName);
|
|
25
|
-
const port = 9000 + (hash % 10000);
|
|
25
|
+
const port = 9000 + (hash % 10000);
|
|
26
26
|
const uniqueId = `${hash}-${resourceCounter++}`;
|
|
27
27
|
const dir = join(tmpdir(), `tkeron-test-${uniqueId}`);
|
|
28
28
|
|