@lessonkit/lxpack 0.9.3 → 1.0.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 +16 -15
- package/dist/bridge.cjs +81 -8
- package/dist/bridge.d.cts +8 -2
- package/dist/bridge.d.ts +8 -2
- package/dist/bridge.js +65 -3
- package/dist/chunk-DYQI222N.js +41 -0
- package/dist/index.cjs +626 -141
- package/dist/index.d.cts +92 -7
- package/dist/index.d.ts +92 -7
- package/dist/index.js +609 -142
- package/lessonkit-manifest.v1.json +100 -0
- package/package.json +12 -10
- package/dist/chunk-PSUSESH3.js +0 -32
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CheckId, CourseId, LessonId } from '@lessonkit/core';
|
|
2
2
|
import { ThemePresetName, LessonkitThemeV1 } from '@lessonkit/themes';
|
|
3
|
+
import { ExportTarget, BuildCourseResult, ValidateCourseResult } from '@lxpack/api';
|
|
4
|
+
export { ExportTarget } from '@lxpack/api';
|
|
3
5
|
import { LessonkitInterchangeV1 } from '@lxpack/validators';
|
|
4
6
|
export { LessonkitInterchangeV1, MaterializeLessonkitOptions, MaterializeLessonkitResult, lessonkitInterchangeSchema, materializeLessonkitProject, parseLessonkitInterchange } from '@lxpack/validators';
|
|
5
|
-
import { ExportTarget, ValidateCourseResult, BuildCourseResult } from '@lxpack/api';
|
|
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';
|
|
9
9
|
|
|
@@ -53,10 +53,14 @@ type MappedLessonkitIds = {
|
|
|
53
53
|
checkIds: CheckId[];
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
/** Shared validation issue shape across lxpack parsers. */
|
|
57
|
+
type ValidationIssue = {
|
|
57
58
|
path: string;
|
|
58
59
|
message: string;
|
|
60
|
+
severity?: string;
|
|
59
61
|
};
|
|
62
|
+
|
|
63
|
+
type DescriptorValidationIssue = ValidationIssue;
|
|
60
64
|
type DescriptorValidationResult = {
|
|
61
65
|
ok: true;
|
|
62
66
|
descriptor: LessonkitCourseDescriptor;
|
|
@@ -64,7 +68,8 @@ type DescriptorValidationResult = {
|
|
|
64
68
|
ok: false;
|
|
65
69
|
issues: DescriptorValidationIssue[];
|
|
66
70
|
};
|
|
67
|
-
declare function validateDescriptor(input:
|
|
71
|
+
declare function validateDescriptor(input: unknown): DescriptorValidationResult;
|
|
72
|
+
declare function validateDescriptorForTarget(input: unknown, target?: ExportTarget): DescriptorValidationResult;
|
|
68
73
|
|
|
69
74
|
type ProjectPathsInput = {
|
|
70
75
|
spaDistDir?: string;
|
|
@@ -94,7 +99,7 @@ declare function themeToLxpackRuntime(input: {
|
|
|
94
99
|
}): LxpackRuntimeTheme;
|
|
95
100
|
|
|
96
101
|
type SpaLessonEntry = {
|
|
97
|
-
id:
|
|
102
|
+
id: LessonId;
|
|
98
103
|
title: string;
|
|
99
104
|
path: string;
|
|
100
105
|
};
|
|
@@ -144,6 +149,40 @@ type WriteLxpackProjectResult = {
|
|
|
144
149
|
*/
|
|
145
150
|
declare function writeLxpackProject(options: WriteLxpackProjectOptions): Promise<WriteLxpackProjectResult>;
|
|
146
151
|
|
|
152
|
+
/**
|
|
153
|
+
* Atomically replace `outDir` with the packaged tree at `stagingDir`.
|
|
154
|
+
* Restores the previous `outDir` when promote fails after a backup rename.
|
|
155
|
+
*/
|
|
156
|
+
declare function promoteStagingToOutDir(stagingDir: string, outDir: string): Promise<void>;
|
|
157
|
+
|
|
158
|
+
type BuildStagingPackageOptions = WriteLxpackProjectOptions & {
|
|
159
|
+
descriptor: LessonkitCourseDescriptor;
|
|
160
|
+
target: ExportTarget;
|
|
161
|
+
output?: string;
|
|
162
|
+
dir?: boolean;
|
|
163
|
+
outputBaseDir?: string;
|
|
164
|
+
};
|
|
165
|
+
type BuildStagingPackageResult = {
|
|
166
|
+
ok: true;
|
|
167
|
+
stagingDir: string;
|
|
168
|
+
build: Extract<BuildCourseResult, {
|
|
169
|
+
ok: true;
|
|
170
|
+
}>;
|
|
171
|
+
outputPath?: string;
|
|
172
|
+
outputDir?: string;
|
|
173
|
+
} | {
|
|
174
|
+
ok: false;
|
|
175
|
+
stagingDir: string;
|
|
176
|
+
issues: Array<{
|
|
177
|
+
path?: string;
|
|
178
|
+
message: string;
|
|
179
|
+
severity?: string;
|
|
180
|
+
}>;
|
|
181
|
+
build?: BuildCourseResult;
|
|
182
|
+
};
|
|
183
|
+
declare function buildStagingPackage(options: BuildStagingPackageOptions): Promise<BuildStagingPackageResult>;
|
|
184
|
+
declare function ensureOutDirParent(outDir: string): Promise<void>;
|
|
185
|
+
|
|
147
186
|
type ValidateLessonkitProjectOptions = {
|
|
148
187
|
courseDir: string;
|
|
149
188
|
target?: ExportTarget;
|
|
@@ -154,7 +193,7 @@ type BuildLessonkitProjectOptions = {
|
|
|
154
193
|
output?: string;
|
|
155
194
|
dir?: boolean;
|
|
156
195
|
outputBaseDir?: string;
|
|
157
|
-
assessments?:
|
|
196
|
+
assessments?: LxpackInjectedAssessment[];
|
|
158
197
|
};
|
|
159
198
|
type PackageLessonkitCourseOptions = WriteLxpackProjectOptions & {
|
|
160
199
|
target: ExportTarget;
|
|
@@ -186,6 +225,52 @@ type PackageLessonkitCourseResult = {
|
|
|
186
225
|
};
|
|
187
226
|
declare function validateLessonkitProject(options: ValidateLessonkitProjectOptions): Promise<ValidateCourseResult>;
|
|
188
227
|
declare function buildLessonkitProject(options: BuildLessonkitProjectOptions): Promise<BuildCourseResult>;
|
|
228
|
+
|
|
189
229
|
declare function packageLessonkitCourse(options: PackageLessonkitCourseOptions): Promise<PackageLessonkitCourseResult>;
|
|
190
230
|
|
|
191
|
-
|
|
231
|
+
type PackageValidationIssue = {
|
|
232
|
+
path?: string;
|
|
233
|
+
message: string;
|
|
234
|
+
severity?: string;
|
|
235
|
+
};
|
|
236
|
+
type ValidatePackageInputsResult = {
|
|
237
|
+
ok: true;
|
|
238
|
+
outDir: string;
|
|
239
|
+
projectRoot?: string;
|
|
240
|
+
} | {
|
|
241
|
+
ok: false;
|
|
242
|
+
courseDir: string;
|
|
243
|
+
target: ExportTarget;
|
|
244
|
+
issues: PackageValidationIssue[];
|
|
245
|
+
};
|
|
246
|
+
declare function validatePackageInputs(options: Pick<PackageLessonkitCourseOptions, "outDir" | "projectRoot" | "outputBaseDir" | "output"> & {
|
|
247
|
+
target: ExportTarget;
|
|
248
|
+
}): ValidatePackageInputsResult;
|
|
249
|
+
declare function remapArtifactPaths(stagingRoot: string, outDir: string, artifactPath: string | undefined): string | undefined;
|
|
250
|
+
|
|
251
|
+
type LessonkitManifestPaths = {
|
|
252
|
+
spaDistDir: string;
|
|
253
|
+
lxpackOutDir: string;
|
|
254
|
+
outputBaseDir: string;
|
|
255
|
+
};
|
|
256
|
+
type LessonkitManifest = {
|
|
257
|
+
schemaVersion: 1;
|
|
258
|
+
name: string;
|
|
259
|
+
course: LessonkitCourseDescriptor;
|
|
260
|
+
paths: LessonkitManifestPaths;
|
|
261
|
+
};
|
|
262
|
+
type ManifestParseIssue = {
|
|
263
|
+
path: string;
|
|
264
|
+
message: string;
|
|
265
|
+
};
|
|
266
|
+
type ParseManifestResult = {
|
|
267
|
+
ok: true;
|
|
268
|
+
manifest: LessonkitManifest;
|
|
269
|
+
} | {
|
|
270
|
+
ok: false;
|
|
271
|
+
issues: ManifestParseIssue[];
|
|
272
|
+
};
|
|
273
|
+
declare function parseLessonkitManifest(raw: unknown, label?: string, projectRoot?: string): ParseManifestResult;
|
|
274
|
+
declare function loadLessonkitManifestFromFile(readJson: () => Promise<unknown>, label?: string, projectRoot?: string): Promise<ParseManifestResult>;
|
|
275
|
+
|
|
276
|
+
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 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, writeLxpackProject };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CheckId, CourseId, LessonId } from '@lessonkit/core';
|
|
2
2
|
import { ThemePresetName, LessonkitThemeV1 } from '@lessonkit/themes';
|
|
3
|
+
import { ExportTarget, BuildCourseResult, ValidateCourseResult } from '@lxpack/api';
|
|
4
|
+
export { ExportTarget } from '@lxpack/api';
|
|
3
5
|
import { LessonkitInterchangeV1 } from '@lxpack/validators';
|
|
4
6
|
export { LessonkitInterchangeV1, MaterializeLessonkitOptions, MaterializeLessonkitResult, lessonkitInterchangeSchema, materializeLessonkitProject, parseLessonkitInterchange } from '@lxpack/validators';
|
|
5
|
-
import { ExportTarget, ValidateCourseResult, BuildCourseResult } from '@lxpack/api';
|
|
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';
|
|
9
9
|
|
|
@@ -53,10 +53,14 @@ type MappedLessonkitIds = {
|
|
|
53
53
|
checkIds: CheckId[];
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
/** Shared validation issue shape across lxpack parsers. */
|
|
57
|
+
type ValidationIssue = {
|
|
57
58
|
path: string;
|
|
58
59
|
message: string;
|
|
60
|
+
severity?: string;
|
|
59
61
|
};
|
|
62
|
+
|
|
63
|
+
type DescriptorValidationIssue = ValidationIssue;
|
|
60
64
|
type DescriptorValidationResult = {
|
|
61
65
|
ok: true;
|
|
62
66
|
descriptor: LessonkitCourseDescriptor;
|
|
@@ -64,7 +68,8 @@ type DescriptorValidationResult = {
|
|
|
64
68
|
ok: false;
|
|
65
69
|
issues: DescriptorValidationIssue[];
|
|
66
70
|
};
|
|
67
|
-
declare function validateDescriptor(input:
|
|
71
|
+
declare function validateDescriptor(input: unknown): DescriptorValidationResult;
|
|
72
|
+
declare function validateDescriptorForTarget(input: unknown, target?: ExportTarget): DescriptorValidationResult;
|
|
68
73
|
|
|
69
74
|
type ProjectPathsInput = {
|
|
70
75
|
spaDistDir?: string;
|
|
@@ -94,7 +99,7 @@ declare function themeToLxpackRuntime(input: {
|
|
|
94
99
|
}): LxpackRuntimeTheme;
|
|
95
100
|
|
|
96
101
|
type SpaLessonEntry = {
|
|
97
|
-
id:
|
|
102
|
+
id: LessonId;
|
|
98
103
|
title: string;
|
|
99
104
|
path: string;
|
|
100
105
|
};
|
|
@@ -144,6 +149,40 @@ type WriteLxpackProjectResult = {
|
|
|
144
149
|
*/
|
|
145
150
|
declare function writeLxpackProject(options: WriteLxpackProjectOptions): Promise<WriteLxpackProjectResult>;
|
|
146
151
|
|
|
152
|
+
/**
|
|
153
|
+
* Atomically replace `outDir` with the packaged tree at `stagingDir`.
|
|
154
|
+
* Restores the previous `outDir` when promote fails after a backup rename.
|
|
155
|
+
*/
|
|
156
|
+
declare function promoteStagingToOutDir(stagingDir: string, outDir: string): Promise<void>;
|
|
157
|
+
|
|
158
|
+
type BuildStagingPackageOptions = WriteLxpackProjectOptions & {
|
|
159
|
+
descriptor: LessonkitCourseDescriptor;
|
|
160
|
+
target: ExportTarget;
|
|
161
|
+
output?: string;
|
|
162
|
+
dir?: boolean;
|
|
163
|
+
outputBaseDir?: string;
|
|
164
|
+
};
|
|
165
|
+
type BuildStagingPackageResult = {
|
|
166
|
+
ok: true;
|
|
167
|
+
stagingDir: string;
|
|
168
|
+
build: Extract<BuildCourseResult, {
|
|
169
|
+
ok: true;
|
|
170
|
+
}>;
|
|
171
|
+
outputPath?: string;
|
|
172
|
+
outputDir?: string;
|
|
173
|
+
} | {
|
|
174
|
+
ok: false;
|
|
175
|
+
stagingDir: string;
|
|
176
|
+
issues: Array<{
|
|
177
|
+
path?: string;
|
|
178
|
+
message: string;
|
|
179
|
+
severity?: string;
|
|
180
|
+
}>;
|
|
181
|
+
build?: BuildCourseResult;
|
|
182
|
+
};
|
|
183
|
+
declare function buildStagingPackage(options: BuildStagingPackageOptions): Promise<BuildStagingPackageResult>;
|
|
184
|
+
declare function ensureOutDirParent(outDir: string): Promise<void>;
|
|
185
|
+
|
|
147
186
|
type ValidateLessonkitProjectOptions = {
|
|
148
187
|
courseDir: string;
|
|
149
188
|
target?: ExportTarget;
|
|
@@ -154,7 +193,7 @@ type BuildLessonkitProjectOptions = {
|
|
|
154
193
|
output?: string;
|
|
155
194
|
dir?: boolean;
|
|
156
195
|
outputBaseDir?: string;
|
|
157
|
-
assessments?:
|
|
196
|
+
assessments?: LxpackInjectedAssessment[];
|
|
158
197
|
};
|
|
159
198
|
type PackageLessonkitCourseOptions = WriteLxpackProjectOptions & {
|
|
160
199
|
target: ExportTarget;
|
|
@@ -186,6 +225,52 @@ type PackageLessonkitCourseResult = {
|
|
|
186
225
|
};
|
|
187
226
|
declare function validateLessonkitProject(options: ValidateLessonkitProjectOptions): Promise<ValidateCourseResult>;
|
|
188
227
|
declare function buildLessonkitProject(options: BuildLessonkitProjectOptions): Promise<BuildCourseResult>;
|
|
228
|
+
|
|
189
229
|
declare function packageLessonkitCourse(options: PackageLessonkitCourseOptions): Promise<PackageLessonkitCourseResult>;
|
|
190
230
|
|
|
191
|
-
|
|
231
|
+
type PackageValidationIssue = {
|
|
232
|
+
path?: string;
|
|
233
|
+
message: string;
|
|
234
|
+
severity?: string;
|
|
235
|
+
};
|
|
236
|
+
type ValidatePackageInputsResult = {
|
|
237
|
+
ok: true;
|
|
238
|
+
outDir: string;
|
|
239
|
+
projectRoot?: string;
|
|
240
|
+
} | {
|
|
241
|
+
ok: false;
|
|
242
|
+
courseDir: string;
|
|
243
|
+
target: ExportTarget;
|
|
244
|
+
issues: PackageValidationIssue[];
|
|
245
|
+
};
|
|
246
|
+
declare function validatePackageInputs(options: Pick<PackageLessonkitCourseOptions, "outDir" | "projectRoot" | "outputBaseDir" | "output"> & {
|
|
247
|
+
target: ExportTarget;
|
|
248
|
+
}): ValidatePackageInputsResult;
|
|
249
|
+
declare function remapArtifactPaths(stagingRoot: string, outDir: string, artifactPath: string | undefined): string | undefined;
|
|
250
|
+
|
|
251
|
+
type LessonkitManifestPaths = {
|
|
252
|
+
spaDistDir: string;
|
|
253
|
+
lxpackOutDir: string;
|
|
254
|
+
outputBaseDir: string;
|
|
255
|
+
};
|
|
256
|
+
type LessonkitManifest = {
|
|
257
|
+
schemaVersion: 1;
|
|
258
|
+
name: string;
|
|
259
|
+
course: LessonkitCourseDescriptor;
|
|
260
|
+
paths: LessonkitManifestPaths;
|
|
261
|
+
};
|
|
262
|
+
type ManifestParseIssue = {
|
|
263
|
+
path: string;
|
|
264
|
+
message: string;
|
|
265
|
+
};
|
|
266
|
+
type ParseManifestResult = {
|
|
267
|
+
ok: true;
|
|
268
|
+
manifest: LessonkitManifest;
|
|
269
|
+
} | {
|
|
270
|
+
ok: false;
|
|
271
|
+
issues: ManifestParseIssue[];
|
|
272
|
+
};
|
|
273
|
+
declare function parseLessonkitManifest(raw: unknown, label?: string, projectRoot?: string): ParseManifestResult;
|
|
274
|
+
declare function loadLessonkitManifestFromFile(readJson: () => Promise<unknown>, label?: string, projectRoot?: string): Promise<ParseManifestResult>;
|
|
275
|
+
|
|
276
|
+
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 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, writeLxpackProject };
|