@travetto/manifest 7.0.0-rc.2 → 7.0.0-rc.3

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
@@ -43,7 +43,7 @@ Once the manifest is created, the application runtime can now read this manifest
43
43
  * Providing contextual information when provided a filename, import name, etc (e.g. logging, testing output)
44
44
 
45
45
  ## Path Normalization
46
- 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#L9) as an equivalent to [Node](https://nodejs.org)'s [path](https://nodejs.org/api/path.html) library. This allows for consistent behavior across all file-interactions.
46
+ 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#L46) as an equivalent to [Node](https://nodejs.org)'s [path](https://nodejs.org/api/path.html) library. This allows for consistent behavior across all file-interactions.
47
47
 
48
48
  ## Anatomy of a Manifest
49
49
 
@@ -56,7 +56,6 @@ By default, all paths within the framework are assumed to be in a POSIX style, a
56
56
  "path": "<generated>",
57
57
  "mono": true,
58
58
  "manager": "npm",
59
- "type": "commonjs",
60
59
  "defaultEnv": "local"
61
60
  },
62
61
  "build": {
@@ -132,7 +131,6 @@ The general context describes the project-space and any important information fo
132
131
 
133
132
  The context contains:
134
133
  * A generated timestamp
135
- * Module Type: `commonjs`([CommonJS](https://nodejs.org/api/modules.html)) or `module`([Ecmascript Module](https://nodejs.org/api/esm.html))
136
134
  * The main module to execute. (*This primarily pertains to mono-repo support when there are multiple modules in the project*)
137
135
  * The root path of the project/workspace
138
136
  * Whether or not the project is a mono-repo. (*This is determined by using the 'workspaces' field in your [Package JSON](https://docs.npmjs.com/cli/v9/configuring-npm/package-json)*)
package/__index__.ts CHANGED
@@ -9,4 +9,4 @@ export * from './src/types/context.ts';
9
9
  export * from './src/types/package.ts';
10
10
  export * from './src/types/manifest.ts';
11
11
  export * from './src/types/common.ts';
12
- export { path } from './src/path.ts';
12
+ export { default as path } from './src/path.ts';
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@travetto/manifest",
3
- "version": "7.0.0-rc.2",
3
+ "version": "7.0.0-rc.3",
4
+ "type": "module",
4
5
  "description": "Support for project indexing, manifesting, along with file watching",
5
6
  "keywords": [
6
7
  "path",
package/src/context.ts CHANGED
@@ -53,13 +53,17 @@ export function getManifestContext(root: string = process.cwd()): ManifestContex
53
53
  readPackage(resolve(`${process.env.TRV_MODULE}/package.json`)) :
54
54
  findPackage(root, pkg => !!pkg) ?? workspace;
55
55
 
56
+ if (workspace.type !== 'module') {
57
+ console.error('ERROR: Only ESM modules are supported, package.json must be of type module');
58
+ process.exit(1);
59
+ }
60
+
56
61
  return {
57
62
  workspace: {
58
63
  name: workspace.name ?? 'untitled',
59
64
  path: workspace.path,
60
65
  mono: !!workspace.workspaces,
61
66
  manager: existsSync(path.resolve(workspace.path, 'yarn.lock')) ? 'yarn' : 'npm',
62
- type: workspace.type ?? 'commonjs',
63
67
  defaultEnv: workspace.travetto?.defaultEnv ?? 'local'
64
68
  },
65
69
  build: {
package/src/delta.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import fs from 'node:fs/promises';
2
2
 
3
3
  import { ManifestModuleUtil } from './module.ts';
4
- import { path } from './path.ts';
4
+ import path from './path.ts';
5
5
 
6
6
  import type { ManifestModule, ManifestModuleCore, ManifestModuleFile, ManifestRoot } from './types/manifest.ts';
7
7
  import type { ChangeEventType, ManifestModuleFileType, ManifestModuleFolderType } from './types/common.ts';
@@ -1,5 +1,5 @@
1
1
  import { PackageUtil } from './package.ts';
2
- import { path } from './path.ts';
2
+ import path from './path.ts';
3
3
 
4
4
  import type { Package, PackageDependencyType } from './types/package.ts';
5
5
  import type { ManifestContext } from './types/context.ts';
package/src/file.ts CHANGED
@@ -2,7 +2,7 @@ import fs from 'node:fs/promises';
2
2
  import { readFileSync } from 'node:fs';
3
3
  import os from 'node:os';
4
4
 
5
- import { path } from './path.ts';
5
+ import path from './path.ts';
6
6
 
7
7
  export class ManifestFileUtil {
8
8
  /**
@@ -1,7 +1,7 @@
1
1
  import { existsSync } from 'node:fs';
2
2
 
3
3
  import { ManifestModuleUtil } from './module.ts';
4
- import { path } from './path.ts';
4
+ import path from './path.ts';
5
5
  import { ManifestUtil } from './util.ts';
6
6
 
7
7
  import type { ManifestModule, ManifestRoot, ManifestModuleFile, IndexedModule, IndexedFile, FindConfig } from './types/manifest.ts';
package/src/module.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import fs from 'node:fs/promises';
2
2
 
3
- import { path } from './path.ts';
3
+ import path from './path.ts';
4
4
  import { PackageModuleVisitor } from './dependencies.ts';
5
5
 
6
6
  import type { ManifestModuleFileType, ManifestModuleRole, ManifestModuleFolderType } from './types/common.ts';
@@ -18,7 +18,7 @@ const EXT_MAPPING: Record<string, ManifestModuleFileType> = {
18
18
  };
19
19
 
20
20
  const INDEX_FILES = new Set(
21
- ['__index__', '__index', 'index', 'jsx-runtime'].flatMap(file =>
21
+ ['__index__', '__index', 'index'].flatMap(file =>
22
22
  ['ts', 'tsx', 'js'].map(ext => `${file}.${ext}`)
23
23
  )
24
24
  );
package/src/package.ts CHANGED
@@ -2,7 +2,7 @@ import { createRequire } from 'node:module';
2
2
  import { execSync } from 'node:child_process';
3
3
  import { existsSync } from 'node:fs';
4
4
 
5
- import { path } from './path.ts';
5
+ import path from './path.ts';
6
6
  import { ManifestFileUtil } from './file.ts';
7
7
 
8
8
  import { PackagePathSymbol, type Package, type PackageWorkspaceEntry } from './types/package.ts';
package/src/path.ts CHANGED
@@ -6,8 +6,8 @@ const toPosix = (file: string): string => file.replaceAll('\\', '/');
6
6
  const toNative = (file: string): string => file.replace(/[\/]/g, native.sep);
7
7
  const cwd = (): string => toPosix(process.cwd());
8
8
 
9
- export const path: posix.PlatformPath & {
10
- native: posix.PlatformPath;
9
+ const path: typeof posix & {
10
+ native: typeof posix;
11
11
  toPosix: typeof toPosix;
12
12
  toNative: typeof toNative;
13
13
  } = {
@@ -1,4 +1,3 @@
1
- export type NodeModuleType = 'module' | 'commonjs';
2
1
  export type NodePackageManager = 'yarn' | 'npm';
3
2
 
4
3
  export type ManifestModuleFileType = 'typings' | 'ts' | 'js' | 'json' | 'package-json' | 'unknown' | 'fixture' | 'md';
@@ -1,4 +1,4 @@
1
- import type { NodeModuleType, NodePackageManager } from './common.ts';
1
+ import type { NodePackageManager } from './common.ts';
2
2
 
3
3
  export type ManifestContext = {
4
4
  workspace: {
@@ -8,8 +8,6 @@ export type ManifestContext = {
8
8
  name: string;
9
9
  /** Is the workspace a monorepo? */
10
10
  mono?: boolean;
11
- /** The module type of the workspace */
12
- type: NodeModuleType;
13
11
  /** The package manager of the workspace */
14
12
  manager: NodePackageManager;
15
13
  /** The default env name */
@@ -1,4 +1,4 @@
1
- import type { ManifestModuleRole, NodeModuleType } from './common.ts';
1
+ import type { ManifestModuleRole } from './common.ts';
2
2
  import type { ManifestContext } from './context.ts';
3
3
 
4
4
  export const PackagePathSymbol = Symbol.for('@travetto/manifest:package-path');
@@ -6,7 +6,7 @@ export const PackagePathSymbol = Symbol.for('@travetto/manifest:package-path');
6
6
  export type Package = {
7
7
  [PackagePathSymbol]?: string;
8
8
  name: string;
9
- type?: NodeModuleType;
9
+ type?: string;
10
10
  version: string;
11
11
  description?: string;
12
12
  license?: string;
package/src/util.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { path } from './path.ts';
1
+ import path from './path.ts';
2
2
  import { ManifestModuleUtil } from './module.ts';
3
3
  import { ManifestFileUtil } from './file.ts';
4
4
  import { PackageUtil } from './package.ts';