@koishi-ce/client 1.0.0 → 1.0.2
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/client/plugins/loader.ts +6 -2
- package/lib/bin.mjs +2 -2
- package/lib/index.mjs +1 -1
- package/lib/{src-Bxzzi1Rx.mjs → src-lTfcJ1xA.mjs} +4 -1
- package/package.json +1 -1
- package/src/index.ts +7 -3
package/client/plugins/loader.ts
CHANGED
|
@@ -126,7 +126,11 @@ export default class LoaderService extends Service {
|
|
|
126
126
|
paths,
|
|
127
127
|
data: ref(data),
|
|
128
128
|
};
|
|
129
|
-
// 依次加载入口声明的全部文件,按后缀分发给对应 loader
|
|
129
|
+
// 依次加载入口声明的全部文件,按后缀分发给对应 loader;
|
|
130
|
+
// task 返回给外层 Promise.all,使 initTask 真正等到全部
|
|
131
|
+
// 入口文件 settle 后才放行(否则 router install 早于扩展
|
|
132
|
+
// 注册路由,初始导航会对当前路径报 no match)。
|
|
133
|
+
// 扩展加载失败不阻塞界面可用性
|
|
130
134
|
const task = Promise.all(
|
|
131
135
|
files.map((url) => {
|
|
132
136
|
for (const ext in loaders) {
|
|
@@ -137,11 +141,11 @@ export default class LoaderService extends Service {
|
|
|
137
141
|
return undefined;
|
|
138
142
|
}),
|
|
139
143
|
);
|
|
140
|
-
// 加载完成即标记 done(扩展加载失败不阻塞界面可用性)
|
|
141
144
|
void task.finally(() => {
|
|
142
145
|
const extension = this.extensions[key];
|
|
143
146
|
if (extension) extension.done.value = true;
|
|
144
147
|
});
|
|
148
|
+
return task.catch(() => {});
|
|
145
149
|
}),
|
|
146
150
|
);
|
|
147
151
|
|
package/lib/bin.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as build } from "./src-
|
|
2
|
+
import { t as build } from "./src-lTfcJ1xA.mjs";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
import { resolve } from "node:path";
|
|
5
5
|
//#endregion
|
|
@@ -16,7 +16,7 @@ import { resolve } from "node:path";
|
|
|
16
16
|
const { version } = {
|
|
17
17
|
name: "@koishi-ce/client",
|
|
18
18
|
description: "Koishi Console Client",
|
|
19
|
-
version: "1.0.
|
|
19
|
+
version: "1.0.2",
|
|
20
20
|
type: "module",
|
|
21
21
|
main: "client/index.ts",
|
|
22
22
|
exports: {
|
package/lib/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as createServer, t as build } from "./src-
|
|
1
|
+
import { n as createServer, t as build } from "./src-lTfcJ1xA.mjs";
|
|
2
2
|
export { build, createServer };
|
|
@@ -90,7 +90,10 @@ async function build(root, config = {}) {
|
|
|
90
90
|
define: { "process.env.NODE_ENV": "\"production\"" }
|
|
91
91
|
}, config));
|
|
92
92
|
for (const item of results[0]?.output ?? []) {
|
|
93
|
-
|
|
93
|
+
let fileName = item.fileName;
|
|
94
|
+
if (fileName === "index.mjs") fileName = "index.js";
|
|
95
|
+
if (fileName === "index.css") fileName = "style.css";
|
|
96
|
+
const dest = `${root}/dist/${fileName}`;
|
|
94
97
|
if (item.type === "asset") {
|
|
95
98
|
if (item.source === void 0) continue;
|
|
96
99
|
await Bun.write(dest, item.source);
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -175,9 +175,13 @@ export async function build(root: string, config: vite.UserConfig = {}) {
|
|
|
175
175
|
// build.write: false 让构建结果留在内存里,由这里手动落盘,
|
|
176
176
|
// 以便对文件名和 JS 产物做后处理
|
|
177
177
|
for (const item of results[0]?.output ?? []) {
|
|
178
|
-
// lib es 格式的产物名是 index.mjs,统一改名为 index.js
|
|
179
|
-
//
|
|
180
|
-
|
|
178
|
+
// lib es 格式的产物名是 index.mjs,统一改名为 index.js;css 产物
|
|
179
|
+
// 默认名是 index.css,统一改名为 style.css(console 服务端的
|
|
180
|
+
// resolveEntry 按该约定探测并下发)。rolldown 的 output 条目是
|
|
181
|
+
// 冻结对象,不能原地改写
|
|
182
|
+
let fileName = item.fileName;
|
|
183
|
+
if (fileName === "index.mjs") fileName = "index.js";
|
|
184
|
+
if (fileName === "index.css") fileName = "style.css";
|
|
181
185
|
const dest = `${root}/dist/${fileName}`;
|
|
182
186
|
if (item.type === "asset") {
|
|
183
187
|
if (item.source === undefined) continue;
|