@taboo-avalanche/andesite-compiler 1.0.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/compile.d.ts +24 -0
- package/dist/compile.js +2076 -0
- package/package.json +30 -0
- package/src/compile.ts +142 -0
- package/src/rasterize/puppeteer.ts +2257 -0
- package/tsconfig.json +7 -0
- package/tsup.config.ts +13 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Browser } from 'puppeteer';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 启动可复用的 Puppeteer 实例,供 build-all 多页栅格化共用,避免每页重复 launch。
|
|
5
|
+
*/
|
|
6
|
+
declare function launchRasterBrowser(): Promise<Browser>;
|
|
7
|
+
|
|
8
|
+
interface CompilePageOptions {
|
|
9
|
+
/** 传入则复用浏览器,多页 build-all 时显著提速 */
|
|
10
|
+
browser?: Browser;
|
|
11
|
+
verbose?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 编译 React 页面为 andesite.zip。
|
|
15
|
+
* 先栅格化所有 APanel 和 AButton 产出 PNG,再从 DOM 读取 ALabel 声明信息,
|
|
16
|
+
* 最后组装 andesite.json 并打包成 zip。
|
|
17
|
+
*
|
|
18
|
+
* @param pageUrl Vite dev server 或静态构建产物的 URL。
|
|
19
|
+
* @param pageId 安山岩页面 id。
|
|
20
|
+
* @param outputZipPath 输出 zip 文件路径。
|
|
21
|
+
*/
|
|
22
|
+
declare function compilePage(pageUrl: string, pageId: string, outputZipPath: string, options?: CompilePageOptions): Promise<void>;
|
|
23
|
+
|
|
24
|
+
export { type CompilePageOptions, compilePage, launchRasterBrowser };
|