@blankgrimoire/runtime 1.0.1 → 1.2.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/engine.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Chapter, ContentRating, MangaDetails, MangaStatus, MangaSummary, Page, PagedResult, SearchQuery, SiteContext, ThemeAdapter, ThemeSelectors, ThemeSelectorsOverrides } from '@blankgrimoire/types';
1
+ import { type Chapter, type ContentRating, type ExtractedGenres, type GenreMapping, type MangaDetails, type MangaStatus, type MangaSummary, type Page, type PagedResult, type SearchQuery, type SiteContext, type ThemeAdapter, type ThemeSelectors, type ThemeSelectorsOverrides } from '@blankgrimoire/types';
2
2
  import type { DocumentLike, ParseHTML, WindowLike } from './dom.js';
3
3
  export interface ThemeRuntimeOptions {
4
4
  adapter: ThemeAdapter;
@@ -12,6 +12,17 @@ export interface PageKeys {
12
12
  mangaKey: string;
13
13
  chapterKey: string;
14
14
  }
15
+ /** Raised when an adapter bundle targets a different contract version. */
16
+ export declare class UnsupportedApiVersionError extends Error {
17
+ readonly expected: number;
18
+ readonly found: unknown;
19
+ constructor(found: unknown);
20
+ }
21
+ /**
22
+ * Reject adapters that do not declare the contract version implemented by
23
+ * this runtime. Adapters created with `defineTheme` always declare it.
24
+ */
25
+ export declare function assertAdapterAPIVersion(adapter: ThemeAdapter): void;
15
26
  /** Merge field-by-field user overrides into the adapter selectors. */
16
27
  export declare function resolveSelectors(base: ThemeSelectors, overrides: ThemeSelectorsOverrides): ThemeSelectors;
17
28
  /** Normalise site text into the closed `MangaStatus` union. */
@@ -26,6 +37,8 @@ export declare function extractDetails(runtime: ThemeRuntimeOptions, key: string
26
37
  export declare function extractChapters(runtime: ThemeRuntimeOptions, key: string): Promise<Chapter[]>;
27
38
  /** Extract chapter pages. Hooks take precedence over declarative strategies. */
28
39
  export declare function extractPages(runtime: ThemeRuntimeOptions, keys: PageKeys): Promise<Page[]>;
40
+ /** Extract genre filters from a page using the theme's genre mapping. */
41
+ export declare function extractGenres(runtime: ThemeRuntimeOptions, mapping: GenreMapping): Promise<ExtractedGenres>;
29
42
  /** Backwards-compatible name for page extraction. */
30
43
  export declare const extract: typeof extractPages;
31
44
  /**
package/dist/engine.js CHANGED
@@ -1,6 +1,25 @@
1
1
  // SPDX-License-Identifier: MIT
2
+ import { API_VERSION, } from '@blankgrimoire/types';
2
3
  import { attr, firstAttribute, queryAll, resolveURL, textOf } from './dom.js';
3
4
  import { runStrategy } from './strategies.js';
5
+ /** Raised when an adapter bundle targets a different contract version. */
6
+ export class UnsupportedApiVersionError extends Error {
7
+ constructor(found) {
8
+ super(`Unsupported adapter apiVersion ${String(found)}; expected ${API_VERSION}`);
9
+ this.expected = API_VERSION;
10
+ this.name = 'UnsupportedApiVersionError';
11
+ this.found = found;
12
+ }
13
+ }
14
+ /**
15
+ * Reject adapters that do not declare the contract version implemented by
16
+ * this runtime. Adapters created with `defineTheme` always declare it.
17
+ */
18
+ export function assertAdapterAPIVersion(adapter) {
19
+ if (adapter.apiVersion !== API_VERSION) {
20
+ throw new UnsupportedApiVersionError(adapter.apiVersion);
21
+ }
22
+ }
4
23
  /** Merge field-by-field user overrides into the adapter selectors. */
5
24
  export function resolveSelectors(base, overrides) {
6
25
  const resolved = {
@@ -39,6 +58,19 @@ function readImageURL(root, selector, baseURL) {
39
58
  const value = firstAttribute(image, ['data-src', 'src', 'data-original']);
40
59
  return value ? resolveURL(value, baseURL) : undefined;
41
60
  }
61
+ /**
62
+ * Finds the link element for a list item.
63
+ *
64
+ * Most adapters point at a child anchor. Some sites expose the anchor as the
65
+ * item itself, so the item is used when it already carries an `href`.
66
+ */
67
+ function selectLink(element, selector) {
68
+ const descendant = selector ? element.querySelector(selector) : null;
69
+ if (descendant) {
70
+ return descendant;
71
+ }
72
+ return attr(element, 'href') ? element : null;
73
+ }
42
74
  function splitList(value) {
43
75
  if (!value) {
44
76
  return undefined;
@@ -99,6 +131,7 @@ function parseChapterNumber(value) {
99
131
  }
100
132
  /** Search a site. Hooks take precedence over declarative selectors. */
101
133
  export async function extractSearch(runtime, query) {
134
+ assertAdapterAPIVersion(runtime.adapter);
102
135
  const hook = runtime.adapter.hooks?.search;
103
136
  if (hook) {
104
137
  return hook(runtime.context, query);
@@ -106,9 +139,10 @@ export async function extractSearch(runtime, query) {
106
139
  const selectors = selectorsFor(runtime).search;
107
140
  const items = [];
108
141
  for (const element of queryAll(runtime.document, selectors.item)) {
109
- const title = textOf(element.querySelector(selectors.title));
110
- const link = element.querySelector(selectors.link);
142
+ const link = selectLink(element, selectors.link);
111
143
  const href = link ? attr(link, 'href') : null;
144
+ // When the item is the anchor, its text is the only available title.
145
+ const title = textOf(element.querySelector(selectors.title)) || (link ? textOf(link) : '');
112
146
  if (title === '' || !href) {
113
147
  continue;
114
148
  }
@@ -129,6 +163,7 @@ export async function extractSearch(runtime, query) {
129
163
  }
130
164
  /** Read series details. Hooks take precedence over declarative selectors. */
131
165
  export async function extractDetails(runtime, key) {
166
+ assertAdapterAPIVersion(runtime.adapter);
132
167
  const hook = runtime.adapter.hooks?.getMangaDetails;
133
168
  if (hook) {
134
169
  return hook(runtime.context, key);
@@ -191,6 +226,7 @@ export async function extractDetails(runtime, key) {
191
226
  }
192
227
  /** Read a chapter list. Hooks take precedence over declarative selectors. */
193
228
  export async function extractChapters(runtime, key) {
229
+ assertAdapterAPIVersion(runtime.adapter);
194
230
  const hook = runtime.adapter.hooks?.getChapters;
195
231
  if (hook) {
196
232
  return hook(runtime.context, key);
@@ -199,13 +235,15 @@ export async function extractChapters(runtime, key) {
199
235
  const baseURL = runtime.context.baseURL;
200
236
  const chapters = [];
201
237
  for (const element of queryAll(runtime.document, selectors.item)) {
202
- const link = element.querySelector(selectors.link);
238
+ const link = selectLink(element, selectors.link);
203
239
  const href = link ? attr(link, 'href') : null;
204
240
  if (!href) {
205
241
  continue;
206
242
  }
243
+ // An item can be the anchor itself, so a missing title selector falls back
244
+ // to the link text.
207
245
  const title = selectors.title
208
- ? readText(element, selectors.title)
246
+ ? (readText(element, selectors.title) ?? textOf(link)) || undefined
209
247
  : textOf(link) || undefined;
210
248
  const chapter = { key: resolveURL(href, baseURL) };
211
249
  if (title) {
@@ -239,6 +277,7 @@ export async function extractChapters(runtime, key) {
239
277
  }
240
278
  /** Extract chapter pages. Hooks take precedence over declarative strategies. */
241
279
  export async function extractPages(runtime, keys) {
280
+ assertAdapterAPIVersion(runtime.adapter);
242
281
  const hook = runtime.adapter.hooks?.getPages;
243
282
  if (hook) {
244
283
  return hook(runtime.context, keys.mangaKey, keys.chapterKey);
@@ -259,6 +298,54 @@ export async function extractPages(runtime, keys) {
259
298
  }
260
299
  return [];
261
300
  }
301
+ /** Extract genre filters from a page using the theme's genre mapping. */
302
+ export async function extractGenres(runtime, mapping) {
303
+ assertAdapterAPIVersion(runtime.adapter);
304
+ const document = runtime.document;
305
+ const filters = [];
306
+ if (!mapping.source) {
307
+ return { filters };
308
+ }
309
+ const elements = document.querySelectorAll(mapping.source);
310
+ for (const element of Array.from(elements)) {
311
+ const displayName = mapping.displayNameAttr
312
+ ? element.querySelector(mapping.displayNameAttr)?.textContent?.trim() || element.textContent?.trim()
313
+ : element.textContent?.trim();
314
+ if (!displayName)
315
+ continue;
316
+ let value = '';
317
+ if (mapping.valueAttr) {
318
+ value = element.getAttribute(mapping.valueAttr) || '';
319
+ }
320
+ else {
321
+ value = element.textContent?.trim() || '';
322
+ }
323
+ if (mapping.valuePattern) {
324
+ const regex = new RegExp(mapping.valuePattern);
325
+ const match = value.match(regex);
326
+ if (match && match[1]) {
327
+ value = match[1];
328
+ }
329
+ }
330
+ if (value) {
331
+ const href = element.getAttribute('href');
332
+ if (href) {
333
+ filters.push({
334
+ displayName: displayName.trim(),
335
+ value: value.trim(),
336
+ url: href
337
+ });
338
+ }
339
+ else {
340
+ filters.push({
341
+ displayName: displayName.trim(),
342
+ value: value.trim()
343
+ });
344
+ }
345
+ }
346
+ }
347
+ return { filters };
348
+ }
262
349
  /** Backwards-compatible name for page extraction. */
263
350
  export const extract = extractPages;
264
351
  function asRecord(value) {
@@ -274,6 +361,7 @@ function toJSON(value) {
274
361
  * Method aliases match the `ThemeHooks` names.
275
362
  */
276
363
  export async function dispatch(runtime, method, argsJSON) {
364
+ assertAdapterAPIVersion(runtime.adapter);
277
365
  const args = asRecord(argsJSON.trim() === '' ? {} : JSON.parse(argsJSON));
278
366
  switch (method) {
279
367
  case 'search': {
@@ -305,6 +393,21 @@ export async function dispatch(runtime, method, argsJSON) {
305
393
  mangaKey: String(args.mangaKey ?? ''),
306
394
  chapterKey: String(args.chapterKey ?? ''),
307
395
  }));
396
+ case 'extractGenres': {
397
+ const argsRecord = args;
398
+ const mapping = {
399
+ source: String(argsRecord.source ?? ''),
400
+ };
401
+ if (argsRecord.displayNameAttr)
402
+ mapping.displayNameAttr = String(argsRecord.displayNameAttr);
403
+ if (argsRecord.valueAttr)
404
+ mapping.valueAttr = String(argsRecord.valueAttr);
405
+ if (argsRecord.valuePattern)
406
+ mapping.valuePattern = String(argsRecord.valuePattern);
407
+ if (argsRecord.filterParam)
408
+ mapping.filterParam = String(argsRecord.filterParam);
409
+ return toJSON(await extractGenres(runtime, mapping));
410
+ }
308
411
  default:
309
412
  throw new Error(`Unknown adapter method: ${method}`);
310
413
  }
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { __apiVersion, __nativeInvoke, __http, __parseHTML, setTimeout, clearTimeout, __timerFire, console, type HttpRequest, type HttpResponse } from './prelude.js';
2
- import { dispatch, extract, extractChapters, extractDetails, extractPages, extractSearch, normalizeContentRating, normalizeStatus, resolveSelectors, type ExtractionResult, type PageKeys, type ThemeRuntimeOptions } from './engine.js';
2
+ import { assertAdapterAPIVersion, dispatch, extract, extractChapters, extractDetails, extractPages, extractSearch, normalizeContentRating, normalizeStatus, resolveSelectors, UnsupportedApiVersionError, type ExtractionResult, type PageKeys, type ThemeRuntimeOptions } from './engine.js';
3
3
  import { extractCss, type CssStrategy } from './css.js';
4
4
  import { extractScriptJSON, extractHydration, extractAjax, parseJSONText, readPath, runStrategy, toPages, type AjaxStrategy, type HydrationStrategy, type ScriptJSONStrategy, type StrategyEnvironment } from './strategies.js';
5
5
  import type { DocumentLike, ElementLike, ParseHTML, WindowLike } from './dom.js';
6
- export { __apiVersion, __nativeInvoke, __http, __parseHTML, setTimeout, clearTimeout, __timerFire, console, dispatch, extract, extractChapters, extractDetails, extractPages, extractSearch, normalizeContentRating, normalizeStatus, resolveSelectors, extractCss, extractScriptJSON, extractHydration, extractAjax, parseJSONText, readPath, runStrategy, toPages, };
6
+ export { __apiVersion, __nativeInvoke, __http, __parseHTML, setTimeout, clearTimeout, __timerFire, console, assertAdapterAPIVersion, dispatch, extract, extractChapters, extractDetails, extractPages, extractSearch, normalizeContentRating, normalizeStatus, resolveSelectors, UnsupportedApiVersionError, extractCss, extractScriptJSON, extractHydration, extractAjax, parseJSONText, readPath, runStrategy, toPages, };
7
7
  export type { HttpRequest, HttpResponse, ExtractionResult, PageKeys, ThemeRuntimeOptions, CssStrategy, ScriptJSONStrategy, HydrationStrategy, AjaxStrategy, StrategyEnvironment, DocumentLike, ElementLike, ParseHTML, WindowLike, };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  import { __apiVersion, __nativeInvoke, __http, __parseHTML, setTimeout, clearTimeout, __timerFire, console, } from './prelude.js';
3
- import { dispatch, extract, extractChapters, extractDetails, extractPages, extractSearch, normalizeContentRating, normalizeStatus, resolveSelectors, } from './engine.js';
3
+ import { assertAdapterAPIVersion, dispatch, extract, extractChapters, extractDetails, extractPages, extractSearch, normalizeContentRating, normalizeStatus, resolveSelectors, UnsupportedApiVersionError, } from './engine.js';
4
4
  import { extractCss } from './css.js';
5
5
  import { extractScriptJSON, extractHydration, extractAjax, parseJSONText, readPath, runStrategy, toPages, } from './strategies.js';
6
- export { __apiVersion, __nativeInvoke, __http, __parseHTML, setTimeout, clearTimeout, __timerFire, console, dispatch, extract, extractChapters, extractDetails, extractPages, extractSearch, normalizeContentRating, normalizeStatus, resolveSelectors, extractCss, extractScriptJSON, extractHydration, extractAjax, parseJSONText, readPath, runStrategy, toPages, };
6
+ export { __apiVersion, __nativeInvoke, __http, __parseHTML, setTimeout, clearTimeout, __timerFire, console, assertAdapterAPIVersion, dispatch, extract, extractChapters, extractDetails, extractPages, extractSearch, normalizeContentRating, normalizeStatus, resolveSelectors, UnsupportedApiVersionError, extractCss, extractScriptJSON, extractHydration, extractAjax, parseJSONText, readPath, runStrategy, toPages, };
package/dist/prelude.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- import { API_VERSION } from '@blankgrimoire/types';
2
+ import { API_VERSION, } from '@blankgrimoire/types';
3
3
  export const __apiVersion = API_VERSION;
4
4
  function nativeHost() {
5
5
  return globalThis.__native;
package/dist/runtime.js CHANGED
@@ -21,11 +21,13 @@ var BlankGrimoireRuntime = (() => {
21
21
  // src/index.ts
22
22
  var index_exports = {};
23
23
  __export(index_exports, {
24
+ UnsupportedApiVersionError: () => UnsupportedApiVersionError,
24
25
  __apiVersion: () => __apiVersion,
25
26
  __http: () => __http,
26
27
  __nativeInvoke: () => __nativeInvoke,
27
28
  __parseHTML: () => __parseHTML,
28
29
  __timerFire: () => __timerFire,
30
+ assertAdapterAPIVersion: () => assertAdapterAPIVersion,
29
31
  clearTimeout: () => clearTimeout,
30
32
  console: () => console,
31
33
  dispatch: () => dispatch,
@@ -498,6 +500,19 @@ var BlankGrimoireRuntime = (() => {
498
500
  }
499
501
 
500
502
  // src/engine.ts
503
+ var UnsupportedApiVersionError = class extends Error {
504
+ constructor(found) {
505
+ super(`Unsupported adapter apiVersion ${String(found)}; expected ${API_VERSION}`);
506
+ this.expected = API_VERSION;
507
+ this.name = "UnsupportedApiVersionError";
508
+ this.found = found;
509
+ }
510
+ };
511
+ function assertAdapterAPIVersion(adapter) {
512
+ if (adapter.apiVersion !== API_VERSION) {
513
+ throw new UnsupportedApiVersionError(adapter.apiVersion);
514
+ }
515
+ }
501
516
  function resolveSelectors(base, overrides) {
502
517
  const resolved = {
503
518
  search: { ...base.search, ...overrides.search },
@@ -533,6 +548,13 @@ var BlankGrimoireRuntime = (() => {
533
548
  const value = firstAttribute(image, ["data-src", "src", "data-original"]);
534
549
  return value ? resolveURL(value, baseURL) : void 0;
535
550
  }
551
+ function selectLink(element, selector) {
552
+ const descendant = selector ? element.querySelector(selector) : null;
553
+ if (descendant) {
554
+ return descendant;
555
+ }
556
+ return attr(element, "href") ? element : null;
557
+ }
536
558
  function splitList(value) {
537
559
  if (!value) {
538
560
  return void 0;
@@ -587,6 +609,7 @@ var BlankGrimoireRuntime = (() => {
587
609
  return Number.isFinite(number) ? number : void 0;
588
610
  }
589
611
  async function extractSearch(runtime, query) {
612
+ assertAdapterAPIVersion(runtime.adapter);
590
613
  const hook = runtime.adapter.hooks?.search;
591
614
  if (hook) {
592
615
  return hook(runtime.context, query);
@@ -594,9 +617,9 @@ var BlankGrimoireRuntime = (() => {
594
617
  const selectors = selectorsFor(runtime).search;
595
618
  const items = [];
596
619
  for (const element of queryAll(runtime.document, selectors.item)) {
597
- const title = textOf(element.querySelector(selectors.title));
598
- const link = element.querySelector(selectors.link);
620
+ const link = selectLink(element, selectors.link);
599
621
  const href = link ? attr(link, "href") : null;
622
+ const title = textOf(element.querySelector(selectors.title)) || (link ? textOf(link) : "");
600
623
  if (title === "" || !href) {
601
624
  continue;
602
625
  }
@@ -614,6 +637,7 @@ var BlankGrimoireRuntime = (() => {
614
637
  return { items, hasNextPage };
615
638
  }
616
639
  async function extractDetails(runtime, key) {
640
+ assertAdapterAPIVersion(runtime.adapter);
617
641
  const hook = runtime.adapter.hooks?.getMangaDetails;
618
642
  if (hook) {
619
643
  return hook(runtime.context, key);
@@ -677,6 +701,7 @@ var BlankGrimoireRuntime = (() => {
677
701
  return details;
678
702
  }
679
703
  async function extractChapters(runtime, key) {
704
+ assertAdapterAPIVersion(runtime.adapter);
680
705
  const hook = runtime.adapter.hooks?.getChapters;
681
706
  if (hook) {
682
707
  return hook(runtime.context, key);
@@ -685,12 +710,12 @@ var BlankGrimoireRuntime = (() => {
685
710
  const baseURL = runtime.context.baseURL;
686
711
  const chapters = [];
687
712
  for (const element of queryAll(runtime.document, selectors.item)) {
688
- const link = element.querySelector(selectors.link);
713
+ const link = selectLink(element, selectors.link);
689
714
  const href = link ? attr(link, "href") : null;
690
715
  if (!href) {
691
716
  continue;
692
717
  }
693
- const title = selectors.title ? readText(element, selectors.title) : textOf(link) || void 0;
718
+ const title = selectors.title ? (readText(element, selectors.title) ?? textOf(link)) || void 0 : textOf(link) || void 0;
694
719
  const chapter = { key: resolveURL(href, baseURL) };
695
720
  if (title) {
696
721
  chapter.title = title;
@@ -721,6 +746,7 @@ var BlankGrimoireRuntime = (() => {
721
746
  return chapters;
722
747
  }
723
748
  async function extractPages(runtime, keys) {
749
+ assertAdapterAPIVersion(runtime.adapter);
724
750
  const hook = runtime.adapter.hooks?.getPages;
725
751
  if (hook) {
726
752
  return hook(runtime.context, keys.mangaKey, keys.chapterKey);
@@ -741,6 +767,48 @@ var BlankGrimoireRuntime = (() => {
741
767
  }
742
768
  return [];
743
769
  }
770
+ async function extractGenres(runtime, mapping) {
771
+ assertAdapterAPIVersion(runtime.adapter);
772
+ const document = runtime.document;
773
+ const filters = [];
774
+ if (!mapping.source) {
775
+ return { filters };
776
+ }
777
+ const elements = document.querySelectorAll(mapping.source);
778
+ for (const element of Array.from(elements)) {
779
+ const displayName = mapping.displayNameAttr ? element.querySelector(mapping.displayNameAttr)?.textContent?.trim() || element.textContent?.trim() : element.textContent?.trim();
780
+ if (!displayName) continue;
781
+ let value = "";
782
+ if (mapping.valueAttr) {
783
+ value = element.getAttribute(mapping.valueAttr) || "";
784
+ } else {
785
+ value = element.textContent?.trim() || "";
786
+ }
787
+ if (mapping.valuePattern) {
788
+ const regex = new RegExp(mapping.valuePattern);
789
+ const match = value.match(regex);
790
+ if (match && match[1]) {
791
+ value = match[1];
792
+ }
793
+ }
794
+ if (value) {
795
+ const href = element.getAttribute("href");
796
+ if (href) {
797
+ filters.push({
798
+ displayName: displayName.trim(),
799
+ value: value.trim(),
800
+ url: href
801
+ });
802
+ } else {
803
+ filters.push({
804
+ displayName: displayName.trim(),
805
+ value: value.trim()
806
+ });
807
+ }
808
+ }
809
+ }
810
+ return { filters };
811
+ }
744
812
  var extract = extractPages;
745
813
  function asRecord(value) {
746
814
  return value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
@@ -749,6 +817,7 @@ var BlankGrimoireRuntime = (() => {
749
817
  return JSON.stringify(value) ?? "null";
750
818
  }
751
819
  async function dispatch(runtime, method, argsJSON) {
820
+ assertAdapterAPIVersion(runtime.adapter);
752
821
  const args = asRecord(argsJSON.trim() === "" ? {} : JSON.parse(argsJSON));
753
822
  switch (method) {
754
823
  case "search": {
@@ -782,6 +851,17 @@ var BlankGrimoireRuntime = (() => {
782
851
  chapterKey: String(args.chapterKey ?? "")
783
852
  })
784
853
  );
854
+ case "extractGenres": {
855
+ const argsRecord = args;
856
+ const mapping = {
857
+ source: String(argsRecord.source ?? "")
858
+ };
859
+ if (argsRecord.displayNameAttr) mapping.displayNameAttr = String(argsRecord.displayNameAttr);
860
+ if (argsRecord.valueAttr) mapping.valueAttr = String(argsRecord.valueAttr);
861
+ if (argsRecord.valuePattern) mapping.valuePattern = String(argsRecord.valuePattern);
862
+ if (argsRecord.filterParam) mapping.filterParam = String(argsRecord.filterParam);
863
+ return toJSON(await extractGenres(runtime, mapping));
864
+ }
785
865
  default:
786
866
  throw new Error(`Unknown adapter method: ${method}`);
787
867
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blankgrimoire/runtime",
3
- "version": "1.0.1",
3
+ "version": "1.2.0",
4
4
  "description": "Declarative extraction runtime for BlankGrimoire theme adapters.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -26,15 +26,16 @@
26
26
  "directory": "packages/runtime"
27
27
  },
28
28
  "dependencies": {
29
- "@blankgrimoire/types": "1.0.1"
29
+ "@blankgrimoire/types": "1.2.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "esbuild": "^0.24.0",
33
33
  "jsdom": "^24.0.0"
34
34
  },
35
35
  "scripts": {
36
- "build": "tsc -p tsconfig.json && esbuild src/index.ts --bundle --format=iife --outfile=dist/runtime.js --global-name=BlankGrimoireRuntime",
36
+ "build": "tsc -p tsconfig.json && node build.mjs",
37
37
  "typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json",
38
+ "pretest": "pnpm --filter @blankgrimoire/types... build && pnpm build",
38
39
  "test": "vitest run --passWithNoTests"
39
40
  }
40
41
  }