@keymanapp/kmc-copy 18.0.138-alpha

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.
@@ -0,0 +1,551 @@
1
+ /*
2
+ * Keyman is copyright (C) SIL International. MIT License.
3
+ *
4
+ * Copy a keyboard or lexical model project
5
+ */
6
+ import { KeymanDeveloperProjectOptions, KPJFileReader, KPJFileWriter, KpsFileReader, KpsFileWriter } from "@keymanapp/developer-utils";
7
+ import { KeymanFileTypes } from "@keymanapp/common-types";
8
+ import { CopierMessages } from "./copier-messages.js";
9
+ import { CopierAsyncCallbacks } from "./copier-async-callbacks.js";
10
+ import { GitHubRef, KeymanCloudSource } from "./cloud.js";
11
+ ;
12
+ ;
13
+ ;
14
+ export class KeymanProjectCopier {
15
+ options;
16
+ callbacks;
17
+ asyncCallbacks;
18
+ sourceId;
19
+ outputId;
20
+ outPath;
21
+ githubRef;
22
+ cloudSource;
23
+ isLocalOrigin() {
24
+ return this.githubRef == undefined;
25
+ }
26
+ relocateExternalFiles = false; // TODO-COPY: support
27
+ async init(callbacks, options) {
28
+ this.callbacks = callbacks;
29
+ this.options = options;
30
+ this.cloudSource = new KeymanCloudSource(this.callbacks);
31
+ return true;
32
+ }
33
+ /**
34
+ * Copy a Keyman project. Returns an object containing binary
35
+ * artifacts on success. The files are passed in by name, and the compiler
36
+ * will use callbacks as passed to the {@link KeymanProjectCopier.init}
37
+ * function to read any input files by disk.
38
+ * @param source Source file or folder to copy. Can be a local file or folder, github:repo[:path], or cloud:id
39
+ * @returns Binary artifacts on success, null on failure.
40
+ */
41
+ async run(source) {
42
+ if (!this.verifyOutputPath()) {
43
+ return null;
44
+ }
45
+ let projectSource;
46
+ const projectSourceOrRef = await this.getSourceProject(source);
47
+ if (!projectSourceOrRef) {
48
+ // error will have been raised in getSourceProject
49
+ return null;
50
+ }
51
+ if (typeof projectSourceOrRef == 'string') {
52
+ projectSource = projectSourceOrRef;
53
+ }
54
+ else {
55
+ projectSource = projectSourceOrRef.path;
56
+ this.githubRef = projectSourceOrRef;
57
+ }
58
+ this.asyncCallbacks = new CopierAsyncCallbacks(this.callbacks, this.githubRef);
59
+ // TODO-COPY: validate outputId is valid for the project type?
60
+ this.outputId = this.callbacks.path.basename(this.outPath);
61
+ this.sourceId = this.callbacks.path.basename(projectSource, ".kpj" /* KeymanFileTypes.Source.Project */);
62
+ // copy project file
63
+ const project = await this.loadProjectFromFile(projectSource);
64
+ if (!project) {
65
+ // loadProjectFromFile already reported errors
66
+ return null;
67
+ }
68
+ const result = { artifacts: {
69
+ 'kmc-copy:outputPath': {
70
+ data: null,
71
+ filename: this.outPath
72
+ }
73
+ } };
74
+ const success = await this.copyProjectFile(project, projectSource, this.outPath, projectSource, result);
75
+ return success ? result : null;
76
+ }
77
+ /**
78
+ * Resolve the source project file to either a local filesystem file,
79
+ * or a reference on GitHub
80
+ * @param source
81
+ * @returns path to .kpj (either local or remote)
82
+ */
83
+ async getSourceProject(source) {
84
+ if (source.startsWith('github:')) {
85
+ // `github:owner/repo:path/to/kpj`, referencing a .kpj file
86
+ return await this.getGitHubSourceProject(source);
87
+ }
88
+ else if (source.startsWith('cloud:')) {
89
+ // `cloud:id`, referencing a Keyman Cloud keyboard
90
+ return await this.getCloudSourceProject(source);
91
+ }
92
+ else if (this.callbacks.fs.existsSync(source) && source.endsWith(".kpj" /* KeymanFileTypes.Source.Project */) && !this.callbacks.isDirectory(source)) {
93
+ // referencing a local filesystem project file
94
+ return this.getLocalFileProject(source);
95
+ }
96
+ else {
97
+ // Referencing a folder, or a missing local file
98
+ return this.getLocalFolderProject(source);
99
+ }
100
+ }
101
+ /**
102
+ * Resolve source path to the contained project file; the project
103
+ * file must have the same basename as the folder in this case
104
+ * @param source
105
+ * @returns
106
+ */
107
+ getLocalFolderProject(source) {
108
+ source = this.normalizePath(source);
109
+ const projectSource = this.normalizePath(this.callbacks.path.join(source, this.callbacks.path.basename(source) + ".kpj" /* KeymanFileTypes.Source.Project */));
110
+ if (!this.callbacks.fs.existsSync(projectSource)) {
111
+ this.callbacks.reportMessage(CopierMessages.Error_CannotFindInputProject({ project: source }));
112
+ return null;
113
+ }
114
+ return projectSource;
115
+ }
116
+ /**
117
+ * Resolve source path to the input .kpj filename, folder name
118
+ * is not relevant when .kpj filename is passed in
119
+ * @param source
120
+ * @returns
121
+ */
122
+ getLocalFileProject(source) {
123
+ return this.normalizePath(source);
124
+ }
125
+ /**
126
+ * Resolve path to GitHub source, which must be in the following format:
127
+ * `github:owner/repo[:branch]:path/to/kpj`
128
+ * The path must be fully qualified, referencing the .kpj file; it
129
+ * cannot just be the folder where the .kpj is found
130
+ * @param source
131
+ * @returns a promise: GitHub reference to the source for the keyboard, or null on failure
132
+ */
133
+ async getGitHubSourceProject(source) {
134
+ const parts = source.split(':');
135
+ if (parts.length < 3 || parts.length > 4 || !parts[1].match(/^[a-z0-9-]+\/[a-z0-9._-]+$/i)) {
136
+ // https://stackoverflow.com/questions/59081778/rules-for-special-characters-in-github-repository-name
137
+ this.callbacks.reportMessage(CopierMessages.Error_InvalidGitHubSource({ source }));
138
+ return null;
139
+ }
140
+ const origin = parts[1].split('/');
141
+ const ref = new GitHubRef({
142
+ owner: origin[0],
143
+ repo: origin[1],
144
+ branch: null,
145
+ path: null
146
+ });
147
+ if (parts.length == 4) {
148
+ ref.branch = parts[2];
149
+ ref.path = parts[3];
150
+ }
151
+ else {
152
+ ref.branch = await this.cloudSource.getDefaultBranchFromGitHub(ref);
153
+ if (!ref.branch) {
154
+ this.callbacks.reportMessage(CopierMessages.Error_CouldNotFindDefaultBranchOnGitHub({ ref: ref.toString() }));
155
+ return null;
156
+ }
157
+ ref.path = parts[2];
158
+ }
159
+ if (!ref.path.startsWith('/')) {
160
+ ref.path = '/' + ref.path;
161
+ }
162
+ return ref;
163
+ }
164
+ /**
165
+ * Resolve path to Keyman Cloud source (which is on GitHub), which must be in
166
+ * the following format:
167
+ * `cloud:keyboard_id|model_id`
168
+ * The `keyboard_id` parameter should be a valid id (a-z0-9_), as found at
169
+ * https://keyman.com/keyboards; alternativel if it is a model_id, it should
170
+ * have the format author.bcp47.uniq
171
+ * @param source
172
+ * @returns a promise: GitHub reference to the source for the keyboard, or null on failure
173
+ */
174
+ async getCloudSourceProject(source) {
175
+ const parts = source.split(':');
176
+ const id = parts[1];
177
+ const isModel = /^[^.]+\.[^.]+\.[^.]+$/.test(id);
178
+ const remote = await this.cloudSource.getSourceFromKeymanCloud(id, isModel);
179
+ if (!remote) {
180
+ return null;
181
+ }
182
+ // append project filename .kpj
183
+ remote.path += '/' + this.callbacks.path.basename(remote.path) + ".kpj" /* KeymanFileTypes.Source.Project */;
184
+ return remote;
185
+ }
186
+ normalizePath(path) {
187
+ return path.replaceAll(/\\/g, '/');
188
+ }
189
+ verifyOutputPath() {
190
+ this.outPath = this.normalizePath(this.options.outPath);
191
+ if (this.outPath.endsWith('/')) {
192
+ this.outPath = this.outPath.substring(0, this.outPath.length - 1);
193
+ }
194
+ if (this.callbacks.fs.existsSync(this.outPath)) {
195
+ this.callbacks.reportMessage(CopierMessages.Error_OutputPathAlreadyExists({ outPath: this.outPath }));
196
+ return false;
197
+ }
198
+ return true;
199
+ }
200
+ copiers = {
201
+ ".kpj": this.copyProjectFile.bind(this),
202
+ ".kmn": this.copyKmnSourceFile.bind(this),
203
+ ".kps": this.copyKpsSourceFile.bind(this),
204
+ ".kvks": this.copySourceFile.bind(this),
205
+ ".keyman-touch-layout": this.copySourceFile.bind(this),
206
+ ".xml": this.copySourceFile.bind(this),
207
+ ".model.ts": this.copyModelTsSourceFile.bind(this),
208
+ };
209
+ async copyFolder(inputPath, outputPath, ignorePatterns, result) {
210
+ // TODO-COPY: watch out for file collisions when copying project files -- after renames
211
+ const files = await this.asyncCallbacks.fsAsync.readdir(inputPath);
212
+ for (const { filename, type } of files) {
213
+ const fullPath = this.normalizePath(this.callbacks.path.join(inputPath, filename));
214
+ if (ignorePatterns.find(pattern => (typeof pattern == 'string' && pattern == fullPath) || (fullPath.match(pattern)))) {
215
+ continue;
216
+ }
217
+ if (type == 'dir') {
218
+ await this.copyFolder(fullPath, this.callbacks.path.join(outputPath, filename), ignorePatterns, result);
219
+ }
220
+ else if (!result.artifacts[fullPath]) {
221
+ result.artifacts[fullPath] = {
222
+ data: await this.asyncCallbacks.fsAsync.readFile(fullPath),
223
+ filename: this.generateNewFilename(fullPath, outputPath)
224
+ };
225
+ }
226
+ }
227
+ }
228
+ resolveFilename(base, filename) {
229
+ if (this.isLocalOrigin()) {
230
+ return this.callbacks.resolveFilename(base, filename);
231
+ }
232
+ // GitHub resolveFilename
233
+ if (filename.startsWith('/')) {
234
+ return filename;
235
+ }
236
+ let result = this.normalizePath(this.callbacks.path.normalize(this.callbacks.path.join(this.callbacks.path.dirname(base), filename)));
237
+ if (!result.startsWith('/'))
238
+ result = '/' + result;
239
+ return result;
240
+ }
241
+ async copyProjectFile(project, filename, outputPath, source, result) {
242
+ for (const file of project.files) {
243
+ const normalizedFilePath = this.normalizePath(file.filePath);
244
+ const subOutputPath = this.normalizePath(this.calculateNewFilePath(normalizedFilePath));
245
+ const subFilename = this.normalizePath(this.resolveFilename(project.projectFilename, normalizedFilePath));
246
+ const copier = this.copiers[file.fileType] ?? this.copyGenericFile.bind(this);
247
+ // Ignore errors because we will continue to do a best effort
248
+ await copier(project, subFilename, subOutputPath, source, result);
249
+ }
250
+ if (project.options.version == "2.0") {
251
+ // For version 2.0 projects, we also copy every file in the folder
252
+ // except for project.buildpath and .kpj.user
253
+ await this.copyFolder(project.projectPath, outputPath, [/\.kpj\.user$/, project.resolveBuildPath()], result);
254
+ }
255
+ // Rewrite the project
256
+ project.options = new KeymanDeveloperProjectOptions('2.0');
257
+ const writer = new KPJFileWriter();
258
+ const data = new TextEncoder().encode(writer.write(project));
259
+ result.artifacts[filename] = {
260
+ data,
261
+ filename: this.generateNewFilename(filename, outputPath)
262
+ };
263
+ return true;
264
+ }
265
+ async copyGenericFile(_project, filename, outputPath, _source, result) {
266
+ if (result.artifacts[filename]) {
267
+ return true;
268
+ }
269
+ const data = await this.asyncCallbacks.fsAsync.readFile(filename);
270
+ if (!data) {
271
+ // We'll add an null artifact and do a best effort, rather
272
+ // than fail the process altogether.
273
+ result.artifacts[filename] = {
274
+ data: null,
275
+ filename: this.generateNewFilename(filename, outputPath)
276
+ };
277
+ // Only warn that the file is missing if it isn't an output file,
278
+ // because a clean project won't contain any outputs (binaries)
279
+ if (KeymanFileTypes.binaryTypeFromFilename(filename) === null) {
280
+ this.callbacks.reportMessage(CopierMessages.Warn_FileNotFound({ filename, newFilename: result.artifacts[filename].filename }));
281
+ }
282
+ return false;
283
+ }
284
+ result.artifacts[filename] = {
285
+ data,
286
+ filename: this.generateNewFilename(filename, outputPath)
287
+ };
288
+ return true;
289
+ }
290
+ async copySourceFile(project, filename, _outputPath, source, result) {
291
+ return await this.copyGenericFile(project, filename, this.callbacks.path.join(this.outPath, 'source'), source, result);
292
+ }
293
+ async copyModelTsSourceFile(project, filename, outputPath, source, result) {
294
+ if (!await this.copySourceFile(project, filename, outputPath, source, result)) {
295
+ return false;
296
+ }
297
+ // Replace wordlist references and update files
298
+ const lines = new TextDecoder().decode(result.artifacts[filename].data);
299
+ const sources = lines.match(/(sources:\s*\[)([^\]]+)(\])/m);
300
+ if (!sources) {
301
+ this.callbacks.reportMessage(CopierMessages.Warn_NoWordlistsFound({ filename }));
302
+ return true;
303
+ }
304
+ const wordlistString = sources[2];
305
+ const wordlists = wordlistString.matchAll(/(['"])(.+)(\1)/g);
306
+ let index = 0;
307
+ let out = '';
308
+ for (const wordlist of wordlists) {
309
+ const wordlistFilename = wordlist[2];
310
+ const newRelativePath = await this.copySubFileAndGetRelativePath(project, filename, wordlistFilename, outputPath, source, result);
311
+ out += wordlistString.substring(index, wordlist.index) + wordlist[1] + newRelativePath + wordlist[3];
312
+ index = wordlist.index + wordlist[0].length;
313
+ }
314
+ out += wordlistString.substring(index);
315
+ const outLines = lines.substring(0, sources.index ?? 0) + sources[1] + out + sources[3] + lines.substring((sources.index ?? 0) + sources[0].length);
316
+ result.artifacts[filename].data = new TextEncoder().encode(outLines);
317
+ return true;
318
+ }
319
+ async copyKmnSourceFile(project, filename, outputPath, source, result) {
320
+ if (!await this.copySourceFile(project, filename, outputPath, source, result)) {
321
+ return false;
322
+ }
323
+ // Replace file references for known files
324
+ const stores = ['&BITMAP', '&DISPLAYMAP', '&INCLUDECODES', '&KMW_EMBEDCSS', '&KMW_EMBEDJS', '&KMW_HELPFILE', '&LAYOUTFILE', '&VISUALKEYBOARD'];
325
+ const storeRegexes = stores.map(m => ({ id: m, re: new RegExp(`^\\s*store\\s*\\(\\s*${m}\\s*\\)\\s*(['"])(.+?)(\\1)`, 'i') }));
326
+ const replacementRegex = /^(\s*store\s*\(\s*&[a-z0-9-_]+\s*\)\s*(['"]))(.+?)(\2.*)$/i;
327
+ const lines = new TextDecoder().decode(result.artifacts[filename].data).replaceAll(/\r\n/g, '\n').replaceAll(/\r/g, '\n').split('\n');
328
+ for (let i = 0; i < lines.length; i++) {
329
+ const line = lines[i];
330
+ for (const r of storeRegexes) {
331
+ const m = line.match(r.re);
332
+ if (m) {
333
+ const newRelativePath = await this.copySubFileAndGetRelativePath(project, filename, m[2], outputPath, source, result);
334
+ lines[i] = line.replace(replacementRegex, `$1${newRelativePath}$4`);
335
+ }
336
+ }
337
+ }
338
+ // rewrite fixups inside the source file
339
+ result.artifacts[filename].data = new TextEncoder().encode(lines.join('\n'));
340
+ return true;
341
+ }
342
+ async copyKpsSourceFile(project, filename, outputPath, source, result) {
343
+ if (!await this.copySourceFile(project, filename, outputPath, source, result)) {
344
+ return false;
345
+ }
346
+ const reader = new KpsFileReader(this.callbacks);
347
+ const kps = reader.read(result.artifacts[filename].data);
348
+ if (!kps) {
349
+ this.callbacks.reportMessage(CopierMessages.Error_PackageFileCouldNotBeRead({ filename }));
350
+ return false;
351
+ }
352
+ if (kps.Package?.Files?.File.length) {
353
+ for (const file of kps.Package.Files.File) {
354
+ const newRelativePath = await this.copySubFileAndGetRelativePath(project, filename, file.Name, outputPath, source, result);
355
+ const remap = (ref) => ref == file.Name ? newRelativePath : ref;
356
+ // Update all other file links in the .kps
357
+ kps.Package.Options.GraphicFile = remap(kps.Package.Options.GraphicFile);
358
+ kps.Package.Options.LicenseFile = remap(kps.Package.Options.LicenseFile);
359
+ kps.Package.Options.MSIFileName = remap(kps.Package.Options.MSIFileName);
360
+ kps.Package.Options.ReadMeFile = remap(kps.Package.Options.ReadMeFile);
361
+ kps.Package.Options.WelcomeFile = remap(kps.Package.Options.WelcomeFile);
362
+ if (kps.Package?.Keyboards?.Keyboard?.length) {
363
+ for (const keyboard of kps.Package.Keyboards?.Keyboard) {
364
+ keyboard.DisplayFont = remap(keyboard.DisplayFont);
365
+ keyboard.OSKFont = remap(keyboard.OSKFont);
366
+ if (keyboard.WebDisplayFonts?.Font?.length) {
367
+ for (const font of keyboard.WebDisplayFonts.Font) {
368
+ font.$.Filename = remap(font.$.Filename);
369
+ }
370
+ }
371
+ if (keyboard.WebOSKFonts?.Font?.length) {
372
+ for (const font of keyboard.WebOSKFonts.Font) {
373
+ font.$.Filename = remap(font.$.Filename);
374
+ }
375
+ }
376
+ // Rewrite keyboard id
377
+ if (keyboard.ID == this.sourceId) {
378
+ keyboard.ID = this.outputId;
379
+ }
380
+ }
381
+ }
382
+ if (kps.Package?.LexicalModels?.LexicalModel?.length) {
383
+ for (const model of kps.Package.LexicalModels?.LexicalModel) {
384
+ // Rewrite keyboard id
385
+ if (model.ID == this.sourceId) {
386
+ model.ID = this.outputId;
387
+ }
388
+ }
389
+ }
390
+ // Rewrite
391
+ file.Name = newRelativePath;
392
+ }
393
+ }
394
+ // Rewrite the .kps artifact
395
+ const writer = new KpsFileWriter();
396
+ const output = writer.write(kps);
397
+ result.artifacts[filename].data = new TextEncoder().encode(output);
398
+ return true;
399
+ }
400
+ async copySubFileAndGetRelativePath(project, parentFilename, originalSubfilename, outputPath, source, result) {
401
+ originalSubfilename = this.normalizePath(originalSubfilename);
402
+ const subFilename = this.normalizePath(this.resolveFilename(parentFilename, originalSubfilename));
403
+ const subFilenameAbsolute = this.normalizePath(this.resolveFilename(project.projectPath, subFilename));
404
+ const subFilenameRelative = this.normalizePath(this.callbacks.path.relative(project.projectPath, subFilenameAbsolute));
405
+ let subOutputPath;
406
+ if (this.callbacks.path.isAbsolute(subFilenameRelative) || subFilenameRelative.startsWith('..')) {
407
+ if (this.isLocalOrigin() && !this.relocateExternalFiles) {
408
+ // Reference outside the project structure, do not attempt to normalize or copy,
409
+ // but we do need to update references for the new output path
410
+ return this.normalizePath(this.callbacks.path.relative(result.artifacts[parentFilename].filename, subFilenameAbsolute));
411
+ }
412
+ else {
413
+ // Reference outside the project structure, we will copy into a subfolder of the project;
414
+ // should be relative to root of remote repo, e.g. release/k/khmer_angkor references release/shared/fonts/...,
415
+ // so should go external/release/shared/fonts/...
416
+ subOutputPath = this.normalizePath(this.callbacks.path.join(this.options.outPath, 'external', this.callbacks.path.dirname(subFilenameAbsolute)));
417
+ }
418
+ }
419
+ else {
420
+ subOutputPath = this.normalizePath(this.callbacks.path.join(outputPath, this.callbacks.path.dirname(originalSubfilename)));
421
+ }
422
+ await this.copyGenericFile(project, subFilename, subOutputPath, source, result);
423
+ // Even if the subfile is missing, we'll still continue the overall copy
424
+ return this.normalizePath(this.callbacks.path.relative(this.callbacks.path.dirname(result.artifacts[parentFilename].filename), result.artifacts[subFilename].filename));
425
+ }
426
+ splitFilename(filename) {
427
+ // We have a special case for .model.kps, as this is not a specific file
428
+ // type in KeymanFileTypes, but we still need to transform the file basename
429
+ const ext = filename.endsWith('.model.kps') ? '.model.kps' : KeymanFileTypes.fromFilename(filename);
430
+ const path = this.callbacks.path.dirname(filename);
431
+ const base = this.callbacks.path.basename(filename, ext);
432
+ return { ext, path, base };
433
+ }
434
+ /**
435
+ * renames matching filename to the output filename pattern, and prepends the
436
+ * outputPath
437
+ * @param filename
438
+ * @param outputPath
439
+ * @returns
440
+ */
441
+ generateNewFilename(filename, outputPath) {
442
+ const { ext, base } = this.splitFilename(filename);
443
+ const newFilename = base == this.sourceId
444
+ ? this.callbacks.path.join(outputPath, this.outputId + ext)
445
+ : this.callbacks.path.join(outputPath, base + ext);
446
+ return this.normalizePath(newFilename);
447
+ }
448
+ calculateNewFilePath(oldFilePath) {
449
+ // Do not change filename here, just its path
450
+ const { ext, base } = this.splitFilename(oldFilePath);
451
+ const filename = base + ext;
452
+ const sourceType = KeymanFileTypes.sourceTypeFromFilename(oldFilePath);
453
+ if (sourceType === null) {
454
+ // Standard metadata files -- root of project
455
+ if (filename === KeymanFileTypes.HISTORY_MD || filename === KeymanFileTypes.README_MD || filename === KeymanFileTypes.LICENSE_MD) {
456
+ return this.outPath;
457
+ }
458
+ // Other files referenced in project, maintain original path
459
+ return this.callbacks.path.join(this.outPath, this.callbacks.path.dirname(oldFilePath));
460
+ }
461
+ if (sourceType == ".kpj" /* KeymanFileTypes.Source.Project */) {
462
+ // Project file -- root of project
463
+ return this.outPath;
464
+ }
465
+ // source type is valid
466
+ return this.callbacks.path.join(this.outPath, 'source');
467
+ }
468
+ async loadProjectFromFile(filename) {
469
+ const kpjData = await this.asyncCallbacks.fsAsync.readFile(filename);
470
+ const reader = new KPJFileReader(this.asyncCallbacks);
471
+ let kpj = null;
472
+ try {
473
+ kpj = reader.read(kpjData);
474
+ if (!kpj) {
475
+ this.callbacks.reportMessage(CopierMessages.Error_ProjectFileCouldNotBeRead({ filename }));
476
+ return null;
477
+ }
478
+ if (kpj.KeymanDeveloperProject?.Options?.Version && kpj.KeymanDeveloperProject.Options.Version != "1.0" && kpj.KeymanDeveloperProject.Options.Version != "2.0") {
479
+ this.callbacks.reportMessage(CopierMessages.Error_UnsupportedProjectVersion({ filename, version: kpj.KeymanDeveloperProject.Options.Version }));
480
+ return null;
481
+ }
482
+ reader.validate(kpj);
483
+ }
484
+ catch (e) {
485
+ this.callbacks.reportMessage(CopierMessages.Error_InvalidProjectFile({ filename, message: (e ?? '').toString() }));
486
+ return null;
487
+ }
488
+ const project = await reader.transform(filename, kpj);
489
+ return project;
490
+ }
491
+ /**
492
+ * Write artifacts from a successful compile to disk, via callbacks methods.
493
+ * The artifacts written will include all files from the project, across
494
+ * multiple folders. Folders will be created as needed
495
+ *
496
+ * @param artifacts - object containing artifact binary data to write out
497
+ * @returns true on success
498
+ */
499
+ /* c8 ignore start */
500
+ async write(artifacts) {
501
+ if (this.callbacks.fs.existsSync(artifacts["kmc-copy:outputPath"].filename)) {
502
+ this.callbacks.reportMessage(CopierMessages.Error_OutputPathAlreadyExists({ outPath: this.outPath }));
503
+ return false;
504
+ }
505
+ const pathsCreated = [];
506
+ if (this.options.dryRun) {
507
+ this.callbacks.reportMessage(CopierMessages.Info_DryRun({ outPath: this.outPath }));
508
+ }
509
+ for (const key of Object.keys(artifacts)) {
510
+ const a = artifacts[key];
511
+ if (a.data == null) {
512
+ // We can have non-existent files (e.g. build artifacts), for which we
513
+ // have recorded filename changes for other linkages, but don't want to
514
+ // write them out
515
+ // also 'copier base path' has null data
516
+ continue;
517
+ }
518
+ const path = this.callbacks.path.dirname(a.filename);
519
+ try {
520
+ if (this.options.dryRun) {
521
+ if (!pathsCreated.includes(path)) {
522
+ this.callbacks.reportMessage(CopierMessages.Info_DryRunCreatingFolder({ path }));
523
+ pathsCreated.push(path);
524
+ }
525
+ }
526
+ else {
527
+ this.callbacks.fs.mkdirSync(path, { recursive: true });
528
+ }
529
+ /* c8 ignore next 4 */
530
+ }
531
+ catch (e) {
532
+ this.callbacks.reportMessage(CopierMessages.Error_CannotCreateFolder({ folderName: path, e }));
533
+ return false;
534
+ }
535
+ try {
536
+ if (this.options.dryRun) {
537
+ this.callbacks.reportMessage(CopierMessages.Info_DryRunWritingFile({ filename: a.filename }));
538
+ }
539
+ else {
540
+ this.callbacks.fs.writeFileSync(a.filename, a.data);
541
+ }
542
+ }
543
+ catch (e) {
544
+ this.callbacks.reportMessage(CopierMessages.Error_CannotWriteOutputFile({ filename: a.filename, e }));
545
+ return false;
546
+ }
547
+ }
548
+ return true;
549
+ }
550
+ }
551
+ //# sourceMappingURL=KeymanProjectCopier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeymanProjectCopier.js","sourceRoot":"","sources":["../../src/KeymanProjectCopier.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAsJ,6BAA6B,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3R,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AA6BzD,CAAC;AAiBD,CAAC;AAYD,CAAC;AAEF,MAAM,OAAO,mBAAmB;IAC9B,OAAO,CAAgB;IACvB,SAAS,CAAoB;IAC7B,cAAc,CAAuB;IAErC,QAAQ,CAAS;IACjB,QAAQ,CAAS;IACjB,OAAO,CAAS;IAEhB,SAAS,CAAY;IACrB,WAAW,CAAoB;IAC/B,aAAa;QACX,OAAO,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC;IACrC,CAAC;IACD,qBAAqB,GAAY,KAAK,CAAC,CAAC,qBAAqB;IAEtD,KAAK,CAAC,IAAI,CAAC,SAA4B,EAAE,OAAsB;QACpE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,IAAI,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,GAAG,CAAC,MAAc;QAE7B,IAAG,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,CAAC;YAC5B,OAA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AAI,CAAC,SAAS,CAAC,aAAa,CAAC,cAAc,CAAC,2BAA2B,CAAC,EAAC,QAAQ,EAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,EAAC,CAAC,CAAC,CAAC;gBACnG,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CAEF"}
@@ -0,0 +1,26 @@
1
+ import { CompilerCallbacks } from "@keymanapp/developer-utils";
2
+ export declare class GitHubRef {
3
+ owner: string;
4
+ repo: string;
5
+ branch: string;
6
+ path: string;
7
+ constructor(owner: string | GitHubRef, repo?: string, branch?: string, path?: string);
8
+ toString(): string;
9
+ }
10
+ export declare class KeymanCloudSource {
11
+ private callbacks;
12
+ static readonly KeymanApp_Owner = "keymanapp";
13
+ static readonly KeymanApp_Keyboards_Repo = "keyboards";
14
+ static readonly KeymanApp_Keyboards_DefaultBranch = "master";
15
+ static readonly KeymanApp_LexicalModels_Repo = "lexical-models";
16
+ static readonly KeymanApp_LexicalModels_DefaultBranch = "master";
17
+ constructor(callbacks: CompilerCallbacks);
18
+ getDefaultBranchFromGitHub(ref: GitHubRef): Promise<string>;
19
+ downloadFolderFromGitHub(ref: GitHubRef): Promise<{
20
+ filename: string;
21
+ type: 'dir' | 'file';
22
+ }[]>;
23
+ downloadFileFromGitHub(ref: GitHubRef): Promise<Uint8Array>;
24
+ getSourceFromKeymanCloud(id: string, isModel: boolean): Promise<GitHubRef | null>;
25
+ }
26
+ //# sourceMappingURL=cloud.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud.d.ts","sourceRoot":"","sources":["../../src/cloud.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAI/D,qBAAa,SAAS;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;gBACR,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;IAapF,QAAQ;CAMT;AAED,qBAAa,iBAAiB;IAOhB,OAAO,CAAC,SAAS;IAN7B,gBAAuB,eAAe,eAAe;IACrD,gBAAuB,wBAAwB,eAAe;IAC9D,gBAAuB,iCAAiC,YAAY;IACpE,gBAAuB,4BAA4B,oBAAoB;IACvE,gBAAuB,qCAAqC,YAAY;gBAEpD,SAAS,EAAE,iBAAiB;IAGnC,0BAA0B,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;IAY3D,wBAAwB,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC;QAAC,QAAQ,EAAC,MAAM,CAAC;QAAA,IAAI,EAAC,KAAK,GAAC,MAAM,CAAA;KAAC,EAAE,CAAC;IAuBxF,sBAAsB,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC;IAuB3D,wBAAwB,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;CAuC/F"}