@joplo-app/server 0.2.2 → 0.2.4
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/build.d.ts +1 -1
- package/dist/build.js +7 -5
- package/dist/contract.d.ts +5 -0
- package/dist/project.d.ts +2 -2
- package/package.json +4 -4
package/dist/build.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Project } from '@joplo-app/core';
|
|
2
2
|
import type { BuildOptions, BuildResult } from './contract.js';
|
|
3
3
|
import type { DistWeb } from './web-assets.js';
|
|
4
|
-
/** 发布站只需要的 IR:去掉创作侧字段(publish
|
|
4
|
+
/** 发布站只需要的 IR:去掉创作侧字段(publish 模式下它们本来就为空)。层级、镜头与 featureIds 顺序属于演示,保留(D43 / D61)。 */
|
|
5
5
|
export declare function publishPayload(project: Project, home: string | null): {
|
|
6
6
|
project: Record<string, unknown>;
|
|
7
7
|
home: string | null;
|
package/dist/build.js
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
* 3. 后处理:IR 内联到 index.html;入口脚本内联为 <script type="module">、去掉 crossorigin,
|
|
8
8
|
* 这样直接双击 index.html(file://)也能离线运行。产物是普通静态目录,可 `wrangler deploy --assets` 或任何静态托管发布。
|
|
9
9
|
*
|
|
10
|
+
* `review: true`(评审版,D63)时第 1 步用 compile 的 review 模式:含所有功能的所有方案,同样去掉创作侧信息;其余步骤相同。
|
|
11
|
+
*
|
|
10
12
|
* 目标目录非空且没有 overwrite 时拒绝写入;永远不清空项目目录本身或它的上级目录。
|
|
11
13
|
*
|
|
12
14
|
* 从 npm 安装时(web-assets.ts 的 dist 形态)第 2 步不编译界面源码:复制 @joplo-app/web 预构建的发布站,
|
|
@@ -17,14 +19,14 @@ import os from 'node:os';
|
|
|
17
19
|
import path from 'node:path';
|
|
18
20
|
import tailwindcss from '@tailwindcss/vite';
|
|
19
21
|
import { build as viteBuild, createServer } from 'vite';
|
|
20
|
-
import { JoploError } from '@joplo-app/core';
|
|
22
|
+
import { JoploError, orderedFeatures } from '@joplo-app/core';
|
|
21
23
|
import { compileProject } from "./project.js";
|
|
22
24
|
import { joploProjectPlugin, kitAliases, locateWebAssets, realProjectDir } from "./vite-shared.js";
|
|
23
25
|
import { subsetSiteFonts } from "./site-fonts.js";
|
|
24
|
-
/** 发布站只需要的 IR:去掉创作侧字段(publish
|
|
26
|
+
/** 发布站只需要的 IR:去掉创作侧字段(publish 模式下它们本来就为空)。层级、镜头与 featureIds 顺序属于演示,保留(D43 / D61)。 */
|
|
25
27
|
export function publishPayload(project, home) {
|
|
26
28
|
const { rules: _r, cases: _c, issues: _i, ...rest } = project;
|
|
27
|
-
const features = Object.fromEntries(
|
|
29
|
+
const features = Object.fromEntries(orderedFeatures(project).map(f => [f.id, { id: f.id, name: f.name, goal: f.goal, optionIds: f.optionIds, pick: f.pick }]));
|
|
28
30
|
const options = Object.fromEntries(Object.entries(project.options).map(([id, o]) => [id, { id: o.id, featureId: o.featureId, key: o.key, name: o.name, idea: o.idea, routes: o.routes, coverage: {}, layers: o.layers ?? {} }]));
|
|
29
31
|
const scenarios = Object.fromEntries(Object.entries(project.scenarios).map(([id, s]) => {
|
|
30
32
|
const { caseIds: _ci, ...sr } = s;
|
|
@@ -92,7 +94,7 @@ export async function buildSite(opts) {
|
|
|
92
94
|
if (nonEmpty && fs.existsSync(path.join(outDir, 'joplo.config.ts')))
|
|
93
95
|
throw new JoploError('USAGE', `Output directory appears to be a Joplo project (contains joplo.config.ts); refusing to clear: ${outDir}`);
|
|
94
96
|
const web = locateWebAssets();
|
|
95
|
-
// 1. 编译(publish)
|
|
97
|
+
// 1. 编译(publish;评审版用 review)
|
|
96
98
|
const loader = await createServer({
|
|
97
99
|
configFile: false,
|
|
98
100
|
envDir: false,
|
|
@@ -106,7 +108,7 @@ export async function buildSite(opts) {
|
|
|
106
108
|
});
|
|
107
109
|
let compiled;
|
|
108
110
|
try {
|
|
109
|
-
compiled = await compileProject(loader, projectDir, 'publish');
|
|
111
|
+
compiled = await compileProject(loader, projectDir, opts.review === true ? 'review' : 'publish');
|
|
110
112
|
}
|
|
111
113
|
finally {
|
|
112
114
|
await loader.close();
|
package/dist/contract.d.ts
CHANGED
|
@@ -25,6 +25,11 @@ export type BuildOptions = {
|
|
|
25
25
|
outDir?: string;
|
|
26
26
|
/** 目标目录非空时,必须显式允许才清空重建。 */
|
|
27
27
|
overwrite?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* 评审版(D63,`joplo share --review`):含所有功能的所有方案(compile 的 review 模式),创作侧信息与普通发布一样去掉。
|
|
30
|
+
* 缺省 false:只含选定方案,与原来完全一致。
|
|
31
|
+
*/
|
|
32
|
+
review?: boolean;
|
|
28
33
|
};
|
|
29
34
|
/** 静态发布站:只含选定方案(compile 的 publish 模式),离线可打开,可直接 `wrangler deploy`。 */
|
|
30
35
|
export type BuildResult = {
|
package/dist/project.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Diagnostic, type Project } from '@joplo-app/core';
|
|
1
|
+
import { type CompileMode, type Diagnostic, type Project } from '@joplo-app/core';
|
|
2
2
|
import { discoverFiles } from '@joplo-app/core/node';
|
|
3
3
|
import type { ViteDevServer } from 'vite';
|
|
4
4
|
export type CompileOutcome = {
|
|
@@ -8,7 +8,7 @@ export type CompileOutcome = {
|
|
|
8
8
|
/** joplo.config 的 home(看板与发布站的首页路径)。 */
|
|
9
9
|
home: string | null;
|
|
10
10
|
};
|
|
11
|
-
export declare function compileProject(server: ViteDevServer, projectDir: string, mode:
|
|
11
|
+
export declare function compileProject(server: ViteDevServer, projectDir: string, mode: CompileMode): Promise<CompileOutcome>;
|
|
12
12
|
/** 让项目源文件在下次载入时重新转译、重新求值。 */
|
|
13
13
|
export declare function invalidateProjectModules(server: ViteDevServer, projectDir: string): void;
|
|
14
14
|
export { discoverFiles };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joplo-app/server",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Joplo 本地服务:dev 看板、build 发布站、render 截图",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@joplo-app/core": "0.2.
|
|
19
|
-
"@joplo-app/kit": "0.2.
|
|
20
|
-
"@joplo-app/web": "0.2.
|
|
18
|
+
"@joplo-app/core": "0.2.4",
|
|
19
|
+
"@joplo-app/kit": "0.2.4",
|
|
20
|
+
"@joplo-app/web": "0.2.4",
|
|
21
21
|
"@tailwindcss/vite": "4.3.4",
|
|
22
22
|
"tailwindcss": "4.3.4",
|
|
23
23
|
"vite": "8.3.5",
|