@travetto/manifest 4.0.0 → 4.0.2
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 +1 -1
- package/package.json +1 -1
- package/src/module.ts +16 -4
- package/src/runtime.ts +1 -1
package/README.md
CHANGED
|
@@ -68,7 +68,7 @@ $ trv main ./doc/lookup.ts
|
|
|
68
68
|
source: './doc/test-class.ts',
|
|
69
69
|
hash: 197152026,
|
|
70
70
|
lines: [ 1, 3 ],
|
|
71
|
-
methods: { doStuff: { hash: 51337554, lines: [
|
|
71
|
+
methods: { doStuff: { hash: 51337554, lines: [ 2, 2 ] } },
|
|
72
72
|
abstract: false,
|
|
73
73
|
synthetic: false
|
|
74
74
|
}
|
package/package.json
CHANGED
package/src/module.ts
CHANGED
|
@@ -26,6 +26,17 @@ const INDEX_FILES = new Set(
|
|
|
26
26
|
const STD_TOP_FOLDERS = new Set(['src', 'bin', 'support']);
|
|
27
27
|
const STD_TOP_FILES = new Set([...INDEX_FILES, 'package.json']);
|
|
28
28
|
|
|
29
|
+
const SUPPORT_FILE_MAP: Record<string, ManifestModuleRole> = {
|
|
30
|
+
transformer: 'compile',
|
|
31
|
+
compile: 'compile',
|
|
32
|
+
test: 'test',
|
|
33
|
+
doc: 'doc',
|
|
34
|
+
pack: 'build',
|
|
35
|
+
FILEld: 'build'
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const SUPPORT_FILE_RE = new RegExp(`^support[/](?<name>${Object.keys(SUPPORT_FILE_MAP).join('|')})[./]`);
|
|
39
|
+
|
|
29
40
|
export class ManifestModuleUtil {
|
|
30
41
|
|
|
31
42
|
static #scanCache: Record<string, string[]> = {};
|
|
@@ -121,9 +132,10 @@ export class ManifestModuleUtil {
|
|
|
121
132
|
* Get file type for a file name
|
|
122
133
|
*/
|
|
123
134
|
static getFileRole(moduleFile: string): ManifestModuleRole | undefined {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
135
|
+
const matched = SUPPORT_FILE_MAP[moduleFile.match(SUPPORT_FILE_RE)?.groups?.name ?? ''];
|
|
136
|
+
if (matched) {
|
|
137
|
+
return matched;
|
|
138
|
+
} else if (moduleFile.startsWith('test/')) {
|
|
127
139
|
return 'test';
|
|
128
140
|
} else if (moduleFile.startsWith('doc/') || /^DOC[.]tsx?$/.test(moduleFile)) {
|
|
129
141
|
return 'doc';
|
|
@@ -144,7 +156,7 @@ export class ManifestModuleUtil {
|
|
|
144
156
|
return 'support/fixtures';
|
|
145
157
|
} else if (moduleFile.startsWith('support/resources/')) {
|
|
146
158
|
return 'support/resources';
|
|
147
|
-
} else if (moduleFile
|
|
159
|
+
} else if (/^support\/transformer[./]/.test(moduleFile)) {
|
|
148
160
|
return '$transformer';
|
|
149
161
|
}
|
|
150
162
|
const key = moduleFile.substring(0, folderLocation);
|
package/src/runtime.ts
CHANGED
|
@@ -115,7 +115,7 @@ class $RuntimeIndex extends ManifestIndex {
|
|
|
115
115
|
|
|
116
116
|
export const RuntimeIndex = new $RuntimeIndex(process.env.TRV_MANIFEST!);
|
|
117
117
|
|
|
118
|
-
const build = <T extends object>(inp: T, props:
|
|
118
|
+
const build = <T extends object, K extends keyof ManifestContext>(inp: T, props: K[]): T & Pick<ManifestContext, K> => {
|
|
119
119
|
for (const prop of props) {
|
|
120
120
|
Object.defineProperty(inp, prop, { configurable: false, get: () => RuntimeIndex.manifest[prop] });
|
|
121
121
|
}
|