coursecode 0.1.40 → 0.1.42
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/framework/index.html
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
8
8
|
<meta name="description" id="page-description" content="" />
|
|
9
9
|
<link rel="stylesheet" href="css/framework.css" />
|
|
10
|
-
<link rel="stylesheet" href="../course/theme.css" />
|
|
10
|
+
<link rel="stylesheet" href="../template/course/theme.css" />
|
|
11
11
|
<!-- Skip link is styled via framework.css for accessibility -->
|
|
12
12
|
</head>
|
|
13
13
|
|
|
@@ -172,4 +172,4 @@
|
|
|
172
172
|
<script type="module" src="./js/main.js"></script>
|
|
173
173
|
</body>
|
|
174
174
|
|
|
175
|
-
</html>
|
|
175
|
+
</html>
|
|
@@ -120,7 +120,7 @@ class EventBus {
|
|
|
120
120
|
// suppress to prevent infinite cascade
|
|
121
121
|
if (isErrorEvent) {
|
|
122
122
|
if (this._emittingError) {
|
|
123
|
-
|
|
123
|
+
logger.warn(`[EventBus] Suppressed recursive error event: ${event}`);
|
|
124
124
|
return false;
|
|
125
125
|
}
|
|
126
126
|
this._emittingError = true;
|
|
@@ -507,8 +507,7 @@ export class Scorm2004Driver extends ScormDriverBase {
|
|
|
507
507
|
const value = this._scorm.get(key);
|
|
508
508
|
const errorCode = this._scorm.debug.getCode();
|
|
509
509
|
|
|
510
|
-
|
|
511
|
-
if (errorCode === 403) {
|
|
510
|
+
if (this._isOptionalReadError(errorCode)) {
|
|
512
511
|
return null;
|
|
513
512
|
}
|
|
514
513
|
|
|
@@ -561,18 +560,12 @@ export class Scorm2004Driver extends ScormDriverBase {
|
|
|
561
560
|
* Populates the CMI cache at init time. Single LMS read pass.
|
|
562
561
|
*/
|
|
563
562
|
_populateCache() {
|
|
564
|
-
//
|
|
565
|
-
//
|
|
566
|
-
// SCORM
|
|
567
|
-
//
|
|
563
|
+
// Startup cache hydration reads LMS state opportunistically. Some LMS
|
|
564
|
+
// adapters report supported-but-empty or unavailable optional fields as
|
|
565
|
+
// SCORM errors, so use the optional read path here and keep strict reads
|
|
566
|
+
// for required operations.
|
|
568
567
|
const getOrDefault = (key, fallback) => {
|
|
569
|
-
|
|
570
|
-
return this._getValue(key) || fallback;
|
|
571
|
-
} catch (e) {
|
|
572
|
-
const code = this._scorm.debug.getCode();
|
|
573
|
-
if (code === 403) return fallback;
|
|
574
|
-
throw e;
|
|
575
|
-
}
|
|
568
|
+
return this._getValueOptional(key) || fallback;
|
|
576
569
|
};
|
|
577
570
|
|
|
578
571
|
// Read-only scalars (may be uninitialized on first launch)
|
|
@@ -712,6 +705,11 @@ export class Scorm2004Driver extends ScormDriverBase {
|
|
|
712
705
|
throw new Error(msg);
|
|
713
706
|
}
|
|
714
707
|
|
|
708
|
+
_isOptionalReadError(code) {
|
|
709
|
+
const numericCode = Number(code);
|
|
710
|
+
return numericCode === 401 || numericCode === 403;
|
|
711
|
+
}
|
|
712
|
+
|
|
715
713
|
// --- Recovery Mode Helpers ---
|
|
716
714
|
|
|
717
715
|
_getValueRecovered(key) {
|
|
@@ -739,7 +737,7 @@ export class Scorm2004Driver extends ScormDriverBase {
|
|
|
739
737
|
const value = api.GetValue(key);
|
|
740
738
|
const errCode = api.GetLastError ? parseInt(api.GetLastError(), 10) : 0;
|
|
741
739
|
|
|
742
|
-
if (errCode
|
|
740
|
+
if (this._isOptionalReadError(errCode)) {
|
|
743
741
|
return null;
|
|
744
742
|
}
|
|
745
743
|
|
|
@@ -31,13 +31,9 @@ further modified by Philip Hutchison
|
|
|
31
31
|
if (typeof define === 'function' && define.amd) {
|
|
32
32
|
// AMD. Register as an anonymous module.
|
|
33
33
|
define([], factory);
|
|
34
|
-
} else if (typeof module === 'object' && module.exports) {
|
|
35
|
-
// Node. Does not work with strict CommonJS, but
|
|
36
|
-
// only CommonJS-like environments that support module.exports,
|
|
37
|
-
// like Node.
|
|
38
|
-
module.exports = factory();
|
|
39
34
|
} else {
|
|
40
|
-
// Browser
|
|
35
|
+
// Browser/global object. CourseCode imports this vendored copy as ESM,
|
|
36
|
+
// so avoid CommonJS export branches that modern bundlers warn about.
|
|
41
37
|
root.pipwerks = factory();
|
|
42
38
|
}
|
|
43
39
|
}(typeof globalThis !== 'undefined' ? globalThis : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : this, function () {
|
|
@@ -927,5 +923,5 @@ further modified by Philip Hutchison
|
|
|
927
923
|
// ESM Export for Vite/modern bundlers
|
|
928
924
|
// Added to enable ES module imports while keeping original UMD intact
|
|
929
925
|
// =============================================================================
|
|
930
|
-
export default
|
|
931
|
-
export const SCORM =
|
|
926
|
+
export default globalThis.pipwerks;
|
|
927
|
+
export const SCORM = globalThis.pipwerks?.SCORM;
|
|
@@ -38,8 +38,7 @@ import {
|
|
|
38
38
|
parseSlideNarration as parseSlideNarrationShared,
|
|
39
39
|
hashContent,
|
|
40
40
|
loadNarrationCache,
|
|
41
|
-
narrationCacheKey
|
|
42
|
-
VOICE_SETTING_KEYS as _SHARED_VOICE_KEYS
|
|
41
|
+
narrationCacheKey
|
|
43
42
|
} from './narration-parser.js';
|
|
44
43
|
|
|
45
44
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -54,9 +53,6 @@ const AUDIO_DIR = path.join(ASSETS_DIR, 'audio');
|
|
|
54
53
|
const SLIDES_DIR = path.join(COURSE_DIR, 'slides');
|
|
55
54
|
const CACHE_FILE = path.join(SCORM_TEMPLATE_DIR, '.narration-cache.json');
|
|
56
55
|
|
|
57
|
-
// Reserved keys for voice settings (not narration content) — re-exported from shared module
|
|
58
|
-
const VOICE_SETTING_KEYS = _SHARED_VOICE_KEYS;
|
|
59
|
-
|
|
60
56
|
// Parse command line arguments
|
|
61
57
|
const args = process.argv.slice(2);
|
|
62
58
|
const FORCE_REGENERATE = args.includes('--force');
|
|
@@ -382,7 +378,7 @@ Examples:
|
|
|
382
378
|
const contentHash = hashContent(text + JSON.stringify(settings));
|
|
383
379
|
|
|
384
380
|
// Cache key includes the item key for multi-key narration
|
|
385
|
-
const cacheKey =
|
|
381
|
+
const cacheKey = narrationCacheKey(source.src, key);
|
|
386
382
|
const cachedHash = cache[cacheKey];
|
|
387
383
|
const outputExists = fs.existsSync(outputPath);
|
|
388
384
|
|