@travetto/manifest 5.0.0-rc.4 → 5.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/README.md CHANGED
@@ -30,7 +30,7 @@ During the compilation process, the compiler needs to know every file that is el
30
30
  Additionally, once the code has been compiled (or even bundled after that), the executing process needs to know what files are available for loading, and any patterns necessary for knowing which files to load versus which ones to ignore. This allows for dynamic loading of modules/files without knowledge/access to the file system, and in a more performant manner.
31
31
 
32
32
  ## Manifest Delta
33
- During the compilation process, it is helpful to know how the output content differs from the manifest, which is produced from the source input. The [ManifestDeltaUtil](https://github.com/travetto/travetto/tree/main/module/manifest/src/delta.ts#L21) provides the functionality for a given manifest, and will produce a stream of changes grouped by module. This is the primary input into the [Compiler](https://github.com/travetto/travetto/tree/main/module/compiler#readme "The compiler infrastructure for the Travetto framework")'s incremental behavior to know when a file has changed and needs to be recompiled.
33
+ During the compilation process, it is helpful to know how the output content differs from the manifest, which is produced from the source input. The [ManifestDeltaUtil](https://github.com/travetto/travetto/tree/main/module/manifest/src/delta.ts#L23) provides the functionality for a given manifest, and will produce a stream of changes grouped by module. This is the primary input into the [Compiler](https://github.com/travetto/travetto/tree/main/module/compiler#readme "The compiler infrastructure for the Travetto framework")'s incremental behavior to know when a file has changed and needs to be recompiled.
34
34
 
35
35
  ## Class and Function Metadata
36
36
  For the framework to work properly, metadata needs to be collected about files, classes and functions to uniquely identify them, with support for detecting changes during live reloads. To achieve this, every `class` is decorated with an additional field of `Ⲑid`. `Ⲑid` represents a computed id that is tied to the file/class combination.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/manifest",
3
- "version": "5.0.0-rc.4",
3
+ "version": "5.0.0",
4
4
  "description": "Support for project indexing, manifesting, along with file watching",
5
5
  "keywords": [
6
6
  "path",
package/src/delta.ts CHANGED
@@ -15,6 +15,8 @@ const VALID_SOURCE_FOLDERS = new Set<ManifestModuleFolderType>(['bin', 'src', 't
15
15
  const VALID_OUTPUT_TYPE = new Set<ManifestModuleFileType>(['js', 'ts', 'package-json']);
16
16
  const VALID_SOURCE_TYPE = new Set<ManifestModuleFileType>([...VALID_OUTPUT_TYPE, 'typings']);
17
17
 
18
+ const TypedObject: { keys<T = unknown, K extends keyof T = keyof T>(o: T): K[] } & ObjectConstructor = Object;
19
+
18
20
  /**
19
21
  * Produce delta for the manifest
20
22
  */
@@ -72,8 +74,7 @@ export class ManifestDeltaUtil {
72
74
  */
73
75
  static #flattenModuleFiles(m: ManifestModule): Record<string, ManifestModuleFile> {
74
76
  const out: Record<string, ManifestModuleFile> = {};
75
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
76
- for (const key of Object.keys(m.files) as (ManifestModuleFolderType[])) {
77
+ for (const key of TypedObject.keys(m.files)) {
77
78
  if (!VALID_SOURCE_FOLDERS.has(key)) {
78
79
  continue;
79
80
  }
@@ -4,7 +4,6 @@ import { ManifestModuleUtil } from './module';
4
4
  import { path } from './path';
5
5
  import { ManifestUtil } from './util';
6
6
 
7
- import type { ManifestModuleFolderType } from './types/common';
8
7
  import type { ManifestModule, ManifestRoot, ManifestModuleFile, IndexedModule, IndexedFile, FindConfig } from './types/manifest';
9
8
 
10
9
  const TypedObject: {
@@ -88,10 +87,9 @@ export class ManifestIndex {
88
87
  outputPath: this.#resolveOutput(m.outputFolder),
89
88
  sourcePath: path.resolve(this.#manifest.workspace.path, m.sourceFolder),
90
89
  children: new Set(),
91
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
92
- files: Object.fromEntries(
93
- Object.entries(m.files).map(([folder, files]) => [folder, this.#moduleFiles(m, files ?? [])])
94
- ) as Record<ManifestModuleFolderType, IndexedFile[]>
90
+ files: TypedObject.fromEntries(
91
+ TypedObject.entries(m.files).map(([folder, files]) => [folder, this.#moduleFiles(m, files ?? [])])
92
+ )
95
93
  }));
96
94
 
97
95
  for (const mod of this.#modules) {
@@ -213,8 +211,8 @@ export class ManifestIndex {
213
211
  for (const expr of exprList.split(/\s*,\s*/g)) {
214
212
  const [, neg, mod] = expr.match(/(-|[+])?([^+\- ]+)$/) ?? [];
215
213
  if (mod) {
216
- const patt = new RegExp(`^${mod.replace(/[*]/g, '.*')}$`);
217
- for (const m of allMods.filter(x => patt.test(x))) {
214
+ const pattern = new RegExp(`^${mod.replace(/[*]/g, '.*')}$`);
215
+ for (const m of allMods.filter(x => pattern.test(x))) {
218
216
  active[neg ? 'delete' : 'add'](m);
219
217
  }
220
218
  }