koishipro-core.js 1.1.1 → 1.1.2

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/README.md CHANGED
@@ -22,9 +22,9 @@ npm install koishipro-core.js
22
22
  ```ts
23
23
  import {
24
24
  createOcgcoreWrapper,
25
- ZipReader,
26
- DirReader,
27
- createSqljsCardReader,
25
+ ZipScriptReader,
26
+ DirScriptReader,
27
+ SqljsCardReader,
28
28
  } from 'koishipro-core.js';
29
29
  import initSqlJs from 'sql.js';
30
30
 
@@ -33,13 +33,13 @@ const wrapper = await createOcgcoreWrapper();
33
33
  // Provide scripts via zip + local directory fallback (Node only)
34
34
  const zipBytes = await fetch('/script.zip').then((r) => r.arrayBuffer());
35
35
  wrapper
36
- .setScriptReader(await ZipReader(new Uint8Array(zipBytes)), true)
37
- .setScriptReader(DirReader('./ygopro-scripts'));
36
+ .setScriptReader(await ZipScriptReader(new Uint8Array(zipBytes)), true)
37
+ .setScriptReader(DirScriptReader('./ygopro-scripts'));
38
38
 
39
39
  // Provide cards via sql.js
40
40
  const SQL = await initSqlJs();
41
41
  const db = new SQL.Database(await fetch('/cards.cdb').then((r) => r.arrayBuffer()));
42
- wrapper.setCardReader(createSqljsCardReader(db));
42
+ wrapper.setCardReader(SqljsCardReader(db));
43
43
 
44
44
  // Optional: log messages from ocgcore (multiple handlers allowed)
45
45
  wrapper
@@ -202,29 +202,32 @@ Represents a single duel instance with full lifecycle management.
202
202
 
203
203
  ### Script Readers
204
204
 
205
- #### `MapReader(...maps: Map<string, string | Uint8Array>[]): ScriptReader`
205
+ #### `MapScriptReader(...maps: Map<string, string | Uint8Array>[]): ScriptReader`
206
206
  Resolve Lua scripts from one or more Maps with fallback order.
207
207
 
208
208
  ```ts
209
209
  const scripts = new Map([
210
210
  ['c12345.lua', 'function c12345.initial_effect(c) end'],
211
211
  ]);
212
- wrapper.setScriptReader(MapReader(scripts));
212
+ wrapper.setScriptReader(MapScriptReader(scripts));
213
213
  ```
214
214
 
215
- #### `ZipReader(...zipBytes: Uint8Array[]): Promise<ScriptReader>`
215
+ #### `ZipScriptReader(...zipBytes: Uint8Array[]): Promise<ScriptReader>`
216
216
  Load all `.lua` files from one or more zips.
217
217
 
218
218
  ```ts
219
219
  const zipBytes = await fetch('/scripts.zip').then(r => r.arrayBuffer());
220
- wrapper.setScriptReader(await ZipReader(new Uint8Array(zipBytes)));
220
+ wrapper.setScriptReader(await ZipScriptReader(new Uint8Array(zipBytes)));
221
221
  ```
222
222
 
223
- #### `DirReader(...dirs: string[]): ScriptReader`
223
+ #### `DirScriptReader(...dirs: string[]): ScriptReader`
224
224
  Node-only directory reader with fallback order.
225
225
 
226
226
  ```ts
227
- wrapper.setScriptReader(DirReader('./ygopro-scripts', './custom-scripts'));
227
+ wrapper.setScriptReader(DirScriptReader('./ygopro-scripts', './custom-scripts'));
228
+
229
+ #### `DirScriptReaderEx(...dirs: string[]): Promise<ScriptReader>`
230
+ Node-only directory reader with zip/ypk fallback. Zips are scanned in project root and `expansions/` with lower priority than filesystem scripts.
228
231
  ```
229
232
 
230
233
  ### Replay Functions
@@ -266,7 +269,7 @@ for (const { duel, result } of playYrpStep(wrapper, yrpBytes)) {
266
269
 
267
270
  ### Card Reader
268
271
 
269
- #### `createSqljsCardReader(...dbs: Database[]): CardReader`
272
+ #### `SqljsCardReader(...dbs: Database[]): CardReader`
270
273
  Build a `CardReader` from one or more SQL.js databases with fallback order.
271
274
 
272
275
  ```ts
@@ -277,7 +280,10 @@ const db1 = new SQL.Database(officialCards);
277
280
  const db2 = new SQL.Database(customCards);
278
281
 
279
282
  // Try db1 first, fallback to db2
280
- wrapper.setCardReader(createSqljsCardReader(db1, db2));
283
+ wrapper.setCardReader(SqljsCardReader(db1, db2));
284
+
285
+ #### `DirCardReader(sqljs: SqlJsStatic, ...dirs: string[]): Promise<CardReader>`
286
+ Node-only card reader that loads `cards.cdb`, `expansions/*.cdb`, and root-level `.cdb` files inside `*.zip`/`*.ypk` archives under each directory.
281
287
  ```
282
288
 
283
289
  ### Constants
package/dist/index.cjs CHANGED
@@ -38,12 +38,16 @@ var __decorateClass = (decorators, target, key, kind) => {
38
38
  var index_exports = {};
39
39
  __export(index_exports, {
40
40
  CardDataStruct: () => CardDataStruct,
41
+ DirCardReader: () => DirCardReader,
41
42
  DirReader: () => DirReader,
43
+ DirScriptReader: () => DirScriptReader,
44
+ DirScriptReaderEx: () => DirScriptReaderEx,
42
45
  LEN_EMPTY: () => LEN_EMPTY,
43
46
  LEN_FAIL: () => LEN_FAIL,
44
47
  LEN_HEADER: () => LEN_HEADER,
45
48
  MESSAGE_BUFFER_SIZE: () => MESSAGE_BUFFER_SIZE,
46
49
  MapReader: () => MapReader,
50
+ MapScriptReader: () => MapScriptReader,
47
51
  OcgcoreCommonConstants: () => OcgcoreCommonConstants,
48
52
  OcgcoreDuel: () => OcgcoreDuel,
49
53
  OcgcoreDuelOptionFlag: () => OcgcoreDuelOptionFlag,
@@ -53,7 +57,9 @@ __export(index_exports, {
53
57
  OcgcoreWrapper: () => OcgcoreWrapper,
54
58
  QUERY_BUFFER_SIZE: () => QUERY_BUFFER_SIZE,
55
59
  REGISTRY_BUFFER_SIZE: () => REGISTRY_BUFFER_SIZE,
60
+ SqljsCardReader: () => SqljsCardReader,
56
61
  ZipReader: () => ZipReader,
62
+ ZipScriptReader: () => ZipScriptReader,
57
63
  createOcgcoreWrapper: () => createOcgcoreWrapper,
58
64
  createSqljsCardReader: () => createSqljsCardReader,
59
65
  normalizeStartDuelOptions: () => normalizeStartDuelOptions,
@@ -1212,114 +1218,6 @@ async function createOcgcoreWrapper(options = {}) {
1212
1218
  return new OcgcoreWrapper(moduleInstance);
1213
1219
  }
1214
1220
 
1215
- // src/adapters/script-readers.ts
1216
- var import_jszip = __toESM(require("jszip"));
1217
- var SCRIPT_PREFIX = "./script/";
1218
- function normalizePath(input) {
1219
- let path = input.replace(/\\/g, "/");
1220
- if (path.startsWith(SCRIPT_PREFIX)) {
1221
- path = path.slice(SCRIPT_PREFIX.length);
1222
- }
1223
- return path;
1224
- }
1225
- function buildCandidates(filename) {
1226
- const entries = [
1227
- filename,
1228
- `specials/${filename}`,
1229
- `expansions/script/${filename}`,
1230
- `script/${filename}`
1231
- ];
1232
- const candidates = [];
1233
- for (const entry of entries) {
1234
- candidates.push(entry);
1235
- if (!entry.startsWith("./")) {
1236
- const dotEntry = entry.startsWith("/") ? `./${entry.slice(1)}` : `./${entry}`;
1237
- candidates.push(dotEntry);
1238
- }
1239
- }
1240
- return candidates;
1241
- }
1242
- function joinPath(baseDir, relativePath) {
1243
- const pathMod = getNodePath();
1244
- if (pathMod) {
1245
- return pathMod.join(baseDir, relativePath);
1246
- }
1247
- const trimmedBase = baseDir.replace(/[/\\]+$/, "");
1248
- const trimmedRel = relativePath.replace(/^[/\\]+/, "");
1249
- return `${trimmedBase}/${trimmedRel}`;
1250
- }
1251
- function MapReader(...maps) {
1252
- return (path) => {
1253
- const filename = normalizePath(path);
1254
- if (!filename.toLowerCase().endsWith(".lua")) {
1255
- return null;
1256
- }
1257
- const candidates = buildCandidates(filename);
1258
- for (const candidate of candidates) {
1259
- for (const map of maps) {
1260
- if (map.has(candidate)) {
1261
- return map.get(candidate) ?? null;
1262
- }
1263
- }
1264
- }
1265
- return null;
1266
- };
1267
- }
1268
- function DirReader(...baseDirs) {
1269
- const fs = getNodeFs();
1270
- return (path) => {
1271
- const filename = normalizePath(path);
1272
- if (!filename.toLowerCase().endsWith(".lua")) {
1273
- return null;
1274
- }
1275
- const candidates = buildCandidates(filename);
1276
- for (const baseDir of baseDirs) {
1277
- for (const candidate of candidates) {
1278
- const normalized = candidate.startsWith("/") ? candidate.slice(1) : candidate;
1279
- const fullPath = joinPath(baseDir, normalized);
1280
- if (fs.existsSync(fullPath)) {
1281
- return fs.readFileSync(fullPath);
1282
- }
1283
- }
1284
- }
1285
- return null;
1286
- };
1287
- }
1288
- function normalizeZipEntryName(name) {
1289
- const normalized = name.replace(/\\/g, "/").replace(/^\.?\//, "");
1290
- const names = /* @__PURE__ */ new Set();
1291
- names.add(normalized);
1292
- if (normalized.startsWith("script/")) {
1293
- names.add(normalized.slice("script/".length));
1294
- }
1295
- return Array.from(names);
1296
- }
1297
- async function ZipReader(...inputs) {
1298
- const maps = await Promise.all(
1299
- inputs.map(async (data) => {
1300
- const zip = await import_jszip.default.loadAsync(data);
1301
- const map = /* @__PURE__ */ new Map();
1302
- const entries = Object.values(zip.files);
1303
- await Promise.all(
1304
- entries.map(async (entry) => {
1305
- if (entry.dir) {
1306
- return;
1307
- }
1308
- if (!entry.name.toLowerCase().endsWith(".lua")) {
1309
- return;
1310
- }
1311
- const content = await entry.async("uint8array");
1312
- for (const name of normalizeZipEntryName(entry.name)) {
1313
- map.set(name, content);
1314
- }
1315
- })
1316
- );
1317
- return map;
1318
- })
1319
- );
1320
- return MapReader(...maps);
1321
- }
1322
-
1323
1221
  // src/vendor/script-constants.ts
1324
1222
  var OcgcoreScriptConstants = {
1325
1223
  ACTIVITY_ATTACK: 5,
@@ -2158,7 +2056,207 @@ var OcgcoreScriptConstants = {
2158
2056
  TYPE_XYZ: 8388608
2159
2057
  };
2160
2058
 
2161
- // src/sqljs-card-reader.ts
2059
+ // src/script-reader/script-readers.ts
2060
+ var import_jszip = __toESM(require("jszip"));
2061
+ var SCRIPT_PREFIX = "./script/";
2062
+ function normalizePath(input) {
2063
+ let path = input.replace(/\\/g, "/");
2064
+ if (path.startsWith(SCRIPT_PREFIX)) {
2065
+ path = path.slice(SCRIPT_PREFIX.length);
2066
+ }
2067
+ return path;
2068
+ }
2069
+ function buildCandidates(filename) {
2070
+ const entries = [
2071
+ filename,
2072
+ `specials/${filename}`,
2073
+ `expansions/script/${filename}`,
2074
+ `script/${filename}`
2075
+ ];
2076
+ const candidates = [];
2077
+ for (const entry of entries) {
2078
+ candidates.push(entry);
2079
+ if (!entry.startsWith("./")) {
2080
+ const dotEntry = entry.startsWith("/") ? `./${entry.slice(1)}` : `./${entry}`;
2081
+ candidates.push(dotEntry);
2082
+ }
2083
+ }
2084
+ return candidates;
2085
+ }
2086
+ function joinPath(baseDir, relativePath) {
2087
+ const pathMod = getNodePath();
2088
+ if (pathMod) {
2089
+ return pathMod.join(baseDir, relativePath);
2090
+ }
2091
+ const trimmedBase = baseDir.replace(/[/\\]+$/, "");
2092
+ const trimmedRel = relativePath.replace(/^[/\\]+/, "");
2093
+ return `${trimmedBase}/${trimmedRel}`;
2094
+ }
2095
+ function MapScriptReader(...maps) {
2096
+ return (path) => {
2097
+ const filename = normalizePath(path);
2098
+ if (!filename.toLowerCase().endsWith(".lua")) {
2099
+ return null;
2100
+ }
2101
+ const candidates = buildCandidates(filename);
2102
+ for (const candidate of candidates) {
2103
+ for (const map of maps) {
2104
+ if (map.has(candidate)) {
2105
+ return map.get(candidate) ?? null;
2106
+ }
2107
+ }
2108
+ }
2109
+ return null;
2110
+ };
2111
+ }
2112
+ function DirScriptReader(...baseDirs) {
2113
+ const fs = getNodeFs();
2114
+ return (path) => {
2115
+ const filename = normalizePath(path);
2116
+ if (!filename.toLowerCase().endsWith(".lua")) {
2117
+ return null;
2118
+ }
2119
+ const candidates = buildCandidates(filename);
2120
+ for (const baseDir of baseDirs) {
2121
+ for (const candidate of candidates) {
2122
+ const normalized = candidate.startsWith("/") ? candidate.slice(1) : candidate;
2123
+ const fullPath = joinPath(baseDir, normalized);
2124
+ if (fs.existsSync(fullPath)) {
2125
+ return fs.readFileSync(fullPath);
2126
+ }
2127
+ }
2128
+ }
2129
+ return null;
2130
+ };
2131
+ }
2132
+ function normalizeZipEntryName(name) {
2133
+ const normalized = name.replace(/\\/g, "/").replace(/^\.?\//, "");
2134
+ const names = /* @__PURE__ */ new Set();
2135
+ names.add(normalized);
2136
+ if (normalized.startsWith("script/")) {
2137
+ names.add(normalized.slice("script/".length));
2138
+ }
2139
+ return Array.from(names);
2140
+ }
2141
+ async function ZipScriptReader(...inputs) {
2142
+ const maps = await Promise.all(
2143
+ inputs.map(async (data) => {
2144
+ const zip = await import_jszip.default.loadAsync(data);
2145
+ const map = /* @__PURE__ */ new Map();
2146
+ const entries = Object.values(zip.files);
2147
+ await Promise.all(
2148
+ entries.map(async (entry) => {
2149
+ if (entry.dir) {
2150
+ return;
2151
+ }
2152
+ if (!entry.name.toLowerCase().endsWith(".lua")) {
2153
+ return;
2154
+ }
2155
+ const content = await entry.async("uint8array");
2156
+ for (const name of normalizeZipEntryName(entry.name)) {
2157
+ map.set(name, content);
2158
+ }
2159
+ })
2160
+ );
2161
+ return map;
2162
+ })
2163
+ );
2164
+ return MapScriptReader(...maps);
2165
+ }
2166
+ function MapReader(...maps) {
2167
+ return MapScriptReader(...maps);
2168
+ }
2169
+ function DirReader(...baseDirs) {
2170
+ return DirScriptReader(...baseDirs);
2171
+ }
2172
+ async function ZipReader(...inputs) {
2173
+ return ZipScriptReader(...inputs);
2174
+ }
2175
+
2176
+ // src/utility/search-zips.ts
2177
+ function joinPath2(pathMod, baseDir, rel) {
2178
+ if (pathMod) {
2179
+ return pathMod.join(baseDir, rel);
2180
+ }
2181
+ const trimmedBase = baseDir.replace(/[/\\]+$/, "");
2182
+ const trimmedRel = rel.replace(/^[/\\]+/, "");
2183
+ return `${trimmedBase}/${trimmedRel}`;
2184
+ }
2185
+ async function safeReadDir(fs, dirPath) {
2186
+ try {
2187
+ return await fs.promises.readdir(dirPath);
2188
+ } catch {
2189
+ return [];
2190
+ }
2191
+ }
2192
+ async function searchZips(fs, pathMod, baseDir) {
2193
+ const results = [];
2194
+ const rootEntries = await safeReadDir(fs, baseDir);
2195
+ for (const entry of rootEntries) {
2196
+ const lower = entry.toLowerCase();
2197
+ if (!lower.endsWith(".zip") && !lower.endsWith(".ypk")) {
2198
+ continue;
2199
+ }
2200
+ const fullPath = joinPath2(pathMod, baseDir, entry);
2201
+ try {
2202
+ const stats = await fs.promises.stat(fullPath);
2203
+ if (stats.isFile()) {
2204
+ results.push(fullPath);
2205
+ }
2206
+ } catch {
2207
+ continue;
2208
+ }
2209
+ }
2210
+ const expansionsDir = joinPath2(pathMod, baseDir, "expansions");
2211
+ const expansionEntries = await safeReadDir(fs, expansionsDir);
2212
+ for (const entry of expansionEntries) {
2213
+ const lower = entry.toLowerCase();
2214
+ if (!lower.endsWith(".zip") && !lower.endsWith(".ypk")) {
2215
+ continue;
2216
+ }
2217
+ const fullPath = joinPath2(pathMod, expansionsDir, entry);
2218
+ try {
2219
+ const stats = await fs.promises.stat(fullPath);
2220
+ if (stats.isFile()) {
2221
+ results.push(fullPath);
2222
+ }
2223
+ } catch {
2224
+ continue;
2225
+ }
2226
+ }
2227
+ return results;
2228
+ }
2229
+
2230
+ // src/script-reader/dir-script-reader-ex.ts
2231
+ function getNodeModuleOrThrow(value, label) {
2232
+ if (!value) {
2233
+ throw new Error(`${label} is not supported in this runtime.`);
2234
+ }
2235
+ return value;
2236
+ }
2237
+ async function DirScriptReaderEx(...baseDirs) {
2238
+ const fs = getNodeModuleOrThrow(getNodeFs(), "DirScriptReaderEx");
2239
+ const pathMod = getNodeModuleOrThrow(getNodePath(), "DirScriptReaderEx");
2240
+ const fsReader = DirScriptReader(...baseDirs);
2241
+ const zipInputs = [];
2242
+ for (const baseDir of baseDirs) {
2243
+ const zipPaths = await searchZips(fs, pathMod, baseDir);
2244
+ for (const zipPath of zipPaths) {
2245
+ try {
2246
+ zipInputs.push(await fs.promises.readFile(zipPath));
2247
+ } catch {
2248
+ continue;
2249
+ }
2250
+ }
2251
+ }
2252
+ if (zipInputs.length === 0) {
2253
+ return fsReader;
2254
+ }
2255
+ const zipReader = await ZipScriptReader(...zipInputs);
2256
+ return (path) => fsReader(path) ?? zipReader(path);
2257
+ }
2258
+
2259
+ // src/card-reader/sqljs-card-reader.ts
2162
2260
  function toUint16ArrayFromSetcode(value) {
2163
2261
  let raw = typeof value === "bigint" ? value : BigInt(value >>> 0);
2164
2262
  const list = new Uint16Array(16);
@@ -2239,7 +2337,7 @@ function queryOne(db, cardId) {
2239
2337
  attribute: row[8]
2240
2338
  });
2241
2339
  }
2242
- function createSqljsCardReader(...dbs) {
2340
+ function SqljsCardReader(...dbs) {
2243
2341
  return (cardId) => {
2244
2342
  for (const db of dbs) {
2245
2343
  const data = queryOne(db, cardId);
@@ -2250,6 +2348,105 @@ function createSqljsCardReader(...dbs) {
2250
2348
  return null;
2251
2349
  };
2252
2350
  }
2351
+ function createSqljsCardReader(...dbs) {
2352
+ return SqljsCardReader(...dbs);
2353
+ }
2354
+
2355
+ // src/card-reader/dir-card-reader.ts
2356
+ var import_jszip2 = __toESM(require("jszip"));
2357
+ function joinPath3(pathMod, baseDir, rel) {
2358
+ if (pathMod) {
2359
+ return pathMod.join(baseDir, rel);
2360
+ }
2361
+ const trimmedBase = baseDir.replace(/[/\\]+$/, "");
2362
+ const trimmedRel = rel.replace(/^[/\\]+/, "");
2363
+ return `${trimmedBase}/${trimmedRel}`;
2364
+ }
2365
+ function getNodeModuleOrThrow2(value, label) {
2366
+ if (!value) {
2367
+ throw new Error(`${label} is not supported in this runtime.`);
2368
+ }
2369
+ return value;
2370
+ }
2371
+ async function safeReadDir2(fs, dirPath) {
2372
+ try {
2373
+ return await fs.promises.readdir(dirPath);
2374
+ } catch {
2375
+ return [];
2376
+ }
2377
+ }
2378
+ async function collectFsDbPaths(fs, pathMod, baseDir) {
2379
+ const results = [];
2380
+ const baseDb = joinPath3(pathMod, baseDir, "cards.cdb");
2381
+ try {
2382
+ const stats = await fs.promises.stat(baseDb);
2383
+ if (stats.isFile()) {
2384
+ results.push(baseDb);
2385
+ }
2386
+ } catch {
2387
+ }
2388
+ const expansionsDir = joinPath3(pathMod, baseDir, "expansions");
2389
+ const entries = await safeReadDir2(fs, expansionsDir);
2390
+ for (const entry of entries) {
2391
+ if (!entry.toLowerCase().endsWith(".cdb")) {
2392
+ continue;
2393
+ }
2394
+ const fullPath = joinPath3(pathMod, expansionsDir, entry);
2395
+ try {
2396
+ const stats = await fs.promises.stat(fullPath);
2397
+ if (stats.isFile()) {
2398
+ results.push(fullPath);
2399
+ }
2400
+ } catch {
2401
+ continue;
2402
+ }
2403
+ }
2404
+ return results;
2405
+ }
2406
+ function isRootCdbEntry(entryName) {
2407
+ const normalized = entryName.replace(/\\/g, "/").replace(/^\.?\//, "");
2408
+ return !normalized.includes("/") && normalized.toLowerCase().endsWith(".cdb");
2409
+ }
2410
+ async function DirCardReader(sqljs, ...baseDirs) {
2411
+ const fs = getNodeModuleOrThrow2(getNodeFs(), "DirCardReader");
2412
+ const pathMod = getNodeModuleOrThrow2(getNodePath(), "DirCardReader");
2413
+ const dbs = [];
2414
+ for (const baseDir of baseDirs) {
2415
+ const dbPaths = await collectFsDbPaths(fs, pathMod, baseDir);
2416
+ for (const dbPath of dbPaths) {
2417
+ try {
2418
+ const bytes = await fs.promises.readFile(dbPath);
2419
+ dbs.push(new sqljs.Database(bytes));
2420
+ } catch {
2421
+ continue;
2422
+ }
2423
+ }
2424
+ }
2425
+ for (const baseDir of baseDirs) {
2426
+ const zipPaths = await searchZips(fs, pathMod, baseDir);
2427
+ for (const zipPath of zipPaths) {
2428
+ try {
2429
+ const bytes = await fs.promises.readFile(zipPath);
2430
+ const zip = await import_jszip2.default.loadAsync(bytes);
2431
+ const entries = Object.values(zip.files);
2432
+ for (const entry of entries) {
2433
+ if (entry.dir || !isRootCdbEntry(entry.name)) {
2434
+ continue;
2435
+ }
2436
+ try {
2437
+ const content = await entry.async("uint8array");
2438
+ dbs.push(new sqljs.Database(content));
2439
+ } catch {
2440
+ continue;
2441
+ }
2442
+ }
2443
+ } catch {
2444
+ continue;
2445
+ }
2446
+ }
2447
+ }
2448
+ return SqljsCardReader(...dbs);
2449
+ }
2253
2450
 
2254
2451
  // src/play-yrp.ts
2255
2452
  var import_ygopro_yrp_encode = require("ygopro-yrp-encode");
@@ -2368,7 +2565,8 @@ function* playYrpStep(ocgcoreWrapper, yrpInput) {
2368
2565
  const result = duel.process();
2369
2566
  yield {
2370
2567
  duel,
2371
- result
2568
+ result,
2569
+ responses
2372
2570
  };
2373
2571
  if (result.raw.length > 0 && result.raw[0] === OcgcoreCommonConstants.MSG_RETRY) {
2374
2572
  throw new Error("Got MSG_RETRY");
@@ -2451,12 +2649,16 @@ if (typeof globalThis !== "undefined" && !globalThis.Buffer) {
2451
2649
  // Annotate the CommonJS export names for ESM import in node:
2452
2650
  0 && (module.exports = {
2453
2651
  CardDataStruct,
2652
+ DirCardReader,
2454
2653
  DirReader,
2654
+ DirScriptReader,
2655
+ DirScriptReaderEx,
2455
2656
  LEN_EMPTY,
2456
2657
  LEN_FAIL,
2457
2658
  LEN_HEADER,
2458
2659
  MESSAGE_BUFFER_SIZE,
2459
2660
  MapReader,
2661
+ MapScriptReader,
2460
2662
  OcgcoreCommonConstants,
2461
2663
  OcgcoreDuel,
2462
2664
  OcgcoreDuelOptionFlag,
@@ -2466,7 +2668,9 @@ if (typeof globalThis !== "undefined" && !globalThis.Buffer) {
2466
2668
  OcgcoreWrapper,
2467
2669
  QUERY_BUFFER_SIZE,
2468
2670
  REGISTRY_BUFFER_SIZE,
2671
+ SqljsCardReader,
2469
2672
  ZipReader,
2673
+ ZipScriptReader,
2470
2674
  createOcgcoreWrapper,
2471
2675
  createSqljsCardReader,
2472
2676
  normalizeStartDuelOptions,