@learnosity/lib-qti-converter 0.15.1 → 0.16.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/README.md +57 -9
- package/docs/EXAMPLES.md +4 -2
- package/docs/FAQ.md +20 -0
- package/docs/GETTING_STARTED.md +1 -1
- package/docs/SUPPORTED_INTERACTIONS.md +1 -1
- package/package.json +10 -10
- package/packages/cli/dist/{batchProcessors-B6yUImA3.js → batchProcessors-BI6C89vy.js} +138 -102
- package/packages/cli/dist/batchProcessors-BI6C89vy.js.map +1 -0
- package/packages/cli/dist/batchWorker.js +2 -3
- package/packages/cli/dist/{configOutput-FwkFyQmk.js → configOutput-CJ-ryN3j.js} +5 -9
- package/packages/cli/dist/{configOutput-FwkFyQmk.js.map → configOutput-CJ-ryN3j.js.map} +1 -1
- package/packages/cli/dist/{create-prompt-dWckcotJ.js → create-prompt-m0MC0vT_.js} +38 -57
- package/packages/cli/dist/create-prompt-m0MC0vT_.js.map +1 -0
- package/packages/cli/dist/{dist-DXDR2peT.js → dist-8MaFD1oj.js} +6 -10
- package/packages/cli/dist/dist-8MaFD1oj.js.map +1 -0
- package/packages/cli/dist/{learnosityToQti-DIxeAztu.js → learnosityToQti-BDf_faIV.js} +5 -6
- package/packages/cli/dist/{learnosityToQti-DIxeAztu.js.map → learnosityToQti-BDf_faIV.js.map} +1 -1
- package/packages/cli/dist/{learnosityToQtiPackage-CMFop6H4.js → learnosityToQtiPackage-w-BXgsLt.js} +16 -15
- package/packages/cli/dist/learnosityToQtiPackage-w-BXgsLt.js.map +1 -0
- package/packages/cli/dist/main.js +22 -29
- package/packages/cli/dist/main.js.map +1 -1
- package/packages/cli/dist/{nodeFileAccess-BhCoGDOi.js → nodeFileAccess-BBS4FAK7.js} +5 -9
- package/packages/cli/dist/{nodeFileAccess-BhCoGDOi.js.map → nodeFileAccess-BBS4FAK7.js.map} +1 -1
- package/packages/cli/dist/pathUtils-BUJJCvvp.js +2919 -0
- package/packages/cli/dist/pathUtils-BUJJCvvp.js.map +1 -0
- package/packages/cli/dist/{qtiPackageToLearnosity-Sk_1j12c.js → qtiPackageToLearnosity-C24effmB.js} +7 -8
- package/packages/cli/dist/{qtiPackageToLearnosity-Sk_1j12c.js.map → qtiPackageToLearnosity-C24effmB.js.map} +1 -1
- package/packages/cli/dist/{qtiToLearnosity-_tybImv1.js → qtiToLearnosity-BEOaukuf.js} +6 -7
- package/packages/cli/dist/{qtiToLearnosity-_tybImv1.js.map → qtiToLearnosity-BEOaukuf.js.map} +1 -1
- package/packages/cli/dist/{resolveOptions-6ReJUr-D.js → resolveOptions-l0Hpn8hY.js} +322 -359
- package/packages/cli/dist/resolveOptions-l0Hpn8hY.js.map +1 -0
- package/packages/cli/dist/{rolldown-runtime-DktXgydw.js → rolldown-runtime-BVN1G_yT.js} +5 -6
- package/packages/cli/dist/{table-CLUiytPO.js → table-BkrwlSAQ.js} +15578 -4894
- package/packages/cli/dist/table-BkrwlSAQ.js.map +1 -0
- package/packages/core/dist/index.d.ts +36 -59
- package/packages/core/dist/index.js +15415 -4712
- package/packages/core/dist/node.d.ts +38 -81
- package/packages/core/dist/node.js +13598 -2857
- package/packages/cli/dist/batchProcessors-B6yUImA3.js.map +0 -1
- package/packages/cli/dist/create-prompt-dWckcotJ.js.map +0 -1
- package/packages/cli/dist/dist-DXDR2peT.js.map +0 -1
- package/packages/cli/dist/learnosityToQtiPackage-CMFop6H4.js.map +0 -1
- package/packages/cli/dist/pathUtils-6nZKvVmg.js +0 -2272
- package/packages/cli/dist/pathUtils-6nZKvVmg.js.map +0 -1
- package/packages/cli/dist/resolveOptions-6ReJUr-D.js.map +0 -1
- package/packages/cli/dist/table-CLUiytPO.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as runBatchTask } from "./batchProcessors-
|
|
1
|
+
import { r as runBatchTask } from "./batchProcessors-BI6C89vy.js";
|
|
2
2
|
import { parentPort } from "node:worker_threads";
|
|
3
|
-
|
|
3
|
+
// src/batchWorker.ts
|
|
4
4
|
/**
|
|
5
5
|
* Worker-thread entry for parallel batch conversion. Receives one package task
|
|
6
6
|
* at a time and posts back the per-package result. All conversion CPU work runs
|
|
@@ -20,7 +20,6 @@ if (parentPort) {
|
|
|
20
20
|
});
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
//#endregion
|
|
24
23
|
export {};
|
|
25
24
|
|
|
26
25
|
//# sourceMappingURL=batchWorker.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { basename, join, resolve, sep } from "path";
|
|
2
2
|
import { existsSync, readdirSync, statSync } from "fs";
|
|
3
3
|
import { Worker } from "node:worker_threads";
|
|
4
|
-
|
|
4
|
+
// src/utils/packageScanner.ts
|
|
5
5
|
/**
|
|
6
6
|
* Package scanning utilities for detecting QTI and Learnosity packages
|
|
7
7
|
*/
|
|
@@ -75,8 +75,7 @@ function scanForPackages(parentDir, expectedType) {
|
|
|
75
75
|
scanRecursive(parentDir, "");
|
|
76
76
|
return packages;
|
|
77
77
|
}
|
|
78
|
-
|
|
79
|
-
//#region src/utils/workerPool.ts
|
|
78
|
+
// src/utils/workerPool.ts
|
|
80
79
|
/**
|
|
81
80
|
* Minimal reusable worker_threads pool.
|
|
82
81
|
*
|
|
@@ -146,8 +145,7 @@ function runPool(options) {
|
|
|
146
145
|
for (let i = 0; i < poolSize; i++) spawn();
|
|
147
146
|
});
|
|
148
147
|
}
|
|
149
|
-
|
|
150
|
-
//#region src/utils/batchProcessing.ts
|
|
148
|
+
// src/utils/batchProcessing.ts
|
|
151
149
|
/**
|
|
152
150
|
* Batch processing utilities for recursive directory conversion
|
|
153
151
|
*/
|
|
@@ -367,8 +365,7 @@ async function processBatchParallel(config) {
|
|
|
367
365
|
if (summary.failed > 0 && summary.succeeded === 0) process.exit(1);
|
|
368
366
|
return summary;
|
|
369
367
|
}
|
|
370
|
-
|
|
371
|
-
//#region src/utils/configOutput.ts
|
|
368
|
+
// src/utils/configOutput.ts
|
|
372
369
|
/**
|
|
373
370
|
* Display a configuration block with consistent formatting
|
|
374
371
|
*/
|
|
@@ -393,7 +390,6 @@ function configField(label, value, indent = 0) {
|
|
|
393
390
|
indent
|
|
394
391
|
};
|
|
395
392
|
}
|
|
396
|
-
//#endregion
|
|
397
393
|
export { processBatchParallel as i, displayConfiguration as n, processBatch as r, configField as t };
|
|
398
394
|
|
|
399
|
-
//# sourceMappingURL=configOutput-
|
|
395
|
+
//# sourceMappingURL=configOutput-CJ-ryN3j.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configOutput-FwkFyQmk.js","names":[],"sources":["../src/utils/packageScanner.ts","../src/utils/workerPool.ts","../src/utils/batchProcessing.ts","../src/utils/configOutput.ts"],"sourcesContent":["/**\n * Package scanning utilities for detecting QTI and Learnosity packages\n */\n\nimport { existsSync, statSync, readdirSync } from 'fs';\nimport { join, basename } from 'path';\n\n/**\n * Package type detection result\n */\nexport type PackageType = 'qti' | 'learnosity' | 'unknown';\n\n/**\n * Detected package information\n */\nexport interface DetectedPackage {\n /** Absolute path to the package directory */\n path: string;\n /** Package directory name */\n name: string;\n /**\n * Path to the package relative to the scanned root directory, e.g.\n * `grade-3/maths/package-a`. Used to mirror the input folder structure in\n * the output directory. Equals `name` for packages directly under the root.\n *\n * Optional so custom scanners can omit it; consumers fall back to `name`.\n */\n relativePath?: string;\n /** Detected package type */\n type: PackageType;\n}\n\n/**\n * Detect if a directory is a QTI package\n * A QTI package must contain an imsmanifest.xml file\n */\nexport function isQtiPackage(dirPath: string): boolean {\n if (!existsSync(dirPath) || !statSync(dirPath).isDirectory()) {\n return false;\n }\n\n // dirPath is a directory the operator pointed the CLI at; the filename is a\n // literal, so this join cannot traverse anywhere the caller did not ask for.\n // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal, javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal\n const manifestPath = join(dirPath, 'imsmanifest.xml');\n\n return existsSync(manifestPath);\n}\n\n/**\n * Detect if a directory is a Learnosity bundle\n * A Learnosity bundle must contain a manifest.json file\n */\nexport function isLearnosityBundle(dirPath: string): boolean {\n if (!existsSync(dirPath) || !statSync(dirPath).isDirectory()) {\n return false;\n }\n\n // Same as isQtiPackage: operator-supplied directory plus a literal filename.\n // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal, javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal\n const manifestPath = join(dirPath, 'manifest.json');\n\n return existsSync(manifestPath);\n}\n\n/**\n * Detect package type for a directory\n */\nexport function detectPackageType(dirPath: string): PackageType {\n if (isQtiPackage(dirPath)) {\n return 'qti';\n }\n if (isLearnosityBundle(dirPath)) {\n return 'learnosity';\n }\n\n return 'unknown';\n}\n\n/**\n * Scan a directory recursively for packages and detect their package types\n *\n * @param parentDir - Parent directory containing subdirectories to scan\n * @param expectedType - Optional filter to only return packages of a specific type\n * @returns Array of detected packages\n */\nexport function scanForPackages(parentDir: string, expectedType?: PackageType): DetectedPackage[] {\n const packages: DetectedPackage[] = [];\n\n if (!existsSync(parentDir)) {\n return packages;\n }\n\n const stat = statSync(parentDir);\n\n if (!stat.isDirectory()) {\n return packages;\n }\n\n /**\n * Recursively scan directories for packages\n *\n * @param currentDir - Directory being scanned\n * @param relativeDir - Path of `currentDir` relative to `parentDir` ('' at the root)\n */\n function scanRecursive(currentDir: string, relativeDir: string): void {\n // Read all items in the current directory\n const items = readdirSync(currentDir);\n\n for (const item of items) {\n // item comes from readdirSync, so it is a single existing directory\n // entry name and cannot contain separators or traversal segments.\n // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal, javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal\n const itemPath = join(currentDir, item);\n\n // relativeDir is built from earlier readdirSync entry names and item is\n // a single entry name, so this label cannot escape the scanned root.\n // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal, javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal\n const itemRelativePath = relativeDir ? join(relativeDir, item) : item;\n\n // Skip non-directories\n try {\n if (!statSync(itemPath).isDirectory()) {\n continue;\n }\n } catch {\n // Skip items that can't be accessed (permissions, broken symlinks, etc.)\n continue;\n }\n\n // Detect package type\n const type = detectPackageType(itemPath);\n\n // If this directory is a package, add it and don't recurse into it\n if (type !== 'unknown') {\n // Skip if type doesn't match expected type (if specified)\n if (expectedType && type !== expectedType) {\n continue;\n }\n\n packages.push({\n path: itemPath,\n name: basename(itemPath),\n relativePath: itemRelativePath,\n type,\n });\n\n // Don't recurse into package directories\n continue;\n }\n\n // If not a package, recurse into subdirectories\n scanRecursive(itemPath, itemRelativePath);\n }\n }\n\n scanRecursive(parentDir, '');\n\n return packages;\n}\n","/**\n * Minimal reusable worker_threads pool.\n *\n * Spawns up to `concurrency` long-lived workers, dispatches one task at a time\n * to each idle worker, and resolves with results in the SAME order as the input\n * tasks (deterministic) regardless of completion order. A worker error/crash\n * fails only its in-flight task (via `onError`) and the worker is respawned if\n * work remains, so one bad package can't sink the whole batch.\n */\n\nimport { Worker } from 'node:worker_threads';\n\nexport interface RunPoolOptions<TTask, TResult> {\n /** Tasks to process (results are returned in this order). */\n tasks: TTask[];\n /** URL/path of the worker module. */\n workerUrl: URL | string;\n /** Max concurrent workers (clamped to [1, tasks.length]). */\n concurrency: number;\n /** Map a worker error/crash to a result for the failing task. */\n onError: (task: TTask, error: Error) => TResult;\n /** Optional callback fired as each task completes (for progress). */\n onResult?: (index: number, task: TTask, result: TResult) => void;\n}\n\n/**\n * Run `tasks` across a pool of workers. Each worker receives one task at a time\n * as a message and posts back a single result message.\n */\nexport function runPool<TTask, TResult>(options: RunPoolOptions<TTask, TResult>): Promise<TResult[]> {\n const { tasks, workerUrl, onError, onResult } = options;\n const results = new Array<TResult>(tasks.length);\n\n if (tasks.length === 0) {\n return Promise.resolve(results);\n }\n\n const poolSize = Math.max(1, Math.min(options.concurrency, tasks.length));\n\n return new Promise<TResult[]>((resolve) => {\n let nextTaskIndex = 0;\n let completed = 0;\n const inFlight = new Map<Worker, number>();\n const workers = new Set<Worker>();\n\n const settleIfDone = (): void => {\n if (completed === tasks.length) {\n for (const worker of workers) {\n void worker.terminate();\n }\n resolve(results);\n }\n };\n\n const recordResult = (index: number, result: TResult): void => {\n if (results[index] !== undefined) {\n return; // already recorded (e.g. error then late message)\n }\n results[index] = result;\n\n if (onResult) {\n onResult(index, tasks[index], result);\n }\n completed++;\n settleIfDone();\n };\n\n const dispatchNext = (worker: Worker): void => {\n if (nextTaskIndex >= tasks.length) {\n inFlight.delete(worker);\n workers.delete(worker);\n void worker.terminate();\n\n return;\n }\n\n const index = nextTaskIndex++;\n\n inFlight.set(worker, index);\n\n worker.once('message', (result: TResult) => {\n inFlight.delete(worker);\n recordResult(index, result);\n dispatchNext(worker);\n });\n\n worker.postMessage(tasks[index]);\n };\n\n const spawn = (): void => {\n const worker = new Worker(workerUrl);\n\n workers.add(worker);\n\n worker.on('error', (err) => {\n const index = inFlight.get(worker);\n\n inFlight.delete(worker);\n workers.delete(worker);\n void worker.terminate();\n\n if (index !== undefined) {\n recordResult(index, onError(tasks[index], err instanceof Error ? err : new Error(String(err))));\n }\n\n // Respawn to keep draining the queue if work remains.\n if (nextTaskIndex < tasks.length) {\n spawn();\n } else {\n settleIfDone();\n }\n });\n\n dispatchNext(worker);\n };\n\n for (let i = 0; i < poolSize; i++) {\n spawn();\n }\n });\n}\n","/**\n * Batch processing utilities for recursive directory conversion\n */\n\nimport { join, resolve, sep } from 'path';\nimport { scanForPackages, type PackageType, type DetectedPackage } from './packageScanner.js';\nimport { runPool } from './workerPool.js';\nimport type { BatchTask, BatchPackageOptions, PackageResult } from './batchProcessors.js';\n\n// Re-export types for backward compatibility\nexport type { PackageType, DetectedPackage };\n\n/**\n * Batch conversion summary\n */\nexport interface BatchConversionSummary {\n /** Total packages found */\n total: number;\n /** Successfully converted packages */\n succeeded: number;\n /** Failed conversions */\n failed: number;\n /** Skipped packages (wrong type or errors) */\n skipped: number;\n /** Total items successfully converted across all packages */\n totalConvertedItems: number;\n /** Total items that failed conversion across all packages */\n totalFailedItems: number;\n /** Details for each package */\n packages: Array<{\n name: string;\n type: PackageType;\n status: 'success' | 'failed' | 'skipped';\n errorCount?: number;\n warningCount?: number;\n }>;\n}\n\n/**\n * Package processor function type\n */\nexport type PackageProcessor<TOptions> = (\n pkg: DetectedPackage,\n outputPath: string,\n options: TOptions\n) => Promise<{\n success: boolean;\n errorCount: number;\n warningCount: number;\n convertedItemCount?: number;\n failedItemCount?: number;\n message?: string;\n}>;\n\n/**\n * Package scanner function type\n */\nexport type PackageScanner = (parentDir: string, expectedType?: PackageType) => DetectedPackage[];\n\n/**\n * Batch processor configuration\n */\nexport interface BatchProcessorConfig<TOptions> {\n inputPath: string;\n outputPath: string;\n packageType: PackageType;\n processPackage: PackageProcessor<TOptions>;\n options: TOptions;\n quiet?: boolean;\n /** Optional package scanner function (defaults to scanForPackages from packageScanner.ts) */\n scanner?: PackageScanner;\n}\n\n/**\n * Resolve the output directory for a package, mirroring the input folder\n * structure below the scanned root.\n *\n * A package found at `<input>/grade-3/maths/pkg-a` is written to\n * `<output>/grade-3/maths/pkg-a`, so siblings with the same directory name in\n * different subtrees no longer collide.\n *\n * Falls back to `pkg.name` when a scanner does not provide `relativePath`.\n */\nexport function resolvePackageOutputPath(outputPath: string, pkg: DetectedPackage): string {\n const relativePath = pkg.relativePath ?? pkg.name;\n\n // relativePath is built from readdirSync entry names below the scanned root,\n // so it cannot contain traversal segments. Resolve and verify anyway so a\n // custom scanner cannot escape the output directory.\n // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal, javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal\n const packageOutputPath = resolve(outputPath, relativePath);\n\n // outputPath is the operator-supplied --out directory and is the containment\n // boundary being checked below, not untrusted input being appended to it.\n // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal, javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal\n const outputRoot = resolve(outputPath);\n\n if (packageOutputPath !== outputRoot && !packageOutputPath.startsWith(outputRoot + sep)) {\n throw new Error(`Package output path escapes the output directory: ${relativePath}`);\n }\n\n // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal, javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal\n return join(outputPath, relativePath);\n}\n\n/**\n * Label used when reporting a package, preferring the path relative to the\n * scanned root so nested packages are distinguishable.\n */\nfunction packageLabel(pkg: DetectedPackage): string {\n return pkg.relativePath ?? pkg.name;\n}\n\n/**\n * Display batch processing summary\n */\nexport function displayBatchSummary(summary: BatchConversionSummary, quiet = false): void {\n if (quiet) {\n return;\n }\n\n console.log('\\n' + '='.repeat(60));\n console.log('Batch Conversion Summary');\n console.log('='.repeat(60));\n console.log(`Total packages: ${summary.total}`);\n console.log(`✓ Succeeded: ${summary.succeeded}`);\n console.log(`✗ Failed: ${summary.failed}`);\n console.log(`⊘ Skipped: ${summary.skipped}`);\n console.log('-'.repeat(60));\n console.log(`Total items: ${summary.totalConvertedItems + summary.totalFailedItems}`);\n console.log(`✓ Converted: ${summary.totalConvertedItems}`);\n console.log(`✗ Errored: ${summary.totalFailedItems}`);\n console.log('='.repeat(60) + '\\n');\n}\n\n/**\n * Generic batch processor that works for both conversion directions\n */\nexport async function processBatch<TOptions>(\n config: BatchProcessorConfig<TOptions>\n): Promise<BatchConversionSummary> {\n const {\n inputPath,\n outputPath,\n packageType,\n processPackage,\n options,\n quiet = false,\n scanner = scanForPackages,\n } = config;\n const startTime = Date.now();\n\n // Scan for packages using the provided scanner or default\n const packages = scanner(inputPath, packageType);\n\n if (packages.length === 0) {\n const typeLabel = packageType === 'qti' ? 'QTI packages' : 'Learnosity bundles';\n const manifestFile = packageType === 'qti' ? 'imsmanifest.xml' : 'manifest.json';\n\n console.error(`Error: No ${typeLabel} found in subdirectories.`);\n console.error(`A ${packageType} package must contain a ${manifestFile} file.`);\n process.exit(1);\n }\n\n if (!quiet) {\n const typeLabel = packageType === 'qti' ? 'QTI package(s)' : 'Learnosity bundle(s)';\n\n console.log(`Found ${packages.length} ${typeLabel}:\\n`);\n packages.forEach((pkg, idx) => {\n console.log(` ${idx + 1}. ${packageLabel(pkg)}`);\n });\n console.log('');\n }\n\n // Initialize summary\n const summary: BatchConversionSummary = {\n total: packages.length,\n succeeded: 0,\n failed: 0,\n skipped: 0,\n totalConvertedItems: 0,\n totalFailedItems: 0,\n packages: [],\n };\n\n // Process each package\n for (let i = 0; i < packages.length; i++) {\n const pkg = packages[i];\n\n // Mirror the input folder structure below the scanned root.\n const packageOutputPath = resolvePackageOutputPath(outputPath, pkg);\n\n if (!quiet) {\n console.log(`\\n[${i + 1}/${packages.length}] Converting: ${packageLabel(pkg)}`);\n console.log(` Input: ${pkg.path}`);\n console.log(` Output: ${packageOutputPath}`);\n console.log('');\n }\n\n try {\n const result = await processPackage(pkg, packageOutputPath, options);\n\n summary.totalConvertedItems += result.convertedItemCount ?? 0;\n summary.totalFailedItems += result.failedItemCount ?? 0;\n\n if (result.success) {\n summary.succeeded++;\n summary.packages.push({\n name: packageLabel(pkg),\n type: pkg.type,\n status: 'success',\n errorCount: result.errorCount,\n warningCount: result.warningCount,\n });\n\n if (!quiet) {\n console.log(\n ` ✓ SUCCESS (${result.errorCount} error(s), ${result.warningCount} warning(s))`\n );\n }\n } else {\n summary.failed++;\n summary.packages.push({\n name: packageLabel(pkg),\n type: pkg.type,\n status: 'failed',\n errorCount: result.errorCount,\n warningCount: result.warningCount,\n });\n\n if (!quiet) {\n console.error(` ✗ FAILED (${result.errorCount} error(s))`);\n if (result.message) {\n console.error(` ${result.message}`);\n }\n }\n }\n } catch (error) {\n summary.failed++;\n summary.packages.push({\n name: packageLabel(pkg),\n type: pkg.type,\n status: 'failed',\n errorCount: 1,\n });\n\n if (!quiet) {\n console.error(\n ` ✗ FAILED: ${error instanceof Error ? error.message : 'Unknown error'}`\n );\n }\n }\n }\n\n // Display summary\n displayBatchSummary(summary, quiet);\n\n const duration = ((Date.now() - startTime) / 1000).toFixed(2);\n\n if (!quiet) {\n console.log(`Completed in ${duration}s\\n`);\n }\n\n // Exit with appropriate code\n if (summary.failed > 0 && summary.succeeded === 0) {\n process.exit(1);\n }\n\n return summary;\n}\n\n/**\n * Configuration for the parallel (worker-pool) batch processor.\n */\nexport interface ParallelBatchConfig {\n inputPath: string;\n outputPath: string;\n packageType: PackageType;\n direction: BatchTask['direction'];\n options: BatchPackageOptions;\n /** Max concurrent worker threads. */\n concurrency: number;\n quiet?: boolean;\n scanner?: PackageScanner;\n /** Worker module URL (defaults to the built batchWorker.js next to main.js). */\n workerUrl?: URL | string;\n}\n\n/**\n * Parallel batch processor: converts packages across a pool of worker threads.\n *\n * Behaviour mirrors {@link processBatch} — same scan, summary shape, console\n * summary and exit code — but per-package conversion runs on worker threads so\n * multiple cores are used. Results are aggregated in package order for a\n * deterministic summary.\n */\nexport async function processBatchParallel(\n config: ParallelBatchConfig\n): Promise<BatchConversionSummary> {\n const {\n inputPath,\n outputPath,\n packageType,\n direction,\n options,\n concurrency,\n quiet = false,\n scanner = scanForPackages,\n workerUrl = new URL('./batchWorker.js', import.meta.url),\n } = config;\n const startTime = Date.now();\n\n const packages = scanner(inputPath, packageType);\n\n if (packages.length === 0) {\n const typeLabel = packageType === 'qti' ? 'QTI packages' : 'Learnosity bundles';\n const manifestFile = packageType === 'qti' ? 'imsmanifest.xml' : 'manifest.json';\n\n console.error(`Error: No ${typeLabel} found in subdirectories.`);\n console.error(`A ${packageType} package must contain a ${manifestFile} file.`);\n process.exit(1);\n }\n\n if (!quiet) {\n const typeLabel = packageType === 'qti' ? 'QTI package(s)' : 'Learnosity bundle(s)';\n\n console.log(\n `Found ${packages.length} ${typeLabel} (converting with ${Math.min(concurrency, packages.length)} workers):\\n`\n );\n packages.forEach((pkg, idx) => {\n console.log(` ${idx + 1}. ${packageLabel(pkg)}`);\n });\n console.log('');\n }\n\n const tasks: BatchTask[] = packages.map((pkg) => ({\n direction,\n pkg,\n // Mirror the input folder structure below the scanned root.\n packageOutputPath: resolvePackageOutputPath(outputPath, pkg),\n options,\n }));\n\n const results = await runPool<BatchTask, PackageResult>({\n tasks,\n workerUrl,\n concurrency,\n onError: (_task, error) => ({\n success: false,\n errorCount: 1,\n warningCount: 0,\n message: error.message,\n }),\n onResult: (index, task, result) => {\n if (quiet) {\n return;\n }\n\n if (result.success) {\n console.log(\n ` ✓ [${index + 1}/${tasks.length}] ${packageLabel(task.pkg)} (${result.errorCount} error(s), ${result.warningCount} warning(s))`\n );\n } else {\n console.error(\n ` ✗ [${index + 1}/${tasks.length}] ${packageLabel(task.pkg)} FAILED (${result.errorCount} error(s))${result.message ? `: ${result.message}` : ''}`\n );\n }\n },\n });\n\n // Aggregate summary in package order (deterministic).\n const summary: BatchConversionSummary = {\n total: packages.length,\n succeeded: 0,\n failed: 0,\n skipped: 0,\n totalConvertedItems: 0,\n totalFailedItems: 0,\n packages: [],\n };\n\n for (let i = 0; i < packages.length; i++) {\n const pkg = packages[i];\n const result = results[i];\n\n summary.totalConvertedItems += result.convertedItemCount ?? 0;\n summary.totalFailedItems += result.failedItemCount ?? 0;\n\n if (result.success) {\n summary.succeeded++;\n summary.packages.push({\n name: packageLabel(pkg),\n type: pkg.type,\n status: 'success',\n errorCount: result.errorCount,\n warningCount: result.warningCount,\n });\n } else {\n summary.failed++;\n summary.packages.push({\n name: packageLabel(pkg),\n type: pkg.type,\n status: 'failed',\n errorCount: result.errorCount,\n warningCount: result.warningCount,\n });\n }\n }\n\n displayBatchSummary(summary, quiet);\n\n const duration = ((Date.now() - startTime) / 1000).toFixed(2);\n\n if (!quiet) {\n console.log(`Completed in ${duration}s\\n`);\n }\n\n if (summary.failed > 0 && summary.succeeded === 0) {\n process.exit(1);\n }\n\n return summary;\n}\n","/**\n * Shared utilities for displaying configuration output in CLI commands\n */\n\nexport interface ConfigField {\n label: string;\n value: string | number | boolean;\n indent?: number;\n}\n\nexport interface ConfigOutputOptions {\n quiet?: boolean;\n}\n\n/**\n * Display a configuration block with consistent formatting\n */\nexport function displayConfiguration(fields: ConfigField[], options: ConfigOutputOptions = {}): void {\n if (options.quiet) {\n return;\n }\n\n console.log('\\nConfiguration:');\n\n for (const field of fields) {\n const indent = field.indent ?? 0;\n const padding = ' ' + ' '.repeat(indent * 2);\n const label = field.label.padEnd(14 - indent * 2, ' ');\n\n console.log(`${padding}${label}${field.value}`);\n }\n\n console.log('');\n}\n\n/**\n * Helper to create a config field\n */\nexport function configField(label: string, value: string | number | boolean, indent = 0): ConfigField {\n return { label, value, indent };\n}\n\n/**\n * Format a list of items for configuration output\n */\nexport function formatList(items: string[], _singular: string, plural: string, showAll = false): string {\n if (items.length === 0) {\n return `0 ${plural}`;\n }\n if (items.length === 1) {\n return items[0];\n }\n\n return `${items.length} ${plural}${showAll ? ' (all)' : ''}`;\n}\n\n"],"mappings":";;;;;;;;;;;AAoCA,SAAgB,aAAa,SAA0B;CACnD,IAAI,CAAC,WAAW,OAAO,KAAK,CAAC,SAAS,OAAO,CAAC,CAAC,YAAY,GACvD,OAAO;CAMX,MAAM,eAAe,KAAK,SAAS,iBAAiB;CAEpD,OAAO,WAAW,YAAY;AAClC;;;;;AAMA,SAAgB,mBAAmB,SAA0B;CACzD,IAAI,CAAC,WAAW,OAAO,KAAK,CAAC,SAAS,OAAO,CAAC,CAAC,YAAY,GACvD,OAAO;CAKX,MAAM,eAAe,KAAK,SAAS,eAAe;CAElD,OAAO,WAAW,YAAY;AAClC;;;;AAKA,SAAgB,kBAAkB,SAA8B;CAC5D,IAAI,aAAa,OAAO,GACpB,OAAO;CAEX,IAAI,mBAAmB,OAAO,GAC1B,OAAO;CAGX,OAAO;AACX;;;;;;;;AASA,SAAgB,gBAAgB,WAAmB,cAA+C;CAC9F,MAAM,WAA8B,CAAC;CAErC,IAAI,CAAC,WAAW,SAAS,GACrB,OAAO;C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AAK,IAAI,IAAI,aAAa,IAAA,CAAM,QAAQ,CAAC;CAE5D,IAAI,CAAC,OACD,QAAQ,IAAI,gBAAgB,SAAS,IAAI;CAG7C,IAAI,QAAQ,SAAS,KAAK,QAAQ,cAAc,GAC5C,QAAQ,KAAK,CAAC;CAGlB,OAAO;AACX;;;;;;ACrZA,SAAgB,qBAAqB,QAAuB,UAA+B,CAAC,GAAS;CACjG,IAAI,QAAQ,OACR;CAGJ,QAAQ,IAAI,kBAAkB;CAE9B,KAAK,MAAM,SAAS,QAAQ;EACxB,MAAM,SAAS,MAAM,UAAU;EAC/B,MAAM,UAAU,OAAO,IAAI,OAAO,SAAS,CAAC;EAC5C,MAAM,QAAQ,MAAM,MAAM,OAAO,KAAK,SAAS,GAAG,GAAG;EAErD,QAAQ,IAAI,GAAG,UAAU,QAAQ,MAAM,OAAO;CAClD;CAEA,QAAQ,IAAI,EAAE;AAClB;;;;AAKA,SAAgB,YAAY,OAAe,OAAkC,SAAS,GAAgB;CAClG,OAAO;EAAE;EAAO;EAAO;CAAO;AAClC"}
|
|
1
|
+
{"version":3,"file":"configOutput-CJ-ryN3j.js","names":[],"sources":["../src/utils/packageScanner.ts","../src/utils/workerPool.ts","../src/utils/batchProcessing.ts","../src/utils/configOutput.ts"],"sourcesContent":["/**\n * Package scanning utilities for detecting QTI and Learnosity packages\n */\n\nimport { existsSync, statSync, readdirSync } from 'fs';\nimport { join, basename } from 'path';\n\n/**\n * Package type detection result\n */\nexport type PackageType = 'qti' | 'learnosity' | 'unknown';\n\n/**\n * Detected package information\n */\nexport interface DetectedPackage {\n /** Absolute path to the package directory */\n path: string;\n /** Package directory name */\n name: string;\n /**\n * Path to the package relative to the scanned root directory, e.g.\n * `grade-3/maths/package-a`. Used to mirror the input folder structure in\n * the output directory. Equals `name` for packages directly under the root.\n *\n * Optional so custom scanners can omit it; consumers fall back to `name`.\n */\n relativePath?: string;\n /** Detected package type */\n type: PackageType;\n}\n\n/**\n * Detect if a directory is a QTI package\n * A QTI package must contain an imsmanifest.xml file\n */\nexport function isQtiPackage(dirPath: string): boolean {\n if (!existsSync(dirPath) || !statSync(dirPath).isDirectory()) {\n return false;\n }\n\n // dirPath is a directory the operator pointed the CLI at; the filename is a\n // literal, so this join cannot traverse anywhere the caller did not ask for.\n // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal, javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal\n const manifestPath = join(dirPath, 'imsmanifest.xml');\n\n return existsSync(manifestPath);\n}\n\n/**\n * Detect if a directory is a Learnosity bundle\n * A Learnosity bundle must contain a manifest.json file\n */\nexport function isLearnosityBundle(dirPath: string): boolean {\n if (!existsSync(dirPath) || !statSync(dirPath).isDirectory()) {\n return false;\n }\n\n // Same as isQtiPackage: operator-supplied directory plus a literal filename.\n // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal, javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal\n const manifestPath = join(dirPath, 'manifest.json');\n\n return existsSync(manifestPath);\n}\n\n/**\n * Detect package type for a directory\n */\nexport function detectPackageType(dirPath: string): PackageType {\n if (isQtiPackage(dirPath)) {\n return 'qti';\n }\n if (isLearnosityBundle(dirPath)) {\n return 'learnosity';\n }\n\n return 'unknown';\n}\n\n/**\n * Scan a directory recursively for packages and detect their package types\n *\n * @param parentDir - Parent directory containing subdirectories to scan\n * @param expectedType - Optional filter to only return packages of a specific type\n * @returns Array of detected packages\n */\nexport function scanForPackages(parentDir: string, expectedType?: PackageType): DetectedPackage[] {\n const packages: DetectedPackage[] = [];\n\n if (!existsSync(parentDir)) {\n return packages;\n }\n\n const stat = statSync(parentDir);\n\n if (!stat.isDirectory()) {\n return packages;\n }\n\n /**\n * Recursively scan directories for packages\n *\n * @param currentDir - Directory being scanned\n * @param relativeDir - Path of `currentDir` relative to `parentDir` ('' at the root)\n */\n function scanRecursive(currentDir: string, relativeDir: string): void {\n // Read all items in the current directory\n const items = readdirSync(currentDir);\n\n for (const item of items) {\n // item comes from readdirSync, so it is a single existing directory\n // entry name and cannot contain separators or traversal segments.\n // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal, javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal\n const itemPath = join(currentDir, item);\n\n // relativeDir is built from earlier readdirSync entry names and item is\n // a single entry name, so this label cannot escape the scanned root.\n // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal, javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal\n const itemRelativePath = relativeDir ? join(relativeDir, item) : item;\n\n // Skip non-directories\n try {\n if (!statSync(itemPath).isDirectory()) {\n continue;\n }\n } catch {\n // Skip items that can't be accessed (permissions, broken symlinks, etc.)\n continue;\n }\n\n // Detect package type\n const type = detectPackageType(itemPath);\n\n // If this directory is a package, add it and don't recurse into it\n if (type !== 'unknown') {\n // Skip if type doesn't match expected type (if specified)\n if (expectedType && type !== expectedType) {\n continue;\n }\n\n packages.push({\n path: itemPath,\n name: basename(itemPath),\n relativePath: itemRelativePath,\n type,\n });\n\n // Don't recurse into package directories\n continue;\n }\n\n // If not a package, recurse into subdirectories\n scanRecursive(itemPath, itemRelativePath);\n }\n }\n\n scanRecursive(parentDir, '');\n\n return packages;\n}\n","/**\n * Minimal reusable worker_threads pool.\n *\n * Spawns up to `concurrency` long-lived workers, dispatches one task at a time\n * to each idle worker, and resolves with results in the SAME order as the input\n * tasks (deterministic) regardless of completion order. A worker error/crash\n * fails only its in-flight task (via `onError`) and the worker is respawned if\n * work remains, so one bad package can't sink the whole batch.\n */\n\nimport { Worker } from 'node:worker_threads';\n\nexport interface RunPoolOptions<TTask, TResult> {\n /** Tasks to process (results are returned in this order). */\n tasks: TTask[];\n /** URL/path of the worker module. */\n workerUrl: URL | string;\n /** Max concurrent workers (clamped to [1, tasks.length]). */\n concurrency: number;\n /** Map a worker error/crash to a result for the failing task. */\n onError: (task: TTask, error: Error) => TResult;\n /** Optional callback fired as each task completes (for progress). */\n onResult?: (index: number, task: TTask, result: TResult) => void;\n}\n\n/**\n * Run `tasks` across a pool of workers. Each worker receives one task at a time\n * as a message and posts back a single result message.\n */\nexport function runPool<TTask, TResult>(options: RunPoolOptions<TTask, TResult>): Promise<TResult[]> {\n const { tasks, workerUrl, onError, onResult } = options;\n const results = new Array<TResult>(tasks.length);\n\n if (tasks.length === 0) {\n return Promise.resolve(results);\n }\n\n const poolSize = Math.max(1, Math.min(options.concurrency, tasks.length));\n\n return new Promise<TResult[]>((resolve) => {\n let nextTaskIndex = 0;\n let completed = 0;\n const inFlight = new Map<Worker, number>();\n const workers = new Set<Worker>();\n\n const settleIfDone = (): void => {\n if (completed === tasks.length) {\n for (const worker of workers) {\n void worker.terminate();\n }\n resolve(results);\n }\n };\n\n const recordResult = (index: number, result: TResult): void => {\n if (results[index] !== undefined) {\n return; // already recorded (e.g. error then late message)\n }\n results[index] = result;\n\n if (onResult) {\n onResult(index, tasks[index], result);\n }\n completed++;\n settleIfDone();\n };\n\n const dispatchNext = (worker: Worker): void => {\n if (nextTaskIndex >= tasks.length) {\n inFlight.delete(worker);\n workers.delete(worker);\n void worker.terminate();\n\n return;\n }\n\n const index = nextTaskIndex++;\n\n inFlight.set(worker, index);\n\n worker.once('message', (result: TResult) => {\n inFlight.delete(worker);\n recordResult(index, result);\n dispatchNext(worker);\n });\n\n worker.postMessage(tasks[index]);\n };\n\n const spawn = (): void => {\n const worker = new Worker(workerUrl);\n\n workers.add(worker);\n\n worker.on('error', (err) => {\n const index = inFlight.get(worker);\n\n inFlight.delete(worker);\n workers.delete(worker);\n void worker.terminate();\n\n if (index !== undefined) {\n recordResult(index, onError(tasks[index], err instanceof Error ? err : new Error(String(err))));\n }\n\n // Respawn to keep draining the queue if work remains.\n if (nextTaskIndex < tasks.length) {\n spawn();\n } else {\n settleIfDone();\n }\n });\n\n dispatchNext(worker);\n };\n\n for (let i = 0; i < poolSize; i++) {\n spawn();\n }\n });\n}\n","/**\n * Batch processing utilities for recursive directory conversion\n */\n\nimport { join, resolve, sep } from 'path';\nimport { scanForPackages, type PackageType, type DetectedPackage } from './packageScanner.js';\nimport { runPool } from './workerPool.js';\nimport type { BatchTask, BatchPackageOptions, PackageResult } from './batchProcessors.js';\n\n// Re-export types for backward compatibility\nexport type { PackageType, DetectedPackage };\n\n/**\n * Batch conversion summary\n */\nexport interface BatchConversionSummary {\n /** Total packages found */\n total: number;\n /** Successfully converted packages */\n succeeded: number;\n /** Failed conversions */\n failed: number;\n /** Skipped packages (wrong type or errors) */\n skipped: number;\n /** Total items successfully converted across all packages */\n totalConvertedItems: number;\n /** Total items that failed conversion across all packages */\n totalFailedItems: number;\n /** Details for each package */\n packages: Array<{\n name: string;\n type: PackageType;\n status: 'success' | 'failed' | 'skipped';\n errorCount?: number;\n warningCount?: number;\n }>;\n}\n\n/**\n * Package processor function type\n */\nexport type PackageProcessor<TOptions> = (\n pkg: DetectedPackage,\n outputPath: string,\n options: TOptions\n) => Promise<{\n success: boolean;\n errorCount: number;\n warningCount: number;\n convertedItemCount?: number;\n failedItemCount?: number;\n message?: string;\n}>;\n\n/**\n * Package scanner function type\n */\nexport type PackageScanner = (parentDir: string, expectedType?: PackageType) => DetectedPackage[];\n\n/**\n * Batch processor configuration\n */\nexport interface BatchProcessorConfig<TOptions> {\n inputPath: string;\n outputPath: string;\n packageType: PackageType;\n processPackage: PackageProcessor<TOptions>;\n options: TOptions;\n quiet?: boolean;\n /** Optional package scanner function (defaults to scanForPackages from packageScanner.ts) */\n scanner?: PackageScanner;\n}\n\n/**\n * Resolve the output directory for a package, mirroring the input folder\n * structure below the scanned root.\n *\n * A package found at `<input>/grade-3/maths/pkg-a` is written to\n * `<output>/grade-3/maths/pkg-a`, so siblings with the same directory name in\n * different subtrees no longer collide.\n *\n * Falls back to `pkg.name` when a scanner does not provide `relativePath`.\n */\nexport function resolvePackageOutputPath(outputPath: string, pkg: DetectedPackage): string {\n const relativePath = pkg.relativePath ?? pkg.name;\n\n // relativePath is built from readdirSync entry names below the scanned root,\n // so it cannot contain traversal segments. Resolve and verify anyway so a\n // custom scanner cannot escape the output directory.\n // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal, javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal\n const packageOutputPath = resolve(outputPath, relativePath);\n\n // outputPath is the operator-supplied --out directory and is the containment\n // boundary being checked below, not untrusted input being appended to it.\n // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal, javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal\n const outputRoot = resolve(outputPath);\n\n if (packageOutputPath !== outputRoot && !packageOutputPath.startsWith(outputRoot + sep)) {\n throw new Error(`Package output path escapes the output directory: ${relativePath}`);\n }\n\n // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal, javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal\n return join(outputPath, relativePath);\n}\n\n/**\n * Label used when reporting a package, preferring the path relative to the\n * scanned root so nested packages are distinguishable.\n */\nfunction packageLabel(pkg: DetectedPackage): string {\n return pkg.relativePath ?? pkg.name;\n}\n\n/**\n * Display batch processing summary\n */\nexport function displayBatchSummary(summary: BatchConversionSummary, quiet = false): void {\n if (quiet) {\n return;\n }\n\n console.log('\\n' + '='.repeat(60));\n console.log('Batch Conversion Summary');\n console.log('='.repeat(60));\n console.log(`Total packages: ${summary.total}`);\n console.log(`✓ Succeeded: ${summary.succeeded}`);\n console.log(`✗ Failed: ${summary.failed}`);\n console.log(`⊘ Skipped: ${summary.skipped}`);\n console.log('-'.repeat(60));\n console.log(`Total items: ${summary.totalConvertedItems + summary.totalFailedItems}`);\n console.log(`✓ Converted: ${summary.totalConvertedItems}`);\n console.log(`✗ Errored: ${summary.totalFailedItems}`);\n console.log('='.repeat(60) + '\\n');\n}\n\n/**\n * Generic batch processor that works for both conversion directions\n */\nexport async function processBatch<TOptions>(\n config: BatchProcessorConfig<TOptions>\n): Promise<BatchConversionSummary> {\n const {\n inputPath,\n outputPath,\n packageType,\n processPackage,\n options,\n quiet = false,\n scanner = scanForPackages,\n } = config;\n const startTime = Date.now();\n\n // Scan for packages using the provided scanner or default\n const packages = scanner(inputPath, packageType);\n\n if (packages.length === 0) {\n const typeLabel = packageType === 'qti' ? 'QTI packages' : 'Learnosity bundles';\n const manifestFile = packageType === 'qti' ? 'imsmanifest.xml' : 'manifest.json';\n\n console.error(`Error: No ${typeLabel} found in subdirectories.`);\n console.error(`A ${packageType} package must contain a ${manifestFile} file.`);\n process.exit(1);\n }\n\n if (!quiet) {\n const typeLabel = packageType === 'qti' ? 'QTI package(s)' : 'Learnosity bundle(s)';\n\n console.log(`Found ${packages.length} ${typeLabel}:\\n`);\n packages.forEach((pkg, idx) => {\n console.log(` ${idx + 1}. ${packageLabel(pkg)}`);\n });\n console.log('');\n }\n\n // Initialize summary\n const summary: BatchConversionSummary = {\n total: packages.length,\n succeeded: 0,\n failed: 0,\n skipped: 0,\n totalConvertedItems: 0,\n totalFailedItems: 0,\n packages: [],\n };\n\n // Process each package\n for (let i = 0; i < packages.length; i++) {\n const pkg = packages[i];\n\n // Mirror the input folder structure below the scanned root.\n const packageOutputPath = resolvePackageOutputPath(outputPath, pkg);\n\n if (!quiet) {\n console.log(`\\n[${i + 1}/${packages.length}] Converting: ${packageLabel(pkg)}`);\n console.log(` Input: ${pkg.path}`);\n console.log(` Output: ${packageOutputPath}`);\n console.log('');\n }\n\n try {\n const result = await processPackage(pkg, packageOutputPath, options);\n\n summary.totalConvertedItems += result.convertedItemCount ?? 0;\n summary.totalFailedItems += result.failedItemCount ?? 0;\n\n if (result.success) {\n summary.succeeded++;\n summary.packages.push({\n name: packageLabel(pkg),\n type: pkg.type,\n status: 'success',\n errorCount: result.errorCount,\n warningCount: result.warningCount,\n });\n\n if (!quiet) {\n console.log(\n ` ✓ SUCCESS (${result.errorCount} error(s), ${result.warningCount} warning(s))`\n );\n }\n } else {\n summary.failed++;\n summary.packages.push({\n name: packageLabel(pkg),\n type: pkg.type,\n status: 'failed',\n errorCount: result.errorCount,\n warningCount: result.warningCount,\n });\n\n if (!quiet) {\n console.error(` ✗ FAILED (${result.errorCount} error(s))`);\n if (result.message) {\n console.error(` ${result.message}`);\n }\n }\n }\n } catch (error) {\n summary.failed++;\n summary.packages.push({\n name: packageLabel(pkg),\n type: pkg.type,\n status: 'failed',\n errorCount: 1,\n });\n\n if (!quiet) {\n console.error(\n ` ✗ FAILED: ${error instanceof Error ? error.message : 'Unknown error'}`\n );\n }\n }\n }\n\n // Display summary\n displayBatchSummary(summary, quiet);\n\n const duration = ((Date.now() - startTime) / 1000).toFixed(2);\n\n if (!quiet) {\n console.log(`Completed in ${duration}s\\n`);\n }\n\n // Exit with appropriate code\n if (summary.failed > 0 && summary.succeeded === 0) {\n process.exit(1);\n }\n\n return summary;\n}\n\n/**\n * Configuration for the parallel (worker-pool) batch processor.\n */\nexport interface ParallelBatchConfig {\n inputPath: string;\n outputPath: string;\n packageType: PackageType;\n direction: BatchTask['direction'];\n options: BatchPackageOptions;\n /** Max concurrent worker threads. */\n concurrency: number;\n quiet?: boolean;\n scanner?: PackageScanner;\n /** Worker module URL (defaults to the built batchWorker.js next to main.js). */\n workerUrl?: URL | string;\n}\n\n/**\n * Parallel batch processor: converts packages across a pool of worker threads.\n *\n * Behaviour mirrors {@link processBatch} — same scan, summary shape, console\n * summary and exit code — but per-package conversion runs on worker threads so\n * multiple cores are used. Results are aggregated in package order for a\n * deterministic summary.\n */\nexport async function processBatchParallel(\n config: ParallelBatchConfig\n): Promise<BatchConversionSummary> {\n const {\n inputPath,\n outputPath,\n packageType,\n direction,\n options,\n concurrency,\n quiet = false,\n scanner = scanForPackages,\n workerUrl = new URL('./batchWorker.js', import.meta.url),\n } = config;\n const startTime = Date.now();\n\n const packages = scanner(inputPath, packageType);\n\n if (packages.length === 0) {\n const typeLabel = packageType === 'qti' ? 'QTI packages' : 'Learnosity bundles';\n const manifestFile = packageType === 'qti' ? 'imsmanifest.xml' : 'manifest.json';\n\n console.error(`Error: No ${typeLabel} found in subdirectories.`);\n console.error(`A ${packageType} package must contain a ${manifestFile} file.`);\n process.exit(1);\n }\n\n if (!quiet) {\n const typeLabel = packageType === 'qti' ? 'QTI package(s)' : 'Learnosity bundle(s)';\n\n console.log(\n `Found ${packages.length} ${typeLabel} (converting with ${Math.min(concurrency, packages.length)} workers):\\n`\n );\n packages.forEach((pkg, idx) => {\n console.log(` ${idx + 1}. ${packageLabel(pkg)}`);\n });\n console.log('');\n }\n\n const tasks: BatchTask[] = packages.map((pkg) => ({\n direction,\n pkg,\n // Mirror the input folder structure below the scanned root.\n packageOutputPath: resolvePackageOutputPath(outputPath, pkg),\n options,\n }));\n\n const results = await runPool<BatchTask, PackageResult>({\n tasks,\n workerUrl,\n concurrency,\n onError: (_task, error) => ({\n success: false,\n errorCount: 1,\n warningCount: 0,\n message: error.message,\n }),\n onResult: (index, task, result) => {\n if (quiet) {\n return;\n }\n\n if (result.success) {\n console.log(\n ` ✓ [${index + 1}/${tasks.length}] ${packageLabel(task.pkg)} (${result.errorCount} error(s), ${result.warningCount} warning(s))`\n );\n } else {\n console.error(\n ` ✗ [${index + 1}/${tasks.length}] ${packageLabel(task.pkg)} FAILED (${result.errorCount} error(s))${result.message ? `: ${result.message}` : ''}`\n );\n }\n },\n });\n\n // Aggregate summary in package order (deterministic).\n const summary: BatchConversionSummary = {\n total: packages.length,\n succeeded: 0,\n failed: 0,\n skipped: 0,\n totalConvertedItems: 0,\n totalFailedItems: 0,\n packages: [],\n };\n\n for (let i = 0; i < packages.length; i++) {\n const pkg = packages[i];\n const result = results[i];\n\n summary.totalConvertedItems += result.convertedItemCount ?? 0;\n summary.totalFailedItems += result.failedItemCount ?? 0;\n\n if (result.success) {\n summary.succeeded++;\n summary.packages.push({\n name: packageLabel(pkg),\n type: pkg.type,\n status: 'success',\n errorCount: result.errorCount,\n warningCount: result.warningCount,\n });\n } else {\n summary.failed++;\n summary.packages.push({\n name: packageLabel(pkg),\n type: pkg.type,\n status: 'failed',\n errorCount: result.errorCount,\n warningCount: result.warningCount,\n });\n }\n }\n\n displayBatchSummary(summary, quiet);\n\n const duration = ((Date.now() - startTime) / 1000).toFixed(2);\n\n if (!quiet) {\n console.log(`Completed in ${duration}s\\n`);\n }\n\n if (summary.failed > 0 && summary.succeeded === 0) {\n process.exit(1);\n }\n\n return summary;\n}\n","/**\n * Shared utilities for displaying configuration output in CLI commands\n */\n\nexport interface ConfigField {\n label: string;\n value: string | number | boolean;\n indent?: number;\n}\n\nexport interface ConfigOutputOptions {\n quiet?: boolean;\n}\n\n/**\n * Display a configuration block with consistent formatting\n */\nexport function displayConfiguration(fields: ConfigField[], options: ConfigOutputOptions = {}): void {\n if (options.quiet) {\n return;\n }\n\n console.log('\\nConfiguration:');\n\n for (const field of fields) {\n const indent = field.indent ?? 0;\n const padding = ' ' + ' '.repeat(indent * 2);\n const label = field.label.padEnd(14 - indent * 2, ' ');\n\n console.log(`${padding}${label}${field.value}`);\n }\n\n console.log('');\n}\n\n/**\n * Helper to create a config field\n */\nexport function configField(label: string, value: string | number | boolean, indent = 0): ConfigField {\n return { label, value, indent };\n}\n\n/**\n * Format a list of items for configuration output\n */\nexport function formatList(items: string[], _singular: string, plural: string, showAll = false): string {\n if (items.length === 0) {\n return `0 ${plural}`;\n }\n if (items.length === 1) {\n return items[0];\n }\n\n return `${items.length} ${plural}${showAll ? ' (all)' : ''}`;\n}\n\n"],"mappings":";;;;;;;;;;;AAoCA,SAAgB,aAAa,SAA0B;CACnD,IAAI,CAAC,WAAW,OAAO,KAAK,CAAC,SAAS,OAAO,CAAC,CAAC,YAAY,GACvD,OAAO;CAMX,MAAM,eAAe,KAAK,SAAS,iBAAiB;CAEpD,OAAO,WAAW,YAAY;AAClC;;;;;AAMA,SAAgB,mBAAmB,SAA0B;CACzD,IAAI,CAAC,WAAW,OAAO,KAAK,CAAC,SAAS,OAAO,CAAC,CAAC,YAAY,G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S,KAAK;IAClB,MAAM,aAAa,GAAG;IACtB,MAAM,IAAI;IACV,QAAQ;IACR,YAAY,OAAO;IACnB,cAAc,OAAO;GACzB,CAAC;EACL,OAAO;GACH,QAAQ;GACR,QAAQ,SAAS,KAAK;IAClB,MAAM,aAAa,GAAG;IACtB,MAAM,IAAI;IACV,QAAQ;IACR,YAAY,OAAO;IACnB,cAAc,OAAO;GACzB,CAAC;EACL;CACJ;CAEA,oBAAoB,SAAS,KAAK;CAElC,MAAM,aAAa,KAAK,IAAI,IAAI,aAAa,IAAA,CAAM,QAAQ,CAAC;CAE5D,IAAI,CAAC,OACD,QAAQ,IAAI,gBAAgB,SAAS,IAAI;CAG7C,IAAI,QAAQ,SAAS,KAAK,QAAQ,cAAc,GAC5C,QAAQ,KAAK,CAAC;CAGlB,OAAO;AACX;;;;;ACrZA,SAAgB,qBAAqB,QAAuB,UAA+B,CAAC,GAAS;CACjG,IAAI,QAAQ,OACR;CAGJ,QAAQ,IAAI,kBAAkB;CAE9B,KAAK,MAAM,SAAS,QAAQ;EACxB,MAAM,SAAS,MAAM,UAAU;EAC/B,MAAM,UAAU,OAAO,IAAI,OAAO,SAAS,CAAC;EAC5C,MAAM,QAAQ,MAAM,MAAM,OAAO,KAAK,SAAS,GAAG,GAAG;EAErD,QAAQ,IAAI,GAAG,UAAU,QAAQ,MAAM,OAAO;CAClD;CAEA,QAAQ,IAAI,EAAE;AAClB;;;;AAKA,SAAgB,YAAY,OAAe,OAAkC,SAAS,GAAgB;CAClG,OAAO;EAAE;EAAO;EAAO;CAAO;AAClC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { i as __toESM, r as __require, t as __commonJSMin } from "./rolldown-runtime-
|
|
1
|
+
import { i as __toESM, r as __require, t as __commonJSMin } from "./rolldown-runtime-BVN1G_yT.js";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import process$
|
|
3
|
+
import process$2 from "node:process";
|
|
4
4
|
import { stripVTControlCharacters, styleText } from "node:util";
|
|
5
5
|
import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
|
|
6
6
|
import * as readline from "node:readline";
|
|
7
|
-
|
|
7
|
+
// ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@26.6.6/node_modules/@inquirer/core/dist/lib/key.js
|
|
8
8
|
const keybindingLookup = /* @__PURE__ */ new Set(["emacs", "vim"]);
|
|
9
9
|
function isKeybinding(value) {
|
|
10
10
|
return keybindingLookup.has(value);
|
|
@@ -21,8 +21,7 @@ const isBackspaceKey = (key) => key.name === "backspace";
|
|
|
21
21
|
const isTabKey = (key) => key.name === "tab";
|
|
22
22
|
const isNumberKey = (key) => "1234567890".includes(key.name);
|
|
23
23
|
const isEnterKey = (key) => key.name === "enter" || key.name === "return";
|
|
24
|
-
|
|
25
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.4_@types+node@26.6.5/node_modules/@inquirer/core/dist/lib/errors.js
|
|
24
|
+
// ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@26.6.6/node_modules/@inquirer/core/dist/lib/errors.js
|
|
26
25
|
var AbortPromptError = class extends Error {
|
|
27
26
|
name = "AbortPromptError";
|
|
28
27
|
message = "Prompt was aborted";
|
|
@@ -44,8 +43,7 @@ var HookError = class extends Error {
|
|
|
44
43
|
var ValidationError = class extends Error {
|
|
45
44
|
name = "ValidationError";
|
|
46
45
|
};
|
|
47
|
-
|
|
48
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.4_@types+node@26.6.5/node_modules/@inquirer/core/dist/lib/hook-engine.js
|
|
46
|
+
// ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@26.6.6/node_modules/@inquirer/core/dist/lib/hook-engine.js
|
|
49
47
|
const hookStorage = new AsyncLocalStorage();
|
|
50
48
|
function createStore(rl) {
|
|
51
49
|
return {
|
|
@@ -138,8 +136,7 @@ const effectScheduler = {
|
|
|
138
136
|
store.hooksCleanup.length = 0;
|
|
139
137
|
}
|
|
140
138
|
};
|
|
141
|
-
|
|
142
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.4_@types+node@26.6.5/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
139
|
+
// ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@26.6.6/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
143
140
|
function isFactory(value) {
|
|
144
141
|
return typeof value === "function";
|
|
145
142
|
}
|
|
@@ -162,8 +159,7 @@ function useState(defaultValue) {
|
|
|
162
159
|
return [value, setState];
|
|
163
160
|
});
|
|
164
161
|
}
|
|
165
|
-
|
|
166
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.4_@types+node@26.6.5/node_modules/@inquirer/core/dist/lib/use-effect.js
|
|
162
|
+
// ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@26.6.6/node_modules/@inquirer/core/dist/lib/use-effect.js
|
|
167
163
|
function useEffect(cb, depArray) {
|
|
168
164
|
withPointer((pointer) => {
|
|
169
165
|
const oldDeps = pointer.get();
|
|
@@ -171,11 +167,10 @@ function useEffect(cb, depArray) {
|
|
|
171
167
|
pointer.set(depArray);
|
|
172
168
|
});
|
|
173
169
|
}
|
|
174
|
-
|
|
175
|
-
//#region ../../node_modules/.pnpm/@inquirer+figures@2.0.9/node_modules/@inquirer/figures/dist/index.js
|
|
170
|
+
// ../../node_modules/.pnpm/@inquirer+figures@2.0.10/node_modules/@inquirer/figures/dist/index.js
|
|
176
171
|
function isUnicodeSupported() {
|
|
177
|
-
if (!process$
|
|
178
|
-
return Boolean(process$
|
|
172
|
+
if (!process$2.platform.startsWith("win")) return process$2.env["TERM"] !== "linux";
|
|
173
|
+
return Boolean(process$2.env["CI"]) || Boolean(process$2.env["WT_SESSION"]) || Boolean(process$2.env["TERMINUS_SUBLIME"]) || process$2.env["ConEmuTask"] === "{cmd::Cmder}" || process$2.env["TERM_PROGRAM"] === "Terminus-Sublime" || process$2.env["TERM_PROGRAM"] === "vscode" || process$2.env["TERM"] === "xterm-256color" || process$2.env["TERM"] === "alacritty" || process$2.env["TERMINAL_EMULATOR"] === "JetBrains-JediTerm";
|
|
179
174
|
}
|
|
180
175
|
const common = {
|
|
181
176
|
circleQuestionMark: "(?)",
|
|
@@ -455,8 +450,7 @@ const fallbackSymbols = {
|
|
|
455
450
|
};
|
|
456
451
|
const figures = isUnicodeSupported() ? mainSymbols : fallbackSymbols;
|
|
457
452
|
Object.entries(specialMainSymbols);
|
|
458
|
-
|
|
459
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.4_@types+node@26.6.5/node_modules/@inquirer/core/dist/lib/theme.js
|
|
453
|
+
// ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@26.6.6/node_modules/@inquirer/core/dist/lib/theme.js
|
|
460
454
|
const defaultTheme = {
|
|
461
455
|
prefix: {
|
|
462
456
|
idle: styleText("blue", "?"),
|
|
@@ -494,8 +488,7 @@ function getDefaultTheme() {
|
|
|
494
488
|
keybindings: getDefaultKeybindings()
|
|
495
489
|
};
|
|
496
490
|
}
|
|
497
|
-
|
|
498
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.4_@types+node@26.6.5/node_modules/@inquirer/core/dist/lib/make-theme.js
|
|
491
|
+
// ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@26.6.6/node_modules/@inquirer/core/dist/lib/make-theme.js
|
|
499
492
|
function isPlainObject(value) {
|
|
500
493
|
if (typeof value !== "object" || value === null) return false;
|
|
501
494
|
let proto = value;
|
|
@@ -513,8 +506,7 @@ function deepMerge(...objects) {
|
|
|
513
506
|
function makeTheme(...themes) {
|
|
514
507
|
return deepMerge(...[getDefaultTheme(), ...themes.filter((theme) => theme != null)]);
|
|
515
508
|
}
|
|
516
|
-
|
|
517
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.4_@types+node@26.6.5/node_modules/@inquirer/core/dist/lib/use-prefix.js
|
|
509
|
+
// ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@26.6.6/node_modules/@inquirer/core/dist/lib/use-prefix.js
|
|
518
510
|
function usePrefix({ status = "idle", theme }) {
|
|
519
511
|
const [showLoader, setShowLoader] = useState(false);
|
|
520
512
|
const [tick, setTick] = useState(0);
|
|
@@ -539,13 +531,11 @@ function usePrefix({ status = "idle", theme }) {
|
|
|
539
531
|
if (showLoader) return spinner.frames[tick];
|
|
540
532
|
return typeof prefix === "string" ? prefix : prefix[status === "loading" ? "idle" : status] ?? prefix["idle"];
|
|
541
533
|
}
|
|
542
|
-
|
|
543
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.4_@types+node@26.6.5/node_modules/@inquirer/core/dist/lib/use-ref.js
|
|
534
|
+
// ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@26.6.6/node_modules/@inquirer/core/dist/lib/use-ref.js
|
|
544
535
|
function useRef(val) {
|
|
545
536
|
return useState({ current: val })[0];
|
|
546
537
|
}
|
|
547
|
-
|
|
548
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.4_@types+node@26.6.5/node_modules/@inquirer/core/dist/lib/use-keypress.js
|
|
538
|
+
// ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@26.6.6/node_modules/@inquirer/core/dist/lib/use-keypress.js
|
|
549
539
|
function useKeypress(userHandler) {
|
|
550
540
|
const signal = useRef(userHandler);
|
|
551
541
|
signal.current = userHandler;
|
|
@@ -562,8 +552,7 @@ function useKeypress(userHandler) {
|
|
|
562
552
|
};
|
|
563
553
|
}, []);
|
|
564
554
|
}
|
|
565
|
-
|
|
566
|
-
//#region ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
|
|
555
|
+
// ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
|
|
567
556
|
var import_cli_width = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
568
557
|
module.exports = cliWidth;
|
|
569
558
|
function normalizeOpts(options) {
|
|
@@ -605,8 +594,7 @@ const isFullWidth = (x) => {
|
|
|
605
594
|
const isWideNotCJKTNotEmoji = (x) => {
|
|
606
595
|
return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
607
596
|
};
|
|
608
|
-
|
|
609
|
-
//#region ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
|
|
597
|
+
// ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
|
|
610
598
|
const ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
611
599
|
const CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
612
600
|
const CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy;
|
|
@@ -615,11 +603,11 @@ const EMOJI_RE = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{
|
|
|
615
603
|
const LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
616
604
|
const MODIFIER_RE = /\p{M}+/gu;
|
|
617
605
|
const NO_TRUNCATION$1 = {
|
|
618
|
-
limit:
|
|
606
|
+
limit: 1e400,
|
|
619
607
|
ellipsis: ""
|
|
620
608
|
};
|
|
621
609
|
const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
|
|
622
|
-
const LIMIT = truncationOptions.limit ??
|
|
610
|
+
const LIMIT = truncationOptions.limit ?? 1e400;
|
|
623
611
|
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
624
612
|
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION$1, widthOptions).width : 0);
|
|
625
613
|
const ANSI_WIDTH = 0;
|
|
@@ -695,18 +683,16 @@ const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {
|
|
|
695
683
|
ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
|
|
696
684
|
};
|
|
697
685
|
};
|
|
698
|
-
|
|
699
|
-
//#region ../../node_modules/.pnpm/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
|
|
686
|
+
// ../../node_modules/.pnpm/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
|
|
700
687
|
const NO_TRUNCATION = {
|
|
701
|
-
limit:
|
|
688
|
+
limit: 1e400,
|
|
702
689
|
ellipsis: "",
|
|
703
690
|
ellipsisWidth: 0
|
|
704
691
|
};
|
|
705
692
|
const fastStringWidth = (input, options = {}) => {
|
|
706
693
|
return getStringTruncatedWidth(input, NO_TRUNCATION, options).width;
|
|
707
694
|
};
|
|
708
|
-
|
|
709
|
-
//#region ../../node_modules/.pnpm/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js
|
|
695
|
+
// ../../node_modules/.pnpm/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js
|
|
710
696
|
const ESC$1 = "\x1B";
|
|
711
697
|
const CSI = "";
|
|
712
698
|
const END_CODE = 39;
|
|
@@ -870,8 +856,7 @@ const CRLF_OR_LF = /\r?\n/;
|
|
|
870
856
|
function wrapAnsi(string, columns, options) {
|
|
871
857
|
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
872
858
|
}
|
|
873
|
-
|
|
874
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.4_@types+node@26.6.5/node_modules/@inquirer/core/dist/lib/utils.js
|
|
859
|
+
// ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@26.6.6/node_modules/@inquirer/core/dist/lib/utils.js
|
|
875
860
|
/**
|
|
876
861
|
* Force line returns at specific width. This function is ANSI code friendly and it'll
|
|
877
862
|
* ignore invisible codes during width calculation.
|
|
@@ -895,8 +880,7 @@ function readlineWidth() {
|
|
|
895
880
|
output: readline$1().output
|
|
896
881
|
});
|
|
897
882
|
}
|
|
898
|
-
|
|
899
|
-
//#region ../../node_modules/.pnpm/@inquirer+type@4.2.0_@types+node@26.6.5/node_modules/@inquirer/type/dist/utils.js
|
|
883
|
+
// ../../node_modules/.pnpm/@inquirer+type@4.2.1_@types+node@26.6.6/node_modules/@inquirer/type/dist/utils.js
|
|
900
884
|
/**
|
|
901
885
|
* Create a promise and get access to its `resolve` and `reject` functions.
|
|
902
886
|
*
|
|
@@ -915,8 +899,7 @@ function withResolver() {
|
|
|
915
899
|
reject
|
|
916
900
|
};
|
|
917
901
|
}
|
|
918
|
-
|
|
919
|
-
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
|
|
902
|
+
// ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
|
|
920
903
|
var import_lib = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
921
904
|
const Stream = __require("stream");
|
|
922
905
|
var MuteStream = class extends Stream {
|
|
@@ -1043,8 +1026,7 @@ const signals = [];
|
|
|
1043
1026
|
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
1044
1027
|
if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
1045
1028
|
if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
1046
|
-
|
|
1047
|
-
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
|
|
1029
|
+
// ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
|
|
1048
1030
|
const processOk = (process) => !!process && typeof process === "object" && typeof process.removeListener === "function" && typeof process.emit === "function" && typeof process.reallyExit === "function" && typeof process.listeners === "function" && typeof process.kill === "function" && typeof process.pid === "number" && typeof process.on === "function";
|
|
1049
1031
|
const kExitEmitter = Symbol.for("signal-exit emitter");
|
|
1050
1032
|
const global = globalThis;
|
|
@@ -1113,7 +1095,7 @@ var SignalExitFallback = class extends SignalExitBase {
|
|
|
1113
1095
|
};
|
|
1114
1096
|
var SignalExit = class extends SignalExitBase {
|
|
1115
1097
|
/* c8 ignore start */
|
|
1116
|
-
#hupSig = process$
|
|
1098
|
+
#hupSig = process$1.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
1117
1099
|
/* c8 ignore stop */
|
|
1118
1100
|
#emitter = new Emitter();
|
|
1119
1101
|
#process;
|
|
@@ -1208,10 +1190,9 @@ var SignalExit = class extends SignalExitBase {
|
|
|
1208
1190
|
} else return og.call(this.#process, ev, ...args);
|
|
1209
1191
|
}
|
|
1210
1192
|
};
|
|
1211
|
-
const process$
|
|
1212
|
-
const { onExit, load, unload } = signalExitWrap(processOk(process$
|
|
1213
|
-
|
|
1214
|
-
//#region ../../node_modules/.pnpm/@inquirer+ansi@2.0.9/node_modules/@inquirer/ansi/dist/index.js
|
|
1193
|
+
const process$1 = globalThis.process;
|
|
1194
|
+
const { onExit, load, unload } = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
|
|
1195
|
+
// ../../node_modules/.pnpm/@inquirer+ansi@2.0.10/node_modules/@inquirer/ansi/dist/index.js
|
|
1215
1196
|
const ESC = "\x1B[";
|
|
1216
1197
|
/** Hide the cursor */
|
|
1217
1198
|
const cursorHide = "\x1B[?25l";
|
|
@@ -1229,8 +1210,7 @@ const cursorTo = (x, y) => {
|
|
|
1229
1210
|
const eraseLine = "\x1B[2K";
|
|
1230
1211
|
/** Erase the specified number of lines above the cursor */
|
|
1231
1212
|
const eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + "\x1B[2K\x1B[G" : "";
|
|
1232
|
-
|
|
1233
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.4_@types+node@26.6.5/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
1213
|
+
// ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@26.6.6/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
1234
1214
|
const height = (content) => content.split("\n").length;
|
|
1235
1215
|
const lastLine = (content) => content.split("\n").pop() ?? "";
|
|
1236
1216
|
var ScreenManager = class {
|
|
@@ -1286,9 +1266,9 @@ var ScreenManager = class {
|
|
|
1286
1266
|
this.rl.close();
|
|
1287
1267
|
}
|
|
1288
1268
|
};
|
|
1289
|
-
|
|
1290
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.4_@types+node@26.6.5/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
1269
|
+
// ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@26.6.6/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
1291
1270
|
const nativeSetImmediate = globalThis.setImmediate;
|
|
1271
|
+
const nativeClearImmediate = globalThis.clearImmediate;
|
|
1292
1272
|
/**
|
|
1293
1273
|
* Register an event listener and return its disposer, so registrations collapse
|
|
1294
1274
|
* into a single statement: `cleanups.add(listenTo(rl, 'close', handler))`.
|
|
@@ -1391,14 +1371,15 @@ function createPrompt(view) {
|
|
|
1391
1371
|
}
|
|
1392
1372
|
});
|
|
1393
1373
|
};
|
|
1394
|
-
if ("readableFlowing" in input)
|
|
1395
|
-
|
|
1374
|
+
if ("readableFlowing" in input && input.isTTY) {
|
|
1375
|
+
const immediate = nativeSetImmediate(startCycle);
|
|
1376
|
+
cleanups.add(() => nativeClearImmediate(immediate));
|
|
1377
|
+
} else startCycle();
|
|
1396
1378
|
return promptPromise;
|
|
1397
1379
|
});
|
|
1398
1380
|
};
|
|
1399
1381
|
return prompt;
|
|
1400
1382
|
}
|
|
1401
|
-
//#endregion
|
|
1402
1383
|
export { isEnterKey as _, readlineWidth as a, isTabKey as b, usePrefix as c, useEffect as d, useState as f, isDownKey as g, isBackspaceKey as h, breakLines as i, makeTheme as l, ValidationError as m, cursorHide as n, useKeypress as o, withPointer as p, onExit as r, useRef as s, createPrompt as t, figures as u, isNumberKey as v, isUpKey as x, isSpaceKey as y };
|
|
1403
1384
|
|
|
1404
|
-
//# sourceMappingURL=create-prompt-
|
|
1385
|
+
//# sourceMappingURL=create-prompt-m0MC0vT_.js.map
|