@lessonkit/lxpack 1.4.0 → 1.6.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
@@ -6,7 +6,7 @@ export { ExportTarget } from '@lxpack/api';
6
6
  import { LessonkitInterchangeV1 } from '@lxpack/validators';
7
7
  export { LessonkitInterchangeV1, MaterializeLessonkitOptions, MaterializeLessonkitResult, lessonkitInterchangeSchema, materializeLessonkitProject, parseLessonkitInterchange } from '@lxpack/validators';
8
8
  export { LESSONKIT_TELEMETRY_EVENTS, LessonkitBridgeAction, LessonkitTelemetryEvent, LessonkitTelemetryEventName, TrackingSchemaEvent, mapLessonkitTelemetryToBridgeAction, mapLessonkitTelemetryToLxpack } from '@lxpack/tracking-schema';
9
- export { t as telemetryEventToLessonkit } from './telemetry-gCxlwc7I.cjs';
9
+ export { t as telemetryEventToLessonkit } from './telemetry-0fIWoomS.cjs';
10
10
 
11
11
  type SpaLayout = "single-spa" | "per-lesson-spa";
12
12
  type LessonDescriptor = {
@@ -155,6 +155,16 @@ type SpaLessonEntry = {
155
155
  path: string;
156
156
  };
157
157
  declare function resolveSpaLessons(descriptor: LessonkitCourseDescriptor): SpaLessonEntry[];
158
+ /**
159
+ * Convert a `lessonkit.json` course descriptor to portable interchange JSON for `.lkcourse`.
160
+ *
161
+ * @example
162
+ * ```ts
163
+ * import { descriptorToInterchange } from "@lessonkit/lxpack";
164
+ *
165
+ * const interchange = descriptorToInterchange(manifest.course);
166
+ * ```
167
+ */
158
168
  declare function descriptorToInterchange(descriptor: LessonkitCourseDescriptor): LessonkitInterchangeV1;
159
169
 
160
170
  type LxpackInjectedAssessment = {
@@ -171,6 +181,8 @@ type LxpackInjectedAssessment = {
171
181
  }>;
172
182
  }>;
173
183
  };
184
+ /** Escape text embedded into LMS shell / SCORM interchange payloads. */
185
+ declare function escapeShellText(text: string): string;
174
186
  declare function assessmentDescriptorToLxpack(assessment: AssessmentDescriptor): LxpackInjectedAssessment | null;
175
187
  declare function extractAssessments(descriptor: LessonkitCourseDescriptor): LxpackInjectedAssessment[];
176
188
 
@@ -187,8 +199,8 @@ type WriteLxpackProjectOptions = {
187
199
  * For `per-lesson-spa`: map lesson id → absolute path to that lesson's built SPA folder.
188
200
  */
189
201
  lessonSpaDirs?: Record<string, string>;
190
- /** When set, relative `spaDistDir` is resolved under this directory instead of `process.cwd()`. */
191
- projectRoot?: string;
202
+ /** Project root used to resolve relative SPA paths and confine output directories. */
203
+ projectRoot: string;
192
204
  };
193
205
  type WriteLxpackProjectResult = {
194
206
  outDir: string;
@@ -197,10 +209,28 @@ type WriteLxpackProjectResult = {
197
209
  };
198
210
  /**
199
211
  * Materialize an LXPack project tree from a LessonKit descriptor (delegates to LXPack 0.6+).
212
+ *
213
+ * @example
214
+ * ```ts
215
+ * import { writeLxpackProject } from "@lessonkit/lxpack";
216
+ *
217
+ * await writeLxpackProject({
218
+ * descriptor: courseFromLessonkitJson,
219
+ * outDir: ".lxpack/course",
220
+ * spaDistDir: "dist",
221
+ * projectRoot: process.cwd(),
222
+ * });
223
+ * ```
200
224
  */
201
225
  declare function writeLxpackProject(options: WriteLxpackProjectOptions): Promise<WriteLxpackProjectResult>;
202
226
 
203
- declare function promoteStagingToOutDir(stagingDir: string, outDir: string): Promise<void>;
227
+ type PromoteStagingOptions = {
228
+ /** Relative path under `outDir` where LMS artifacts live (default `.lxpack/out`). */
229
+ outputBaseDir?: string;
230
+ /** When set, re-validates `outDir` is under the project root immediately before promote. */
231
+ projectRoot?: string;
232
+ };
233
+ declare function promoteStagingToOutDir(stagingDir: string, outDir: string, options?: PromoteStagingOptions): Promise<void>;
204
234
 
205
235
  type BuildStagingPackageOptions = WriteLxpackProjectOptions & {
206
236
  descriptor: LessonkitCourseDescriptor;
@@ -250,6 +280,10 @@ type PackageLessonkitCourseOptions = WriteLxpackProjectOptions & {
250
280
  output?: string;
251
281
  dir?: boolean;
252
282
  outputBaseDir?: string;
283
+ /** Treat React parity warnings as packaging errors. */
284
+ strictParity?: boolean;
285
+ /** Treat LXPack build warnings as packaging errors. */
286
+ strictBuild?: boolean;
253
287
  };
254
288
  type PackageLessonkitCourseResult = {
255
289
  ok: true;
@@ -275,6 +309,25 @@ type PackageLessonkitCourseResult = {
275
309
  declare function validateLessonkitProject(options: ValidateLessonkitProjectOptions): Promise<ValidateCourseResult>;
276
310
  declare function buildLessonkitProject(options: BuildLessonkitProjectOptions): Promise<BuildCourseResult>;
277
311
 
312
+ /**
313
+ * Package a built SPA into SCORM, xAPI, cmi5, or standalone LMS artifacts.
314
+ * Prefer `lessonkit package --target …` in course projects; call directly for custom pipelines.
315
+ *
316
+ * @example
317
+ * ```ts
318
+ * import { packageLessonkitCourse } from "@lessonkit/lxpack";
319
+ *
320
+ * const result = await packageLessonkitCourse({
321
+ * descriptor: manifest.course,
322
+ * outDir: ".lxpack/course",
323
+ * spaDistDir: "dist",
324
+ * projectRoot: process.cwd(),
325
+ * target: "scorm12",
326
+ * strictBuild: true,
327
+ * });
328
+ * if (!result.ok) console.error(result.issues);
329
+ * ```
330
+ */
278
331
  declare function packageLessonkitCourse(options: PackageLessonkitCourseOptions): Promise<PackageLessonkitCourseResult>;
279
332
 
280
333
  type PackageValidationIssue = {
@@ -297,6 +350,11 @@ declare function validatePackageInputs(options: Pick<PackageLessonkitCourseOptio
297
350
  }): ValidatePackageInputsResult;
298
351
  declare function remapArtifactPaths(stagingRoot: string, outDir: string, artifactPath: string | undefined): string | undefined;
299
352
 
353
+ /**
354
+ * Reject symlinks and paths escaping dist roots before packaging LMS artifacts.
355
+ */
356
+ declare function assertSpaDistContentsSafe(spaDirs: Record<string, string>, projectRoot?: string): Promise<void>;
357
+
300
358
  type LessonkitManifestPaths = {
301
359
  spaDistDir: string;
302
360
  lxpackOutDir: string;
@@ -319,7 +377,128 @@ type ParseManifestResult = {
319
377
  ok: false;
320
378
  issues: ManifestParseIssue[];
321
379
  };
380
+ /**
381
+ * Parse and validate a project-root `lessonkit.json` manifest (`schemaVersion: 1`).
382
+ * Pass `projectRoot` for path containment checks equivalent to the CLI.
383
+ */
322
384
  declare function parseLessonkitManifest(raw: unknown, label?: string, projectRoot?: string): ParseManifestResult;
323
385
  declare function loadLessonkitManifestFromFile(readJson: () => Promise<unknown>, label?: string, projectRoot?: string): Promise<ParseManifestResult>;
324
386
 
325
- 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, extractAssessments, loadLessonkitManifestFromFile, mapLessonkitIds, packageLessonkitCourse, parseLessonkitManifest, promoteStagingToOutDir, remapArtifactPaths, resolveSafePackageOutputOverride, resolveSpaLessons, themeToLxpackRuntime, validateDescriptor, validateDescriptorForTarget, validateLessonkitProject, validatePackageInputs, validateProjectPaths, validateReactManifestParity, writeLxpackProject };
387
+ type LkcourseEnvelopeV1 = {
388
+ format: "lkcourse";
389
+ schemaVersion: 1;
390
+ lessonkitVersion: string;
391
+ exportedAt: string;
392
+ sourceManifest: LessonkitManifest;
393
+ entries: string[];
394
+ };
395
+ type BlockTreeNodeV1 = {
396
+ type: string;
397
+ rawTag?: string;
398
+ courseId?: string;
399
+ lessonId?: string;
400
+ checkId?: string;
401
+ blockId?: string;
402
+ nodeId?: string;
403
+ children?: BlockTreeNodeV1[];
404
+ };
405
+ type BlockTreeV1 = {
406
+ schemaVersion: 1;
407
+ sources: string[];
408
+ blocks: BlockTreeNodeV1[];
409
+ };
410
+ type LkcourseValidationIssue = {
411
+ path: string;
412
+ message: string;
413
+ };
414
+ type ExportLkcourseOptions = {
415
+ projectRoot: string;
416
+ manifest: LessonkitManifest;
417
+ outPath?: string;
418
+ includeBlockTree?: boolean;
419
+ lessonkitVersion?: string;
420
+ };
421
+ type ExportLkcourseResult = {
422
+ ok: true;
423
+ archivePath: string;
424
+ fileCount: number;
425
+ includeBlockTree: boolean;
426
+ } | {
427
+ ok: false;
428
+ issues: LkcourseValidationIssue[];
429
+ };
430
+ type ValidateLkcourseResult = {
431
+ ok: true;
432
+ envelope: LkcourseEnvelopeV1;
433
+ interchange: LessonkitInterchangeV1;
434
+ } | {
435
+ ok: false;
436
+ issues: LkcourseValidationIssue[];
437
+ };
438
+ type ImportLkcourseOptions = {
439
+ archivePath: string;
440
+ targetDir: string;
441
+ };
442
+ type ImportLkcourseResult = {
443
+ ok: true;
444
+ targetDir: string;
445
+ manifest: LessonkitManifest;
446
+ interchange: LessonkitInterchangeV1;
447
+ fileCount: number;
448
+ } | {
449
+ ok: false;
450
+ issues: LkcourseValidationIssue[];
451
+ };
452
+ type ExtractBlockTreeOptions = {
453
+ projectRoot: string;
454
+ blockTypes?: string[];
455
+ appSources?: string[];
456
+ };
457
+
458
+ type ParseEnvelopeResult = {
459
+ ok: true;
460
+ envelope: LkcourseEnvelopeV1;
461
+ } | {
462
+ ok: false;
463
+ issues: LkcourseValidationIssue[];
464
+ };
465
+ declare function parseLkcourseEnvelope(raw: unknown, label?: string): ParseEnvelopeResult;
466
+
467
+ declare function extractBlockTree(options: ExtractBlockTreeOptions): BlockTreeV1;
468
+
469
+ /**
470
+ * Build a portable `.lkcourse` zip (manifest envelope + interchange + dist).
471
+ * Prefer `lessonkit export` in course projects.
472
+ *
473
+ * @example
474
+ * ```ts
475
+ * import { exportLkcourse } from "@lessonkit/lxpack";
476
+ *
477
+ * const result = await exportLkcourse({
478
+ * projectRoot: "/path/to/course",
479
+ * manifest: parsedLessonkitJson,
480
+ * archivePath: "handoff.lkcourse",
481
+ * });
482
+ * ```
483
+ */
484
+ declare function exportLkcourse(options: ExportLkcourseOptions): Promise<ExportLkcourseResult>;
485
+
486
+ declare function validateLkcourseArchiveEntries(entries: Map<string, Uint8Array>, _archiveLabel: string): ValidateLkcourseResult;
487
+ declare function validateLkcourse(archivePath: string): ValidateLkcourseResult;
488
+
489
+ /**
490
+ * Extract a `.lkcourse` archive into a project directory (manifest + dist tree).
491
+ *
492
+ * @example
493
+ * ```ts
494
+ * import { importLkcourse } from "@lessonkit/lxpack";
495
+ *
496
+ * const result = await importLkcourse({
497
+ * archivePath: "handoff.lkcourse",
498
+ * targetDir: "/path/to/dest",
499
+ * });
500
+ * ```
501
+ */
502
+ declare function importLkcourse(options: ImportLkcourseOptions): Promise<ImportLkcourseResult>;
503
+
504
+ export { type AssessmentDescriptor, type BlockTreeNodeV1, type BlockTreeV1, type BuildLessonkitProjectOptions, type BuildStagingPackageOptions, type BuildStagingPackageResult, type DescriptorValidationIssue, type DescriptorValidationResult, type ExportLkcourseOptions, type ExportLkcourseResult, type ExtractBlockTreeOptions, type FillInBlanksAssessmentDescriptor, type ImportLkcourseOptions, type ImportLkcourseResult, type LessonDescriptor, type LessonkitCourseDescriptor, type LessonkitExportTarget, type LessonkitManifest, type LessonkitManifestPaths, type LkcourseEnvelopeV1, type LkcourseValidationIssue, 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 ValidateLkcourseResult, type ValidatePackageInputsResult, type ValidationIssue, type WriteLxpackProjectOptions, type WriteLxpackProjectResult, assertSpaDistContentsSafe, assessmentDescriptorToLxpack, buildLessonkitProject, buildStagingPackage, descriptorToInterchange, ensureOutDirParent, escapeShellText, exportLkcourse, extractAssessments, extractBlockTree, importLkcourse, loadLessonkitManifestFromFile, mapLessonkitIds, packageLessonkitCourse, parseLessonkitManifest, parseLkcourseEnvelope, promoteStagingToOutDir, remapArtifactPaths, resolveSafePackageOutputOverride, resolveSpaLessons, themeToLxpackRuntime, validateDescriptor, validateDescriptorForTarget, validateLessonkitProject, validateLkcourse, validateLkcourseArchiveEntries, validatePackageInputs, validateProjectPaths, validateReactManifestParity, writeLxpackProject };
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ export { ExportTarget } from '@lxpack/api';
6
6
  import { LessonkitInterchangeV1 } from '@lxpack/validators';
7
7
  export { LessonkitInterchangeV1, MaterializeLessonkitOptions, MaterializeLessonkitResult, lessonkitInterchangeSchema, materializeLessonkitProject, parseLessonkitInterchange } from '@lxpack/validators';
8
8
  export { LESSONKIT_TELEMETRY_EVENTS, LessonkitBridgeAction, LessonkitTelemetryEvent, LessonkitTelemetryEventName, TrackingSchemaEvent, mapLessonkitTelemetryToBridgeAction, mapLessonkitTelemetryToLxpack } from '@lxpack/tracking-schema';
9
- export { t as telemetryEventToLessonkit } from './telemetry-gCxlwc7I.js';
9
+ export { t as telemetryEventToLessonkit } from './telemetry-0fIWoomS.js';
10
10
 
11
11
  type SpaLayout = "single-spa" | "per-lesson-spa";
12
12
  type LessonDescriptor = {
@@ -155,6 +155,16 @@ type SpaLessonEntry = {
155
155
  path: string;
156
156
  };
157
157
  declare function resolveSpaLessons(descriptor: LessonkitCourseDescriptor): SpaLessonEntry[];
158
+ /**
159
+ * Convert a `lessonkit.json` course descriptor to portable interchange JSON for `.lkcourse`.
160
+ *
161
+ * @example
162
+ * ```ts
163
+ * import { descriptorToInterchange } from "@lessonkit/lxpack";
164
+ *
165
+ * const interchange = descriptorToInterchange(manifest.course);
166
+ * ```
167
+ */
158
168
  declare function descriptorToInterchange(descriptor: LessonkitCourseDescriptor): LessonkitInterchangeV1;
159
169
 
160
170
  type LxpackInjectedAssessment = {
@@ -171,6 +181,8 @@ type LxpackInjectedAssessment = {
171
181
  }>;
172
182
  }>;
173
183
  };
184
+ /** Escape text embedded into LMS shell / SCORM interchange payloads. */
185
+ declare function escapeShellText(text: string): string;
174
186
  declare function assessmentDescriptorToLxpack(assessment: AssessmentDescriptor): LxpackInjectedAssessment | null;
175
187
  declare function extractAssessments(descriptor: LessonkitCourseDescriptor): LxpackInjectedAssessment[];
176
188
 
@@ -187,8 +199,8 @@ type WriteLxpackProjectOptions = {
187
199
  * For `per-lesson-spa`: map lesson id → absolute path to that lesson's built SPA folder.
188
200
  */
189
201
  lessonSpaDirs?: Record<string, string>;
190
- /** When set, relative `spaDistDir` is resolved under this directory instead of `process.cwd()`. */
191
- projectRoot?: string;
202
+ /** Project root used to resolve relative SPA paths and confine output directories. */
203
+ projectRoot: string;
192
204
  };
193
205
  type WriteLxpackProjectResult = {
194
206
  outDir: string;
@@ -197,10 +209,28 @@ type WriteLxpackProjectResult = {
197
209
  };
198
210
  /**
199
211
  * Materialize an LXPack project tree from a LessonKit descriptor (delegates to LXPack 0.6+).
212
+ *
213
+ * @example
214
+ * ```ts
215
+ * import { writeLxpackProject } from "@lessonkit/lxpack";
216
+ *
217
+ * await writeLxpackProject({
218
+ * descriptor: courseFromLessonkitJson,
219
+ * outDir: ".lxpack/course",
220
+ * spaDistDir: "dist",
221
+ * projectRoot: process.cwd(),
222
+ * });
223
+ * ```
200
224
  */
201
225
  declare function writeLxpackProject(options: WriteLxpackProjectOptions): Promise<WriteLxpackProjectResult>;
202
226
 
203
- declare function promoteStagingToOutDir(stagingDir: string, outDir: string): Promise<void>;
227
+ type PromoteStagingOptions = {
228
+ /** Relative path under `outDir` where LMS artifacts live (default `.lxpack/out`). */
229
+ outputBaseDir?: string;
230
+ /** When set, re-validates `outDir` is under the project root immediately before promote. */
231
+ projectRoot?: string;
232
+ };
233
+ declare function promoteStagingToOutDir(stagingDir: string, outDir: string, options?: PromoteStagingOptions): Promise<void>;
204
234
 
205
235
  type BuildStagingPackageOptions = WriteLxpackProjectOptions & {
206
236
  descriptor: LessonkitCourseDescriptor;
@@ -250,6 +280,10 @@ type PackageLessonkitCourseOptions = WriteLxpackProjectOptions & {
250
280
  output?: string;
251
281
  dir?: boolean;
252
282
  outputBaseDir?: string;
283
+ /** Treat React parity warnings as packaging errors. */
284
+ strictParity?: boolean;
285
+ /** Treat LXPack build warnings as packaging errors. */
286
+ strictBuild?: boolean;
253
287
  };
254
288
  type PackageLessonkitCourseResult = {
255
289
  ok: true;
@@ -275,6 +309,25 @@ type PackageLessonkitCourseResult = {
275
309
  declare function validateLessonkitProject(options: ValidateLessonkitProjectOptions): Promise<ValidateCourseResult>;
276
310
  declare function buildLessonkitProject(options: BuildLessonkitProjectOptions): Promise<BuildCourseResult>;
277
311
 
312
+ /**
313
+ * Package a built SPA into SCORM, xAPI, cmi5, or standalone LMS artifacts.
314
+ * Prefer `lessonkit package --target …` in course projects; call directly for custom pipelines.
315
+ *
316
+ * @example
317
+ * ```ts
318
+ * import { packageLessonkitCourse } from "@lessonkit/lxpack";
319
+ *
320
+ * const result = await packageLessonkitCourse({
321
+ * descriptor: manifest.course,
322
+ * outDir: ".lxpack/course",
323
+ * spaDistDir: "dist",
324
+ * projectRoot: process.cwd(),
325
+ * target: "scorm12",
326
+ * strictBuild: true,
327
+ * });
328
+ * if (!result.ok) console.error(result.issues);
329
+ * ```
330
+ */
278
331
  declare function packageLessonkitCourse(options: PackageLessonkitCourseOptions): Promise<PackageLessonkitCourseResult>;
279
332
 
280
333
  type PackageValidationIssue = {
@@ -297,6 +350,11 @@ declare function validatePackageInputs(options: Pick<PackageLessonkitCourseOptio
297
350
  }): ValidatePackageInputsResult;
298
351
  declare function remapArtifactPaths(stagingRoot: string, outDir: string, artifactPath: string | undefined): string | undefined;
299
352
 
353
+ /**
354
+ * Reject symlinks and paths escaping dist roots before packaging LMS artifacts.
355
+ */
356
+ declare function assertSpaDistContentsSafe(spaDirs: Record<string, string>, projectRoot?: string): Promise<void>;
357
+
300
358
  type LessonkitManifestPaths = {
301
359
  spaDistDir: string;
302
360
  lxpackOutDir: string;
@@ -319,7 +377,128 @@ type ParseManifestResult = {
319
377
  ok: false;
320
378
  issues: ManifestParseIssue[];
321
379
  };
380
+ /**
381
+ * Parse and validate a project-root `lessonkit.json` manifest (`schemaVersion: 1`).
382
+ * Pass `projectRoot` for path containment checks equivalent to the CLI.
383
+ */
322
384
  declare function parseLessonkitManifest(raw: unknown, label?: string, projectRoot?: string): ParseManifestResult;
323
385
  declare function loadLessonkitManifestFromFile(readJson: () => Promise<unknown>, label?: string, projectRoot?: string): Promise<ParseManifestResult>;
324
386
 
325
- 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, extractAssessments, loadLessonkitManifestFromFile, mapLessonkitIds, packageLessonkitCourse, parseLessonkitManifest, promoteStagingToOutDir, remapArtifactPaths, resolveSafePackageOutputOverride, resolveSpaLessons, themeToLxpackRuntime, validateDescriptor, validateDescriptorForTarget, validateLessonkitProject, validatePackageInputs, validateProjectPaths, validateReactManifestParity, writeLxpackProject };
387
+ type LkcourseEnvelopeV1 = {
388
+ format: "lkcourse";
389
+ schemaVersion: 1;
390
+ lessonkitVersion: string;
391
+ exportedAt: string;
392
+ sourceManifest: LessonkitManifest;
393
+ entries: string[];
394
+ };
395
+ type BlockTreeNodeV1 = {
396
+ type: string;
397
+ rawTag?: string;
398
+ courseId?: string;
399
+ lessonId?: string;
400
+ checkId?: string;
401
+ blockId?: string;
402
+ nodeId?: string;
403
+ children?: BlockTreeNodeV1[];
404
+ };
405
+ type BlockTreeV1 = {
406
+ schemaVersion: 1;
407
+ sources: string[];
408
+ blocks: BlockTreeNodeV1[];
409
+ };
410
+ type LkcourseValidationIssue = {
411
+ path: string;
412
+ message: string;
413
+ };
414
+ type ExportLkcourseOptions = {
415
+ projectRoot: string;
416
+ manifest: LessonkitManifest;
417
+ outPath?: string;
418
+ includeBlockTree?: boolean;
419
+ lessonkitVersion?: string;
420
+ };
421
+ type ExportLkcourseResult = {
422
+ ok: true;
423
+ archivePath: string;
424
+ fileCount: number;
425
+ includeBlockTree: boolean;
426
+ } | {
427
+ ok: false;
428
+ issues: LkcourseValidationIssue[];
429
+ };
430
+ type ValidateLkcourseResult = {
431
+ ok: true;
432
+ envelope: LkcourseEnvelopeV1;
433
+ interchange: LessonkitInterchangeV1;
434
+ } | {
435
+ ok: false;
436
+ issues: LkcourseValidationIssue[];
437
+ };
438
+ type ImportLkcourseOptions = {
439
+ archivePath: string;
440
+ targetDir: string;
441
+ };
442
+ type ImportLkcourseResult = {
443
+ ok: true;
444
+ targetDir: string;
445
+ manifest: LessonkitManifest;
446
+ interchange: LessonkitInterchangeV1;
447
+ fileCount: number;
448
+ } | {
449
+ ok: false;
450
+ issues: LkcourseValidationIssue[];
451
+ };
452
+ type ExtractBlockTreeOptions = {
453
+ projectRoot: string;
454
+ blockTypes?: string[];
455
+ appSources?: string[];
456
+ };
457
+
458
+ type ParseEnvelopeResult = {
459
+ ok: true;
460
+ envelope: LkcourseEnvelopeV1;
461
+ } | {
462
+ ok: false;
463
+ issues: LkcourseValidationIssue[];
464
+ };
465
+ declare function parseLkcourseEnvelope(raw: unknown, label?: string): ParseEnvelopeResult;
466
+
467
+ declare function extractBlockTree(options: ExtractBlockTreeOptions): BlockTreeV1;
468
+
469
+ /**
470
+ * Build a portable `.lkcourse` zip (manifest envelope + interchange + dist).
471
+ * Prefer `lessonkit export` in course projects.
472
+ *
473
+ * @example
474
+ * ```ts
475
+ * import { exportLkcourse } from "@lessonkit/lxpack";
476
+ *
477
+ * const result = await exportLkcourse({
478
+ * projectRoot: "/path/to/course",
479
+ * manifest: parsedLessonkitJson,
480
+ * archivePath: "handoff.lkcourse",
481
+ * });
482
+ * ```
483
+ */
484
+ declare function exportLkcourse(options: ExportLkcourseOptions): Promise<ExportLkcourseResult>;
485
+
486
+ declare function validateLkcourseArchiveEntries(entries: Map<string, Uint8Array>, _archiveLabel: string): ValidateLkcourseResult;
487
+ declare function validateLkcourse(archivePath: string): ValidateLkcourseResult;
488
+
489
+ /**
490
+ * Extract a `.lkcourse` archive into a project directory (manifest + dist tree).
491
+ *
492
+ * @example
493
+ * ```ts
494
+ * import { importLkcourse } from "@lessonkit/lxpack";
495
+ *
496
+ * const result = await importLkcourse({
497
+ * archivePath: "handoff.lkcourse",
498
+ * targetDir: "/path/to/dest",
499
+ * });
500
+ * ```
501
+ */
502
+ declare function importLkcourse(options: ImportLkcourseOptions): Promise<ImportLkcourseResult>;
503
+
504
+ export { type AssessmentDescriptor, type BlockTreeNodeV1, type BlockTreeV1, type BuildLessonkitProjectOptions, type BuildStagingPackageOptions, type BuildStagingPackageResult, type DescriptorValidationIssue, type DescriptorValidationResult, type ExportLkcourseOptions, type ExportLkcourseResult, type ExtractBlockTreeOptions, type FillInBlanksAssessmentDescriptor, type ImportLkcourseOptions, type ImportLkcourseResult, type LessonDescriptor, type LessonkitCourseDescriptor, type LessonkitExportTarget, type LessonkitManifest, type LessonkitManifestPaths, type LkcourseEnvelopeV1, type LkcourseValidationIssue, 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 ValidateLkcourseResult, type ValidatePackageInputsResult, type ValidationIssue, type WriteLxpackProjectOptions, type WriteLxpackProjectResult, assertSpaDistContentsSafe, assessmentDescriptorToLxpack, buildLessonkitProject, buildStagingPackage, descriptorToInterchange, ensureOutDirParent, escapeShellText, exportLkcourse, extractAssessments, extractBlockTree, importLkcourse, loadLessonkitManifestFromFile, mapLessonkitIds, packageLessonkitCourse, parseLessonkitManifest, parseLkcourseEnvelope, promoteStagingToOutDir, remapArtifactPaths, resolveSafePackageOutputOverride, resolveSpaLessons, themeToLxpackRuntime, validateDescriptor, validateDescriptorForTarget, validateLessonkitProject, validateLkcourse, validateLkcourseArchiveEntries, validatePackageInputs, validateProjectPaths, validateReactManifestParity, writeLxpackProject };