@lessonkit/lxpack 0.9.2 → 1.0.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
@@ -2,7 +2,7 @@ import { CheckId, CourseId, LessonId } from '@lessonkit/core';
2
2
  import { ThemePresetName, LessonkitThemeV1 } from '@lessonkit/themes';
3
3
  import { LessonkitInterchangeV1 } from '@lxpack/validators';
4
4
  export { LessonkitInterchangeV1, MaterializeLessonkitOptions, MaterializeLessonkitResult, lessonkitInterchangeSchema, materializeLessonkitProject, parseLessonkitInterchange } from '@lxpack/validators';
5
- import { ExportTarget, ValidateCourseResult, BuildCourseResult } from '@lxpack/api';
5
+ import { ExportTarget, BuildCourseResult, ValidateCourseResult } from '@lxpack/api';
6
6
  export { ExportTarget } from '@lxpack/api';
7
7
  export { LESSONKIT_TELEMETRY_EVENTS, LessonkitBridgeAction, LessonkitTelemetryEvent, LessonkitTelemetryEventName, TrackingSchemaEvent, mapLessonkitTelemetryToBridgeAction, mapLessonkitTelemetryToLxpack } from '@lxpack/tracking-schema';
8
8
  export { t as telemetryEventToLessonkit } from './telemetry-gCxlwc7I.cjs';
@@ -144,6 +144,40 @@ type WriteLxpackProjectResult = {
144
144
  */
145
145
  declare function writeLxpackProject(options: WriteLxpackProjectOptions): Promise<WriteLxpackProjectResult>;
146
146
 
147
+ /**
148
+ * Atomically replace `outDir` with the packaged tree at `stagingDir`.
149
+ * Restores the previous `outDir` when promote fails after a backup rename.
150
+ */
151
+ declare function promoteStagingToOutDir(stagingDir: string, outDir: string): Promise<void>;
152
+
153
+ type BuildStagingPackageOptions = WriteLxpackProjectOptions & {
154
+ descriptor: LessonkitCourseDescriptor;
155
+ target: ExportTarget;
156
+ output?: string;
157
+ dir?: boolean;
158
+ outputBaseDir?: string;
159
+ };
160
+ type BuildStagingPackageResult = {
161
+ ok: true;
162
+ stagingDir: string;
163
+ build: Extract<BuildCourseResult, {
164
+ ok: true;
165
+ }>;
166
+ outputPath?: string;
167
+ outputDir?: string;
168
+ } | {
169
+ ok: false;
170
+ stagingDir: string;
171
+ issues: Array<{
172
+ path?: string;
173
+ message: string;
174
+ severity?: string;
175
+ }>;
176
+ build?: BuildCourseResult;
177
+ };
178
+ declare function buildStagingPackage(options: BuildStagingPackageOptions): Promise<BuildStagingPackageResult>;
179
+ declare function ensureOutDirParent(outDir: string): Promise<void>;
180
+
147
181
  type ValidateLessonkitProjectOptions = {
148
182
  courseDir: string;
149
183
  target?: ExportTarget;
@@ -186,6 +220,52 @@ type PackageLessonkitCourseResult = {
186
220
  };
187
221
  declare function validateLessonkitProject(options: ValidateLessonkitProjectOptions): Promise<ValidateCourseResult>;
188
222
  declare function buildLessonkitProject(options: BuildLessonkitProjectOptions): Promise<BuildCourseResult>;
223
+
189
224
  declare function packageLessonkitCourse(options: PackageLessonkitCourseOptions): Promise<PackageLessonkitCourseResult>;
190
225
 
191
- export { type AssessmentDescriptor, type BuildLessonkitProjectOptions, type DescriptorValidationIssue, type DescriptorValidationResult, type LessonDescriptor, type LessonkitCourseDescriptor, type LxpackInjectedAssessment, type LxpackRuntimeTheme, type MappedLessonkitIds, type PackageLessonkitCourseOptions, type PackageLessonkitCourseResult, type ProjectPathsInput, type SpaLayout, type SpaLessonEntry, type ValidateLessonkitProjectOptions, type WriteLxpackProjectOptions, type WriteLxpackProjectResult, assessmentDescriptorToLxpack, buildLessonkitProject, descriptorToInterchange, extractAssessments, mapLessonkitIds, packageLessonkitCourse, resolveSafePackageOutputOverride, resolveSpaLessons, themeToLxpackRuntime, validateDescriptor, validateLessonkitProject, validateProjectPaths, writeLxpackProject };
226
+ type PackageValidationIssue = {
227
+ path?: string;
228
+ message: string;
229
+ severity?: string;
230
+ };
231
+ type ValidatePackageInputsResult = {
232
+ ok: true;
233
+ outDir: string;
234
+ projectRoot?: string;
235
+ } | {
236
+ ok: false;
237
+ courseDir: string;
238
+ target: ExportTarget;
239
+ issues: PackageValidationIssue[];
240
+ };
241
+ declare function validatePackageInputs(options: Pick<PackageLessonkitCourseOptions, "outDir" | "projectRoot" | "outputBaseDir" | "output"> & {
242
+ target: ExportTarget;
243
+ }): ValidatePackageInputsResult;
244
+ declare function remapArtifactPaths(stagingRoot: string, outDir: string, artifactPath: string | undefined): string | undefined;
245
+
246
+ type LessonkitManifestPaths = {
247
+ spaDistDir: string;
248
+ lxpackOutDir: string;
249
+ outputBaseDir: string;
250
+ };
251
+ type LessonkitManifest = {
252
+ schemaVersion: 1;
253
+ name: string;
254
+ course: LessonkitCourseDescriptor;
255
+ paths: LessonkitManifestPaths;
256
+ };
257
+ type ManifestParseIssue = {
258
+ path: string;
259
+ message: string;
260
+ };
261
+ type ParseManifestResult = {
262
+ ok: true;
263
+ manifest: LessonkitManifest;
264
+ } | {
265
+ ok: false;
266
+ issues: ManifestParseIssue[];
267
+ };
268
+ declare function parseLessonkitManifest(raw: unknown, label?: string, projectRoot?: string): ParseManifestResult;
269
+ declare function loadLessonkitManifestFromFile(readJson: () => Promise<unknown>, label?: string, projectRoot?: string): Promise<ParseManifestResult>;
270
+
271
+ export { type AssessmentDescriptor, type BuildLessonkitProjectOptions, type BuildStagingPackageOptions, type BuildStagingPackageResult, type DescriptorValidationIssue, type DescriptorValidationResult, type LessonDescriptor, type LessonkitCourseDescriptor, type LessonkitManifest, type LessonkitManifestPaths, type LxpackInjectedAssessment, type LxpackRuntimeTheme, type ManifestParseIssue, type MappedLessonkitIds, type PackageLessonkitCourseOptions, type PackageLessonkitCourseResult, type PackageValidationIssue, type ParseManifestResult, type ProjectPathsInput, type SpaLayout, type SpaLessonEntry, type ValidateLessonkitProjectOptions, type ValidatePackageInputsResult, type WriteLxpackProjectOptions, type WriteLxpackProjectResult, assessmentDescriptorToLxpack, buildLessonkitProject, buildStagingPackage, descriptorToInterchange, ensureOutDirParent, extractAssessments, loadLessonkitManifestFromFile, mapLessonkitIds, packageLessonkitCourse, parseLessonkitManifest, promoteStagingToOutDir, remapArtifactPaths, resolveSafePackageOutputOverride, resolveSpaLessons, themeToLxpackRuntime, validateDescriptor, validateLessonkitProject, validatePackageInputs, validateProjectPaths, writeLxpackProject };
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { CheckId, CourseId, LessonId } from '@lessonkit/core';
2
2
  import { ThemePresetName, LessonkitThemeV1 } from '@lessonkit/themes';
3
3
  import { LessonkitInterchangeV1 } from '@lxpack/validators';
4
4
  export { LessonkitInterchangeV1, MaterializeLessonkitOptions, MaterializeLessonkitResult, lessonkitInterchangeSchema, materializeLessonkitProject, parseLessonkitInterchange } from '@lxpack/validators';
5
- import { ExportTarget, ValidateCourseResult, BuildCourseResult } from '@lxpack/api';
5
+ import { ExportTarget, BuildCourseResult, ValidateCourseResult } from '@lxpack/api';
6
6
  export { ExportTarget } from '@lxpack/api';
7
7
  export { LESSONKIT_TELEMETRY_EVENTS, LessonkitBridgeAction, LessonkitTelemetryEvent, LessonkitTelemetryEventName, TrackingSchemaEvent, mapLessonkitTelemetryToBridgeAction, mapLessonkitTelemetryToLxpack } from '@lxpack/tracking-schema';
8
8
  export { t as telemetryEventToLessonkit } from './telemetry-gCxlwc7I.js';
@@ -144,6 +144,40 @@ type WriteLxpackProjectResult = {
144
144
  */
145
145
  declare function writeLxpackProject(options: WriteLxpackProjectOptions): Promise<WriteLxpackProjectResult>;
146
146
 
147
+ /**
148
+ * Atomically replace `outDir` with the packaged tree at `stagingDir`.
149
+ * Restores the previous `outDir` when promote fails after a backup rename.
150
+ */
151
+ declare function promoteStagingToOutDir(stagingDir: string, outDir: string): Promise<void>;
152
+
153
+ type BuildStagingPackageOptions = WriteLxpackProjectOptions & {
154
+ descriptor: LessonkitCourseDescriptor;
155
+ target: ExportTarget;
156
+ output?: string;
157
+ dir?: boolean;
158
+ outputBaseDir?: string;
159
+ };
160
+ type BuildStagingPackageResult = {
161
+ ok: true;
162
+ stagingDir: string;
163
+ build: Extract<BuildCourseResult, {
164
+ ok: true;
165
+ }>;
166
+ outputPath?: string;
167
+ outputDir?: string;
168
+ } | {
169
+ ok: false;
170
+ stagingDir: string;
171
+ issues: Array<{
172
+ path?: string;
173
+ message: string;
174
+ severity?: string;
175
+ }>;
176
+ build?: BuildCourseResult;
177
+ };
178
+ declare function buildStagingPackage(options: BuildStagingPackageOptions): Promise<BuildStagingPackageResult>;
179
+ declare function ensureOutDirParent(outDir: string): Promise<void>;
180
+
147
181
  type ValidateLessonkitProjectOptions = {
148
182
  courseDir: string;
149
183
  target?: ExportTarget;
@@ -186,6 +220,52 @@ type PackageLessonkitCourseResult = {
186
220
  };
187
221
  declare function validateLessonkitProject(options: ValidateLessonkitProjectOptions): Promise<ValidateCourseResult>;
188
222
  declare function buildLessonkitProject(options: BuildLessonkitProjectOptions): Promise<BuildCourseResult>;
223
+
189
224
  declare function packageLessonkitCourse(options: PackageLessonkitCourseOptions): Promise<PackageLessonkitCourseResult>;
190
225
 
191
- export { type AssessmentDescriptor, type BuildLessonkitProjectOptions, type DescriptorValidationIssue, type DescriptorValidationResult, type LessonDescriptor, type LessonkitCourseDescriptor, type LxpackInjectedAssessment, type LxpackRuntimeTheme, type MappedLessonkitIds, type PackageLessonkitCourseOptions, type PackageLessonkitCourseResult, type ProjectPathsInput, type SpaLayout, type SpaLessonEntry, type ValidateLessonkitProjectOptions, type WriteLxpackProjectOptions, type WriteLxpackProjectResult, assessmentDescriptorToLxpack, buildLessonkitProject, descriptorToInterchange, extractAssessments, mapLessonkitIds, packageLessonkitCourse, resolveSafePackageOutputOverride, resolveSpaLessons, themeToLxpackRuntime, validateDescriptor, validateLessonkitProject, validateProjectPaths, writeLxpackProject };
226
+ type PackageValidationIssue = {
227
+ path?: string;
228
+ message: string;
229
+ severity?: string;
230
+ };
231
+ type ValidatePackageInputsResult = {
232
+ ok: true;
233
+ outDir: string;
234
+ projectRoot?: string;
235
+ } | {
236
+ ok: false;
237
+ courseDir: string;
238
+ target: ExportTarget;
239
+ issues: PackageValidationIssue[];
240
+ };
241
+ declare function validatePackageInputs(options: Pick<PackageLessonkitCourseOptions, "outDir" | "projectRoot" | "outputBaseDir" | "output"> & {
242
+ target: ExportTarget;
243
+ }): ValidatePackageInputsResult;
244
+ declare function remapArtifactPaths(stagingRoot: string, outDir: string, artifactPath: string | undefined): string | undefined;
245
+
246
+ type LessonkitManifestPaths = {
247
+ spaDistDir: string;
248
+ lxpackOutDir: string;
249
+ outputBaseDir: string;
250
+ };
251
+ type LessonkitManifest = {
252
+ schemaVersion: 1;
253
+ name: string;
254
+ course: LessonkitCourseDescriptor;
255
+ paths: LessonkitManifestPaths;
256
+ };
257
+ type ManifestParseIssue = {
258
+ path: string;
259
+ message: string;
260
+ };
261
+ type ParseManifestResult = {
262
+ ok: true;
263
+ manifest: LessonkitManifest;
264
+ } | {
265
+ ok: false;
266
+ issues: ManifestParseIssue[];
267
+ };
268
+ declare function parseLessonkitManifest(raw: unknown, label?: string, projectRoot?: string): ParseManifestResult;
269
+ declare function loadLessonkitManifestFromFile(readJson: () => Promise<unknown>, label?: string, projectRoot?: string): Promise<ParseManifestResult>;
270
+
271
+ export { type AssessmentDescriptor, type BuildLessonkitProjectOptions, type BuildStagingPackageOptions, type BuildStagingPackageResult, type DescriptorValidationIssue, type DescriptorValidationResult, type LessonDescriptor, type LessonkitCourseDescriptor, type LessonkitManifest, type LessonkitManifestPaths, type LxpackInjectedAssessment, type LxpackRuntimeTheme, type ManifestParseIssue, type MappedLessonkitIds, type PackageLessonkitCourseOptions, type PackageLessonkitCourseResult, type PackageValidationIssue, type ParseManifestResult, type ProjectPathsInput, type SpaLayout, type SpaLessonEntry, type ValidateLessonkitProjectOptions, type ValidatePackageInputsResult, type WriteLxpackProjectOptions, type WriteLxpackProjectResult, assessmentDescriptorToLxpack, buildLessonkitProject, buildStagingPackage, descriptorToInterchange, ensureOutDirParent, extractAssessments, loadLessonkitManifestFromFile, mapLessonkitIds, packageLessonkitCourse, parseLessonkitManifest, promoteStagingToOutDir, remapArtifactPaths, resolveSafePackageOutputOverride, resolveSpaLessons, themeToLxpackRuntime, validateDescriptor, validateLessonkitProject, validatePackageInputs, validateProjectPaths, writeLxpackProject };