@lessonkit/lxpack 1.3.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,11 +1,12 @@
1
- import { CheckId, CourseId, LessonId } from '@lessonkit/core';
1
+ import { McqAssessmentProps, CheckId, CourseId, LessonId } from '@lessonkit/core';
2
+ export { LmsBridgeMode, McqAssessmentProps } from '@lessonkit/core';
2
3
  import { ThemePresetName, LessonkitThemeV1 } from '@lessonkit/themes';
3
4
  import { ExportTarget, BuildCourseResult, ValidateCourseResult } from '@lxpack/api';
4
5
  export { ExportTarget } from '@lxpack/api';
5
6
  import { LessonkitInterchangeV1 } from '@lxpack/validators';
6
7
  export { LessonkitInterchangeV1, MaterializeLessonkitOptions, MaterializeLessonkitResult, lessonkitInterchangeSchema, materializeLessonkitProject, parseLessonkitInterchange } from '@lxpack/validators';
7
8
  export { LESSONKIT_TELEMETRY_EVENTS, LessonkitBridgeAction, LessonkitTelemetryEvent, LessonkitTelemetryEventName, TrackingSchemaEvent, mapLessonkitTelemetryToBridgeAction, mapLessonkitTelemetryToLxpack } from '@lxpack/tracking-schema';
8
- export { t as telemetryEventToLessonkit } from './telemetry-gCxlwc7I.cjs';
9
+ export { t as telemetryEventToLessonkit } from './telemetry-0fIWoomS.cjs';
9
10
 
10
11
  type SpaLayout = "single-spa" | "per-lesson-spa";
11
12
  type LessonDescriptor = {
@@ -14,14 +15,8 @@ type LessonDescriptor = {
14
15
  /** Built SPA folder relative to the LXPack project root (`per-lesson-spa` only). */
15
16
  spaPath?: string;
16
17
  };
17
- type McqAssessmentDescriptor = {
18
- kind?: "mcq";
19
- checkId: CheckId;
20
- question: string;
21
- choices: string[];
22
- answer: string;
23
- passingScore?: number;
24
- };
18
+ /** @deprecated Use `McqAssessmentProps` from `@lessonkit/core`. */
19
+ type McqAssessmentDescriptor = McqAssessmentProps;
25
20
  type TrueFalseAssessmentDescriptor = {
26
21
  kind: "trueFalse";
27
22
  checkId: CheckId;
@@ -176,6 +171,8 @@ type LxpackInjectedAssessment = {
176
171
  }>;
177
172
  }>;
178
173
  };
174
+ /** Escape text embedded into LMS shell / SCORM interchange payloads. */
175
+ declare function escapeShellText(text: string): string;
179
176
  declare function assessmentDescriptorToLxpack(assessment: AssessmentDescriptor): LxpackInjectedAssessment | null;
180
177
  declare function extractAssessments(descriptor: LessonkitCourseDescriptor): LxpackInjectedAssessment[];
181
178
 
@@ -192,8 +189,8 @@ type WriteLxpackProjectOptions = {
192
189
  * For `per-lesson-spa`: map lesson id → absolute path to that lesson's built SPA folder.
193
190
  */
194
191
  lessonSpaDirs?: Record<string, string>;
195
- /** When set, relative `spaDistDir` is resolved under this directory instead of `process.cwd()`. */
196
- projectRoot?: string;
192
+ /** Project root used to resolve relative SPA paths and confine output directories. */
193
+ projectRoot: string;
197
194
  };
198
195
  type WriteLxpackProjectResult = {
199
196
  outDir: string;
@@ -205,7 +202,13 @@ type WriteLxpackProjectResult = {
205
202
  */
206
203
  declare function writeLxpackProject(options: WriteLxpackProjectOptions): Promise<WriteLxpackProjectResult>;
207
204
 
208
- declare function promoteStagingToOutDir(stagingDir: string, outDir: string): Promise<void>;
205
+ type PromoteStagingOptions = {
206
+ /** Relative path under `outDir` where LMS artifacts live (default `.lxpack/out`). */
207
+ outputBaseDir?: string;
208
+ /** When set, re-validates `outDir` is under the project root immediately before promote. */
209
+ projectRoot?: string;
210
+ };
211
+ declare function promoteStagingToOutDir(stagingDir: string, outDir: string, options?: PromoteStagingOptions): Promise<void>;
209
212
 
210
213
  type BuildStagingPackageOptions = WriteLxpackProjectOptions & {
211
214
  descriptor: LessonkitCourseDescriptor;
@@ -235,6 +238,8 @@ type BuildStagingPackageResult = {
235
238
  declare function buildStagingPackage(options: BuildStagingPackageOptions): Promise<BuildStagingPackageResult>;
236
239
  declare function ensureOutDirParent(outDir: string): Promise<void>;
237
240
 
241
+ /** LessonKit-owned alias for LMS export targets (maps to `@lxpack/api` `ExportTarget`). */
242
+ type LessonkitExportTarget = ExportTarget;
238
243
  type ValidateLessonkitProjectOptions = {
239
244
  courseDir: string;
240
245
  target?: ExportTarget;
@@ -253,6 +258,8 @@ type PackageLessonkitCourseOptions = WriteLxpackProjectOptions & {
253
258
  output?: string;
254
259
  dir?: boolean;
255
260
  outputBaseDir?: string;
261
+ /** Treat React parity warnings as packaging errors. */
262
+ strictParity?: boolean;
256
263
  };
257
264
  type PackageLessonkitCourseResult = {
258
265
  ok: true;
@@ -278,6 +285,10 @@ type PackageLessonkitCourseResult = {
278
285
  declare function validateLessonkitProject(options: ValidateLessonkitProjectOptions): Promise<ValidateCourseResult>;
279
286
  declare function buildLessonkitProject(options: BuildLessonkitProjectOptions): Promise<BuildCourseResult>;
280
287
 
288
+ /**
289
+ * Package a built SPA into SCORM, xAPI, cmi5, or standalone LMS artifacts.
290
+ * Prefer `lessonkit package --target …` in course projects; call directly for custom pipelines.
291
+ */
281
292
  declare function packageLessonkitCourse(options: PackageLessonkitCourseOptions): Promise<PackageLessonkitCourseResult>;
282
293
 
283
294
  type PackageValidationIssue = {
@@ -322,7 +333,11 @@ type ParseManifestResult = {
322
333
  ok: false;
323
334
  issues: ManifestParseIssue[];
324
335
  };
336
+ /**
337
+ * Parse and validate a project-root `lessonkit.json` manifest (`schemaVersion: 1`).
338
+ * Pass `projectRoot` for path containment checks equivalent to the CLI.
339
+ */
325
340
  declare function parseLessonkitManifest(raw: unknown, label?: string, projectRoot?: string): ParseManifestResult;
326
341
  declare function loadLessonkitManifestFromFile(readJson: () => Promise<unknown>, label?: string, projectRoot?: string): Promise<ParseManifestResult>;
327
342
 
328
- export { type AssessmentDescriptor, type BuildLessonkitProjectOptions, type BuildStagingPackageOptions, type BuildStagingPackageResult, type DescriptorValidationIssue, type DescriptorValidationResult, type FillInBlanksAssessmentDescriptor, type LessonDescriptor, type LessonkitCourseDescriptor, type LessonkitManifest, type LessonkitManifestPaths, type LxpackInjectedAssessment, type LxpackRuntimeTheme, type ManifestParseIssue, type MappedLessonkitIds, type McqAssessmentDescriptor, type PackageLessonkitCourseOptions, type PackageLessonkitCourseResult, type PackageValidationIssue, type ParseManifestResult, type ProjectPathsInput, type ReactParityIssue, type SpaLayout, type SpaLessonEntry, type TrueFalseAssessmentDescriptor, type ValidateLessonkitProjectOptions, type ValidatePackageInputsResult, type ValidationIssue, type WriteLxpackProjectOptions, type WriteLxpackProjectResult, assessmentDescriptorToLxpack, buildLessonkitProject, buildStagingPackage, descriptorToInterchange, ensureOutDirParent, extractAssessments, loadLessonkitManifestFromFile, mapLessonkitIds, packageLessonkitCourse, parseLessonkitManifest, promoteStagingToOutDir, remapArtifactPaths, resolveSafePackageOutputOverride, resolveSpaLessons, themeToLxpackRuntime, validateDescriptor, validateDescriptorForTarget, validateLessonkitProject, validatePackageInputs, validateProjectPaths, validateReactManifestParity, writeLxpackProject };
343
+ export { type AssessmentDescriptor, type BuildLessonkitProjectOptions, type BuildStagingPackageOptions, type BuildStagingPackageResult, type DescriptorValidationIssue, type DescriptorValidationResult, type FillInBlanksAssessmentDescriptor, type LessonDescriptor, type LessonkitCourseDescriptor, type LessonkitExportTarget, type LessonkitManifest, type LessonkitManifestPaths, type LxpackInjectedAssessment, type LxpackRuntimeTheme, type ManifestParseIssue, type MappedLessonkitIds, type McqAssessmentDescriptor, type PackageLessonkitCourseOptions, type PackageLessonkitCourseResult, type PackageValidationIssue, type ParseManifestResult, type ProjectPathsInput, type ReactParityIssue, type SpaLayout, type SpaLessonEntry, type TrueFalseAssessmentDescriptor, type ValidateLessonkitProjectOptions, type ValidatePackageInputsResult, type ValidationIssue, type WriteLxpackProjectOptions, type WriteLxpackProjectResult, assessmentDescriptorToLxpack, buildLessonkitProject, buildStagingPackage, descriptorToInterchange, ensureOutDirParent, escapeShellText, extractAssessments, loadLessonkitManifestFromFile, mapLessonkitIds, packageLessonkitCourse, parseLessonkitManifest, promoteStagingToOutDir, remapArtifactPaths, resolveSafePackageOutputOverride, resolveSpaLessons, themeToLxpackRuntime, validateDescriptor, validateDescriptorForTarget, validateLessonkitProject, validatePackageInputs, validateProjectPaths, validateReactManifestParity, writeLxpackProject };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,12 @@
1
- import { CheckId, CourseId, LessonId } from '@lessonkit/core';
1
+ import { McqAssessmentProps, CheckId, CourseId, LessonId } from '@lessonkit/core';
2
+ export { LmsBridgeMode, McqAssessmentProps } from '@lessonkit/core';
2
3
  import { ThemePresetName, LessonkitThemeV1 } from '@lessonkit/themes';
3
4
  import { ExportTarget, BuildCourseResult, ValidateCourseResult } from '@lxpack/api';
4
5
  export { ExportTarget } from '@lxpack/api';
5
6
  import { LessonkitInterchangeV1 } from '@lxpack/validators';
6
7
  export { LessonkitInterchangeV1, MaterializeLessonkitOptions, MaterializeLessonkitResult, lessonkitInterchangeSchema, materializeLessonkitProject, parseLessonkitInterchange } from '@lxpack/validators';
7
8
  export { LESSONKIT_TELEMETRY_EVENTS, LessonkitBridgeAction, LessonkitTelemetryEvent, LessonkitTelemetryEventName, TrackingSchemaEvent, mapLessonkitTelemetryToBridgeAction, mapLessonkitTelemetryToLxpack } from '@lxpack/tracking-schema';
8
- export { t as telemetryEventToLessonkit } from './telemetry-gCxlwc7I.js';
9
+ export { t as telemetryEventToLessonkit } from './telemetry-0fIWoomS.js';
9
10
 
10
11
  type SpaLayout = "single-spa" | "per-lesson-spa";
11
12
  type LessonDescriptor = {
@@ -14,14 +15,8 @@ type LessonDescriptor = {
14
15
  /** Built SPA folder relative to the LXPack project root (`per-lesson-spa` only). */
15
16
  spaPath?: string;
16
17
  };
17
- type McqAssessmentDescriptor = {
18
- kind?: "mcq";
19
- checkId: CheckId;
20
- question: string;
21
- choices: string[];
22
- answer: string;
23
- passingScore?: number;
24
- };
18
+ /** @deprecated Use `McqAssessmentProps` from `@lessonkit/core`. */
19
+ type McqAssessmentDescriptor = McqAssessmentProps;
25
20
  type TrueFalseAssessmentDescriptor = {
26
21
  kind: "trueFalse";
27
22
  checkId: CheckId;
@@ -176,6 +171,8 @@ type LxpackInjectedAssessment = {
176
171
  }>;
177
172
  }>;
178
173
  };
174
+ /** Escape text embedded into LMS shell / SCORM interchange payloads. */
175
+ declare function escapeShellText(text: string): string;
179
176
  declare function assessmentDescriptorToLxpack(assessment: AssessmentDescriptor): LxpackInjectedAssessment | null;
180
177
  declare function extractAssessments(descriptor: LessonkitCourseDescriptor): LxpackInjectedAssessment[];
181
178
 
@@ -192,8 +189,8 @@ type WriteLxpackProjectOptions = {
192
189
  * For `per-lesson-spa`: map lesson id → absolute path to that lesson's built SPA folder.
193
190
  */
194
191
  lessonSpaDirs?: Record<string, string>;
195
- /** When set, relative `spaDistDir` is resolved under this directory instead of `process.cwd()`. */
196
- projectRoot?: string;
192
+ /** Project root used to resolve relative SPA paths and confine output directories. */
193
+ projectRoot: string;
197
194
  };
198
195
  type WriteLxpackProjectResult = {
199
196
  outDir: string;
@@ -205,7 +202,13 @@ type WriteLxpackProjectResult = {
205
202
  */
206
203
  declare function writeLxpackProject(options: WriteLxpackProjectOptions): Promise<WriteLxpackProjectResult>;
207
204
 
208
- declare function promoteStagingToOutDir(stagingDir: string, outDir: string): Promise<void>;
205
+ type PromoteStagingOptions = {
206
+ /** Relative path under `outDir` where LMS artifacts live (default `.lxpack/out`). */
207
+ outputBaseDir?: string;
208
+ /** When set, re-validates `outDir` is under the project root immediately before promote. */
209
+ projectRoot?: string;
210
+ };
211
+ declare function promoteStagingToOutDir(stagingDir: string, outDir: string, options?: PromoteStagingOptions): Promise<void>;
209
212
 
210
213
  type BuildStagingPackageOptions = WriteLxpackProjectOptions & {
211
214
  descriptor: LessonkitCourseDescriptor;
@@ -235,6 +238,8 @@ type BuildStagingPackageResult = {
235
238
  declare function buildStagingPackage(options: BuildStagingPackageOptions): Promise<BuildStagingPackageResult>;
236
239
  declare function ensureOutDirParent(outDir: string): Promise<void>;
237
240
 
241
+ /** LessonKit-owned alias for LMS export targets (maps to `@lxpack/api` `ExportTarget`). */
242
+ type LessonkitExportTarget = ExportTarget;
238
243
  type ValidateLessonkitProjectOptions = {
239
244
  courseDir: string;
240
245
  target?: ExportTarget;
@@ -253,6 +258,8 @@ type PackageLessonkitCourseOptions = WriteLxpackProjectOptions & {
253
258
  output?: string;
254
259
  dir?: boolean;
255
260
  outputBaseDir?: string;
261
+ /** Treat React parity warnings as packaging errors. */
262
+ strictParity?: boolean;
256
263
  };
257
264
  type PackageLessonkitCourseResult = {
258
265
  ok: true;
@@ -278,6 +285,10 @@ type PackageLessonkitCourseResult = {
278
285
  declare function validateLessonkitProject(options: ValidateLessonkitProjectOptions): Promise<ValidateCourseResult>;
279
286
  declare function buildLessonkitProject(options: BuildLessonkitProjectOptions): Promise<BuildCourseResult>;
280
287
 
288
+ /**
289
+ * Package a built SPA into SCORM, xAPI, cmi5, or standalone LMS artifacts.
290
+ * Prefer `lessonkit package --target …` in course projects; call directly for custom pipelines.
291
+ */
281
292
  declare function packageLessonkitCourse(options: PackageLessonkitCourseOptions): Promise<PackageLessonkitCourseResult>;
282
293
 
283
294
  type PackageValidationIssue = {
@@ -322,7 +333,11 @@ type ParseManifestResult = {
322
333
  ok: false;
323
334
  issues: ManifestParseIssue[];
324
335
  };
336
+ /**
337
+ * Parse and validate a project-root `lessonkit.json` manifest (`schemaVersion: 1`).
338
+ * Pass `projectRoot` for path containment checks equivalent to the CLI.
339
+ */
325
340
  declare function parseLessonkitManifest(raw: unknown, label?: string, projectRoot?: string): ParseManifestResult;
326
341
  declare function loadLessonkitManifestFromFile(readJson: () => Promise<unknown>, label?: string, projectRoot?: string): Promise<ParseManifestResult>;
327
342
 
328
- export { type AssessmentDescriptor, type BuildLessonkitProjectOptions, type BuildStagingPackageOptions, type BuildStagingPackageResult, type DescriptorValidationIssue, type DescriptorValidationResult, type FillInBlanksAssessmentDescriptor, type LessonDescriptor, type LessonkitCourseDescriptor, type LessonkitManifest, type LessonkitManifestPaths, type LxpackInjectedAssessment, type LxpackRuntimeTheme, type ManifestParseIssue, type MappedLessonkitIds, type McqAssessmentDescriptor, type PackageLessonkitCourseOptions, type PackageLessonkitCourseResult, type PackageValidationIssue, type ParseManifestResult, type ProjectPathsInput, type ReactParityIssue, type SpaLayout, type SpaLessonEntry, type TrueFalseAssessmentDescriptor, type ValidateLessonkitProjectOptions, type ValidatePackageInputsResult, type ValidationIssue, type WriteLxpackProjectOptions, type WriteLxpackProjectResult, assessmentDescriptorToLxpack, buildLessonkitProject, buildStagingPackage, descriptorToInterchange, ensureOutDirParent, extractAssessments, loadLessonkitManifestFromFile, mapLessonkitIds, packageLessonkitCourse, parseLessonkitManifest, promoteStagingToOutDir, remapArtifactPaths, resolveSafePackageOutputOverride, resolveSpaLessons, themeToLxpackRuntime, validateDescriptor, validateDescriptorForTarget, validateLessonkitProject, validatePackageInputs, validateProjectPaths, validateReactManifestParity, writeLxpackProject };
343
+ export { type AssessmentDescriptor, type BuildLessonkitProjectOptions, type BuildStagingPackageOptions, type BuildStagingPackageResult, type DescriptorValidationIssue, type DescriptorValidationResult, type FillInBlanksAssessmentDescriptor, type LessonDescriptor, type LessonkitCourseDescriptor, type LessonkitExportTarget, type LessonkitManifest, type LessonkitManifestPaths, type LxpackInjectedAssessment, type LxpackRuntimeTheme, type ManifestParseIssue, type MappedLessonkitIds, type McqAssessmentDescriptor, type PackageLessonkitCourseOptions, type PackageLessonkitCourseResult, type PackageValidationIssue, type ParseManifestResult, type ProjectPathsInput, type ReactParityIssue, type SpaLayout, type SpaLessonEntry, type TrueFalseAssessmentDescriptor, type ValidateLessonkitProjectOptions, type ValidatePackageInputsResult, type ValidationIssue, type WriteLxpackProjectOptions, type WriteLxpackProjectResult, assessmentDescriptorToLxpack, buildLessonkitProject, buildStagingPackage, descriptorToInterchange, ensureOutDirParent, escapeShellText, extractAssessments, loadLessonkitManifestFromFile, mapLessonkitIds, packageLessonkitCourse, parseLessonkitManifest, promoteStagingToOutDir, remapArtifactPaths, resolveSafePackageOutputOverride, resolveSpaLessons, themeToLxpackRuntime, validateDescriptor, validateDescriptorForTarget, validateLessonkitProject, validatePackageInputs, validateProjectPaths, validateReactManifestParity, writeLxpackProject };