@travetto/manifest 3.2.0-rc.0 → 3.3.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
@@ -85,10 +85,10 @@ Once the manifest is created, the application runtime can now read this manifest
85
85
  * Providing contextual information when provided a filename, import name, etc (e.g. logging, testing output)
86
86
 
87
87
  ## Path Normalization
88
- By default, all paths within the framework are assumed to be in a POSIX style, and all input paths are converted to the POSIX style. This works appropriately within a Unix and a Windows environment. This module offers up [path](https://github.com/travetto/travetto/tree/main/module/manifest/src/path.ts#L7) as an equivalent to [Node](https://nodejs.org)'s [http](https://nodejs.org/api/path.html) library. This allows for consistent behavior across all file-interactions, and also allows for easy analysis if [Node](https://nodejs.org)'s [http](https://nodejs.org/api/path.html) library is ever imported.
88
+ By default, all paths within the framework are assumed to be in a POSIX style, and all input paths are converted to the POSIX style. This works appropriately within a Unix and a Windows environment. This module offers up [path](https://github.com/travetto/travetto/tree/main/module/manifest/src/path.ts#L8) as an equivalent to [Node](https://nodejs.org)'s [http](https://nodejs.org/api/path.html) library. This allows for consistent behavior across all file-interactions, and also allows for easy analysis if [Node](https://nodejs.org)'s [http](https://nodejs.org/api/path.html) library is ever imported.
89
89
 
90
90
  ## File Watching
91
- The module also leverages [fetch](https://www.npmjs.com/package/@parcel/watcher), to expose a single function of `watchFolders`. Only the [Compiler](https://github.com/travetto/travetto/tree/main/module/compiler#readme "The compiler infrastructure for the Travetto framework") module packages [fetch](https://www.npmjs.com/package/@parcel/watcher) as a direct dependency. This means, that in production, by default all watch operations will fail with a missing dependency.
91
+ The module also leverages [@parcel/watcher](https://www.npmjs.com/package/@parcel/watcher), to expose a single function of `watchFolders`. Only the [Compiler](https://github.com/travetto/travetto/tree/main/module/compiler#readme "The compiler infrastructure for the Travetto framework") module packages [@parcel/watcher](https://www.npmjs.com/package/@parcel/watcher) as a direct dependency. This means, that in production, by default all watch operations will fail with a missing dependency.
92
92
 
93
93
  **Code: Watch Configuration**
94
94
  ```typescript
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/manifest",
3
- "version": "3.2.0-rc.0",
3
+ "version": "3.3.0",
4
4
  "description": "Support for project indexing, manifesting, along with file watching",
5
5
  "keywords": [
6
6
  "path",
@@ -260,6 +260,7 @@ export class ManifestIndex {
260
260
  const name = this.getFromImport(importName)?.module;
261
261
  return name ? this.getModule(name) : undefined;
262
262
  }
263
+
263
264
  /**
264
265
  * Build module list from an expression list (e.g. `@travetto/rest,-@travetto/log)
265
266
  */
package/src/path.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { extname, dirname, resolve, basename, delimiter, join, sep } from 'path';
1
+ import { extname, dirname, resolve, basename, join } from 'path/posix';
2
+ import { sep } from 'path';
2
3
 
3
4
  const posix = (file: string): string => file.replaceAll('\\', '/');
4
5
 
@@ -7,11 +8,10 @@ const cwd = (): string => posix(process.cwd());
7
8
  export const path = {
8
9
  cwd,
9
10
  toPosix: posix,
10
- delimiter,
11
- basename: (file: string, suffix?: string): string => posix(basename(file, suffix)),
12
- extname: (file: string): string => posix(extname(file)),
13
- dirname: (file: string): string => posix(dirname(file)),
14
- resolve: (...args: string[]): string => posix(resolve(cwd(), ...args.map(f => posix(f)))),
15
- join: (root: string, ...args: string[]): string => posix(join(posix(root), ...args.map(f => posix(f)))),
11
+ basename: (file: string, suffix?: string): string => basename(posix(file), suffix),
12
+ extname: (file: string): string => extname(posix(file)),
13
+ dirname: (file: string): string => dirname(posix(file)),
14
+ resolve: (...args: string[]): string => resolve(cwd(), ...args.map(f => posix(f))),
15
+ join: (root: string, ...args: string[]): string => join(posix(root), ...args.map(f => posix(f))),
16
16
  toNative: (file: string): string => file.replaceAll('/', sep)
17
17
  };
package/src/util.ts CHANGED
@@ -17,7 +17,7 @@ export class ManifestUtil {
17
17
  */
18
18
  static async writeFileWithBuffer(file: string, content: string): Promise<string> {
19
19
  const ext = path.extname(file);
20
- const tempName = `${path.basename(file, ext)}.${process.ppid}.${process.pid}.${Date.now()}.${Math.random()}.${ext}`;
20
+ const tempName = `${path.basename(file, ext)}.${process.ppid}.${process.pid}.${Date.now()}.${Math.random()}${ext}`;
21
21
  await fs.mkdir(path.dirname(file), { recursive: true });
22
22
  const temp = path.resolve(os.tmpdir(), tempName);
23
23
  await fs.writeFile(temp, content, 'utf8');