@vyaz/core 0.0.7 → 0.0.8

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.
@@ -1,28 +1,21 @@
1
1
  /**
2
- * @vyaz/core — Browser entry point.
2
+ * @vyaz/core — Browser bundle entry point.
3
3
  *
4
- * Re-exports everything from the main index **except** `SystemFontRegistry`
5
- * and `systemFontRegistry`, which require Node.js built-in modules
6
- * (`node:fs`, `get-system-fonts`).
4
+ * Re-exports all browser-safe APIs. Forces bundlers to inline the modules
5
+ * by using a single `export *`/re-export style that bun build inlines.
7
6
  *
8
- * All server-only code paths are guarded by runtime checks (`isNodeLike`)
9
- * so tree-shakers can safely eliminate dead branches.
10
- *
11
- * ✅ Safe for Vite / webpack / Rollup / esbuild browser builds.
7
+ * NOT exported: SystemFontRegistry / systemFontRegistry requires `node:fs`
12
8
  */
13
- export type { TextFrame, Paragraph, ParagraphStyle, TextRun, InlineWidget, AutofitConfig, TextAlignment, WritingMode, TextOrientation, VerticalAlignment, ScriptType, WhiteSpace, MultiColumnConfig, DominantBaseline, LineFitEdge, TextAlignLast, WordBreak, LineBreak, OverflowWrap, TextDecorationStyle, TextTransform, ListType, NumberFormat, ListStylePosition, ListStyle, } from './types/Document.js';
14
- export { DEFAULT_PARAGRAPH_STYLE, DEFAULT_TEXT_STYLE, } from './types/Document.js';
15
- export type { ParagraphLayoutResult, Line, Span, SpanFontMetrics, SemanticParagraph, SemanticLine, SemanticFragment, } from './types/LayoutTypes.js';
16
- export type { FontMetrics, IFontMetricsProvider, GlyphData, } from './types/FontTypes.js';
17
9
  export { ParagraphLayoutEngine, paragraphLayoutEngine } from './layout/ParagraphLayoutEngine.js';
18
10
  export { positionLines } from './layout/PositioningEngine.js';
19
11
  export { assertLineInvariants, linesToYAML } from './layout/LineBoxValidator.js';
20
- export type { InvariantError } from './layout/LineBoxValidator.js';
21
12
  export { layoutTextFrame } from './layout/TextFrameLayoutEngine.js';
22
- export type { TextFrameLayoutResult } from './layout/TextFrameLayoutEngine.js';
23
13
  export { applyScale, findScale } from './layout/AutoFitEngine.js';
24
- export type { AutoFitOptions, AutoFitResult } from './layout/AutoFitEngine.js';
25
- export { compileParagraph, getParagraphText, makeFontToken } from './compile/DocumentCompiler.js';
26
- export type { PreparedRichInlineItem } from './compile/DocumentCompiler.js';
14
+ export { compileParagraph, getParagraphText, makeFontToken, collapseSegmentWhitespace, splitParagraphByHardBreaks } from './compile/DocumentCompiler.js';
27
15
  export { FontMetricsProvider, fontMetricsProvider } from './measure/FontMetricsProvider.js';
16
+ export { createFontFace, getGlyphAdvance, computePixelMetrics, isFontEngineAvailable } from './measure/FontEngine.js';
17
+ export { getFontBuffer } from './utils/font.js';
28
18
  export { FontNotFoundError } from './measure/FontNotFoundError.js';
19
+ export { DEFAULT_PARAGRAPH_STYLE, DEFAULT_TEXT_STYLE, } from './types/Document.js';
20
+ export { transformText } from './utils/textTransform.js';
21
+ export { formatListNumber, defaultBulletChar, BULLET_CHARACTERS } from './utils/list.js';
@@ -1,18 +1,29 @@
1
1
  export {
2
+ transformText,
3
+ splitParagraphByHardBreaks,
2
4
  positionLines,
3
5
  paragraphLayoutEngine,
4
6
  makeFontToken,
5
7
  linesToYAML,
6
8
  layoutTextFrame,
9
+ isFontEngineAvailable,
7
10
  getParagraphText,
11
+ getGlyphAdvance,
12
+ getFontBuffer,
13
+ formatListNumber,
8
14
  fontMetricsProvider,
9
15
  findScale,
16
+ defaultBulletChar,
17
+ createFontFace,
18
+ computePixelMetrics,
10
19
  compileParagraph,
20
+ collapseSegmentWhitespace,
11
21
  assertLineInvariants,
12
22
  applyScale,
13
23
  ParagraphLayoutEngine,
14
24
  FontNotFoundError,
15
25
  FontMetricsProvider,
16
26
  DEFAULT_TEXT_STYLE,
17
- DEFAULT_PARAGRAPH_STYLE
27
+ DEFAULT_PARAGRAPH_STYLE,
28
+ BULLET_CHARACTERS
18
29
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vyaz/core",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -26,7 +26,7 @@
26
26
  "child_process": false
27
27
  },
28
28
  "scripts": {
29
- "build": "bun build ./src/index.ts --outdir ./dist --target bun && bun build ./src/index.browser.ts --outdir ./dist --outfile ./dist/index.browser.js --target browser && tsc --project tsconfig.json --emitDeclarationOnly",
29
+ "build": "bun build ./src/index.ts --outdir ./dist --target bun --external @chenglou/pretext --external js-yaml --external @napi-rs/canvas --external fontkit --external get-system-fonts && bun build ./src/index.browser.ts --outdir ./dist --outfile ./dist/index.browser.js --target browser && tsc --project tsconfig.json --emitDeclarationOnly",
30
30
  "test": "bun test"
31
31
  },
32
32
  "dependencies": {