@travetto/manifest 5.0.0-rc.3 → 5.0.0-rc.4

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 CHANGED
@@ -51,7 +51,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
51
51
  exports.TestClass = void 0;
52
52
  const tslib_1 = require("tslib");
53
53
  const Ⲑ_function_1 = tslib_1.__importStar(require("@travetto/runtime/src/function.js"));
54
- var ᚕm = ["@travetto/manifest", "doc/test-class"];
54
+ var ᚕm = ["@travetto/manifest", "doc/test-class.ts"];
55
55
  class TestClass {
56
56
  static Ⲑinit = Ⲑ_function_1.registerFunction(TestClass, ᚕm, { hash: 197152026, lines: [1, 3] }, { doStuff: { hash: 51337554, lines: [2, 2] } }, false, false);
57
57
  async doStuff() { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/manifest",
3
- "version": "5.0.0-rc.3",
3
+ "version": "5.0.0-rc.4",
4
4
  "description": "Support for project indexing, manifesting, along with file watching",
5
5
  "keywords": [
6
6
  "path",
package/src/delta.ts CHANGED
@@ -40,14 +40,14 @@ export class ManifestDeltaUtil {
40
40
  const type = ManifestModuleUtil.getFileType(x);
41
41
  return VALID_SOURCE_TYPE.has(type);
42
42
  })
43
- .map(x => ManifestModuleUtil.sourceToBlankExt(x.replace(`${root}/`, '')))
43
+ .map(x => ManifestModuleUtil.withoutSourceExtension(x.replace(`${root}/`, '')))
44
44
  );
45
45
 
46
46
  for (const el of Object.keys(left.files)) {
47
- const output = ManifestModuleUtil.sourceToOutputExt(`${outputFolder}/${left.outputFolder}/${el}`);
47
+ const output = ManifestModuleUtil.withOutputExtension(`${outputFolder}/${left.outputFolder}/${el}`);
48
48
  const [, , leftTs] = left.files[el];
49
49
  const stat = await fs.stat(output).catch(() => undefined);
50
- right.delete(ManifestModuleUtil.sourceToBlankExt(el));
50
+ right.delete(ManifestModuleUtil.withoutSourceExtension(el));
51
51
 
52
52
  if (!stat) {
53
53
  add(el, 'added');
@@ -61,12 +61,12 @@ export class ManifestIndex {
61
61
  return files.map(([f, type, ts, role = 'std']) => {
62
62
  const isSource = type === 'ts' || type === 'js';
63
63
  const sourceFile = path.resolve(this.#manifest.workspace.path, m.sourceFolder, f);
64
- const js = isSource ? ManifestModuleUtil.sourceToOutputExt(f) : f;
64
+ const js = isSource ? ManifestModuleUtil.withOutputExtension(f) : f;
65
65
  const outputFile = this.#resolveOutput(m.outputFolder, js);
66
- const modImport = `${m.name}/${js}`;
67
- let id = modImport.replace(`${m.name}/`, _ => _.replace(/[/]$/, ':'));
66
+ const modImport = `${m.name}/${f}`;
67
+ let id = `${m.name}:${f}`;
68
68
  if (isSource) {
69
- id = ManifestModuleUtil.sourceToBlankExt(id);
69
+ id = ManifestModuleUtil.withoutSourceExtension(id);
70
70
  }
71
71
 
72
72
  return { id, type, sourceFile, outputFile, import: modImport, role, relativeFile: f, module: m.name };
@@ -100,7 +100,8 @@ export class ManifestIndex {
100
100
  this.#outputToEntry.set(entry.outputFile, entry);
101
101
  this.#sourceToEntry.set(entry.sourceFile, entry);
102
102
  this.#importToEntry.set(entry.import, entry);
103
- this.#importToEntry.set(entry.import.replace(/[.]js$/, ''), entry);
103
+ this.#importToEntry.set(ManifestModuleUtil.withoutSourceExtension(entry.import), entry);
104
+ this.#importToEntry.set(ManifestModuleUtil.withOutputExtension(entry.import), entry);
104
105
  }
105
106
  }
106
107
  }
@@ -189,7 +190,7 @@ export class ManifestIndex {
189
190
  */
190
191
  getFromImport(imp: string): IndexedFile | undefined {
191
192
  // Strip ext
192
- imp = ManifestModuleUtil.sourceToBlankExt(imp);
193
+ imp = ManifestModuleUtil.withoutSourceExtension(imp);
193
194
  return this.#importToEntry.get(imp);
194
195
  }
195
196
 
package/src/module.ts CHANGED
@@ -48,7 +48,7 @@ export class ManifestModuleUtil {
48
48
  /**
49
49
  * Replace a source file's extension with a given value
50
50
  */
51
- static #sourceToExtension(inputFile: string, ext: string): string {
51
+ static #pathToExtension(inputFile: string, ext: string): string {
52
52
  return inputFile.replace(/[.][tj]sx?$/, ext);
53
53
  }
54
54
 
@@ -227,14 +227,14 @@ export class ManifestModuleUtil {
227
227
  /**
228
228
  * Get the output file name for a given input
229
229
  */
230
- static sourceToOutputExt(inputFile: string): string {
231
- return this.#sourceToExtension(inputFile, '.js');
230
+ static withOutputExtension(inputFile: string): string {
231
+ return this.#pathToExtension(inputFile, '.js');
232
232
  }
233
233
 
234
234
  /**
235
235
  * Get the file without an extension
236
236
  */
237
- static sourceToBlankExt(inputFile: string): string {
238
- return this.#sourceToExtension(inputFile, '');
237
+ static withoutSourceExtension(inputFile: string): string {
238
+ return this.#pathToExtension(inputFile, '');
239
239
  }
240
240
  }