@konomi-app/k2 2.1.3 → 2.1.5
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/index.d.ts +0 -2
- package/dist/index.js +551 -13
- package/dist/index.js.map +1 -1
- package/dist/plugin.d.ts +0 -2
- package/dist/plugin.js +1086 -23
- package/dist/plugin.js.map +1 -1
- package/package.json +5 -5
- package/dist/commands/build-base.d.ts +0 -6
- package/dist/commands/build-base.d.ts.map +0 -1
- package/dist/commands/build-base.js +0 -7
- package/dist/commands/build-base.js.map +0 -1
- package/dist/commands/build-esbuild.d.ts +0 -7
- package/dist/commands/build-esbuild.d.ts.map +0 -1
- package/dist/commands/build-esbuild.js +0 -63
- package/dist/commands/build-esbuild.js.map +0 -1
- package/dist/commands/build-tailwind.d.ts +0 -2
- package/dist/commands/build-tailwind.d.ts.map +0 -1
- package/dist/commands/build-tailwind.js +0 -19
- package/dist/commands/build-tailwind.js.map +0 -1
- package/dist/commands/build.d.ts +0 -7
- package/dist/commands/build.d.ts.map +0 -1
- package/dist/commands/build.js +0 -52
- package/dist/commands/build.js.map +0 -1
- package/dist/commands/dev/index.d.ts +0 -9
- package/dist/commands/dev/index.d.ts.map +0 -1
- package/dist/commands/dev/index.js +0 -60
- package/dist/commands/dev/index.js.map +0 -1
- package/dist/commands/dev/tailwind.d.ts +0 -5
- package/dist/commands/dev/tailwind.d.ts.map +0 -1
- package/dist/commands/dev/tailwind.js +0 -30
- package/dist/commands/dev/tailwind.js.map +0 -1
- package/dist/commands/dev-base-esbuild.d.ts +0 -8
- package/dist/commands/dev-base-esbuild.d.ts.map +0 -1
- package/dist/commands/dev-base-esbuild.js +0 -18
- package/dist/commands/dev-base-esbuild.js.map +0 -1
- package/dist/commands/genkey-base.d.ts +0 -4
- package/dist/commands/genkey-base.d.ts.map +0 -1
- package/dist/commands/genkey-base.js +0 -19
- package/dist/commands/genkey-base.js.map +0 -1
- package/dist/commands/genkey.d.ts +0 -5
- package/dist/commands/genkey.d.ts.map +0 -1
- package/dist/commands/genkey.js +0 -14
- package/dist/commands/genkey.js.map +0 -1
- package/dist/commands/lint.d.ts +0 -8
- package/dist/commands/lint.d.ts.map +0 -1
- package/dist/commands/lint.js +0 -20
- package/dist/commands/lint.js.map +0 -1
- package/dist/commands/manifest/index.d.ts +0 -2
- package/dist/commands/manifest/index.d.ts.map +0 -1
- package/dist/commands/manifest/index.js +0 -29
- package/dist/commands/manifest/index.js.map +0 -1
- package/dist/commands/plugin-build.d.ts +0 -3
- package/dist/commands/plugin-build.d.ts.map +0 -1
- package/dist/commands/plugin-build.js +0 -60
- package/dist/commands/plugin-build.js.map +0 -1
- package/dist/commands/plugin-dev/create-manifest.d.ts +0 -5
- package/dist/commands/plugin-dev/create-manifest.d.ts.map +0 -1
- package/dist/commands/plugin-dev/create-manifest.js +0 -30
- package/dist/commands/plugin-dev/create-manifest.js.map +0 -1
- package/dist/commands/plugin-dev/index.d.ts +0 -6
- package/dist/commands/plugin-dev/index.d.ts.map +0 -1
- package/dist/commands/plugin-dev/index.js +0 -50
- package/dist/commands/plugin-dev/index.js.map +0 -1
- package/dist/commands/plugin-dev/tailwind.d.ts +0 -2
- package/dist/commands/plugin-dev/tailwind.d.ts.map +0 -1
- package/dist/commands/plugin-dev/tailwind.js +0 -42
- package/dist/commands/plugin-dev/tailwind.js.map +0 -1
- package/dist/commands/plugin-dev/upload.d.ts +0 -5
- package/dist/commands/plugin-dev/upload.d.ts.map +0 -1
- package/dist/commands/plugin-dev/upload.js +0 -58
- package/dist/commands/plugin-dev/upload.js.map +0 -1
- package/dist/commands/plugin-esbuild.d.ts +0 -3
- package/dist/commands/plugin-esbuild.d.ts.map +0 -1
- package/dist/commands/plugin-esbuild.js +0 -66
- package/dist/commands/plugin-esbuild.js.map +0 -1
- package/dist/commands/plugin-genkey.d.ts +0 -3
- package/dist/commands/plugin-genkey.d.ts.map +0 -1
- package/dist/commands/plugin-genkey.js +0 -13
- package/dist/commands/plugin-genkey.js.map +0 -1
- package/dist/commands/plugin-init.d.ts +0 -3
- package/dist/commands/plugin-init.d.ts.map +0 -1
- package/dist/commands/plugin-init.js +0 -45
- package/dist/commands/plugin-init.js.map +0 -1
- package/dist/commands/plugin-tsup.d.ts +0 -3
- package/dist/commands/plugin-tsup.d.ts.map +0 -1
- package/dist/commands/plugin-tsup.js +0 -65
- package/dist/commands/plugin-tsup.js.map +0 -1
- package/dist/commands/plugin-zip.d.ts +0 -2
- package/dist/commands/plugin-zip.d.ts.map +0 -1
- package/dist/commands/plugin-zip.js +0 -50
- package/dist/commands/plugin-zip.js.map +0 -1
- package/dist/commands/test/index.d.ts +0 -3
- package/dist/commands/test/index.d.ts.map +0 -1
- package/dist/commands/test/index.js +0 -17
- package/dist/commands/test/index.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/lib/cert.d.ts +0 -4
- package/dist/lib/cert.d.ts.map +0 -1
- package/dist/lib/cert.js +0 -16
- package/dist/lib/cert.js.map +0 -1
- package/dist/lib/constants.d.ts +0 -13
- package/dist/lib/constants.d.ts.map +0 -1
- package/dist/lib/constants.js +0 -14
- package/dist/lib/constants.js.map +0 -1
- package/dist/lib/esbuild.d.ts +0 -6
- package/dist/lib/esbuild.d.ts.map +0 -1
- package/dist/lib/esbuild.js +0 -39
- package/dist/lib/esbuild.js.map +0 -1
- package/dist/lib/exec.d.ts +0 -3
- package/dist/lib/exec.d.ts.map +0 -1
- package/dist/lib/exec.js +0 -4
- package/dist/lib/exec.js.map +0 -1
- package/dist/lib/import.d.ts +0 -4
- package/dist/lib/import.d.ts.map +0 -1
- package/dist/lib/import.js +0 -18
- package/dist/lib/import.js.map +0 -1
- package/dist/lib/k2.d.ts +0 -2
- package/dist/lib/k2.d.ts.map +0 -1
- package/dist/lib/k2.js +0 -9
- package/dist/lib/k2.js.map +0 -1
- package/dist/lib/kintone-api-client.d.ts +0 -57
- package/dist/lib/kintone-api-client.d.ts.map +0 -1
- package/dist/lib/kintone-api-client.js +0 -95
- package/dist/lib/kintone-api-client.js.map +0 -1
- package/dist/lib/lint.d.ts +0 -2
- package/dist/lib/lint.d.ts.map +0 -1
- package/dist/lib/lint.js +0 -28
- package/dist/lib/lint.js.map +0 -1
- package/dist/lib/plugin-contents.d.ts +0 -5
- package/dist/lib/plugin-contents.d.ts.map +0 -1
- package/dist/lib/plugin-contents.js +0 -28
- package/dist/lib/plugin-contents.js.map +0 -1
- package/dist/lib/plugin-manifest.d.ts +0 -4
- package/dist/lib/plugin-manifest.d.ts.map +0 -1
- package/dist/lib/plugin-manifest.js +0 -13
- package/dist/lib/plugin-manifest.js.map +0 -1
- package/dist/lib/tailwind.d.ts +0 -33
- package/dist/lib/tailwind.d.ts.map +0 -1
- package/dist/lib/tailwind.js +0 -91
- package/dist/lib/tailwind.js.map +0 -1
- package/dist/lib/tsup.d.ts +0 -3
- package/dist/lib/tsup.d.ts.map +0 -1
- package/dist/lib/tsup.js +0 -26
- package/dist/lib/tsup.js.map +0 -1
- package/dist/lib/utils.d.ts +0 -16
- package/dist/lib/utils.d.ts.map +0 -1
- package/dist/lib/utils.js +0 -66
- package/dist/lib/utils.js.map +0 -1
- package/dist/lib/webpack.d.ts +0 -6
- package/dist/lib/webpack.d.ts.map +0 -1
- package/dist/lib/webpack.js +0 -72
- package/dist/lib/webpack.js.map +0 -1
- package/dist/lib/zip.d.ts +0 -4
- package/dist/lib/zip.d.ts.map +0 -1
- package/dist/lib/zip.js +0 -65
- package/dist/lib/zip.js.map +0 -1
- package/dist/plugin.d.ts.map +0 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,15 +1,553 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import { program as program6 } from "commander";
|
|
5
|
+
|
|
6
|
+
// src/commands/build.ts
|
|
7
|
+
import { program } from "commander";
|
|
8
|
+
import fs2 from "fs-extra";
|
|
9
|
+
import path6 from "path";
|
|
10
|
+
|
|
11
|
+
// src/lib/constants.ts
|
|
12
|
+
import path from "path";
|
|
13
|
+
var WORKSPACE_DIRECTORY = ".k2";
|
|
14
|
+
var DEVELOPMENT_DIRECTORY = path.join(WORKSPACE_DIRECTORY, "dev");
|
|
15
|
+
var CONFIG_FILE_NAME = "k2.config.mjs";
|
|
16
|
+
var PLUGIN_WORKSPACE_DIRECTORY = ".plugin";
|
|
17
|
+
var PLUGIN_CONTENTS_DIRECTORY = path.join(PLUGIN_WORKSPACE_DIRECTORY, "contents");
|
|
18
|
+
var PLUGIN_DEVELOPMENT_DIRECTORY = path.join(PLUGIN_WORKSPACE_DIRECTORY, "dev");
|
|
19
|
+
var DEFAULT_PORT = 32767;
|
|
20
|
+
|
|
21
|
+
// src/commands/build-base.ts
|
|
22
|
+
import "webpack";
|
|
23
|
+
|
|
24
|
+
// src/lib/webpack.ts
|
|
25
|
+
import MiniCssExtractPlugin from "mini-css-extract-plugin";
|
|
26
|
+
import path2 from "path";
|
|
27
|
+
import { cwd } from "process";
|
|
28
|
+
import TerserPlugin from "terser-webpack-plugin";
|
|
29
|
+
import webpack from "webpack";
|
|
30
|
+
import chalk from "chalk";
|
|
31
|
+
import { TsconfigPathsPlugin } from "tsconfig-paths-webpack-plugin";
|
|
32
|
+
var buildWithWebpack = async (props) => {
|
|
33
|
+
const { entries, outDir } = props;
|
|
34
|
+
const exclude = /node_modules/;
|
|
35
|
+
const styleLoader = MiniCssExtractPlugin.loader;
|
|
36
|
+
const tsConfigPath = path2.join(cwd(), "tsconfig.json");
|
|
37
|
+
console.group(chalk.blue("\u{1F680} Building with Webpack..."));
|
|
38
|
+
console.log("\u{1F527} tsconfig.json path:", tsConfigPath);
|
|
39
|
+
console.groupEnd();
|
|
40
|
+
return new Promise((resolve, reject) => {
|
|
41
|
+
webpack(
|
|
42
|
+
{
|
|
43
|
+
mode: "production",
|
|
44
|
+
target: ["web", "es2023"],
|
|
45
|
+
entry: entries,
|
|
46
|
+
resolve: {
|
|
47
|
+
extensions: [".ts", ".tsx", ".js", ".json"],
|
|
48
|
+
fallback: {
|
|
49
|
+
path: false
|
|
50
|
+
},
|
|
51
|
+
plugins: [new TsconfigPathsPlugin({ configFile: tsConfigPath })]
|
|
52
|
+
},
|
|
53
|
+
cache: { type: "filesystem" },
|
|
54
|
+
output: { filename: "[name].js", path: path2.resolve(outDir) },
|
|
55
|
+
module: {
|
|
56
|
+
rules: [
|
|
57
|
+
{ test: /\.tsx?$/, exclude, loader: "ts-loader" },
|
|
58
|
+
{ test: /\.css$/, use: [styleLoader, "css-loader"] },
|
|
59
|
+
{
|
|
60
|
+
test: /\.scss$/,
|
|
61
|
+
use: [
|
|
62
|
+
styleLoader,
|
|
63
|
+
"css-loader",
|
|
64
|
+
{ loader: "sass-loader", options: { sassOptions: { outputStyle: "expanded" } } }
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
plugins: [new MiniCssExtractPlugin()],
|
|
70
|
+
optimization: {
|
|
71
|
+
minimize: true,
|
|
72
|
+
minimizer: [
|
|
73
|
+
new TerserPlugin({
|
|
74
|
+
terserOptions: { format: { comments: false } },
|
|
75
|
+
extractComments: false
|
|
76
|
+
})
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
(err, stats) => {
|
|
81
|
+
if (err) {
|
|
82
|
+
reject(err);
|
|
83
|
+
} else {
|
|
84
|
+
if (stats?.compilation.errors.length) {
|
|
85
|
+
reject(
|
|
86
|
+
[
|
|
87
|
+
chalk.red("\u26A0 Build failed."),
|
|
88
|
+
...stats.compilation.errors.map((error) => error.message)
|
|
89
|
+
].join("\n")
|
|
90
|
+
);
|
|
91
|
+
} else {
|
|
92
|
+
resolve();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// src/commands/build-base.ts
|
|
101
|
+
async function action(params) {
|
|
102
|
+
const { entries, outDir } = params;
|
|
103
|
+
return buildWithWebpack({ entries, outDir });
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// src/commands/build-tailwind.ts
|
|
107
|
+
import path5 from "path";
|
|
108
|
+
|
|
109
|
+
// src/lib/import.ts
|
|
110
|
+
import { pathToFileURL } from "url";
|
|
111
|
+
import path3 from "path";
|
|
112
|
+
var esmImport = (path12) => {
|
|
113
|
+
if (process.platform === "win32") {
|
|
114
|
+
return import(pathToFileURL(path12).toString());
|
|
115
|
+
} else {
|
|
116
|
+
return import(path12);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
var importK2Config = async (configFileName) => {
|
|
120
|
+
return (await esmImport(path3.resolve(configFileName ?? CONFIG_FILE_NAME))).default;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
// src/lib/tailwind.ts
|
|
124
|
+
import chokidar from "chokidar";
|
|
125
|
+
import cssnanoPlugin from "cssnano";
|
|
126
|
+
import fs from "fs-extra";
|
|
127
|
+
import { glob } from "glob";
|
|
128
|
+
import path4 from "path";
|
|
129
|
+
import postcss from "postcss";
|
|
130
|
+
import { debounce } from "remeda";
|
|
131
|
+
import tailwindcss from "tailwindcss";
|
|
132
|
+
import invariant from "tiny-invariant";
|
|
133
|
+
var getTailwindConfigFromK2Config = async (k2Config) => {
|
|
134
|
+
invariant(k2Config?.config, "tailwind.config is required");
|
|
135
|
+
const config = (await esmImport(path4.resolve(k2Config?.config))).default;
|
|
136
|
+
return config;
|
|
137
|
+
};
|
|
138
|
+
var outputCss = async (params) => {
|
|
139
|
+
const { inputPath, outputPath, config, minify = false } = params;
|
|
140
|
+
const css = await fs.readFile(inputPath, "utf8");
|
|
141
|
+
const result = await postcss([tailwindcss(config), ...minify ? [cssnanoPlugin()] : []]).process(
|
|
142
|
+
css,
|
|
143
|
+
{
|
|
144
|
+
from: inputPath,
|
|
145
|
+
to: outputPath
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
await fs.writeFile(outputPath, result.css);
|
|
149
|
+
if (result.map) {
|
|
150
|
+
await fs.writeFile(`${outputPath}.map`, result.map.toString());
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
var watchTailwindCSS = async (params) => {
|
|
154
|
+
const { input, output, config } = params;
|
|
155
|
+
const content = config.content ?? ["./src/**/*.{ts,tsx}"];
|
|
156
|
+
const files = await glob([...content, input], { ignore: ["**/node_modules/**"] });
|
|
157
|
+
const watcher = chokidar.watch(files, {
|
|
158
|
+
persistent: true,
|
|
159
|
+
ignoreInitial: true
|
|
160
|
+
});
|
|
161
|
+
let isInitialized = false;
|
|
162
|
+
const processChanges = async (type) => {
|
|
163
|
+
try {
|
|
164
|
+
await outputCss({ inputPath: input, outputPath: output, config });
|
|
165
|
+
params.onChanges?.({ input, output, type });
|
|
166
|
+
} catch (error) {
|
|
167
|
+
console.error("Error building Tailwind CSS:", error);
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
const debouncedProcessChanges = debounce(processChanges, { waitMs: 1e3 });
|
|
171
|
+
watcher.on("ready", async () => {
|
|
172
|
+
if (!isInitialized) {
|
|
173
|
+
isInitialized = true;
|
|
174
|
+
await processChanges("init");
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
watcher.on("error", (error) => {
|
|
178
|
+
console.error("Error watching Tailwind CSS:", error);
|
|
179
|
+
});
|
|
180
|
+
watcher.on("add", (path12) => {
|
|
181
|
+
debouncedProcessChanges.call("add");
|
|
182
|
+
});
|
|
183
|
+
watcher.on("change", (path12) => {
|
|
184
|
+
debouncedProcessChanges.call("change");
|
|
185
|
+
});
|
|
186
|
+
watcher.on("unlink", (path12) => {
|
|
187
|
+
debouncedProcessChanges.call("unlink");
|
|
188
|
+
});
|
|
189
|
+
watcher.on("unlinkDir", (path12) => {
|
|
190
|
+
debouncedProcessChanges.call("unlink");
|
|
191
|
+
});
|
|
192
|
+
return watcher;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
// src/commands/build-tailwind.ts
|
|
196
|
+
var buildTailwind = async (config) => {
|
|
197
|
+
if (!config.tailwind?.css || !config.tailwind?.config) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
const tailwindConfig = (await esmImport(path5.resolve(config.tailwind.config))).default;
|
|
201
|
+
const inputPath = path5.resolve(config.tailwind.css);
|
|
202
|
+
const fileName = config.tailwind.fileName ?? "tailwind.css";
|
|
203
|
+
await outputCss({
|
|
204
|
+
inputPath,
|
|
205
|
+
outputPath: path5.join(config.outDir, fileName),
|
|
206
|
+
config: tailwindConfig,
|
|
207
|
+
minify: true
|
|
208
|
+
});
|
|
209
|
+
console.log(`\u2728 Built ${fileName}`);
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
// src/lib/k2.ts
|
|
213
|
+
var getDefaultK2Config = () => {
|
|
214
|
+
return {
|
|
215
|
+
version: 1,
|
|
216
|
+
server: {
|
|
217
|
+
port: 32768
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
// src/commands/build.ts
|
|
223
|
+
function command() {
|
|
224
|
+
program.command("build").option("-o, --outdir <outdir>", "Output directory.", path6.join(WORKSPACE_DIRECTORY, "prod")).option("-i, --input <input>", "Input directory.", path6.join("src", "apps")).option("--config <config>", "k2 config file path").description("Build the project for production. (It's a wrapper of webpack build command.)").action(action2);
|
|
225
|
+
}
|
|
226
|
+
async function action2(options) {
|
|
227
|
+
console.group("\u{1F373} Build the project for production");
|
|
228
|
+
try {
|
|
229
|
+
const { outdir, input, config } = options;
|
|
230
|
+
const outDir = path6.resolve(outdir);
|
|
231
|
+
const allProjects = fs2.readdirSync(path6.resolve(input));
|
|
232
|
+
const entries = allProjects.reduce((acc, dir) => {
|
|
233
|
+
for (const filename of ["index.ts", "index.js", "index.mjs"]) {
|
|
234
|
+
if (fs2.existsSync(path6.join(input, dir, filename))) {
|
|
235
|
+
return { ...acc, [dir]: path6.join(input, dir, filename) };
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return acc;
|
|
239
|
+
}, {});
|
|
240
|
+
const k2Config = config ? await importK2Config(config) : getDefaultK2Config();
|
|
241
|
+
const fullConfig = { ...k2Config, outDir };
|
|
242
|
+
const results = await Promise.allSettled([
|
|
243
|
+
action({ entries, outDir }),
|
|
244
|
+
buildTailwind(fullConfig)
|
|
245
|
+
]);
|
|
246
|
+
for (const result of results) {
|
|
247
|
+
if (result.status === "rejected") {
|
|
248
|
+
throw result.reason;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
console.log("\u2728 Build success.");
|
|
252
|
+
} catch (error) {
|
|
253
|
+
throw error;
|
|
254
|
+
} finally {
|
|
255
|
+
console.groupEnd();
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// src/commands/dev/index.ts
|
|
260
|
+
import { program as program2 } from "commander";
|
|
261
|
+
import "esbuild";
|
|
262
|
+
import fs4 from "fs-extra";
|
|
263
|
+
import path9 from "path";
|
|
264
|
+
|
|
265
|
+
// src/commands/dev-base-esbuild.ts
|
|
266
|
+
import "esbuild";
|
|
267
|
+
import path7 from "path";
|
|
268
|
+
|
|
269
|
+
// src/lib/esbuild.ts
|
|
270
|
+
import chalk2 from "chalk";
|
|
271
|
+
import esbuild from "esbuild";
|
|
272
|
+
var completeBuildOptions = (params) => {
|
|
273
|
+
return {
|
|
274
|
+
bundle: true,
|
|
275
|
+
platform: "browser",
|
|
276
|
+
...params,
|
|
277
|
+
plugins: [...params.plugins ?? []]
|
|
278
|
+
};
|
|
279
|
+
};
|
|
280
|
+
var completeDevBuildOptions = (params) => {
|
|
281
|
+
return completeBuildOptions({
|
|
282
|
+
...params,
|
|
283
|
+
plugins: [
|
|
284
|
+
...params.plugins ?? [],
|
|
285
|
+
{
|
|
286
|
+
name: "on-end",
|
|
287
|
+
setup: ({ onEnd }) => onEnd(
|
|
288
|
+
() => console.log(
|
|
289
|
+
chalk2.hex("#e5e7eb")(`${(/* @__PURE__ */ new Date()).toLocaleTimeString()} `) + chalk2.cyan(`[js] `) + `rebuilt`
|
|
290
|
+
)
|
|
291
|
+
)
|
|
292
|
+
}
|
|
293
|
+
]
|
|
294
|
+
});
|
|
295
|
+
};
|
|
296
|
+
var getEsbuildContext = async (params) => {
|
|
297
|
+
return esbuild.context(completeDevBuildOptions(params));
|
|
298
|
+
};
|
|
299
|
+
var buildWithEsbuild = async (params) => {
|
|
300
|
+
const { watch = false, ...rest } = params;
|
|
301
|
+
if (watch) {
|
|
302
|
+
const context = await getEsbuildContext(rest);
|
|
303
|
+
context.watch();
|
|
304
|
+
} else {
|
|
305
|
+
const options = completeBuildOptions(rest);
|
|
306
|
+
await esbuild.build(options);
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
// src/commands/dev-base-esbuild.ts
|
|
311
|
+
async function action3(params) {
|
|
312
|
+
const { entryPoints, staticDir: outdir, certDir, port } = params;
|
|
313
|
+
const context = await getEsbuildContext({ sourcemap: "inline", entryPoints, outdir });
|
|
314
|
+
const [_, serveResult] = await Promise.all([
|
|
315
|
+
context.watch(),
|
|
316
|
+
context.serve({
|
|
317
|
+
port,
|
|
318
|
+
keyfile: path7.join(certDir, "localhost-key.pem"),
|
|
319
|
+
certfile: path7.join(certDir, "localhost-cert.pem"),
|
|
320
|
+
servedir: outdir
|
|
321
|
+
})
|
|
322
|
+
]);
|
|
323
|
+
console.log(`\u{1F680} Start development server at https://localhost:${serveResult.port}`);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// src/commands/dev/tailwind.ts
|
|
327
|
+
import path8 from "path";
|
|
328
|
+
import chalk3 from "chalk";
|
|
329
|
+
import fs3 from "fs-extra";
|
|
330
|
+
var watchCss = async (params) => {
|
|
331
|
+
const { k2Config, outdir } = params;
|
|
332
|
+
if (!k2Config.tailwind?.css || !k2Config.tailwind?.config) {
|
|
333
|
+
console.log("\u{1F6AB} missing tailwind config. Skip watching css.");
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
const tailwindConfig = await getTailwindConfigFromK2Config(k2Config.tailwind);
|
|
337
|
+
const input = path8.resolve(k2Config.tailwind.css);
|
|
338
|
+
const output = path8.join(outdir, "tailwind.css");
|
|
339
|
+
if (!await fs3.pathExists(output)) {
|
|
340
|
+
await fs3.outputFile(output, "");
|
|
341
|
+
}
|
|
342
|
+
return watchTailwindCSS({
|
|
343
|
+
input,
|
|
344
|
+
output: path8.join(outdir, "tailwind.css"),
|
|
345
|
+
config: tailwindConfig,
|
|
346
|
+
onChanges: ({ output: output2, type }) => {
|
|
347
|
+
const outputFileName = path8.basename(output2);
|
|
348
|
+
console.log(
|
|
349
|
+
chalk3.hex("#e5e7eb")(`${(/* @__PURE__ */ new Date()).toLocaleTimeString()} `) + chalk3.cyan(`[css] `) + outputFileName + (type === "init" ? " init" : ` rebuilt(${type})`)
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
// src/commands/dev/index.ts
|
|
356
|
+
function command2() {
|
|
357
|
+
program2.command("dev").description("Start development server.").option("-i, --input <input>", "Input directory", "src/apps").option("-o, --outdir <outdir>", "Output directory.", DEVELOPMENT_DIRECTORY).option("-c, --certdir <certdir>", "Certificate directory", WORKSPACE_DIRECTORY).option("--config <config>", "k2 config file path").option("-p, --port <port>", "Port number").action(action4);
|
|
358
|
+
}
|
|
359
|
+
async function action4(options) {
|
|
360
|
+
const { certdir, outdir, config, port: specifiedPort, input } = options;
|
|
361
|
+
console.group("\u{1F373} Start development server");
|
|
362
|
+
try {
|
|
363
|
+
console.log(`\u{1F4C2} Output directory: ${outdir}`);
|
|
364
|
+
console.log(`\u{1F511} Certificate directory: ${certdir}`);
|
|
365
|
+
let k2Config = null;
|
|
366
|
+
try {
|
|
367
|
+
k2Config = await importK2Config(config);
|
|
368
|
+
} catch (error) {
|
|
369
|
+
console.log(`\u2699 ${CONFIG_FILE_NAME} not found. use default settings.`);
|
|
370
|
+
}
|
|
371
|
+
const port = Number(specifiedPort ?? k2Config?.server?.port ?? DEFAULT_PORT);
|
|
372
|
+
await Promise.all([
|
|
373
|
+
build({ certdir, outdir, port, input }),
|
|
374
|
+
watchCss({ k2Config: k2Config ?? {}, outdir })
|
|
375
|
+
]);
|
|
376
|
+
} catch (error) {
|
|
377
|
+
throw error;
|
|
378
|
+
} finally {
|
|
379
|
+
console.groupEnd();
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
var build = async (params) => {
|
|
383
|
+
const { outdir, certdir, port, input } = params;
|
|
384
|
+
const srcDir = path9.resolve(input);
|
|
385
|
+
const dirs = fs4.readdirSync(srcDir);
|
|
386
|
+
const entryPoints = dirs.reduce(
|
|
387
|
+
(acc, dir) => {
|
|
388
|
+
for (const filename of ["index.ts", "index.js", "index.mjs"]) {
|
|
389
|
+
if (fs4.existsSync(path9.join(srcDir, dir, filename))) {
|
|
390
|
+
return [...acc, { in: path9.join(srcDir, dir, filename), out: dir }];
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
return acc;
|
|
394
|
+
},
|
|
395
|
+
[]
|
|
396
|
+
);
|
|
397
|
+
return action3({ port, entryPoints, certDir: certdir, staticDir: outdir });
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
// src/commands/genkey.ts
|
|
401
|
+
import { program as program3 } from "commander";
|
|
402
|
+
|
|
403
|
+
// src/lib/exec.ts
|
|
404
|
+
import { exec as defaultExec } from "child_process";
|
|
405
|
+
import { promisify } from "util";
|
|
406
|
+
var exec = promisify(defaultExec);
|
|
407
|
+
|
|
408
|
+
// src/lib/cert.ts
|
|
409
|
+
import fs5 from "fs-extra";
|
|
410
|
+
import path10 from "path";
|
|
411
|
+
var generateCert = async (outDir) => {
|
|
412
|
+
const { stdout } = await exec(`mkcert localhost 127.0.0.1 ::1`);
|
|
413
|
+
[
|
|
414
|
+
{ input: "localhost+2.pem", output: "localhost-cert.pem" },
|
|
415
|
+
{ input: "localhost+2-key.pem", output: "localhost-key.pem" }
|
|
416
|
+
].forEach(({ input, output }) => {
|
|
417
|
+
fs5.moveSync(`./${input}`, path10.join(outDir, output), {
|
|
418
|
+
overwrite: true
|
|
419
|
+
});
|
|
420
|
+
});
|
|
421
|
+
return { stdout };
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
// src/commands/genkey-base.ts
|
|
425
|
+
async function action5(options) {
|
|
426
|
+
const { output } = options;
|
|
427
|
+
console.group("\u{1F373} Generate SSL key for localhost");
|
|
428
|
+
try {
|
|
429
|
+
const { stdout } = await generateCert(output);
|
|
430
|
+
if (stdout) {
|
|
431
|
+
console.log(stdout);
|
|
432
|
+
}
|
|
433
|
+
console.log(`\u{1F511} key generation success. Output to ./${output}`);
|
|
434
|
+
} catch (error) {
|
|
435
|
+
throw error;
|
|
436
|
+
} finally {
|
|
437
|
+
console.groupEnd();
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
// src/commands/genkey.ts
|
|
442
|
+
function command3() {
|
|
443
|
+
program3.command("genkey").description("Generate SSL key for localhost. (Require mkcert)").option("-o, --output <output>", "Output directory.", WORKSPACE_DIRECTORY).action(action6);
|
|
444
|
+
}
|
|
445
|
+
async function action6(options) {
|
|
446
|
+
await action5(options);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
// src/commands/build-esbuild.ts
|
|
450
|
+
import { program as program4 } from "commander";
|
|
451
|
+
import fs6 from "fs-extra";
|
|
452
|
+
import path11 from "path";
|
|
453
|
+
import "esbuild";
|
|
454
|
+
function command4() {
|
|
455
|
+
program4.command("esbuild-build").option("-o, --outdir <outdir>", "Output directory.", path11.join(WORKSPACE_DIRECTORY, "prod")).option("-i, --input <input>", "Input directory.", path11.join("src", "apps")).option("--config <config>", "k2 config file path").description("Build the project for production. (It's a wrapper of webpack build command.)").action(action7);
|
|
456
|
+
}
|
|
457
|
+
async function action7(options) {
|
|
458
|
+
console.group("\u{1F373} Build the project for production");
|
|
459
|
+
try {
|
|
460
|
+
const { outdir, input, config } = options;
|
|
461
|
+
const outDir = path11.resolve(outdir);
|
|
462
|
+
if (!fs6.existsSync(outDir)) {
|
|
463
|
+
fs6.mkdirSync(outDir, { recursive: true });
|
|
464
|
+
}
|
|
465
|
+
const allProjects = fs6.readdirSync(path11.resolve(input));
|
|
466
|
+
const entryPoints = allProjects.reduce((acc, dir) => {
|
|
467
|
+
for (const filename of ["index.ts", "index.js", "index.mjs"]) {
|
|
468
|
+
if (fs6.existsSync(path11.join(input, dir, filename))) {
|
|
469
|
+
return { ...acc, [dir]: path11.join(input, dir, filename) };
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
return acc;
|
|
473
|
+
}, {});
|
|
474
|
+
console.log(`\u{1F4C1} ${Object.keys(entryPoints).length} entry points`);
|
|
475
|
+
const k2Config = config ? await importK2Config(config) : getDefaultK2Config();
|
|
476
|
+
const fullConfig = { ...k2Config, outDir };
|
|
477
|
+
const results = await Promise.allSettled([
|
|
478
|
+
buildWithEsbuild({
|
|
479
|
+
entryPoints,
|
|
480
|
+
outdir,
|
|
481
|
+
sourcemap: false,
|
|
482
|
+
minify: true,
|
|
483
|
+
legalComments: "none"
|
|
484
|
+
}),
|
|
485
|
+
buildTailwind(fullConfig)
|
|
486
|
+
]);
|
|
487
|
+
for (const result of results) {
|
|
488
|
+
if (result.status === "rejected") {
|
|
489
|
+
throw result.reason;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
console.log("\u2728 Build success.");
|
|
493
|
+
} catch (error) {
|
|
494
|
+
throw error;
|
|
495
|
+
} finally {
|
|
496
|
+
console.groupEnd();
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
// src/commands/lint.ts
|
|
501
|
+
import { program as program5 } from "commander";
|
|
502
|
+
|
|
503
|
+
// src/lib/lint.ts
|
|
504
|
+
import { ESLint } from "eslint";
|
|
505
|
+
import globals from "globals";
|
|
506
|
+
import pluginJs from "@eslint/js";
|
|
507
|
+
import "typescript-eslint";
|
|
508
|
+
import pluginReact from "eslint-plugin-react";
|
|
509
|
+
async function lint() {
|
|
510
|
+
const eslint = new ESLint({
|
|
511
|
+
baseConfig: [
|
|
512
|
+
{ files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"] },
|
|
513
|
+
{ languageOptions: { globals: globals.browser } },
|
|
514
|
+
pluginJs.configs.recommended,
|
|
515
|
+
// ...tseslint.configs.recommended,
|
|
516
|
+
...pluginReact.configs.flat?.recommended ? [pluginReact.configs.flat.recommended] : []
|
|
517
|
+
]
|
|
518
|
+
});
|
|
519
|
+
const results = await eslint.lintFiles(["src/**/*.{ts,tsx?}"]);
|
|
520
|
+
const formatter = await eslint.loadFormatter("stylish");
|
|
521
|
+
const resultText = formatter.format(results);
|
|
522
|
+
console.group("\u{1F455} Lint Results");
|
|
523
|
+
console.log(resultText);
|
|
524
|
+
console.groupEnd();
|
|
525
|
+
const hasErrors = results.some((result) => result.errorCount > 0);
|
|
526
|
+
if (hasErrors) {
|
|
527
|
+
console.error("\u{1F6A8} Lint errors found");
|
|
528
|
+
process.exit(1);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
// src/commands/lint.ts
|
|
533
|
+
function command5() {
|
|
534
|
+
program5.command("lint").description("Lint source files").option("-c, --config <config>", "Config file path").action(action8);
|
|
535
|
+
}
|
|
536
|
+
async function action8(options) {
|
|
537
|
+
try {
|
|
538
|
+
lint();
|
|
539
|
+
} catch (error) {
|
|
540
|
+
throw error;
|
|
541
|
+
} finally {
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
// src/index.ts
|
|
546
|
+
program6.name("k2").version("1.12.0").description("k2 - \u{1F373} kintone kitchen \u{1F373}");
|
|
547
|
+
command();
|
|
548
|
+
command4();
|
|
549
|
+
command2();
|
|
550
|
+
command3();
|
|
551
|
+
command5();
|
|
552
|
+
program6.parse(process.argv);
|
|
15
553
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,qBAAqB,CAAC;AACxC,OAAO,GAAG,MAAM,yBAAyB,CAAC;AAC1C,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAC1C,OAAO,YAAY,MAAM,6BAA6B,CAAC;AACvD,OAAO,IAAI,MAAM,oBAAoB,CAAC;AAEtC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,4BAA4B,CAAC,CAAC;AAE/E,KAAK,EAAE,CAAC;AACR,YAAY,EAAE,CAAC;AACf,GAAG,EAAE,CAAC;AACN,MAAM,EAAE,CAAC;AACT,IAAI,EAAE,CAAC;AAEP,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/commands/build.ts","../src/lib/constants.ts","../src/commands/build-base.ts","../src/lib/webpack.ts","../src/commands/build-tailwind.ts","../src/lib/import.ts","../src/lib/tailwind.ts","../src/lib/k2.ts","../src/commands/dev/index.ts","../src/commands/dev-base-esbuild.ts","../src/lib/esbuild.ts","../src/commands/dev/tailwind.ts","../src/commands/genkey.ts","../src/lib/exec.ts","../src/lib/cert.ts","../src/commands/genkey-base.ts","../src/commands/build-esbuild.ts","../src/commands/lint.ts","../src/lib/lint.ts"],"sourcesContent":["#!/usr/bin/env node\r\nimport { program } from 'commander';\r\nimport build from './commands/build.js';\r\nimport dev from './commands/dev/index.js';\r\nimport genkey from './commands/genkey.js';\r\nimport esbuildBuild from './commands/build-esbuild.js';\r\nimport lint from './commands/lint.js';\r\n\r\nprogram.name('k2').version('1.12.0').description('k2 - 🍳 kintone kitchen 🍳');\r\n\r\nbuild();\r\nesbuildBuild();\r\ndev();\r\ngenkey();\r\nlint();\r\n\r\nprogram.parse(process.argv);\r\n","import { program } from 'commander';\nimport fs from 'fs-extra';\nimport path from 'path';\nimport { WORKSPACE_DIRECTORY } from '../lib/constants.js';\nimport base from './build-base.js';\nimport { buildTailwind } from './build-tailwind.js';\nimport { importK2Config } from '../lib/import.js';\nimport { getDefaultK2Config } from '../lib/k2.js';\n\nexport default function command() {\n program\n .command('build')\n .option('-o, --outdir <outdir>', 'Output directory.', path.join(WORKSPACE_DIRECTORY, 'prod'))\n .option('-i, --input <input>', 'Input directory.', path.join('src', 'apps'))\n .option('--config <config>', 'k2 config file path')\n .description(\"Build the project for production. (It's a wrapper of webpack build command.)\")\n .action(action);\n}\n\nexport async function action(options: { outdir: string; input: string; config?: string }) {\n console.group('🍳 Build the project for production');\n\n try {\n const { outdir, input, config } = options;\n const outDir = path.resolve(outdir);\n\n const allProjects = fs.readdirSync(path.resolve(input));\n\n const entries = allProjects.reduce<Record<string, string>>((acc, dir) => {\n for (const filename of ['index.ts', 'index.js', 'index.mjs']) {\n if (fs.existsSync(path.join(input, dir, filename))) {\n return { ...acc, [dir]: path.join(input, dir, filename) };\n }\n }\n return acc;\n }, {});\n\n const k2Config = config ? await importK2Config(config) : getDefaultK2Config();\n const fullConfig: K2.FullConfig = { ...k2Config, outDir };\n\n const results = await Promise.allSettled([\n base({ entries, outDir }),\n buildTailwind(fullConfig),\n ]);\n for (const result of results) {\n if (result.status === 'rejected') {\n throw result.reason;\n }\n }\n console.log('✨ Build success.');\n } catch (error) {\n throw error;\n } finally {\n console.groupEnd();\n }\n}\n","import path from 'path';\n\nexport const WORKSPACE_DIRECTORY = '.k2';\nexport const DEVELOPMENT_DIRECTORY = path.join(WORKSPACE_DIRECTORY, 'dev');\n\nexport const CONFIG_FILE_NAME = 'k2.config.mjs';\nexport const PLUGIN_CONFIG_FILE_NAME = 'plugin.config.mjs';\n\n/** kintoneプラグインの一時ファイルを管理するフォルダ */\nexport const PLUGIN_WORKSPACE_DIRECTORY = '.plugin';\n/** kintoneプラグインのcontents.zipに格納するファイルを管理するフォルダ */\nexport const PLUGIN_CONTENTS_DIRECTORY = path.join(PLUGIN_WORKSPACE_DIRECTORY, 'contents');\n/** kintoneプラグインの開発時、ローカルサーバーに反映するファイルを管理するフォルダ */\nexport const PLUGIN_DEVELOPMENT_DIRECTORY = path.join(PLUGIN_WORKSPACE_DIRECTORY, 'dev');\n\n/** ローカルサーバーのデフォルトポート番号 */\nexport const DEFAULT_PORT = 32767;\n","import { type Configuration } from 'webpack';\nimport { buildWithWebpack } from '../lib/webpack.js';\n\nexport default async function action(params: { entries: Configuration['entry']; outDir: string }) {\n const { entries, outDir } = params;\n return buildWithWebpack({ entries, outDir });\n}\n","import MiniCssExtractPlugin from 'mini-css-extract-plugin';\r\nimport path from 'path';\r\nimport { cwd } from 'process';\r\nimport TerserPlugin from 'terser-webpack-plugin';\r\nimport webpack, { type Configuration } from 'webpack';\r\nimport chalk from 'chalk';\r\nimport { TsconfigPathsPlugin } from 'tsconfig-paths-webpack-plugin';\r\n\r\nexport const buildWithWebpack = async (props: {\r\n entries: Configuration['entry'];\r\n outDir: string;\r\n}) => {\r\n const { entries, outDir } = props;\r\n\r\n const exclude = /node_modules/;\r\n const styleLoader = MiniCssExtractPlugin.loader;\r\n\r\n const tsConfigPath = path.join(cwd(), 'tsconfig.json');\r\n\r\n console.group(chalk.blue('🚀 Building with Webpack...'));\r\n console.log('🔧 tsconfig.json path:', tsConfigPath);\r\n console.groupEnd();\r\n\r\n return new Promise<void>((resolve, reject) => {\r\n webpack(\r\n {\r\n mode: 'production',\r\n target: ['web', 'es2023'],\r\n entry: entries,\r\n resolve: {\r\n extensions: ['.ts', '.tsx', '.js', '.json'],\r\n fallback: {\r\n path: false,\r\n },\r\n plugins: [new TsconfigPathsPlugin({ configFile: tsConfigPath })],\r\n },\r\n cache: { type: 'filesystem' },\r\n output: { filename: '[name].js', path: path.resolve(outDir) },\r\n module: {\r\n rules: [\r\n { test: /\\.tsx?$/, exclude, loader: 'ts-loader' },\r\n { test: /\\.css$/, use: [styleLoader, 'css-loader'] },\r\n {\r\n test: /\\.scss$/,\r\n use: [\r\n styleLoader,\r\n 'css-loader',\r\n { loader: 'sass-loader', options: { sassOptions: { outputStyle: 'expanded' } } },\r\n ],\r\n },\r\n ],\r\n },\r\n plugins: [new MiniCssExtractPlugin()],\r\n optimization: {\r\n minimize: true,\r\n minimizer: [\r\n new TerserPlugin({\r\n terserOptions: { format: { comments: false } },\r\n extractComments: false,\r\n }),\r\n ],\r\n },\r\n },\r\n (err, stats) => {\r\n if (err) {\r\n reject(err);\r\n } else {\r\n if (stats?.compilation.errors.length) {\r\n reject(\r\n [\r\n chalk.red('⚠ Build failed.'),\r\n ...stats.compilation.errors.map((error) => error.message),\r\n ].join('\\n')\r\n );\r\n } else {\r\n resolve();\r\n }\r\n }\r\n }\r\n );\r\n });\r\n};\r\n","import path from 'path';\nimport { esmImport } from '../lib/import.js';\nimport { outputCss } from '../lib/tailwind.js';\n\nexport const buildTailwind = async (config: K2.FullConfig) => {\n if (!config.tailwind?.css || !config.tailwind?.config) {\n return;\n }\n const tailwindConfig = (await esmImport(path.resolve(config.tailwind.config))).default;\n\n const inputPath = path.resolve(config.tailwind.css);\n\n const fileName = config.tailwind.fileName ?? 'tailwind.css';\n\n await outputCss({\n inputPath,\n outputPath: path.join(config.outDir, fileName),\n config: tailwindConfig,\n minify: true,\n });\n console.log(`✨ Built ${fileName}`);\n};\n","import { pathToFileURL } from 'url';\nimport { CONFIG_FILE_NAME, PLUGIN_CONFIG_FILE_NAME } from './constants.js';\nimport path from 'path';\n\nexport const esmImport = (path: string) => {\n if (process.platform === 'win32') {\n return import(pathToFileURL(path).toString());\n } else {\n return import(path);\n }\n};\n\nexport const importK2Config = async (configFileName?: string): Promise<K2.Config> => {\n return (await esmImport(path.resolve(configFileName ?? CONFIG_FILE_NAME))).default;\n};\n\nexport const importK2PluginConfig = async (\n configFileName?: string\n): Promise<Plugin.Meta.Config> => {\n return (await esmImport(path.resolve(configFileName ?? PLUGIN_CONFIG_FILE_NAME))).default;\n};\n","import chokidar from 'chokidar';\nimport cssnanoPlugin from 'cssnano';\nimport fs from 'fs-extra';\nimport { glob } from 'glob';\nimport path from 'path';\nimport postcss from 'postcss';\nimport { debounce } from 'remeda';\nimport tailwindcss, { type Config as TailwindConfig } from 'tailwindcss';\nimport invariant from 'tiny-invariant';\nimport { esmImport } from './import.js';\n\nexport const getTailwindConfigFromK2Config = async (\n k2Config: K2.Config['tailwind']\n): Promise<TailwindConfig> => {\n invariant(k2Config?.config, 'tailwind.config is required');\n const config = (await esmImport(path.resolve(k2Config?.config))).default;\n return config;\n};\n\nexport const getTailwindInputCss = (\n config: Plugin.Meta.Config['tailwind']\n): { desktop: string; config: string } => {\n invariant(config?.css, 'tailwind.css is required');\n const { css } = config;\n if (typeof css === 'string') {\n const resolved = path.resolve(css);\n return { desktop: resolved, config: resolved };\n }\n return {\n desktop: path.resolve(css.desktop),\n config: path.resolve(css.config),\n };\n};\n\nexport const getTailwindConfig = async (\n config: Plugin.Meta.Config['tailwind']\n): Promise<{\n desktop: TailwindConfig;\n config: TailwindConfig;\n}> => {\n invariant(config?.config, 'tailwind.config is required');\n\n const { config: configPath } = config;\n\n const configPathForDesktop = typeof configPath === 'string' ? configPath : configPath.desktop;\n const configPathForConfig = typeof configPath === 'string' ? configPath : configPath.config;\n\n const desktopConfig = (await esmImport(path.resolve(configPathForDesktop))).default;\n const configConfig = (await esmImport(path.resolve(configPathForConfig))).default;\n\n return { desktop: desktopConfig, config: configConfig };\n};\n\nexport const outputCss = async (params: {\n inputPath: string;\n outputPath: string;\n config: TailwindConfig;\n minify?: boolean;\n}) => {\n const { inputPath, outputPath, config, minify = false } = params;\n\n const css = await fs.readFile(inputPath, 'utf8');\n\n const result = await postcss([tailwindcss(config), ...(minify ? [cssnanoPlugin()] : [])]).process(\n css,\n {\n from: inputPath,\n to: outputPath,\n }\n );\n\n await fs.writeFile(outputPath, result.css);\n\n if (result.map) {\n await fs.writeFile(`${outputPath}.map`, result.map.toString());\n }\n};\n\ntype WatchType = 'init' | 'add' | 'change' | 'unlink';\n\nexport const watchTailwindCSS = async (params: {\n /** input path */\n input: string;\n /** output path */\n output: string;\n /** tailwindcss config file */\n config: TailwindConfig;\n /** callback function */\n onChanges?: (params: { input: string; output: string; type: WatchType }) => void;\n}) => {\n const { input, output, config } = params;\n\n const content = (config.content as string[] | undefined) ?? ['./src/**/*.{ts,tsx}'];\n\n const files = await glob([...content, input], { ignore: ['**/node_modules/**'] });\n\n const watcher = chokidar.watch(files, {\n persistent: true,\n ignoreInitial: true,\n });\n\n let isInitialized = false;\n\n const processChanges = async (type: WatchType) => {\n try {\n await outputCss({ inputPath: input, outputPath: output, config });\n params.onChanges?.({ input, output, type });\n } catch (error) {\n console.error('Error building Tailwind CSS:', error);\n }\n };\n\n const debouncedProcessChanges = debounce(processChanges, { waitMs: 1000 });\n\n watcher.on('ready', async () => {\n if (!isInitialized) {\n isInitialized = true;\n await processChanges('init');\n }\n });\n\n watcher.on('error', (error) => {\n console.error('Error watching Tailwind CSS:', error);\n });\n\n watcher.on('add', (path) => {\n debouncedProcessChanges.call('add');\n });\n watcher.on('change', (path) => {\n debouncedProcessChanges.call('change');\n });\n watcher.on('unlink', (path) => {\n debouncedProcessChanges.call('unlink');\n });\n watcher.on('unlinkDir', (path) => {\n debouncedProcessChanges.call('unlink');\n });\n\n return watcher;\n};\n","export const getDefaultK2Config = (): K2.Config => {\n return {\n version: 1,\n server: {\n port: 32768,\n },\n };\n};\n","import { program } from 'commander';\nimport { type BuildOptions } from 'esbuild';\nimport fs from 'fs-extra';\nimport path from 'path';\nimport {\n CONFIG_FILE_NAME,\n DEFAULT_PORT,\n DEVELOPMENT_DIRECTORY,\n WORKSPACE_DIRECTORY,\n} from '../../lib/constants.js';\nimport base from '../dev-base-esbuild.js';\nimport { importK2Config } from '../../lib/import.js';\nimport { watchCss } from './tailwind.js';\n\nexport default function command() {\n program\n .command('dev')\n .description('Start development server.')\n .option('-i, --input <input>', 'Input directory', 'src/apps')\n .option('-o, --outdir <outdir>', 'Output directory.', DEVELOPMENT_DIRECTORY)\n .option('-c, --certdir <certdir>', 'Certificate directory', WORKSPACE_DIRECTORY)\n .option('--config <config>', 'k2 config file path')\n .option('-p, --port <port>', 'Port number')\n .action(action);\n}\n\nexport async function action(options: {\n outdir: string;\n certdir: string;\n port?: string;\n config?: string;\n input: string;\n}) {\n const { certdir, outdir, config, port: specifiedPort, input } = options;\n console.group('🍳 Start development server');\n try {\n console.log(`📂 Output directory: ${outdir}`);\n console.log(`🔑 Certificate directory: ${certdir}`);\n\n let k2Config: null | K2.Config = null;\n try {\n k2Config = await importK2Config(config);\n } catch (error) {\n console.log(`⚙ ${CONFIG_FILE_NAME} not found. use default settings.`);\n }\n\n const port = Number(specifiedPort ?? k2Config?.server?.port ?? DEFAULT_PORT);\n\n await Promise.all([\n build({ certdir, outdir, port, input }),\n watchCss({ k2Config: k2Config ?? {}, outdir }),\n ]);\n } catch (error) {\n throw error;\n } finally {\n console.groupEnd();\n }\n}\n\nconst build = async (params: { outdir: string; certdir: string; port: number; input: string }) => {\n const { outdir, certdir, port, input } = params;\n\n const srcDir = path.resolve(input);\n const dirs = fs.readdirSync(srcDir);\n\n const entryPoints: BuildOptions['entryPoints'] = dirs.reduce<{ in: string; out: string }[]>(\n (acc, dir) => {\n for (const filename of ['index.ts', 'index.js', 'index.mjs']) {\n if (fs.existsSync(path.join(srcDir, dir, filename))) {\n return [...acc, { in: path.join(srcDir, dir, filename), out: dir }];\n }\n }\n return acc;\n },\n []\n );\n\n return base({ port, entryPoints, certDir: certdir, staticDir: outdir });\n};\n","import { type BuildOptions } from 'esbuild';\nimport path from 'path';\nimport { getEsbuildContext } from '../lib/esbuild.js';\n\nexport default async function action(params: {\n entryPoints: BuildOptions['entryPoints'];\n staticDir: string;\n certDir: string;\n port: number;\n}) {\n const { entryPoints, staticDir: outdir, certDir, port } = params;\n\n const context = await getEsbuildContext({ sourcemap: 'inline', entryPoints, outdir });\n\n const [_, serveResult] = await Promise.all([\n context.watch(),\n context.serve({\n port,\n keyfile: path.join(certDir, 'localhost-key.pem'),\n certfile: path.join(certDir, 'localhost-cert.pem'),\n servedir: outdir,\n }),\n ]);\n\n console.log(`🚀 Start development server at https://localhost:${serveResult.port}`);\n}\n","import chalk from 'chalk';\nimport esbuild, { type BuildOptions } from 'esbuild';\n\nconst completeBuildOptions = (params: BuildOptions): BuildOptions => {\n return {\n bundle: true,\n platform: 'browser',\n ...params,\n plugins: [...(params.plugins ?? [])],\n };\n};\n\nconst completeDevBuildOptions = (params: BuildOptions): BuildOptions => {\n return completeBuildOptions({\n ...params,\n plugins: [\n ...(params.plugins ?? []),\n {\n name: 'on-end',\n setup: ({ onEnd }) =>\n onEnd(() =>\n console.log(\n chalk.hex('#e5e7eb')(`${new Date().toLocaleTimeString()} `) +\n chalk.cyan(`[js] `) +\n `rebuilt`\n )\n ),\n },\n ],\n });\n};\n\nexport const getEsbuildContext = async (params: BuildOptions) => {\n return esbuild.context(completeDevBuildOptions(params));\n};\n\nexport const buildWithEsbuild = async (params: BuildOptions & { watch?: boolean }) => {\n const { watch = false, ...rest } = params;\n if (watch) {\n const context = await getEsbuildContext(rest);\n context.watch();\n } else {\n const options = completeBuildOptions(rest);\n await esbuild.build(options);\n }\n};\n","import path from 'path';\nimport chalk from 'chalk';\nimport { getTailwindConfigFromK2Config, watchTailwindCSS } from '../../lib/tailwind.js';\nimport fs from 'fs-extra';\n\nexport const watchCss = async (params: { k2Config: K2.Config; outdir: string }) => {\n const { k2Config, outdir } = params;\n if (!k2Config.tailwind?.css || !k2Config.tailwind?.config) {\n console.log('🚫 missing tailwind config. Skip watching css.');\n return;\n }\n\n const tailwindConfig = await getTailwindConfigFromK2Config(k2Config.tailwind);\n\n const input = path.resolve(k2Config.tailwind.css);\n const output = path.join(outdir, 'tailwind.css');\n\n if (!(await fs.pathExists(output))) {\n await fs.outputFile(output, '');\n }\n\n return watchTailwindCSS({\n input,\n output: path.join(outdir, 'tailwind.css'),\n config: tailwindConfig,\n onChanges: ({ output, type }) => {\n const outputFileName = path.basename(output);\n console.log(\n chalk.hex('#e5e7eb')(`${new Date().toLocaleTimeString()} `) +\n chalk.cyan(`[css] `) +\n outputFileName +\n (type === 'init' ? ' init' : ` rebuilt(${type})`)\n );\n },\n });\n};\n","import { program } from 'commander';\nimport base from './genkey-base.js';\nimport { WORKSPACE_DIRECTORY } from '../lib/constants.js';\n\nexport default function command() {\n program\n .command('genkey')\n .description('Generate SSL key for localhost. (Require mkcert)')\n .option('-o, --output <output>', 'Output directory.', WORKSPACE_DIRECTORY)\n .action(action);\n}\n\nexport async function action(options: { output: string }) {\n await base(options);\n}\n","import { exec as defaultExec } from 'child_process';\nimport { promisify } from 'util';\n\nexport const exec = promisify(defaultExec);\n","import { exec } from './exec.js';\nimport fs from 'fs-extra';\nimport path from 'path';\n\nexport const generateCert = async (outDir: string) => {\n const { stdout } = await exec(`mkcert localhost 127.0.0.1 ::1`);\n [\n { input: 'localhost+2.pem', output: 'localhost-cert.pem' },\n { input: 'localhost+2-key.pem', output: 'localhost-key.pem' },\n ].forEach(({ input, output }) => {\n fs.moveSync(`./${input}`, path.join(outDir, output), {\n overwrite: true,\n });\n });\n return { stdout };\n};\n","import { generateCert } from '../lib/cert.js';\n\nexport default async function action(options: { output: string }) {\n const { output } = options;\n\n console.group('🍳 Generate SSL key for localhost');\n try {\n const { stdout } = await generateCert(output);\n if (stdout) {\n console.log(stdout);\n }\n console.log(`🔑 key generation success. Output to ./${output}`);\n } catch (error) {\n throw error;\n } finally {\n console.groupEnd();\n }\n}\n","import { program } from 'commander';\nimport fs from 'fs-extra';\nimport path from 'path';\nimport { WORKSPACE_DIRECTORY } from '../lib/constants.js';\nimport { type BuildOptions } from 'esbuild';\nimport { buildWithEsbuild } from '../lib/esbuild.js';\nimport { importK2Config } from '../lib/import.js';\nimport { getDefaultK2Config } from '../lib/k2.js';\nimport { buildTailwind } from './build-tailwind.js';\n\nexport default function command() {\n program\n .command('esbuild-build')\n .option('-o, --outdir <outdir>', 'Output directory.', path.join(WORKSPACE_DIRECTORY, 'prod'))\n .option('-i, --input <input>', 'Input directory.', path.join('src', 'apps'))\n .option('--config <config>', 'k2 config file path')\n .description(\"Build the project for production. (It's a wrapper of webpack build command.)\")\n .action(action);\n}\n\nexport async function action(options: { outdir: string; input: string; config?: string }) {\n console.group('🍳 Build the project for production');\n\n try {\n const { outdir, input, config } = options;\n const outDir = path.resolve(outdir);\n\n if (!fs.existsSync(outDir)) {\n fs.mkdirSync(outDir, { recursive: true });\n }\n\n const allProjects = fs.readdirSync(path.resolve(input));\n\n const entryPoints = allProjects.reduce<NonNullable<BuildOptions['entryPoints']>>((acc, dir) => {\n for (const filename of ['index.ts', 'index.js', 'index.mjs']) {\n if (fs.existsSync(path.join(input, dir, filename))) {\n return { ...acc, [dir]: path.join(input, dir, filename) };\n }\n }\n return acc;\n }, {});\n\n console.log(`📁 ${Object.keys(entryPoints).length} entry points`);\n\n const k2Config = config ? await importK2Config(config) : getDefaultK2Config();\n const fullConfig: K2.FullConfig = { ...k2Config, outDir };\n\n const results = await Promise.allSettled([\n buildWithEsbuild({\n entryPoints,\n outdir,\n sourcemap: false,\n minify: true,\n legalComments: 'none',\n }),\n buildTailwind(fullConfig),\n ]);\n\n for (const result of results) {\n if (result.status === 'rejected') {\n throw result.reason;\n }\n }\n\n console.log('✨ Build success.');\n } catch (error) {\n throw error;\n } finally {\n console.groupEnd();\n }\n}\n","import { program } from 'commander';\nimport { lint } from '../lib/lint.js';\n\nexport default function command() {\n program\n .command('lint')\n .description('Lint source files')\n .option('-c, --config <config>', 'Config file path')\n .action(action);\n}\n\nexport async function action(options: {\n outdir: string;\n certdir: string;\n port: string;\n input: string;\n}) {\n try {\n lint();\n } catch (error) {\n throw error;\n } finally {\n }\n}\n","import { ESLint } from 'eslint';\nimport globals from 'globals';\nimport pluginJs from '@eslint/js';\nimport tseslint from 'typescript-eslint';\nimport pluginReact from 'eslint-plugin-react';\n\nexport async function lint() {\n const eslint = new ESLint({\n baseConfig: [\n { files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'] },\n { languageOptions: { globals: globals.browser } },\n pluginJs.configs.recommended,\n // ...tseslint.configs.recommended,\n ...(pluginReact.configs.flat?.recommended ? [pluginReact.configs.flat.recommended] : []),\n ],\n });\n\n const results = await eslint.lintFiles(['src/**/*.{ts,tsx?}']);\n\n const formatter = await eslint.loadFormatter('stylish');\n const resultText = formatter.format(results);\n\n console.group('👕 Lint Results');\n console.log(resultText);\n console.groupEnd();\n\n const hasErrors = results.some((result) => result.errorCount > 0);\n if (hasErrors) {\n console.error('🚨 Lint errors found');\n process.exit(1);\n }\n}\n"],"mappings":";;;AACA,SAAS,WAAAA,gBAAe;;;ACDxB,SAAS,eAAe;AACxB,OAAOC,SAAQ;AACf,OAAOC,WAAU;;;ACFjB,OAAO,UAAU;AAEV,IAAM,sBAAsB;AAC5B,IAAM,wBAAwB,KAAK,KAAK,qBAAqB,KAAK;AAElE,IAAM,mBAAmB;AAIzB,IAAM,6BAA6B;AAEnC,IAAM,4BAA4B,KAAK,KAAK,4BAA4B,UAAU;AAElF,IAAM,+BAA+B,KAAK,KAAK,4BAA4B,KAAK;AAGhF,IAAM,eAAe;;;AChB5B,OAAmC;;;ACAnC,OAAO,0BAA0B;AACjC,OAAOC,WAAU;AACjB,SAAS,WAAW;AACpB,OAAO,kBAAkB;AACzB,OAAO,aAAqC;AAC5C,OAAO,WAAW;AAClB,SAAS,2BAA2B;AAE7B,IAAM,mBAAmB,OAAO,UAGjC;AACJ,QAAM,EAAE,SAAS,OAAO,IAAI;AAE5B,QAAM,UAAU;AAChB,QAA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AAI;","names":["program","fs","path","path","path","path","path","path","path","path","path","action","fs","program","fs","path","path","chalk","action","path","path","chalk","fs","path","output","chalk","command","program","action","path","fs","program","fs","path","action","command","program","action","program","fs","path","command","program","path","action","fs","program","command","program","action","program","command"]}
|
package/dist/plugin.d.ts
CHANGED