@kizenapps/cli 0.2.0 → 0.3.0
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/dist/chunk-HJPLDI45.js +6134 -0
- package/dist/chunk-HJPLDI45.js.map +1 -0
- package/dist/chunk-ZWE3DS7E.js +39 -0
- package/dist/chunk-ZWE3DS7E.js.map +1 -0
- package/dist/dist-C3F6UOWF.js +8472 -0
- package/dist/dist-C3F6UOWF.js.map +1 -0
- package/dist/dist-ZIZQOSY3.js +135 -0
- package/dist/dist-ZIZQOSY3.js.map +1 -0
- package/dist/electron/main.js +8 -3
- package/dist/electron/main.js.map +1 -1
- package/dist/electron/preload.cjs +4 -0
- package/dist/gzip-size-QRGIYYEQ.js +137 -0
- package/dist/gzip-size-QRGIYYEQ.js.map +1 -0
- package/dist/index.js.map +1 -1
- package/dist/viewer/assets/{index-ClCwhanM.js → index-DaB01Qok.js} +22 -22
- package/dist/viewer/index.html +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
compressSingleFile,
|
|
4
|
+
getContentFromFilesAsync,
|
|
5
|
+
isImageFile,
|
|
6
|
+
readFileAsync,
|
|
7
|
+
run,
|
|
8
|
+
setFileNameMin,
|
|
9
|
+
setPublicFolder,
|
|
10
|
+
wildcards
|
|
11
|
+
} from "./chunk-HJPLDI45.js";
|
|
12
|
+
import "./chunk-ZWE3DS7E.js";
|
|
13
|
+
|
|
14
|
+
// node_modules/.pnpm/@node-minify+core@10.5.0/node_modules/@node-minify/core/dist/index.js
|
|
15
|
+
import { mkdir } from "fs/promises";
|
|
16
|
+
import path from "path";
|
|
17
|
+
async function compress(settings) {
|
|
18
|
+
if (Array.isArray(settings.output)) {
|
|
19
|
+
if (!Array.isArray(settings.input)) throw new Error("When output is an array, input must also be an array");
|
|
20
|
+
if (settings.input.length !== settings.output.length) throw new Error(`Input and output arrays must have the same length (input: ${settings.input.length}, output: ${settings.output.length})`);
|
|
21
|
+
}
|
|
22
|
+
if (settings.output) await createDirectory(settings.output);
|
|
23
|
+
if (Array.isArray(settings.output)) return compressArrayOfFiles(settings);
|
|
24
|
+
return compressSingleFile(settings);
|
|
25
|
+
}
|
|
26
|
+
async function compressArrayOfFiles(settings) {
|
|
27
|
+
const inputs = settings.input;
|
|
28
|
+
inputs.forEach((input, index) => {
|
|
29
|
+
if (!input || typeof input !== "string") throw new Error(`Invalid input at index ${index}: expected non-empty string, got ${typeof input === "string" ? "empty string" : typeof input}`);
|
|
30
|
+
});
|
|
31
|
+
const compressionTasks = inputs.map(async (input, index) => {
|
|
32
|
+
return run({
|
|
33
|
+
settings,
|
|
34
|
+
content: isImageFile(input) ? await readFileAsync(input, true) : await getContentFromFilesAsync(input),
|
|
35
|
+
index
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
const results = await Promise.all(compressionTasks);
|
|
39
|
+
return results[results.length - 1] ?? "";
|
|
40
|
+
}
|
|
41
|
+
async function createDirectory(filePath) {
|
|
42
|
+
if (!filePath) return;
|
|
43
|
+
const paths = Array.isArray(filePath) ? filePath : [filePath];
|
|
44
|
+
const uniqueDirs = /* @__PURE__ */ new Set();
|
|
45
|
+
for (const outputPath of paths) {
|
|
46
|
+
if (typeof outputPath !== "string") continue;
|
|
47
|
+
const dirPath = getDirectoryPath(outputPath);
|
|
48
|
+
if (!dirPath) continue;
|
|
49
|
+
uniqueDirs.add(dirPath);
|
|
50
|
+
}
|
|
51
|
+
await Promise.all(Array.from(uniqueDirs).map((dir) => mkdir(dir, { recursive: true })));
|
|
52
|
+
}
|
|
53
|
+
function getDirectoryPath(outputPath) {
|
|
54
|
+
const dirPath = path.dirname(outputPath);
|
|
55
|
+
if (dirPath && dirPath !== ".") return dirPath;
|
|
56
|
+
const windowsDirPath = path.win32.dirname(outputPath);
|
|
57
|
+
if (windowsDirPath && windowsDirPath !== ".") return windowsDirPath;
|
|
58
|
+
return "";
|
|
59
|
+
}
|
|
60
|
+
var defaultSettings = {
|
|
61
|
+
options: {},
|
|
62
|
+
buffer: 1e3 * 1024
|
|
63
|
+
};
|
|
64
|
+
function setup(inputSettings) {
|
|
65
|
+
const settings = {
|
|
66
|
+
...structuredClone(defaultSettings),
|
|
67
|
+
...inputSettings
|
|
68
|
+
};
|
|
69
|
+
if (settings.content !== void 0) {
|
|
70
|
+
validateMandatoryFields(inputSettings, ["compressor"]);
|
|
71
|
+
return settings;
|
|
72
|
+
}
|
|
73
|
+
validateMandatoryFields(inputSettings, [
|
|
74
|
+
"compressor",
|
|
75
|
+
"input",
|
|
76
|
+
"output"
|
|
77
|
+
]);
|
|
78
|
+
if (Array.isArray(settings.input)) settings.input.forEach((input, index) => {
|
|
79
|
+
if (!input || typeof input !== "string") throw new Error(`Invalid input at index ${index}: expected non-empty string, got ${typeof input === "string" ? "empty string" : typeof input}`);
|
|
80
|
+
});
|
|
81
|
+
return enhanceSettings(settings);
|
|
82
|
+
}
|
|
83
|
+
function enhanceSettings(settings) {
|
|
84
|
+
let enhancedSettings = settings;
|
|
85
|
+
if (enhancedSettings.input) enhancedSettings = {
|
|
86
|
+
...enhancedSettings,
|
|
87
|
+
...wildcards(enhancedSettings.input, enhancedSettings.publicFolder)
|
|
88
|
+
};
|
|
89
|
+
const optionsWithFormats = enhancedSettings.options;
|
|
90
|
+
const shouldPreserveBareDollarOneOutput = enhancedSettings.output === "$1" && !enhancedSettings.publicFolder && !enhancedSettings.replaceInPlace && Array.isArray(optionsWithFormats?.formats) && optionsWithFormats.formats.length > 0;
|
|
91
|
+
if (Array.isArray(enhancedSettings.input) && shouldPreserveBareDollarOneOutput) enhancedSettings = {
|
|
92
|
+
...enhancedSettings,
|
|
93
|
+
output: enhancedSettings.input.map((file) => setFileNameMin(file, "$1", void 0, true))
|
|
94
|
+
};
|
|
95
|
+
else if (enhancedSettings.input && enhancedSettings.output && !Array.isArray(enhancedSettings.output) && !shouldPreserveBareDollarOneOutput) enhancedSettings = {
|
|
96
|
+
...enhancedSettings,
|
|
97
|
+
...checkOutput(enhancedSettings.input, enhancedSettings.output, enhancedSettings.publicFolder, enhancedSettings.replaceInPlace)
|
|
98
|
+
};
|
|
99
|
+
if (enhancedSettings.input && enhancedSettings.publicFolder) enhancedSettings = {
|
|
100
|
+
...enhancedSettings,
|
|
101
|
+
...setPublicFolder(enhancedSettings.input, enhancedSettings.publicFolder)
|
|
102
|
+
};
|
|
103
|
+
return enhancedSettings;
|
|
104
|
+
}
|
|
105
|
+
function checkOutput(input, output, publicFolder, replaceInPlace) {
|
|
106
|
+
if (Array.isArray(output)) return;
|
|
107
|
+
if (!/\$1/.test(output)) return;
|
|
108
|
+
const effectivePublicFolder = replaceInPlace ? void 0 : publicFolder;
|
|
109
|
+
if (Array.isArray(input)) return { output: input.map((file) => setFileNameMin(file, output, effectivePublicFolder, replaceInPlace)) };
|
|
110
|
+
return { output: setFileNameMin(input, output, effectivePublicFolder, replaceInPlace) };
|
|
111
|
+
}
|
|
112
|
+
function validateMandatoryFields(settings, fields) {
|
|
113
|
+
for (const field of fields) mandatory(field, settings);
|
|
114
|
+
if (typeof settings.compressor !== "function") throw new Error("compressor should be a function, maybe you forgot to install the compressor");
|
|
115
|
+
}
|
|
116
|
+
function mandatory(setting, settings) {
|
|
117
|
+
if (!settings[setting]) throw new Error(`${setting} is mandatory.`);
|
|
118
|
+
}
|
|
119
|
+
async function minify(settings) {
|
|
120
|
+
const compressorSettings = setup(settings);
|
|
121
|
+
return await (compressorSettings.content !== void 0 ? compressSingleFile : compress)(compressorSettings);
|
|
122
|
+
}
|
|
123
|
+
export {
|
|
124
|
+
minify
|
|
125
|
+
};
|
|
126
|
+
/*! Bundled license information:
|
|
127
|
+
|
|
128
|
+
@node-minify/core/dist/index.js:
|
|
129
|
+
(*!
|
|
130
|
+
* node-minify
|
|
131
|
+
* Copyright (c) 2011-2026 Rodolphe Stoclin
|
|
132
|
+
* MIT Licensed
|
|
133
|
+
*)
|
|
134
|
+
*/
|
|
135
|
+
//# sourceMappingURL=dist-ZIZQOSY3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../node_modules/.pnpm/@node-minify+core@10.5.0/node_modules/@node-minify/core/src/compress.ts","../node_modules/.pnpm/@node-minify+core@10.5.0/node_modules/@node-minify/core/src/setup.ts","../node_modules/.pnpm/@node-minify+core@10.5.0/node_modules/@node-minify/core/src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright (c) 2011-2026 Rodolphe Stoclin\n * MIT Licensed\n */\n\nimport { mkdir } from \"node:fs/promises\";\nimport path from \"node:path\";\n/**\n * Module dependencies.\n */\nimport type {\n CompressorOptions,\n MinifierOptions,\n Settings,\n} from \"@node-minify/types\";\nimport {\n compressSingleFile,\n getContentFromFilesAsync,\n isImageFile,\n readFileAsync,\n run,\n} from \"@node-minify/utils\";\n\n/**\n * Run the compressor using the provided settings.\n *\n * Validates settings when `output` is an array (requires `input` to be an array with the same length) and ensures target output directories exist before processing. Dispatches either multi-file or single-file compression based on `settings.output`.\n *\n * @param settings - Compression settings including `input`, `output`, and compressor-specific options\n * @returns The resulting compressed output string for a single output, or the last result produced when processing multiple outputs (or an empty string if no results were produced)\n * @throws Error - If `output` is an array but `input` is not, or if `input` and `output` arrays have differing lengths\n */\nexport async function compress<T extends CompressorOptions = CompressorOptions>(\n settings: Settings<T>\n): Promise<string> {\n if (Array.isArray(settings.output)) {\n if (!Array.isArray(settings.input)) {\n throw new Error(\n \"When output is an array, input must also be an array\"\n );\n }\n if (settings.input.length !== settings.output.length) {\n throw new Error(\n `Input and output arrays must have the same length (input: ${settings.input.length}, output: ${settings.output.length})`\n );\n }\n }\n\n if (settings.output) {\n await createDirectory(settings.output);\n }\n\n // Handle array outputs (from user input or created internally by checkOutput when processing $1 pattern)\n if (Array.isArray(settings.output)) {\n return compressArrayOfFiles(settings);\n }\n\n return compressSingleFile(settings as Settings);\n}\n\n/**\n * Compress multiple input files specified in the settings.\n *\n * @param settings - Configuration object where `settings.input` and `settings.output` are arrays of equal length; each `settings.input[i]` is a file path to compress and corresponds to `settings.output[i]`.\n * @returns The result of the last compression task, or an empty string if no tasks ran.\n * @throws Error if any entry in `settings.input` is not a non-empty string.\n */\nasync function compressArrayOfFiles<\n T extends CompressorOptions = CompressorOptions,\n>(settings: Settings<T>): Promise<string> {\n const inputs = settings.input as string[];\n\n inputs.forEach((input, index) => {\n if (!input || typeof input !== \"string\") {\n throw new Error(\n `Invalid input at index ${index}: expected non-empty string, got ${\n typeof input === \"string\" ? \"empty string\" : typeof input\n }`\n );\n }\n });\n\n const compressionTasks = inputs.map(async (input, index) => {\n const content = isImageFile(input)\n ? await readFileAsync(input, true)\n : await getContentFromFilesAsync(input);\n return run({ settings, content, index } as MinifierOptions<T>);\n });\n\n const results = await Promise.all(compressionTasks);\n return results[results.length - 1] ?? \"\";\n}\n\n/**\n * Create folder of the target file.\n * @param filePath Full path of the file (can be string or array when $1 pattern is used)\n */\nasync function createDirectory(filePath: string | string[]) {\n // Early return if no file path provided\n if (!filePath) {\n return;\n }\n\n // Handle array (created internally by checkOutput when processing $1 pattern)\n const paths = Array.isArray(filePath) ? filePath : [filePath];\n const uniqueDirs = new Set<string>();\n\n for (const outputPath of paths) {\n if (typeof outputPath !== \"string\") {\n continue;\n }\n\n // Use platform dirname first, then fallback for Windows-style separators on POSIX.\n const dirPath = getDirectoryPath(outputPath);\n\n // Early return if no directory path\n if (!dirPath) {\n continue;\n }\n\n uniqueDirs.add(dirPath);\n }\n\n // Create directories in parallel\n await Promise.all(\n Array.from(uniqueDirs).map((dir) => mkdir(dir, { recursive: true }))\n );\n}\n\n/**\n * Resolve the directory path from an output file path.\n * @param outputPath Full path to the output file\n * @returns A directory path when resolvable, or an empty string\n */\nfunction getDirectoryPath(outputPath: string): string {\n const dirPath = path.dirname(outputPath);\n if (dirPath && dirPath !== \".\") {\n return dirPath;\n }\n\n const windowsDirPath = path.win32.dirname(outputPath);\n if (windowsDirPath && windowsDirPath !== \".\") {\n return windowsDirPath;\n }\n\n return \"\";\n}\n","/*!\n * node-minify\n * Copyright (c) 2011-2026 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * Module dependencies.\n */\nimport type { CompressorOptions, Settings } from \"@node-minify/types\";\nimport { setFileNameMin, setPublicFolder, wildcards } from \"@node-minify/utils\";\n\n/**\n * Default settings.\n */\nconst defaultSettings: Partial<Settings> = {\n options: {},\n buffer: 1000 * 1024,\n};\n\n/**\n * Builds and validates the final Settings object by merging defaults with user input.\n *\n * @param inputSettings - User-provided settings that override defaults\n * @returns The validated and enhanced Settings object ready for use\n */\nfunction setup<T extends CompressorOptions = CompressorOptions>(\n inputSettings: Settings<T>\n): Settings<T> {\n const settings: Settings<T> = {\n ...structuredClone(defaultSettings),\n ...inputSettings,\n } as Settings<T>;\n\n // In memory\n if (settings.content !== undefined) {\n validateMandatoryFields(inputSettings, [\"compressor\"]);\n return settings;\n }\n\n validateMandatoryFields(inputSettings, [\"compressor\", \"input\", \"output\"]);\n\n if (Array.isArray(settings.input)) {\n settings.input.forEach((input, index) => {\n if (!input || typeof input !== \"string\") {\n throw new Error(\n `Invalid input at index ${index}: expected non-empty string, got ${\n typeof input === \"string\"\n ? \"empty string\"\n : typeof input\n }`\n );\n }\n });\n }\n\n return enhanceSettings(settings);\n}\n\n/**\n * Augments a Settings object with derived values and normalized path outputs.\n *\n * Enhancements performed when applicable:\n * - Expands input patterns into concrete input entries.\n * - Computes output paths when a single output string contains the `$1` placeholder, producing per-input outputs.\n * - Resolves and attaches public-folder-related values derived from input and publicFolder.\n *\n * @param settings - The initial settings to enhance\n * @returns The enhanced Settings object with derived inputs, outputs, and public-folder values applied\n */\nfunction enhanceSettings<T extends CompressorOptions = CompressorOptions>(\n settings: Settings<T>\n): Settings<T> {\n let enhancedSettings = settings;\n\n if (enhancedSettings.input) {\n enhancedSettings = {\n ...enhancedSettings,\n ...wildcards(enhancedSettings.input, enhancedSettings.publicFolder),\n };\n }\n const optionsWithFormats = enhancedSettings.options as\n | { formats?: unknown[] }\n | undefined;\n const shouldPreserveBareDollarOneOutput =\n enhancedSettings.output === \"$1\" &&\n !enhancedSettings.publicFolder &&\n !enhancedSettings.replaceInPlace &&\n Array.isArray(optionsWithFormats?.formats) &&\n optionsWithFormats.formats.length > 0;\n\n if (\n Array.isArray(enhancedSettings.input) &&\n shouldPreserveBareDollarOneOutput\n ) {\n enhancedSettings = {\n ...enhancedSettings,\n output: enhancedSettings.input.map((file) =>\n setFileNameMin(file, \"$1\", undefined, true)\n ),\n };\n } else if (\n enhancedSettings.input &&\n enhancedSettings.output &&\n !Array.isArray(enhancedSettings.output) &&\n !shouldPreserveBareDollarOneOutput\n ) {\n enhancedSettings = {\n ...enhancedSettings,\n ...checkOutput(\n enhancedSettings.input,\n enhancedSettings.output,\n enhancedSettings.publicFolder,\n enhancedSettings.replaceInPlace\n ),\n };\n }\n if (enhancedSettings.input && enhancedSettings.publicFolder) {\n enhancedSettings = {\n ...enhancedSettings,\n ...setPublicFolder(\n enhancedSettings.input,\n enhancedSettings.publicFolder\n ),\n };\n }\n\n return enhancedSettings;\n}\n\n/**\n * Check the output path, searching for $1\n * if exist, returns the path replacing $1 by file name\n * @param input Path file\n * @param output Path to the output file\n * @param publicFolder Path to the public folder\n * @param replaceInPlace True to replace file in same folder\n * @returns Enhanced settings with processed output, or undefined if no processing needed\n */\nfunction checkOutput(\n input: string | string[],\n output: string | string[],\n publicFolder?: string,\n replaceInPlace?: boolean\n): { output: string | string[] } | undefined {\n // Arrays don't use the $1 placeholder pattern - they're handled directly in compress()\n if (Array.isArray(output)) {\n return undefined;\n }\n\n const PLACEHOLDER_PATTERN = /\\$1/;\n\n if (!PLACEHOLDER_PATTERN.test(output)) {\n return undefined;\n }\n\n const effectivePublicFolder = replaceInPlace ? undefined : publicFolder;\n\n // If array of files\n if (Array.isArray(input)) {\n const outputMin = input.map((file) =>\n setFileNameMin(file, output, effectivePublicFolder, replaceInPlace)\n );\n return { output: outputMin };\n }\n\n // Single file\n return {\n output: setFileNameMin(\n input,\n output,\n effectivePublicFolder,\n replaceInPlace\n ),\n };\n}\n\n/**\n * Ensure required settings are present and that `compressor` is a valid function.\n *\n * @param settings - Settings object to validate\n * @param fields - Names of required fields to check on `settings`\n * @throws Error if a required field is missing\n * @throws Error if `settings.compressor` is not a function\n */\nfunction validateMandatoryFields<\n T extends CompressorOptions = CompressorOptions,\n>(settings: Settings<T>, fields: string[]) {\n for (const field of fields) {\n mandatory(field, settings);\n }\n\n if (typeof settings.compressor !== \"function\") {\n throw new Error(\n \"compressor should be a function, maybe you forgot to install the compressor\"\n );\n }\n}\n\n/**\n * Check if the setting exists.\n * @param setting - Setting key to check\n * @param settings - Settings object\n */\nfunction mandatory(setting: string, settings: Record<string, unknown>) {\n if (!settings[setting]) {\n throw new Error(`${setting} is mandatory.`);\n }\n}\n\nexport { setup };\n","/*!\n * node-minify\n * Copyright (c) 2011-2026 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * Module dependencies.\n */\nimport type { CompressorOptions, Settings } from \"@node-minify/types\";\nimport { compressSingleFile } from \"@node-minify/utils\";\nimport { compress } from \"./compress.ts\";\nimport { setup } from \"./setup.ts\";\n\n/**\n * Minifies input according to the provided settings.\n *\n * @param settings - User-provided settings that specify the compressor, input/content, output and related options\n * @returns The minified content as a string\n */\nexport async function minify<T extends CompressorOptions = CompressorOptions>(\n settings: Settings<T>\n): Promise<string> {\n const compressorSettings = setup(settings);\n const method =\n compressorSettings.content !== undefined\n ? compressSingleFile\n : compress;\n return await method(compressorSettings);\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAiCA,eAAsB,SAClB,UACe;AACf,MAAI,MAAM,QAAQ,SAAS,MAAA,GAAS;AAChC,QAAI,CAAC,MAAM,QAAQ,SAAS,KAAA,EACxB,OAAM,IAAI,MACN,sDAAA;AAGR,QAAI,SAAS,MAAM,WAAW,SAAS,OAAO,OAC1C,OAAM,IAAI,MACN,6DAA6D,SAAS,MAAM,MA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AAG;IACH,GAAG,gBACC,iBAAiB,OACjB,iBAAiB,YAAA;;AAK7B,SAAO;;AAYX,SAAS,YACL,OACA,QACA,cACA,gBACyC;AAEzC,MAAI,MAAM,QAAQ,MAAA,EACd;AAKJ,MAAI,CAFwB,MAEH,KAAK,MAAA,EAC1B;AAGJ,QAAM,wBAAwB,iBAAiB,SAAY;AAG3D,MAAI,MAAM,QAAQ,KAAA,EAId,QAAO,EAAE,QAHS,MAAM,IAAA,CAAK,SACzB,eAAe,MAAM,QAAQ,uBAAuB,cAAA,CAAe,EACtE;AAKL,SAAO,EACH,QAAQ,eACJ,OACA,QACA,uBACA,cAAA,EACH;;AAYT,SAAS,wBAEP,UAAuB,QAAkB;AACvC,aAAW,SAAS,OAChB,WAAU,OAAO,QAAA;AAGrB,MAAI,OAAO,SAAS,eAAe,WAC/B,OAAM,IAAI,MACN,6EAAA;;AAUZ,SAAS,UAAU,SAAiB,UAAmC;AACnE,MAAI,CAAC,SAAS,OAAA,EACV,OAAM,IAAI,MAAM,GAAG,OAAA,gBAAQ;;AC1LnC,eAAsB,OAClB,UACe;AACf,QAAM,qBAAqB,MAAM,QAAA;AAKjC,SAAO,OAHH,mBAAmB,YAAY,SACzB,qBACA,UACU,kBAAA;;","names":[]}
|
package/dist/electron/main.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/electron/main.ts
|
|
2
|
-
import { app, BrowserWindow, session, nativeImage, Menu } from "electron";
|
|
2
|
+
import { app, BrowserWindow, session, nativeImage, Menu, ipcMain } from "electron";
|
|
3
3
|
import { join, dirname } from "path";
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
5
5
|
var args = process.argv.slice(2);
|
|
@@ -71,7 +71,7 @@ function setupSession() {
|
|
|
71
71
|
})();
|
|
72
72
|
}, 2e3);
|
|
73
73
|
}
|
|
74
|
-
app.whenReady().then(() => {
|
|
74
|
+
void app.whenReady().then(() => {
|
|
75
75
|
Menu.setApplicationMenu(null);
|
|
76
76
|
setupSession();
|
|
77
77
|
const iconPath = join(dirname(fileURLToPath(import.meta.url)), "icon.png");
|
|
@@ -86,9 +86,14 @@ app.whenReady().then(() => {
|
|
|
86
86
|
icon,
|
|
87
87
|
webPreferences: {
|
|
88
88
|
nodeIntegration: false,
|
|
89
|
-
contextIsolation: true
|
|
89
|
+
contextIsolation: true,
|
|
90
|
+
sandbox: false,
|
|
91
|
+
preload: join(dirname(fileURLToPath(import.meta.url)), "preload.cjs")
|
|
90
92
|
}
|
|
91
93
|
});
|
|
94
|
+
ipcMain.on("open-devtools", () => {
|
|
95
|
+
win.webContents.openDevTools();
|
|
96
|
+
});
|
|
92
97
|
void win.loadURL(`http://localhost:${String(port)}`);
|
|
93
98
|
});
|
|
94
99
|
app.on("window-all-closed", () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/electron/main.ts"],"sourcesContent":["import { app, BrowserWindow, session, nativeImage, Menu } from 'electron';\nimport { join, dirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nconst args = process.argv.slice(2);\nconst port = parseInt(args.find((a) => a.startsWith('--port='))?.slice(7) ?? '3121', 10);\nconst userDataDir = args.find((a) => a.startsWith('--user-data-dir='))?.slice(16);\n\nif (userDataDir) {\n app.setPath('userData', userDataDir);\n}\n\napp.setName('Kizen Dev');\n\nconst CSP_HEADERS = new Set([\n 'content-security-policy',\n 'content-security-policy-report-only',\n 'x-frame-options',\n]);\n\nconst KIZEN_DOMAINS = ['kizen.dev', 'kizen.com'];\n\nfunction isKizenUrl(url: string): boolean {\n try {\n const { hostname } = new URL(url);\n return KIZEN_DOMAINS.some((d) => hostname === d || hostname.endsWith('.' + d));\n } catch {\n return false;\n }\n}\n\nfunction setupSession(): void {\n // Strip CSP headers and fix SameSite cookies on Kizen responses.\n session.defaultSession.webRequest.onHeadersReceived((details, callback) => {\n const headers: Record<string, string[]> = {};\n\n for (const [key, value] of Object.entries(details.responseHeaders ?? {})) {\n if (!CSP_HEADERS.has(key.toLowerCase())) {\n headers[key] = value;\n }\n }\n\n if (isKizenUrl(details.url) && headers['set-cookie']) {\n headers['set-cookie'] = headers['set-cookie'].map((cookie) => {\n if (!/SameSite=/i.test(cookie)) {\n return cookie + '; SameSite=None; Secure';\n }\n\n return cookie.replace(/SameSite=\\w+/i, 'SameSite=None');\n });\n }\n\n callback({ responseHeaders: headers });\n });\n\n // Periodically re-patch existing Kizen cookies that arrived without SameSite=None.\n // Needed for cookies set before the interceptor was active or via JS document.cookie.\n setInterval(() => {\n void (async () => {\n for (const domain of KIZEN_DOMAINS) {\n try {\n const cookies = await session.defaultSession.cookies.get({ domain });\n for (const cookie of cookies) {\n if (cookie.sameSite !== 'no_restriction') {\n const raw = cookie.domain ?? domain;\n const bare = raw.startsWith('.') ? raw.slice(1) : raw;\n await session.defaultSession.cookies.set({\n url: `https://${bare}`,\n name: cookie.name,\n value: cookie.value,\n domain: raw,\n path: cookie.path ?? '/',\n secure: true,\n ...(cookie.httpOnly !== undefined && { httpOnly: cookie.httpOnly }),\n ...(cookie.expirationDate !== undefined && {\n expirationDate: cookie.expirationDate,\n }),\n sameSite: 'no_restriction',\n });\n }\n }\n } catch {\n /* ignore */\n }\n }\n })();\n }, 2000);\n}\n\
|
|
1
|
+
{"version":3,"sources":["../../src/electron/main.ts"],"sourcesContent":["import { app, BrowserWindow, session, nativeImage, Menu, ipcMain } from 'electron';\nimport { join, dirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nconst args = process.argv.slice(2);\nconst port = parseInt(args.find((a) => a.startsWith('--port='))?.slice(7) ?? '3121', 10);\nconst userDataDir = args.find((a) => a.startsWith('--user-data-dir='))?.slice(16);\n\nif (userDataDir) {\n app.setPath('userData', userDataDir);\n}\n\napp.setName('Kizen Dev');\n\nconst CSP_HEADERS = new Set([\n 'content-security-policy',\n 'content-security-policy-report-only',\n 'x-frame-options',\n]);\n\nconst KIZEN_DOMAINS = ['kizen.dev', 'kizen.com'];\n\nfunction isKizenUrl(url: string): boolean {\n try {\n const { hostname } = new URL(url);\n return KIZEN_DOMAINS.some((d) => hostname === d || hostname.endsWith('.' + d));\n } catch {\n return false;\n }\n}\n\nfunction setupSession(): void {\n // Strip CSP headers and fix SameSite cookies on Kizen responses.\n session.defaultSession.webRequest.onHeadersReceived((details, callback) => {\n const headers: Record<string, string[]> = {};\n\n for (const [key, value] of Object.entries(details.responseHeaders ?? {})) {\n if (!CSP_HEADERS.has(key.toLowerCase())) {\n headers[key] = value;\n }\n }\n\n if (isKizenUrl(details.url) && headers['set-cookie']) {\n headers['set-cookie'] = headers['set-cookie'].map((cookie) => {\n if (!/SameSite=/i.test(cookie)) {\n return cookie + '; SameSite=None; Secure';\n }\n\n return cookie.replace(/SameSite=\\w+/i, 'SameSite=None');\n });\n }\n\n callback({ responseHeaders: headers });\n });\n\n // Periodically re-patch existing Kizen cookies that arrived without SameSite=None.\n // Needed for cookies set before the interceptor was active or via JS document.cookie.\n setInterval(() => {\n void (async () => {\n for (const domain of KIZEN_DOMAINS) {\n try {\n const cookies = await session.defaultSession.cookies.get({ domain });\n for (const cookie of cookies) {\n if (cookie.sameSite !== 'no_restriction') {\n const raw = cookie.domain ?? domain;\n const bare = raw.startsWith('.') ? raw.slice(1) : raw;\n await session.defaultSession.cookies.set({\n url: `https://${bare}`,\n name: cookie.name,\n value: cookie.value,\n domain: raw,\n path: cookie.path ?? '/',\n secure: true,\n ...(cookie.httpOnly !== undefined && { httpOnly: cookie.httpOnly }),\n ...(cookie.expirationDate !== undefined && {\n expirationDate: cookie.expirationDate,\n }),\n sameSite: 'no_restriction',\n });\n }\n }\n } catch {\n /* ignore */\n }\n }\n })();\n }, 2000);\n}\n\nvoid app.whenReady().then(() => {\n Menu.setApplicationMenu(null);\n\n setupSession();\n\n const iconPath = join(dirname(fileURLToPath(import.meta.url)), 'icon.png');\n const icon = nativeImage.createFromPath(iconPath);\n\n if (process.platform === 'darwin' && !icon.isEmpty()) {\n app.dock.setIcon(icon);\n }\n\n const win = new BrowserWindow({\n width: 1920,\n height: 1080,\n title: 'Kizen Dev',\n icon,\n webPreferences: {\n nodeIntegration: false,\n contextIsolation: true,\n sandbox: false,\n preload: join(dirname(fileURLToPath(import.meta.url)), 'preload.cjs'),\n },\n });\n\n ipcMain.on('open-devtools', () => {\n win.webContents.openDevTools();\n });\n\n void win.loadURL(`http://localhost:${String(port)}`);\n});\n\napp.on('window-all-closed', () => {\n app.quit();\n});\n"],"mappings":";AAAA,SAAS,KAAK,eAAe,SAAS,aAAa,MAAM,eAAe;AACxE,SAAS,MAAM,eAAe;AAC9B,SAAS,qBAAqB;AAE9B,IAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AACjC,IAAM,OAAO,SAAS,KAAK,KAAK,CAAC,MAAM,EAAE,WAAW,SAAS,CAAC,GAAG,MAAM,CAAC,KAAK,QAAQ,EAAE;AACvF,IAAM,cAAc,KAAK,KAAK,CAAC,MAAM,EAAE,WAAW,kBAAkB,CAAC,GAAG,MAAM,EAAE;AAEhF,IAAI,aAAa;AACf,MAAI,QAAQ,YAAY,WAAW;AACrC;AAEA,IAAI,QAAQ,WAAW;AAEvB,IAAM,cAAc,oBAAI,IAAI;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,IAAM,gBAAgB,CAAC,aAAa,WAAW;AAE/C,SAAS,WAAW,KAAsB;AACxC,MAAI;AACF,UAAM,EAAE,SAAS,IAAI,IAAI,IAAI,GAAG;AAChC,WAAO,cAAc,KAAK,CAAC,MAAM,aAAa,KAAK,SAAS,SAAS,MAAM,CAAC,CAAC;AAAA,EAC/E,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,SAAS,eAAqB;AAE5B,UAAQ,eAAe,WAAW,kBAAkB,CAAC,SAAS,aAAa;AACzE,UAAM,UAAoC,CAAC;AAE3C,eAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,QAAQ,mBAAmB,CAAC,CAAC,GAAG;AACxE,UAAI,CAAC,YAAY,IAAI,IAAI,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;AAE5B,eAAa;AAEb,QAAM,WAAW,KAAK,QAAQ,cAAc,YAAY,GAAG,CAAC,GAAG,UAAU;AACzE,QAAM,OAAO,YAAY,eAAe,QAAQ;AAEhD,MAAI,QAAQ,aAAa,YAAY,CAAC,KAAK,QAAQ,GAAG;AACpD,QAAI,KAAK,QAAQ,IAAI;AAAA,EACvB;AAEA,QAAM,MAAM,IAAI,cAAc;AAAA,IAC5B,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,OAAO;AAAA,IACP;AAAA,IACA,gBAAgB;AAAA,MACd,iBAAiB;AAAA,MACjB,kBAAkB;AAAA,MAClB,SAAS;AAAA,MACT,SAAS,KAAK,QAAQ,cAAc,YAAY,GAAG,CAAC,GAAG,aAAa;AAAA,IACtE;AAAA,EACF,CAAC;AAED,UAAQ,GAAG,iBAAiB,MAAM;AAChC,QAAI,YAAY,aAAa;AAAA,EAC/B,CAAC;AAED,OAAK,IAAI,QAAQ,oBAAoB,OAAO,IAAI,CAAC,EAAE;AACrD,CAAC;AAED,IAAI,GAAG,qBAAqB,MAAM;AAChC,MAAI,KAAK;AACX,CAAC;","names":[]}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
__commonJS,
|
|
4
|
+
__require,
|
|
5
|
+
__toESM
|
|
6
|
+
} from "./chunk-ZWE3DS7E.js";
|
|
7
|
+
|
|
8
|
+
// node_modules/.pnpm/duplexer@0.1.2/node_modules/duplexer/index.js
|
|
9
|
+
var require_duplexer = __commonJS({
|
|
10
|
+
"node_modules/.pnpm/duplexer@0.1.2/node_modules/duplexer/index.js"(exports, module) {
|
|
11
|
+
"use strict";
|
|
12
|
+
var Stream = __require("stream");
|
|
13
|
+
var writeMethods = ["write", "end", "destroy"];
|
|
14
|
+
var readMethods = ["resume", "pause"];
|
|
15
|
+
var readEvents = ["data", "close"];
|
|
16
|
+
var slice = Array.prototype.slice;
|
|
17
|
+
module.exports = duplex;
|
|
18
|
+
function forEach(arr, fn) {
|
|
19
|
+
if (arr.forEach) {
|
|
20
|
+
return arr.forEach(fn);
|
|
21
|
+
}
|
|
22
|
+
for (var i = 0; i < arr.length; i++) {
|
|
23
|
+
fn(arr[i], i);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function duplex(writer, reader) {
|
|
27
|
+
var stream2 = new Stream();
|
|
28
|
+
var ended = false;
|
|
29
|
+
forEach(writeMethods, proxyWriter);
|
|
30
|
+
forEach(readMethods, proxyReader);
|
|
31
|
+
forEach(readEvents, proxyStream);
|
|
32
|
+
reader.on("end", handleEnd);
|
|
33
|
+
writer.on("drain", function() {
|
|
34
|
+
stream2.emit("drain");
|
|
35
|
+
});
|
|
36
|
+
writer.on("error", reemit);
|
|
37
|
+
reader.on("error", reemit);
|
|
38
|
+
stream2.writable = writer.writable;
|
|
39
|
+
stream2.readable = reader.readable;
|
|
40
|
+
return stream2;
|
|
41
|
+
function proxyWriter(methodName) {
|
|
42
|
+
stream2[methodName] = method;
|
|
43
|
+
function method() {
|
|
44
|
+
return writer[methodName].apply(writer, arguments);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function proxyReader(methodName) {
|
|
48
|
+
stream2[methodName] = method;
|
|
49
|
+
function method() {
|
|
50
|
+
stream2.emit(methodName);
|
|
51
|
+
var func = reader[methodName];
|
|
52
|
+
if (func) {
|
|
53
|
+
return func.apply(reader, arguments);
|
|
54
|
+
}
|
|
55
|
+
reader.emit(methodName);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function proxyStream(methodName) {
|
|
59
|
+
reader.on(methodName, reemit2);
|
|
60
|
+
function reemit2() {
|
|
61
|
+
var args = slice.call(arguments);
|
|
62
|
+
args.unshift(methodName);
|
|
63
|
+
stream2.emit.apply(stream2, args);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function handleEnd() {
|
|
67
|
+
if (ended) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
ended = true;
|
|
71
|
+
var args = slice.call(arguments);
|
|
72
|
+
args.unshift("end");
|
|
73
|
+
stream2.emit.apply(stream2, args);
|
|
74
|
+
}
|
|
75
|
+
function reemit(err) {
|
|
76
|
+
stream2.emit("error", err);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// node_modules/.pnpm/gzip-size@7.0.0/node_modules/gzip-size/index.js
|
|
83
|
+
var import_duplexer = __toESM(require_duplexer(), 1);
|
|
84
|
+
import fs from "fs";
|
|
85
|
+
import stream from "stream";
|
|
86
|
+
import zlib from "zlib";
|
|
87
|
+
import { promisify } from "util";
|
|
88
|
+
var getOptions = (options) => ({ level: 9, ...options });
|
|
89
|
+
var gzip = promisify(zlib.gzip);
|
|
90
|
+
async function gzipSize(input, options) {
|
|
91
|
+
if (!input) {
|
|
92
|
+
return 0;
|
|
93
|
+
}
|
|
94
|
+
const data = await gzip(input, getOptions(options));
|
|
95
|
+
return data.length;
|
|
96
|
+
}
|
|
97
|
+
function gzipSizeSync(input, options) {
|
|
98
|
+
return zlib.gzipSync(input, getOptions(options)).length;
|
|
99
|
+
}
|
|
100
|
+
function gzipSizeFromFile(path, options) {
|
|
101
|
+
return new Promise((resolve, reject) => {
|
|
102
|
+
const stream2 = fs.createReadStream(path);
|
|
103
|
+
stream2.on("error", reject);
|
|
104
|
+
const gzipStream = stream2.pipe(gzipSizeStream(options));
|
|
105
|
+
gzipStream.on("error", reject);
|
|
106
|
+
gzipStream.on("gzip-size", resolve);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function gzipSizeFromFileSync(path, options) {
|
|
110
|
+
return gzipSizeSync(fs.readFileSync(path), options);
|
|
111
|
+
}
|
|
112
|
+
function gzipSizeStream(options) {
|
|
113
|
+
const input = new stream.PassThrough();
|
|
114
|
+
const output = new stream.PassThrough();
|
|
115
|
+
const wrapper = (0, import_duplexer.default)(input, output);
|
|
116
|
+
let gzipSize2 = 0;
|
|
117
|
+
const gzip2 = zlib.createGzip(getOptions(options)).on("data", (buf) => {
|
|
118
|
+
gzipSize2 += buf.length;
|
|
119
|
+
}).on("error", () => {
|
|
120
|
+
wrapper.gzipSize = 0;
|
|
121
|
+
}).on("end", () => {
|
|
122
|
+
wrapper.gzipSize = gzipSize2;
|
|
123
|
+
wrapper.emit("gzip-size", gzipSize2);
|
|
124
|
+
output.end();
|
|
125
|
+
});
|
|
126
|
+
input.pipe(gzip2);
|
|
127
|
+
input.pipe(output, { end: false });
|
|
128
|
+
return wrapper;
|
|
129
|
+
}
|
|
130
|
+
export {
|
|
131
|
+
gzipSize,
|
|
132
|
+
gzipSizeFromFile,
|
|
133
|
+
gzipSizeFromFileSync,
|
|
134
|
+
gzipSizeStream,
|
|
135
|
+
gzipSizeSync
|
|
136
|
+
};
|
|
137
|
+
//# sourceMappingURL=gzip-size-QRGIYYEQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../node_modules/.pnpm/duplexer@0.1.2/node_modules/duplexer/index.js","../node_modules/.pnpm/gzip-size@7.0.0/node_modules/gzip-size/index.js"],"sourcesContent":["var Stream = require(\"stream\")\nvar writeMethods = [\"write\", \"end\", \"destroy\"]\nvar readMethods = [\"resume\", \"pause\"]\nvar readEvents = [\"data\", \"close\"]\nvar slice = Array.prototype.slice\n\nmodule.exports = duplex\n\nfunction forEach (arr, fn) {\n if (arr.forEach) {\n return arr.forEach(fn)\n }\n\n for (var i = 0; i < arr.length; i++) {\n fn(arr[i], i)\n }\n}\n\nfunction duplex(writer, reader) {\n var stream = new Stream()\n var ended = false\n\n forEach(writeMethods, proxyWriter)\n\n forEach(readMethods, proxyReader)\n\n forEach(readEvents, proxyStream)\n\n reader.on(\"end\", handleEnd)\n\n writer.on(\"drain\", function() {\n stream.emit(\"drain\")\n })\n\n writer.on(\"error\", reemit)\n reader.on(\"error\", reemit)\n\n stream.writable = writer.writable\n stream.readable = reader.readable\n\n return stream\n\n function proxyWriter(methodName) {\n stream[methodName] = method\n\n function method() {\n return writer[methodName].apply(writer, arguments)\n }\n }\n\n function proxyReader(methodName) {\n stream[methodName] = method\n\n function method() {\n stream.emit(methodName)\n var func = reader[methodName]\n if (func) {\n return func.apply(reader, arguments)\n }\n reader.emit(methodName)\n }\n }\n\n function proxyStream(methodName) {\n reader.on(methodName, reemit)\n\n function reemit() {\n var args = slice.call(arguments)\n args.unshift(methodName)\n stream.emit.apply(stream, args)\n }\n }\n\n function handleEnd() {\n if (ended) {\n return\n }\n ended = true\n var args = slice.call(arguments)\n args.unshift(\"end\")\n stream.emit.apply(stream, args)\n }\n\n function reemit(err) {\n stream.emit(\"error\", err)\n }\n}\n","import fs from 'node:fs';\nimport stream from 'node:stream';\nimport zlib from 'node:zlib';\nimport {promisify} from 'node:util';\nimport duplexer from 'duplexer';\n\nconst getOptions = options => ({level: 9, ...options});\nconst gzip = promisify(zlib.gzip);\n\nexport async function gzipSize(input, options) {\n\tif (!input) {\n\t\treturn 0;\n\t}\n\n\tconst data = await gzip(input, getOptions(options));\n\treturn data.length;\n}\n\nexport function gzipSizeSync(input, options) {\n\treturn zlib.gzipSync(input, getOptions(options)).length;\n}\n\nexport function gzipSizeFromFile(path, options) {\n\t// TODO: Use `stream.pipeline` here.\n\n\treturn new Promise((resolve, reject) => {\n\t\tconst stream = fs.createReadStream(path);\n\t\tstream.on('error', reject);\n\n\t\tconst gzipStream = stream.pipe(gzipSizeStream(options));\n\t\tgzipStream.on('error', reject);\n\t\tgzipStream.on('gzip-size', resolve);\n\t});\n}\n\nexport function gzipSizeFromFileSync(path, options) {\n\treturn gzipSizeSync(fs.readFileSync(path), options);\n}\n\nexport function gzipSizeStream(options) {\n\t// TODO: Use `stream.pipeline` here.\n\n\tconst input = new stream.PassThrough();\n\tconst output = new stream.PassThrough();\n\tconst wrapper = duplexer(input, output);\n\n\tlet gzipSize = 0;\n\tconst gzip = zlib.createGzip(getOptions(options))\n\t\t.on('data', buf => {\n\t\t\tgzipSize += buf.length;\n\t\t})\n\t\t.on('error', () => {\n\t\t\twrapper.gzipSize = 0;\n\t\t})\n\t\t.on('end', () => {\n\t\t\twrapper.gzipSize = gzipSize;\n\t\t\twrapper.emit('gzip-size', gzipSize);\n\t\t\toutput.end();\n\t\t});\n\n\tinput.pipe(gzip);\n\tinput.pipe(output, {end: false});\n\n\treturn wrapper;\n}\n"],"mappings":";;;;;;;;AAAA;AAAA;AAAA;AAAA,QAAI,SAAS,UAAQ,QAAQ;AAC7B,QAAI,eAAe,CAAC,SAAS,OAAO,SAAS;AAC7C,QAAI,cAAc,CAAC,UAAU,OAAO;AACpC,QAAI,aAAa,CAAC,QAAQ,OAAO;AACjC,QAAI,QAAQ,MAAM,UAAU;AAE5B,WAAO,UAAU;AAEjB,aAAS,QAAS,KAAK,IAAI;AACvB,UAAI,IAAI,SAAS;AACb,eAAO,IAAI,QAAQ,EAAE;AAAA,MACzB;AAEA,eAAS,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK;AACjC,WAAG,IAAI,CAAC,GAAG,CAAC;AAAA,MAChB;AAAA,IACJ;AAEA,aAAS,OAAO,QAAQ,QAAQ;AAC5B,UAAIA,UAAS,IAAI,OAAO;AACxB,UAAI,QAAQ;AAEZ,cAAQ,cAAc,WAAW;AAEjC,cAAQ,aAAa,WAAW;AAEhC,cAAQ,YAAY,WAAW;AAE/B,aAAO,GAAG,OAAO,SAAS;AAE1B,aAAO,GAAG,SAAS,WAAW;AAC5B,QAAAA,QAAO,KAAK,OAAO;AAAA,MACrB,CAAC;AAED,aAAO,GAAG,SAAS,MAAM;AACzB,aAAO,GAAG,SAAS,MAAM;AAEzB,MAAAA,QAAO,WAAW,OAAO;AACzB,MAAAA,QAAO,WAAW,OAAO;AAEzB,aAAOA;AAEP,eAAS,YAAY,YAAY;AAC7B,QAAAA,QAAO,UAAU,IAAI;AAErB,iBAAS,SAAS;AACd,iBAAO,OAAO,UAAU,EAAE,MAAM,QAAQ,SAAS;AAAA,QACrD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SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACvC,UAAME,UAAS,GAAG,iBAAiB,IAAI;AACvC,IAAAA,QAAO,GAAG,SAAS,MAAM;AAEzB,UAAM,aAAaA,QAAO,KAAK,eAAe,OAAO,CAAC;AACtD,eAAW,GAAG,SAAS,MAAM;AAC7B,eAAW,GAAG,aAAa,OAAO;AAAA,EACnC,CAAC;AACF;AAEO,SAAS,qBAAqB,MAAM,SAAS;AACnD,SAAO,aAAa,GAAG,aAAa,IAAI,GAAG,OAAO;AACnD;AAEO,SAAS,eAAe,SAAS;AAGvC,QAAM,QAAQ,IAAI,OAAO,YAAY;AACrC,QAAM,SAAS,IAAI,OAAO,YAAY;AACtC,QAAM,cAAU,gBAAAC,SAAS,OAAO,MAAM;AAEtC,MAAIC,YAAW;AACf,QAAMC,QAAO,KAAK,WAAW,WAAW,OAAO,CAAC,EAC9C,GAAG,QAAQ,SAAO;AAClB,IAAAD,aAAY,IAAI;AAAA,EACjB,CAAC,EACA,GAAG,SAAS,MAAM;AAClB,YAAQ,WAAW;AAAA,EACpB,CAAC,EACA,GAAG,OAAO,MAAM;AAChB,YAAQ,WAAWA;AACnB,YAAQ,KAAK,aAAaA,SAAQ;AAClC,WAAO,IAAI;AAAA,EACZ,CAAC;AAEF,QAAM,KAAKC,KAAI;AACf,QAAM,KAAK,QAAQ,EAAC,KAAK,MAAK,CAAC;AAE/B,SAAO;AACR;","names":["stream","reemit","stream","duplexer","gzipSize","gzip"]}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/commands/build.ts","../src/ui/BuildUI.tsx","../src/lib/runBuild.ts","../src/lib/readFiles.ts","../src/commands/dev.ts","../src/ui/DevUI.tsx"],"sourcesContent":["import { program } from 'commander';\nimport { buildCommand } from './commands/build.js';\nimport { devCommand } from './commands/dev.js';\n\nprogram.name('appbuilder').description('Kizen plugin app builder').version('0.1.0');\n\nbuildCommand(program);\ndevCommand(program);\n\nprogram.parse();\n","import { createElement } from 'react';\nimport { render } from 'ink';\nimport type { Command } from 'commander';\nimport { BuildUI } from '../ui/BuildUI.js';\n\nexport function buildCommand(program: Command): void {\n program\n .command('build')\n .description('Bundle the plugin app into .kizenapp directory')\n .action(async () => {\n const outputDir = `${process.cwd()}/.kizenapp`;\n const pluginDir = process.cwd();\n const { waitUntilExit } = render(createElement(BuildUI, { outputDir, pluginDir }));\n await waitUntilExit();\n });\n}\n","import type { FC } from 'react';\nimport { useEffect, useState } from 'react';\nimport { Box, Text, useApp } from 'ink';\nimport { runBuild } from '../lib/runBuild.js';\nimport type { BuildStepName } from '../lib/runBuild.js';\n\ntype BuildStep = BuildStepName | 'done' | 'error';\n\ninterface BuildUIProps {\n outputDir: string;\n pluginDir: string;\n}\n\nconst SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];\n\nconst Spinner: FC = () => {\n const [frame, setFrame] = useState(0);\n\n useEffect(() => {\n const id = setInterval(() => {\n setFrame((prev) => (prev + 1) % SPINNER_FRAMES.length);\n }, 80);\n\n return () => {\n clearInterval(id);\n };\n }, []);\n\n return <Text color=\"cyan\">{SPINNER_FRAMES[frame] ?? '⠋'}</Text>;\n};\n\nconst STEPS: BuildStepName[] = [\n 'creating-dir',\n 'reading-files',\n 'minifying',\n 'packaging',\n 'writing-bundle',\n];\n\nconst STEP_LABELS: Record<BuildStepName, string> = {\n 'creating-dir': 'Creating .kizenapp directory',\n 'reading-files': 'Reading plugin files',\n minifying: 'Minifying scripts',\n packaging: 'Packaging plugin',\n 'writing-bundle': 'Writing bundle.json',\n};\n\nexport const BuildUI: FC<BuildUIProps> = ({ outputDir, pluginDir }) => {\n const { exit } = useApp();\n const [step, setStep] = useState<BuildStep>('creating-dir');\n const [errorMessage, setErrorMessage] = useState<string | null>(null);\n\n useEffect(() => {\n void runBuild(pluginDir, outputDir, setStep)\n .then(() => {\n setStep('done');\n exit();\n })\n .catch((err: unknown) => {\n const message = err instanceof Error ? err.message : String(err);\n setErrorMessage(message);\n setStep('error');\n exit(err instanceof Error ? err : new Error(message));\n });\n }, [outputDir, pluginDir, exit]);\n\n const currentIndex = STEPS.indexOf(step as BuildStepName);\n const isError = step === 'error';\n const isDone = step === 'done';\n\n return (\n <Box flexDirection=\"column\" paddingY={1} paddingX={1}>\n <Box flexDirection=\"column\" marginBottom={1}>\n <Text bold color=\"cyan\">\n Kizen App Builder\n </Text>\n <Text dimColor>{'─'.repeat(22)}</Text>\n </Box>\n\n <Box flexDirection=\"column\" gap={1}>\n {STEPS.map((s, i) => {\n const isActive = step === s;\n const isStepDone = isDone || currentIndex > i;\n const isFailed = isError && i === currentIndex;\n\n return (\n <Box key={s} gap={1}>\n {isFailed ? (\n <Text color=\"red\">✗ {STEP_LABELS[s]}</Text>\n ) : isStepDone ? (\n <Text color=\"green\">✓ {STEP_LABELS[s]}</Text>\n ) : isActive ? (\n <>\n <Spinner />\n <Text>{STEP_LABELS[s]}</Text>\n </>\n ) : (\n <Text dimColor>· {STEP_LABELS[s]}</Text>\n )}\n </Box>\n );\n })}\n\n {errorMessage !== null && (\n <Box marginTop={1}>\n <Text color=\"red\">{errorMessage}</Text>\n </Box>\n )}\n </Box>\n </Box>\n );\n};\n","import { mkdir, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { minifyFiles, packagePlugin, transformDeployablePlugin } from '@kizenapps/packager';\nimport type { DeployablePlugin } from '@kizenapps/packager';\nimport { readLocalFiles } from './readFiles.js';\n\nexport type BuildStepName =\n | 'creating-dir'\n | 'reading-files'\n | 'minifying'\n | 'packaging'\n | 'writing-bundle';\n\ntype SerializableDeployablePlugin = Omit<DeployablePlugin, 'thumbnail' | 'kznFile'> & {\n thumbnail: string | null;\n kznFile: string | null;\n};\n\nconst serializePlugin = (plugin: DeployablePlugin): SerializableDeployablePlugin => ({\n ...plugin,\n thumbnail: plugin.thumbnail ? Buffer.from(plugin.thumbnail).toString('base64') : null,\n kznFile: plugin.kznFile ? Buffer.from(plugin.kznFile).toString('base64') : null,\n});\n\nexport async function runBuild(\n pluginDir: string,\n outputDir: string,\n onStep?: (step: BuildStepName) => void,\n): Promise<void> {\n await mkdir(outputDir, { recursive: true });\n\n onStep?.('reading-files');\n const files = await readLocalFiles(pluginDir);\n\n onStep?.('minifying');\n const minified = await minifyFiles(files);\n\n onStep?.('packaging');\n const manifestFile = minified.find((f) => f.path === 'kizen.json');\n if (!manifestFile) {\n throw new Error('kizen.json not found in plugin directory.');\n }\n const manifests = JSON.parse(manifestFile.content) as Parameters<typeof packagePlugin>[1];\n const packaged = packagePlugin(minified, manifests);\n const deployable = Object.values(packaged).map(transformDeployablePlugin);\n\n onStep?.('writing-bundle');\n const bundle = deployable.map(serializePlugin);\n await writeFile(join(outputDir, 'bundle.json'), JSON.stringify(bundle, null, 2), 'utf-8');\n}\n","import { readdir, readFile } from 'node:fs/promises';\nimport { join, relative } from 'node:path';\nimport type { FileContent } from '@kizenapps/packager';\n\nconst IMAGE_EXTENSIONS = new Set(['.png', '.svg']);\nconst BINARY_EXTENSIONS = new Set(['.kzn']);\n\nconst SKIP_DIRS = new Set(['node_modules', '.git', '.kizenapp', '.github']);\n\nasync function walk(dir: string, rootDir: string): Promise<string[]> {\n const entries = await readdir(dir, { withFileTypes: true });\n const paths: string[] = [];\n\n for (const entry of entries) {\n if (entry.isDirectory()) {\n if (SKIP_DIRS.has(entry.name)) {\n continue;\n }\n\n paths.push(...(await walk(join(dir, entry.name), rootDir)));\n } else if (entry.isFile()) {\n paths.push(join(dir, entry.name));\n }\n }\n\n return paths;\n}\n\nexport async function readLocalFiles(rootDir: string): Promise<FileContent[]> {\n const absolutePaths = await walk(rootDir, rootDir);\n\n return Promise.all(\n absolutePaths.map(async (absPath): Promise<FileContent> => {\n const relPath = relative(rootDir, absPath).split('\\\\').join('/');\n const dotIndex = relPath.lastIndexOf('.');\n const ext = dotIndex >= 0 ? relPath.slice(dotIndex).toLowerCase() : '';\n\n if (IMAGE_EXTENSIONS.has(ext)) {\n const buf = await readFile(absPath);\n return { path: relPath, content: '', base64Image: buf.toString('base64') };\n }\n\n if (BINARY_EXTENSIONS.has(ext)) {\n const buf = await readFile(absPath);\n return { path: relPath, content: '', binaryData: buf };\n }\n\n const content = await readFile(absPath, 'utf-8');\n return { path: relPath, content };\n }),\n );\n}\n","import { createElement } from 'react';\nimport { render } from 'ink';\nimport type { Command } from 'commander';\nimport { DevUI } from '../ui/DevUI.js';\n\nexport function devCommand(program: Command): void {\n program\n .command('dev')\n .description('Start the plugin viewer dev server')\n .option('-p, --port <port>', 'port to listen on', '3121')\n .action(async (options: { port: string }) => {\n const port = parseInt(options.port, 10);\n const pluginDir = process.cwd();\n const outputDir = `${pluginDir}/.kizenapp`;\n const { waitUntilExit } = render(createElement(DevUI, { port, pluginDir, outputDir }), {\n exitOnCtrlC: false,\n });\n await waitUntilExit();\n });\n}\n","import type { FC } from 'react';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { Box, Text, useInput } from 'ink';\nimport { spawn } from 'node:child_process';\nimport {\n createReadStream,\n readFileSync,\n statSync,\n unlinkSync,\n watch,\n writeFileSync,\n} from 'node:fs';\nimport type { FSWatcher } from 'node:fs';\nimport { access, readFile } from 'node:fs/promises';\nimport { createServer } from 'node:http';\nimport type { IncomingMessage, Server, ServerResponse } from 'node:http';\nimport { createRequire } from 'node:module';\nimport { dirname, extname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { WebSocket, WebSocketServer } from 'ws';\nimport { runBuild } from '../lib/runBuild.js';\n\ntype ServerStatus = 'starting' | 'running' | 'error';\ntype BuildStatus = 'pending' | 'building' | 'done' | 'error';\n\nconst SKIP_WATCH_PREFIXES = ['.kizenapp', '.git'];\nconst LOG_LIMIT = 50;\nconst LOG_DISPLAY = 8;\n\ninterface DevUIProps {\n port: number;\n pluginDir: string;\n outputDir: string;\n}\n\nconst MIME_TYPES: Readonly<Record<string, string>> = {\n '.html': 'text/html; charset=utf-8',\n '.js': 'application/javascript; charset=utf-8',\n '.mjs': 'application/javascript; charset=utf-8',\n '.css': 'text/css; charset=utf-8',\n '.png': 'image/png',\n '.jpg': 'image/jpeg',\n '.svg': 'image/svg+xml',\n '.ico': 'image/x-icon',\n '.json': 'application/json; charset=utf-8',\n '.woff': 'font/woff',\n '.woff2': 'font/woff2',\n '.ttf': 'font/ttf',\n '.map': 'application/json',\n};\n\nconst SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];\n\nconst Spinner: FC = () => {\n const [frame, setFrame] = useState(0);\n\n useEffect(() => {\n const id = setInterval(() => {\n setFrame((prev) => (prev + 1) % SPINNER_FRAMES.length);\n }, 80);\n\n return () => {\n clearInterval(id);\n };\n }, []);\n\n return <Text color=\"cyan\">{SPINNER_FRAMES[frame] ?? '⠋'}</Text>;\n};\n\nfunction getViewerPath(): string {\n const filename = fileURLToPath(import.meta.url);\n return join(dirname(filename), 'viewer');\n}\n\nfunction getElectronMainPath(): string {\n const filename = fileURLToPath(import.meta.url);\n return join(dirname(filename), 'electron', 'main.js');\n}\n\nasync function fileExists(filePath: string): Promise<boolean> {\n try {\n await access(filePath);\n return true;\n } catch {\n return false;\n }\n}\n\nfunction createRequestHandler(\n viewerPath: string,\n createServerLog: (message: string) => void,\n createProxyLog: (message: string) => void,\n): (req: IncomingMessage, res: ServerResponse) => void {\n return (req, res) => {\n void (async () => {\n const url = req.url ?? '/';\n\n createServerLog(`Received request: ${url}`);\n\n if (url === '/api/bundle') {\n const bundlePath = join(process.cwd(), '.kizenapp', 'bundle.json');\n try {\n const content = await readFile(bundlePath, 'utf-8');\n res.writeHead(200, { 'Content-Type': 'application/json; charset=utf-8' });\n res.end(content);\n } catch {\n res.writeHead(200, { 'Content-Type': 'application/json; charset=utf-8' });\n res.end('{}');\n }\n return;\n }\n\n if (url.startsWith('/api/proxy')) {\n const proxyTarget = req.headers['x-proxy-target'];\n if (typeof proxyTarget !== 'string') {\n res.writeHead(400);\n res.end('Missing x-proxy-target header');\n return;\n }\n\n const upstreamPath = url.slice('/api/proxy'.length) || '/';\n const upstreamUrl = `${proxyTarget}${upstreamPath}`;\n\n const chunks: Buffer[] = [];\n for await (const chunk of req) {\n chunks.push(chunk as Buffer);\n }\n\n const body = chunks.length > 0 ? Buffer.concat(chunks) : undefined;\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { host, 'x-proxy-target': _drop, ...forwardHeaders } = req.headers;\n\n const resolvedBody = body && body.length > 0 ? body : undefined;\n const upstream = await fetch(upstreamUrl, {\n ...(req.method !== undefined && { method: req.method }),\n headers: forwardHeaders as Record<string, string>,\n ...(resolvedBody !== undefined && { body: resolvedBody }),\n });\n\n createProxyLog(`${req.method ?? 'GET'} ${upstreamPath} → ${String(upstream.status)}`);\n\n // Node fetch auto-decompresses the body, so strip encoding/length headers\n // that describe the compressed wire format — they no longer apply.\n const responseHeaders = Object.fromEntries(upstream.headers);\n delete responseHeaders['content-encoding'];\n delete responseHeaders['content-length'];\n\n res.writeHead(upstream.status, responseHeaders);\n res.end(Buffer.from(await upstream.arrayBuffer()));\n return;\n }\n\n const rawPath = url === '/' ? '/index.html' : url;\n const filePath = join(viewerPath, rawPath);\n const resolvedPath = (await fileExists(filePath)) ? filePath : join(viewerPath, 'index.html');\n const ext = extname(resolvedPath);\n const mimeType = MIME_TYPES[ext] ?? 'application/octet-stream';\n res.writeHead(200, { 'Content-Type': mimeType });\n createReadStream(resolvedPath).pipe(res);\n })();\n };\n}\n\nexport const DevUI: FC<DevUIProps> = ({ port, pluginDir, outputDir }) => {\n const [status, setStatus] = useState<ServerStatus>('starting');\n const [errorMessage, setErrorMessage] = useState<string | null>(null);\n const [serverLogHistory, setServerLogHistory] = useState<string[]>([]);\n const [buildLogHistory, setBuildLogHistory] = useState<string[]>([]);\n const [proxyLogHistory, setProxyLogHistory] = useState<string[]>([]);\n const [buildStatus, setBuildStatus] = useState<BuildStatus>('pending');\n const [buildError, setBuildError] = useState<string | null>(null);\n const [lastBuilt, setLastBuilt] = useState<Date | null>(null);\n const [wsClientCount, setWsClientCount] = useState(0);\n\n const buildingRef = useRef(false);\n const electronLaunchedRef = useRef(false);\n const debounceTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const wsClientsRef = useRef<Set<WebSocket>>(new Set());\n const pendingMessagesRef = useRef<string[]>([]);\n\n useInput((input, key) => {\n if (input === 'q' || (key.ctrl && input === 'c')) {\n process.exit(0);\n }\n });\n\n useEffect(() => {\n if (status !== 'running' || electronLaunchedRef.current) {\n return;\n }\n\n electronLaunchedRef.current = true;\n\n const _require = createRequire(import.meta.url);\n const electronBin = _require('electron') as string;\n const electronMain = getElectronMainPath();\n const userDataDir = join(outputDir, '.electron');\n\n // Patch Electron's CFBundleName so macOS shows \"Kizen Dev\" in the Dock.\n // Breaks the pnpm hard link first so the global content-addressable store is unaffected.\n if (process.platform === 'darwin') {\n try {\n const plistPath = join(dirname(dirname(electronBin)), 'Info.plist');\n const plist = readFileSync(plistPath, 'utf-8');\n if (!plist.includes('>Kizen Dev<')) {\n if (statSync(plistPath).nlink > 1) {\n unlinkSync(plistPath);\n writeFileSync(plistPath, plist);\n }\n writeFileSync(\n plistPath,\n plist\n .replace(/(<key>CFBundleName<\\/key>\\s*<string>)[^<]*(<\\/string>)/, '$1Kizen Dev$2')\n .replace(\n /(<key>CFBundleDisplayName<\\/key>\\s*<string>)[^<]*(<\\/string>)/,\n '$1Kizen Dev$2',\n ),\n );\n }\n } catch {\n // Non-fatal — Dock will show \"Electron\" if patching fails\n }\n }\n\n const proc = spawn(\n electronBin,\n [electronMain, `--port=${String(port)}`, `--user-data-dir=${userDataDir}`],\n {\n stdio: 'ignore',\n },\n );\n proc.unref();\n process.on('exit', () => {\n proc.kill();\n });\n }, [status, port, outputDir]);\n\n const createServerLog = useCallback((message: string): void => {\n setServerLogHistory((h) =>\n [...h, `${new Date().toLocaleTimeString()}: ${message}`].slice(-LOG_LIMIT),\n );\n }, []);\n\n const broadcast = useCallback((msg: object): void => {\n const json = JSON.stringify(msg);\n if (wsClientsRef.current.size === 0) {\n pendingMessagesRef.current = [...pendingMessagesRef.current, json].slice(-LOG_LIMIT);\n return;\n }\n for (const client of wsClientsRef.current) {\n if (client.readyState === 1) {\n client.send(json);\n }\n }\n }, []);\n\n const createProxyLog = useCallback(\n (message: string): void => {\n setProxyLogHistory((h) =>\n [...h, `${new Date().toLocaleTimeString()}: ${message}`].slice(-LOG_LIMIT),\n );\n broadcast({ type: 'proxy-log', message });\n },\n [broadcast],\n );\n\n const createBuildLog = useCallback(\n (message: string): void => {\n setBuildLogHistory((h) =>\n [...h, `${new Date().toLocaleTimeString()}: ${message}`].slice(-LOG_LIMIT),\n );\n broadcast({ type: 'log', message });\n },\n [broadcast],\n );\n\n const triggerBuild = useCallback(() => {\n if (buildingRef.current) {\n return;\n }\n\n buildingRef.current = true;\n\n setBuildStatus('building');\n setBuildError(null);\n createBuildLog('Build started');\n\n void runBuild(pluginDir, outputDir)\n .then(() => {\n createBuildLog('Build finished');\n setBuildStatus('done');\n setLastBuilt(new Date());\n\n createBuildLog('Notifying viewers to reload');\n for (const client of wsClientsRef.current) {\n if (client.readyState === 1) {\n client.send(JSON.stringify({ type: 'rebuild' }));\n }\n }\n })\n .catch((err: unknown) => {\n const message = err instanceof Error ? err.message : String(err);\n setBuildError(message);\n setBuildStatus('error');\n })\n .finally(() => {\n buildingRef.current = false;\n });\n }, [pluginDir, outputDir, createBuildLog]);\n\n useEffect(() => {\n triggerBuild();\n\n const watcher: FSWatcher = watch(pluginDir, { recursive: true }, (_, filename) => {\n if (!filename) {\n return;\n }\n\n const normalized = filename.replace(/\\\\/g, '/');\n\n if (SKIP_WATCH_PREFIXES.some((prefix) => normalized.startsWith(prefix))) {\n return;\n }\n\n createBuildLog(`File change detected: ${filename}`);\n\n if (debounceTimerRef.current !== null) {\n clearTimeout(debounceTimerRef.current);\n }\n debounceTimerRef.current = setTimeout(triggerBuild, 150);\n });\n\n return () => {\n watcher.close();\n\n if (debounceTimerRef.current !== null) {\n clearTimeout(debounceTimerRef.current);\n }\n };\n }, [pluginDir, triggerBuild, createBuildLog]);\n\n useEffect(() => {\n const viewerPath = getViewerPath();\n\n void fileExists(join(viewerPath, 'index.html')).then((viewerBuilt) => {\n if (!viewerBuilt) {\n setErrorMessage(\"Viewer not built. Run 'pnpm build:viewer' first.\");\n setStatus('error');\n return;\n }\n\n const handler = createRequestHandler(viewerPath, createServerLog, createProxyLog);\n const server: Server = createServer(handler);\n const wss = new WebSocketServer({ server });\n\n wss.on('connection', (ws: WebSocket) => {\n for (const json of pendingMessagesRef.current) {\n if (ws.readyState === 1) {\n ws.send(json);\n }\n }\n pendingMessagesRef.current = [];\n\n createServerLog('Viewer connected for live reload');\n wsClientsRef.current.add(ws);\n setWsClientCount(wsClientsRef.current.size);\n\n ws.on('close', () => {\n wsClientsRef.current.delete(ws);\n setWsClientCount(wsClientsRef.current.size);\n });\n });\n\n server.listen(port, () => {\n setStatus('running');\n createServerLog(`Server started on port ${String(port)}`);\n });\n\n server.on('error', (err: Error) => {\n setErrorMessage(err.message);\n setStatus('error');\n });\n\n return () => {\n wss.close();\n server.close();\n };\n });\n }, [port, createServerLog, createProxyLog]);\n\n const elapsedSeconds =\n lastBuilt !== null ? Math.round((Date.now() - lastBuilt.getTime()) / 1000) : null;\n const elapsedLabel =\n elapsedSeconds === null\n ? ''\n : elapsedSeconds < 5\n ? ' (just now)'\n : ` (${String(elapsedSeconds)}s ago)`;\n\n return (\n <Box flexDirection=\"column\" paddingY={1} paddingX={1}>\n {/* Header */}\n <Box flexDirection=\"column\" marginBottom={1}>\n <Box gap={1}>\n <Text bold color=\"cyan\">\n Kizen App Builder\n </Text>\n </Box>\n </Box>\n\n {/* Build log */}\n <Box flexDirection=\"column\">\n <Box gap={1} marginBottom={0}>\n {buildStatus === 'pending' && <Text dimColor>Build waiting...</Text>}\n {buildStatus === 'building' && (\n <>\n <Spinner />\n <Text>Building Plugin Package...</Text>\n </>\n )}\n {buildStatus === 'done' && (\n <Text color=\"green\">\n ✓ Built Plugin Package\n {lastBuilt !== null ? ` at ${lastBuilt.toLocaleTimeString()}` : ''}\n <Text dimColor>{elapsedLabel}</Text>\n </Text>\n )}\n {buildStatus === 'error' && (\n <Text color=\"red\">✗ Build error: {buildError ?? 'unknown error'}</Text>\n )}\n </Box>\n <Box\n flexDirection=\"column\"\n height={LOG_DISPLAY}\n borderStyle=\"round\"\n borderColor=\"gray\"\n overflow=\"hidden\"\n >\n {buildLogHistory.slice(-LOG_DISPLAY).map((log, index) => (\n <Text key={index} dimColor wrap=\"truncate\">\n {log}\n </Text>\n ))}\n </Box>\n </Box>\n\n {/* Web server log */}\n <Box marginTop={1} flexDirection=\"column\">\n <Box gap={2}>\n {status === 'starting' && <Text dimColor>Starting server...</Text>}\n {status === 'running' && (\n <>\n <Text color=\"green\">✓ Dev Server running</Text>\n <Text dimColor>\n ● {wsClientCount} viewer{wsClientCount !== 1 ? 's' : ''}\n </Text>\n </>\n )}\n {status === 'error' && <Text color=\"red\">✗ {errorMessage ?? 'Server error'}</Text>}\n </Box>\n <Box\n flexDirection=\"column\"\n height={LOG_DISPLAY}\n borderStyle=\"round\"\n borderColor=\"gray\"\n overflow=\"hidden\"\n >\n {serverLogHistory.slice(-LOG_DISPLAY).map((log, index) => (\n <Text key={index} dimColor wrap=\"truncate\">\n {log}\n </Text>\n ))}\n </Box>\n </Box>\n\n {/* Proxy log */}\n <Box marginTop={1} flexDirection=\"column\">\n <Text dimColor>Proxy</Text>\n <Box\n flexDirection=\"column\"\n height={LOG_DISPLAY}\n borderStyle=\"round\"\n borderColor=\"gray\"\n overflow=\"hidden\"\n >\n {proxyLogHistory.length === 0 ? (\n <Text dimColor> No proxy requests yet.</Text>\n ) : (\n proxyLogHistory.slice(-LOG_DISPLAY).map((log, i) => (\n <Text key={i} dimColor wrap=\"truncate\">\n {log}\n </Text>\n ))\n )}\n </Box>\n </Box>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;AAAA,MACH;AAAA,OACF;AAAA,IAGA,gBAAAL,MAACQ,MAAA,EAAI,WAAW,GAAG,eAAc,UAC/B;AAAA,sBAAAT,KAACM,OAAA,EAAK,UAAQ,MAAC,mBAAK;AAAA,MACpB,gBAAAN;AAAA,QAACS;AAAA,QAAA;AAAA,UACC,eAAc;AAAA,UACd,QAAQ;AAAA,UACR,aAAY;AAAA,UACZ,aAAY;AAAA,UACZ,UAAS;AAAA,UAER,0BAAgB,WAAW,IAC1B,gBAAAT,KAACM,OAAA,EAAK,UAAQ,MAAC,qCAAuB,IAEtC,gBAAgB,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC,KAAK,MAC5C,gBAAAN,KAACM,OAAA,EAAa,UAAQ,MAAC,MAAK,YACzB,iBADQ,CAEX,CACD;AAAA;AAAA,MAEL;AAAA,OACF;AAAA,IAGA,gBAAAN,KAACS,MAAA,EAAI,WAAW,GACd,0BAAAT,KAACM,OAAA,EAAK,UAAQ,MAAC,uBAAS,GAC1B;AAAA,KACF;AAEJ;;;ADnfO,SAAS,WAAWI,UAAwB;AACjD,EAAAA,SACG,QAAQ,KAAK,EACb,YAAY,oCAAoC,EAChD,OAAO,qBAAqB,qBAAqB,MAAM,EACvD,OAAO,OAAO,YAA8B;AAC3C,UAAM,OAAO,SAAS,QAAQ,MAAM,EAAE;AACtC,UAAM,YAAY,QAAQ,IAAI;AAC9B,UAAM,YAAY,GAAG,SAAS;AAC9B,UAAM,EAAE,cAAc,IAAIC,QAAOC,eAAc,OAAO,EAAE,MAAM,WAAW,UAAU,CAAC,GAAG;AAAA,MACrF,aAAa;AAAA,IACf,CAAC;AACD,UAAM,cAAc;AAAA,EACtB,CAAC;AACL;;;ALfA,QAAQ,KAAK,YAAY,EAAE,YAAY,0BAA0B,EAAE,QAAQ,OAAO;AAElF,aAAa,OAAO;AACpB,WAAW,OAAO;AAElB,QAAQ,MAAM;","names":["join","join","program","createElement","render","useEffect","useState","Box","Text","readFile","join","Fragment","jsx","jsxs","SPINNER_FRAMES","Spinner","useState","useEffect","Text","join","readFile","Box","program","render","createElement"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/commands/build.ts","../src/ui/BuildUI.tsx","../src/lib/runBuild.ts","../src/lib/readFiles.ts","../src/commands/dev.ts","../src/ui/DevUI.tsx"],"sourcesContent":["import { program } from 'commander';\nimport { buildCommand } from './commands/build.js';\nimport { devCommand } from './commands/dev.js';\n\nprogram.name('appbuilder').description('Kizen plugin app builder').version('0.1.0');\n\nbuildCommand(program);\ndevCommand(program);\n\nprogram.parse();\n","import { createElement } from 'react';\nimport { render } from 'ink';\nimport type { Command } from 'commander';\nimport { BuildUI } from '../ui/BuildUI.js';\n\nexport function buildCommand(program: Command): void {\n program\n .command('build')\n .description('Bundle the plugin app into .kizenapp directory')\n .action(async () => {\n const outputDir = `${process.cwd()}/.kizenapp`;\n const pluginDir = process.cwd();\n const { waitUntilExit } = render(createElement(BuildUI, { outputDir, pluginDir }));\n await waitUntilExit();\n });\n}\n","import type { FC } from 'react';\nimport { useEffect, useState } from 'react';\nimport { Box, Text, useApp } from 'ink';\nimport { runBuild } from '../lib/runBuild.js';\nimport type { BuildStepName } from '../lib/runBuild.js';\n\ntype BuildStep = BuildStepName | 'done' | 'error';\n\ninterface BuildUIProps {\n outputDir: string;\n pluginDir: string;\n}\n\nconst SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];\n\nconst Spinner: FC = () => {\n const [frame, setFrame] = useState(0);\n\n useEffect(() => {\n const id = setInterval(() => {\n setFrame((prev) => (prev + 1) % SPINNER_FRAMES.length);\n }, 80);\n\n return () => {\n clearInterval(id);\n };\n }, []);\n\n return <Text color=\"cyan\">{SPINNER_FRAMES[frame] ?? '⠋'}</Text>;\n};\n\nconst STEPS: BuildStepName[] = [\n 'creating-dir',\n 'reading-files',\n 'minifying',\n 'packaging',\n 'writing-bundle',\n];\n\nconst STEP_LABELS: Record<BuildStepName, string> = {\n 'creating-dir': 'Creating .kizenapp directory',\n 'reading-files': 'Reading plugin files',\n minifying: 'Minifying scripts',\n packaging: 'Packaging plugin',\n 'writing-bundle': 'Writing bundle.json',\n};\n\nexport const BuildUI: FC<BuildUIProps> = ({ outputDir, pluginDir }) => {\n const { exit } = useApp();\n const [step, setStep] = useState<BuildStep>('creating-dir');\n const [errorMessage, setErrorMessage] = useState<string | null>(null);\n\n useEffect(() => {\n void runBuild(pluginDir, outputDir, setStep)\n .then(() => {\n setStep('done');\n exit();\n })\n .catch((err: unknown) => {\n const message = err instanceof Error ? err.message : String(err);\n setErrorMessage(message);\n setStep('error');\n exit(err instanceof Error ? err : new Error(message));\n });\n }, [outputDir, pluginDir, exit]);\n\n const currentIndex = STEPS.indexOf(step as BuildStepName);\n const isError = step === 'error';\n const isDone = step === 'done';\n\n return (\n <Box flexDirection=\"column\" paddingY={1} paddingX={1}>\n <Box flexDirection=\"column\" marginBottom={1}>\n <Text bold color=\"cyan\">\n Kizen App Builder\n </Text>\n <Text dimColor>{'─'.repeat(22)}</Text>\n </Box>\n\n <Box flexDirection=\"column\" gap={1}>\n {STEPS.map((s, i) => {\n const isActive = step === s;\n const isStepDone = isDone || currentIndex > i;\n const isFailed = isError && i === currentIndex;\n\n return (\n <Box key={s} gap={1}>\n {isFailed ? (\n <Text color=\"red\">✗ {STEP_LABELS[s]}</Text>\n ) : isStepDone ? (\n <Text color=\"green\">✓ {STEP_LABELS[s]}</Text>\n ) : isActive ? (\n <>\n <Spinner />\n <Text>{STEP_LABELS[s]}</Text>\n </>\n ) : (\n <Text dimColor>· {STEP_LABELS[s]}</Text>\n )}\n </Box>\n );\n })}\n\n {errorMessage !== null && (\n <Box marginTop={1}>\n <Text color=\"red\">{errorMessage}</Text>\n </Box>\n )}\n </Box>\n </Box>\n );\n};\n","import { mkdir, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { minifyFiles, packagePlugin, transformDeployablePlugin } from '@kizenapps/packager';\nimport type { DeployablePlugin } from '@kizenapps/packager';\nimport { readLocalFiles } from './readFiles.js';\n\nexport type BuildStepName =\n | 'creating-dir'\n | 'reading-files'\n | 'minifying'\n | 'packaging'\n | 'writing-bundle';\n\ntype SerializableDeployablePlugin = Omit<DeployablePlugin, 'thumbnail' | 'kznFile'> & {\n thumbnail: string | null;\n kznFile: string | null;\n};\n\nconst serializePlugin = (plugin: DeployablePlugin): SerializableDeployablePlugin => ({\n ...plugin,\n thumbnail: plugin.thumbnail ? Buffer.from(plugin.thumbnail).toString('base64') : null,\n kznFile: plugin.kznFile ? Buffer.from(plugin.kznFile).toString('base64') : null,\n});\n\nexport async function runBuild(\n pluginDir: string,\n outputDir: string,\n onStep?: (step: BuildStepName) => void,\n): Promise<void> {\n await mkdir(outputDir, { recursive: true });\n\n onStep?.('reading-files');\n const files = await readLocalFiles(pluginDir);\n\n onStep?.('minifying');\n const minified = await minifyFiles(files);\n\n onStep?.('packaging');\n const manifestFile = minified.find((f) => f.path === 'kizen.json');\n if (!manifestFile) {\n throw new Error('kizen.json not found in plugin directory.');\n }\n const manifests = JSON.parse(manifestFile.content) as Parameters<typeof packagePlugin>[1];\n const packaged = packagePlugin(minified, manifests);\n const deployable = Object.values(packaged).map(transformDeployablePlugin);\n\n onStep?.('writing-bundle');\n const bundle = deployable.map(serializePlugin);\n await writeFile(join(outputDir, 'bundle.json'), JSON.stringify(bundle, null, 2), 'utf-8');\n}\n","import { readdir, readFile } from 'node:fs/promises';\nimport { join, relative } from 'node:path';\nimport type { FileContent } from '@kizenapps/packager';\n\nconst IMAGE_EXTENSIONS = new Set(['.png', '.svg']);\nconst BINARY_EXTENSIONS = new Set(['.kzn']);\n\nconst SKIP_DIRS = new Set(['node_modules', '.git', '.kizenapp', '.github']);\n\nasync function walk(dir: string, rootDir: string): Promise<string[]> {\n const entries = await readdir(dir, { withFileTypes: true });\n const paths: string[] = [];\n\n for (const entry of entries) {\n if (entry.isDirectory()) {\n if (SKIP_DIRS.has(entry.name)) {\n continue;\n }\n\n paths.push(...(await walk(join(dir, entry.name), rootDir)));\n } else if (entry.isFile()) {\n paths.push(join(dir, entry.name));\n }\n }\n\n return paths;\n}\n\nexport async function readLocalFiles(rootDir: string): Promise<FileContent[]> {\n const absolutePaths = await walk(rootDir, rootDir);\n\n return Promise.all(\n absolutePaths.map(async (absPath): Promise<FileContent> => {\n const relPath = relative(rootDir, absPath).split('\\\\').join('/');\n const dotIndex = relPath.lastIndexOf('.');\n const ext = dotIndex >= 0 ? relPath.slice(dotIndex).toLowerCase() : '';\n\n if (IMAGE_EXTENSIONS.has(ext)) {\n const buf = await readFile(absPath);\n return { path: relPath, content: '', base64Image: buf.toString('base64') };\n }\n\n if (BINARY_EXTENSIONS.has(ext)) {\n const buf = await readFile(absPath);\n return { path: relPath, content: '', binaryData: buf };\n }\n\n const content = await readFile(absPath, 'utf-8');\n return { path: relPath, content };\n }),\n );\n}\n","import { createElement } from 'react';\nimport { render } from 'ink';\nimport type { Command } from 'commander';\nimport { DevUI } from '../ui/DevUI.js';\n\nexport function devCommand(program: Command): void {\n program\n .command('dev')\n .description('Start the plugin viewer dev server')\n .option('-p, --port <port>', 'port to listen on', '3121')\n .action(async (options: { port: string }) => {\n const port = parseInt(options.port, 10);\n const pluginDir = process.cwd();\n const outputDir = `${pluginDir}/.kizenapp`;\n const { waitUntilExit } = render(createElement(DevUI, { port, pluginDir, outputDir }), {\n exitOnCtrlC: false,\n });\n await waitUntilExit();\n });\n}\n","import type { FC } from 'react';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { Box, Text, useInput } from 'ink';\nimport { spawn } from 'node:child_process';\nimport {\n createReadStream,\n readFileSync,\n statSync,\n unlinkSync,\n watch,\n writeFileSync,\n} from 'node:fs';\nimport type { FSWatcher } from 'node:fs';\nimport { access, readFile } from 'node:fs/promises';\nimport { createServer } from 'node:http';\nimport type { IncomingMessage, Server, ServerResponse } from 'node:http';\nimport { createRequire } from 'node:module';\nimport { dirname, extname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { type WebSocket, WebSocketServer } from 'ws';\nimport { runBuild } from '../lib/runBuild.js';\n\ntype ServerStatus = 'starting' | 'running' | 'error';\ntype BuildStatus = 'pending' | 'building' | 'done' | 'error';\n\nconst SKIP_WATCH_PREFIXES = ['.kizenapp', '.git'];\nconst LOG_LIMIT = 50;\nconst LOG_DISPLAY = 8;\n\ninterface DevUIProps {\n port: number;\n pluginDir: string;\n outputDir: string;\n}\n\nconst MIME_TYPES: Readonly<Record<string, string>> = {\n '.html': 'text/html; charset=utf-8',\n '.js': 'application/javascript; charset=utf-8',\n '.mjs': 'application/javascript; charset=utf-8',\n '.css': 'text/css; charset=utf-8',\n '.png': 'image/png',\n '.jpg': 'image/jpeg',\n '.svg': 'image/svg+xml',\n '.ico': 'image/x-icon',\n '.json': 'application/json; charset=utf-8',\n '.woff': 'font/woff',\n '.woff2': 'font/woff2',\n '.ttf': 'font/ttf',\n '.map': 'application/json',\n};\n\nconst SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];\n\nconst Spinner: FC = () => {\n const [frame, setFrame] = useState(0);\n\n useEffect(() => {\n const id = setInterval(() => {\n setFrame((prev) => (prev + 1) % SPINNER_FRAMES.length);\n }, 80);\n\n return () => {\n clearInterval(id);\n };\n }, []);\n\n return <Text color=\"cyan\">{SPINNER_FRAMES[frame] ?? '⠋'}</Text>;\n};\n\nfunction getViewerPath(): string {\n const filename = fileURLToPath(import.meta.url);\n return join(dirname(filename), 'viewer');\n}\n\nfunction getElectronMainPath(): string {\n const filename = fileURLToPath(import.meta.url);\n return join(dirname(filename), 'electron', 'main.js');\n}\n\nasync function fileExists(filePath: string): Promise<boolean> {\n try {\n await access(filePath);\n return true;\n } catch {\n return false;\n }\n}\n\nfunction createRequestHandler(\n viewerPath: string,\n createServerLog: (message: string) => void,\n createProxyLog: (message: string) => void,\n): (req: IncomingMessage, res: ServerResponse) => void {\n return (req, res) => {\n void (async () => {\n const url = req.url ?? '/';\n\n createServerLog(`Received request: ${url}`);\n\n if (url === '/api/bundle') {\n const bundlePath = join(process.cwd(), '.kizenapp', 'bundle.json');\n try {\n const content = await readFile(bundlePath, 'utf-8');\n res.writeHead(200, { 'Content-Type': 'application/json; charset=utf-8' });\n res.end(content);\n } catch {\n res.writeHead(200, { 'Content-Type': 'application/json; charset=utf-8' });\n res.end('{}');\n }\n return;\n }\n\n if (url.startsWith('/api/proxy')) {\n const proxyTarget = req.headers['x-proxy-target'];\n if (typeof proxyTarget !== 'string') {\n res.writeHead(400);\n res.end('Missing x-proxy-target header');\n return;\n }\n\n const upstreamPath = url.slice('/api/proxy'.length) || '/';\n const upstreamUrl = `${proxyTarget}${upstreamPath}`;\n\n const chunks: Buffer[] = [];\n for await (const chunk of req) {\n chunks.push(chunk as Buffer);\n }\n\n const body = chunks.length > 0 ? Buffer.concat(chunks) : undefined;\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { host, 'x-proxy-target': _drop, ...forwardHeaders } = req.headers;\n\n const resolvedBody = body && body.length > 0 ? body : undefined;\n const upstream = await fetch(upstreamUrl, {\n ...(req.method !== undefined && { method: req.method }),\n headers: forwardHeaders as Record<string, string>,\n ...(resolvedBody !== undefined && { body: resolvedBody }),\n });\n\n createProxyLog(`${req.method ?? 'GET'} ${upstreamPath} → ${String(upstream.status)}`);\n\n // Node fetch auto-decompresses the body, so strip encoding/length headers\n // that describe the compressed wire format — they no longer apply.\n const responseHeaders = Object.fromEntries(upstream.headers);\n delete responseHeaders['content-encoding'];\n delete responseHeaders['content-length'];\n\n res.writeHead(upstream.status, responseHeaders);\n res.end(Buffer.from(await upstream.arrayBuffer()));\n return;\n }\n\n const rawPath = url === '/' ? '/index.html' : url;\n const filePath = join(viewerPath, rawPath);\n const resolvedPath = (await fileExists(filePath)) ? filePath : join(viewerPath, 'index.html');\n const ext = extname(resolvedPath);\n const mimeType = MIME_TYPES[ext] ?? 'application/octet-stream';\n res.writeHead(200, { 'Content-Type': mimeType });\n createReadStream(resolvedPath).pipe(res);\n })();\n };\n}\n\nexport const DevUI: FC<DevUIProps> = ({ port, pluginDir, outputDir }) => {\n const [status, setStatus] = useState<ServerStatus>('starting');\n const [errorMessage, setErrorMessage] = useState<string | null>(null);\n const [serverLogHistory, setServerLogHistory] = useState<string[]>([]);\n const [buildLogHistory, setBuildLogHistory] = useState<string[]>([]);\n const [proxyLogHistory, setProxyLogHistory] = useState<string[]>([]);\n const [buildStatus, setBuildStatus] = useState<BuildStatus>('pending');\n const [buildError, setBuildError] = useState<string | null>(null);\n const [lastBuilt, setLastBuilt] = useState<Date | null>(null);\n const [wsClientCount, setWsClientCount] = useState(0);\n\n const buildingRef = useRef(false);\n const electronLaunchedRef = useRef(false);\n const debounceTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const wsClientsRef = useRef<Set<WebSocket>>(new Set());\n const pendingMessagesRef = useRef<string[]>([]);\n\n useInput((input, key) => {\n if (input === 'q' || (key.ctrl && input === 'c')) {\n process.exit(0);\n }\n });\n\n useEffect(() => {\n if (status !== 'running' || electronLaunchedRef.current) {\n return;\n }\n\n electronLaunchedRef.current = true;\n\n const _require = createRequire(import.meta.url);\n const electronBin = _require('electron') as string;\n const electronMain = getElectronMainPath();\n const userDataDir = join(outputDir, '.electron');\n\n // Patch Electron's CFBundleName so macOS shows \"Kizen Dev\" in the Dock.\n // Breaks the pnpm hard link first so the global content-addressable store is unaffected.\n if (process.platform === 'darwin') {\n try {\n const plistPath = join(dirname(dirname(electronBin)), 'Info.plist');\n const plist = readFileSync(plistPath, 'utf-8');\n if (!plist.includes('>Kizen Dev<')) {\n if (statSync(plistPath).nlink > 1) {\n unlinkSync(plistPath);\n writeFileSync(plistPath, plist);\n }\n writeFileSync(\n plistPath,\n plist\n .replace(/(<key>CFBundleName<\\/key>\\s*<string>)[^<]*(<\\/string>)/, '$1Kizen Dev$2')\n .replace(\n /(<key>CFBundleDisplayName<\\/key>\\s*<string>)[^<]*(<\\/string>)/,\n '$1Kizen Dev$2',\n ),\n );\n }\n } catch {\n // Non-fatal — Dock will show \"Electron\" if patching fails\n }\n }\n\n const proc = spawn(\n electronBin,\n [electronMain, `--port=${String(port)}`, `--user-data-dir=${userDataDir}`],\n {\n stdio: 'ignore',\n },\n );\n proc.unref();\n process.on('exit', () => {\n proc.kill();\n });\n }, [status, port, outputDir]);\n\n const createServerLog = useCallback((message: string): void => {\n setServerLogHistory((h) =>\n [...h, `${new Date().toLocaleTimeString()}: ${message}`].slice(-LOG_LIMIT),\n );\n }, []);\n\n const broadcast = useCallback((msg: object): void => {\n const json = JSON.stringify(msg);\n if (wsClientsRef.current.size === 0) {\n pendingMessagesRef.current = [...pendingMessagesRef.current, json].slice(-LOG_LIMIT);\n return;\n }\n for (const client of wsClientsRef.current) {\n if (client.readyState === 1) {\n client.send(json);\n }\n }\n }, []);\n\n const createProxyLog = useCallback(\n (message: string): void => {\n setProxyLogHistory((h) =>\n [...h, `${new Date().toLocaleTimeString()}: ${message}`].slice(-LOG_LIMIT),\n );\n broadcast({ type: 'proxy-log', message });\n },\n [broadcast],\n );\n\n const createBuildLog = useCallback(\n (message: string): void => {\n setBuildLogHistory((h) =>\n [...h, `${new Date().toLocaleTimeString()}: ${message}`].slice(-LOG_LIMIT),\n );\n broadcast({ type: 'log', message });\n },\n [broadcast],\n );\n\n const triggerBuild = useCallback(() => {\n if (buildingRef.current) {\n return;\n }\n\n buildingRef.current = true;\n\n setBuildStatus('building');\n setBuildError(null);\n createBuildLog('Build started');\n\n void runBuild(pluginDir, outputDir)\n .then(() => {\n createBuildLog('Build finished');\n setBuildStatus('done');\n setLastBuilt(new Date());\n\n createBuildLog('Notifying viewers to reload');\n for (const client of wsClientsRef.current) {\n if (client.readyState === 1) {\n client.send(JSON.stringify({ type: 'rebuild' }));\n }\n }\n })\n .catch((err: unknown) => {\n const message = err instanceof Error ? err.message : String(err);\n setBuildError(message);\n setBuildStatus('error');\n })\n .finally(() => {\n buildingRef.current = false;\n });\n }, [pluginDir, outputDir, createBuildLog]);\n\n useEffect(() => {\n triggerBuild();\n\n const watcher: FSWatcher = watch(pluginDir, { recursive: true }, (_, filename) => {\n if (!filename) {\n return;\n }\n\n const normalized = filename.replace(/\\\\/g, '/');\n\n if (SKIP_WATCH_PREFIXES.some((prefix) => normalized.startsWith(prefix))) {\n return;\n }\n\n createBuildLog(`File change detected: ${filename}`);\n\n if (debounceTimerRef.current !== null) {\n clearTimeout(debounceTimerRef.current);\n }\n debounceTimerRef.current = setTimeout(triggerBuild, 150);\n });\n\n return () => {\n watcher.close();\n\n if (debounceTimerRef.current !== null) {\n clearTimeout(debounceTimerRef.current);\n }\n };\n }, [pluginDir, triggerBuild, createBuildLog]);\n\n useEffect(() => {\n const viewerPath = getViewerPath();\n\n void fileExists(join(viewerPath, 'index.html')).then((viewerBuilt) => {\n if (!viewerBuilt) {\n setErrorMessage(\"Viewer not built. Run 'pnpm build:viewer' first.\");\n setStatus('error');\n return;\n }\n\n const handler = createRequestHandler(viewerPath, createServerLog, createProxyLog);\n const server: Server = createServer(handler);\n const wss = new WebSocketServer({ server });\n\n wss.on('connection', (ws: WebSocket) => {\n for (const json of pendingMessagesRef.current) {\n if (ws.readyState === 1) {\n ws.send(json);\n }\n }\n pendingMessagesRef.current = [];\n\n createServerLog('Viewer connected for live reload');\n wsClientsRef.current.add(ws);\n setWsClientCount(wsClientsRef.current.size);\n\n ws.on('close', () => {\n wsClientsRef.current.delete(ws);\n setWsClientCount(wsClientsRef.current.size);\n });\n });\n\n server.listen(port, () => {\n setStatus('running');\n createServerLog(`Server started on port ${String(port)}`);\n });\n\n server.on('error', (err: Error) => {\n setErrorMessage(err.message);\n setStatus('error');\n });\n\n return () => {\n wss.close();\n server.close();\n };\n });\n }, [port, createServerLog, createProxyLog]);\n\n const elapsedSeconds =\n lastBuilt !== null ? Math.round((Date.now() - lastBuilt.getTime()) / 1000) : null;\n const elapsedLabel =\n elapsedSeconds === null\n ? ''\n : elapsedSeconds < 5\n ? ' (just now)'\n : ` (${String(elapsedSeconds)}s ago)`;\n\n return (\n <Box flexDirection=\"column\" paddingY={1} paddingX={1}>\n {/* Header */}\n <Box flexDirection=\"column\" marginBottom={1}>\n <Box gap={1}>\n <Text bold color=\"cyan\">\n Kizen App Builder\n </Text>\n </Box>\n </Box>\n\n {/* Build log */}\n <Box flexDirection=\"column\">\n <Box gap={1} marginBottom={0}>\n {buildStatus === 'pending' && <Text dimColor>Build waiting...</Text>}\n {buildStatus === 'building' && (\n <>\n <Spinner />\n <Text>Building Plugin Package...</Text>\n </>\n )}\n {buildStatus === 'done' && (\n <Text color=\"green\">\n ✓ Built Plugin Package\n {lastBuilt !== null ? ` at ${lastBuilt.toLocaleTimeString()}` : ''}\n <Text dimColor>{elapsedLabel}</Text>\n </Text>\n )}\n {buildStatus === 'error' && (\n <Text color=\"red\">✗ Build error: {buildError ?? 'unknown error'}</Text>\n )}\n </Box>\n <Box\n flexDirection=\"column\"\n height={LOG_DISPLAY}\n borderStyle=\"round\"\n borderColor=\"gray\"\n overflow=\"hidden\"\n >\n {buildLogHistory.slice(-LOG_DISPLAY).map((log, index) => (\n <Text key={index} dimColor wrap=\"truncate\">\n {log}\n </Text>\n ))}\n </Box>\n </Box>\n\n {/* Web server log */}\n <Box marginTop={1} flexDirection=\"column\">\n <Box gap={2}>\n {status === 'starting' && <Text dimColor>Starting server...</Text>}\n {status === 'running' && (\n <>\n <Text color=\"green\">✓ Dev Server running</Text>\n <Text dimColor>\n ● {wsClientCount} viewer{wsClientCount !== 1 ? 's' : ''}\n </Text>\n </>\n )}\n {status === 'error' && <Text color=\"red\">✗ {errorMessage ?? 'Server error'}</Text>}\n </Box>\n <Box\n flexDirection=\"column\"\n height={LOG_DISPLAY}\n borderStyle=\"round\"\n borderColor=\"gray\"\n overflow=\"hidden\"\n >\n {serverLogHistory.slice(-LOG_DISPLAY).map((log, index) => (\n <Text key={index} dimColor wrap=\"truncate\">\n {log}\n </Text>\n ))}\n </Box>\n </Box>\n\n {/* Proxy log */}\n <Box marginTop={1} flexDirection=\"column\">\n <Text dimColor>Proxy</Text>\n <Box\n flexDirection=\"column\"\n height={LOG_DISPLAY}\n borderStyle=\"round\"\n borderColor=\"gray\"\n overflow=\"hidden\"\n >\n {proxyLogHistory.length === 0 ? (\n <Text dimColor> No proxy requests yet.</Text>\n ) : (\n proxyLogHistory.slice(-LOG_DISPLAY).map((log, i) => (\n <Text key={i} dimColor wrap=\"truncate\">\n {log}\n </Text>\n ))\n )}\n </Box>\n </Box>\n\n {/* Footer */}\n <Box marginTop={1}>\n <Text dimColor>q to quit</Text>\n </Box>\n </Box>\n );\n};\n"],"mappings":";;;AAAA,SAAS,eAAe;;;ACAxB,SAAS,qBAAqB;AAC9B,SAAS,cAAc;;;ACAvB,SAAS,WAAW,gBAAgB;AACpC,SAAS,KAAK,MAAM,cAAc;;;ACFlC,SAAS,OAAO,iBAAiB;AACjC,SAAS,QAAAA,aAAY;AACrB,SAAS,aAAa,eAAe,iCAAiC;;;ACFtE,SAAS,SAAS,gBAAgB;AAClC,SAAS,MAAM,gBAAgB;AAG/B,IAAM,mBAAmB,oBAAI,IAAI,CAAC,QAAQ,MAAM,CAAC;AACjD,IAAM,oBAAoB,oBAAI,IAAI,CAAC,MAAM,CAAC;AAE1C,IAAM,YAAY,oBAAI,IAAI,CAAC,gBAAgB,QAAQ,aAAa,SAAS,CAAC;AAE1E,eAAe,KAAK,KAAa,SAAoC;AACnE,QAAM,UAAU,MAAM,QAAQ,KAAK,EAAE,eAAe,KAAK,CAAC;AAC1D,QAAM,QAAkB,CAAC;AAEzB,aAAW,SAAS,SAAS;AAC3B,QAAI,MAAM,YAAY,GAAG;AACvB,UAAI,UAAU,IAAI,MAAM,IAAI,GAAG;AAC7B;AAAA,MACF;AAEA,YAAM,KAAK,GAAI,MAAM,KAAK,KAAK,KAAK,MAAM,IAAI,GAAG,OAAO,CAAE;AAAA,IAC5D,WAAW,MAAM,OAAO,GAAG;AACzB,YAAM,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AE,cAAc,IAAIC,QAAOC,eAAc,OAAO,EAAE,MAAM,WAAW,UAAU,CAAC,GAAG;AAAA,MACrF,aAAa;AAAA,IACf,CAAC;AACD,UAAM,cAAc;AAAA,EACtB,CAAC;AACL;;;ALfA,QAAQ,KAAK,YAAY,EAAE,YAAY,0BAA0B,EAAE,QAAQ,OAAO;AAElF,aAAa,OAAO;AACpB,WAAW,OAAO;AAElB,QAAQ,MAAM;","names":["join","join","program","createElement","render","useEffect","useState","Box","Text","readFile","join","Fragment","jsx","jsxs","SPINNER_FRAMES","Spinner","useState","useEffect","Text","join","readFile","Box","program","render","createElement"]}
|