@jxsuite/import 0.40.0 → 0.40.1
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/package.json +6 -4
- package/src/ai-componentize.ts +12 -2
- package/src/asset-collect.ts +2 -2
- package/src/asset-download.ts +10 -11
- package/src/browser-local.ts +67 -0
- package/src/capture.ts +50 -61
- package/src/crawl.ts +16 -16
- package/src/emit.ts +34 -28
- package/src/index.ts +11 -5
- package/src/io.ts +52 -0
- package/src/media-extract.ts +3 -3
- package/src/pipeline.ts +605 -0
- package/src/run.ts +93 -503
- package/src/style-capture.ts +6 -3
- package/src/verify.ts +1 -1
package/src/style-capture.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* UA-default baselines per unique tagName by rendering throwaway elements.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type {
|
|
9
|
+
import type { ImportPage } from "./capture.ts";
|
|
10
10
|
|
|
11
11
|
export interface CapturedStyle {
|
|
12
12
|
/** Depth-first element-index path from <body>, e.g. [0, 2, 1]. */
|
|
@@ -163,7 +163,7 @@ const STYLE_ALLOWLIST: string[] = [
|
|
|
163
163
|
* Run the style capture in a puppeteer page. Executes entirely in-browser via page.evaluate() — no
|
|
164
164
|
* round-trips per element.
|
|
165
165
|
*/
|
|
166
|
-
export async function captureStyles(page:
|
|
166
|
+
export async function captureStyles(page: ImportPage): Promise<StyleCaptureResult> {
|
|
167
167
|
return page.evaluate((allowlist: string[]) => {
|
|
168
168
|
const elements: { path: number[]; tagName: string; styles: Record<string, string> }[] = [];
|
|
169
169
|
const tagsSeen = new Set<string>();
|
|
@@ -337,7 +337,10 @@ export async function captureStyles(page: Page): Promise<StyleCaptureResult> {
|
|
|
337
337
|
* Re-capture computed styles at a different viewport width (for $media extraction). Returns only
|
|
338
338
|
* the per-element styles — no UA defaults or media queries (reuse from base).
|
|
339
339
|
*/
|
|
340
|
-
export async function captureStylesAtWidth(
|
|
340
|
+
export async function captureStylesAtWidth(
|
|
341
|
+
page: ImportPage,
|
|
342
|
+
width: number,
|
|
343
|
+
): Promise<CapturedStyle[]> {
|
|
341
344
|
await page.setViewport({ width, height: 900 });
|
|
342
345
|
// Let layout reflow settle
|
|
343
346
|
await page.evaluate(
|
package/src/verify.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { extname, join } from "node:path";
|
|
11
11
|
import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
12
12
|
import type { Browser, Page } from "puppeteer-core";
|
|
13
|
-
import { launchBrowser, closeBrowser } from "./
|
|
13
|
+
import { launchBrowser, closeBrowser } from "./browser-local.ts";
|
|
14
14
|
import { diffScreenshots } from "./screenshot-diff.ts";
|
|
15
15
|
|
|
16
16
|
export interface PageRef {
|