@travetto/manifest 3.0.2-rc.0 → 3.0.2-rc.1
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 +4 -0
- package/package.json +1 -1
- package/src/watch.ts +10 -1
- package/support/transformer.function-metadata.ts +5 -7
package/README.md
CHANGED
package/package.json
CHANGED
package/src/watch.ts
CHANGED
|
@@ -32,6 +32,10 @@ export type WatchConfig = {
|
|
|
32
32
|
* Include files that start with '.'
|
|
33
33
|
*/
|
|
34
34
|
includeHidden?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Should watching prevent normal exiting, until watch is removed?
|
|
37
|
+
*/
|
|
38
|
+
persistent?: boolean;
|
|
35
39
|
};
|
|
36
40
|
|
|
37
41
|
/**
|
|
@@ -46,7 +50,7 @@ export async function watchFolderImmediate(
|
|
|
46
50
|
options: WatchConfig = {}
|
|
47
51
|
): Promise<() => Promise<void>> {
|
|
48
52
|
const watchPath = path.resolve(folder);
|
|
49
|
-
const watcher = watch(watchPath, { persistent:
|
|
53
|
+
const watcher = watch(watchPath, { persistent: options.persistent, encoding: 'utf8' });
|
|
50
54
|
const lastStats: Record<string, Stats | undefined> = {};
|
|
51
55
|
const invalidFilter = (el: string): boolean =>
|
|
52
56
|
(el === '.' || el === '..' || (!options.includeHidden && el.startsWith('.')) || !!options.ignore?.includes(el));
|
|
@@ -130,6 +134,11 @@ export async function watchFolders(
|
|
|
130
134
|
let finalProm: Promise<void> | undefined;
|
|
131
135
|
const remove = (): Promise<void> => finalProm ??= Promise.all(subs.map(x => x?.unsubscribe())).then(() => { });
|
|
132
136
|
|
|
137
|
+
// Cleanup on intent to exit
|
|
138
|
+
if (!config.persistent) {
|
|
139
|
+
process.on('SIGUSR2', remove);
|
|
140
|
+
}
|
|
141
|
+
|
|
133
142
|
// Cleanup on exit
|
|
134
143
|
process.on('exit', remove);
|
|
135
144
|
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
|
|
8
8
|
const MANIFEST_MOD = '@travetto/manifest';
|
|
9
9
|
const MANIFEST_IDX = `${MANIFEST_MOD}/__index__`;
|
|
10
|
+
const ENTRY_POINT = 'support/entry';
|
|
10
11
|
|
|
11
12
|
const ROOT_IDX_IMPORT = `${MANIFEST_MOD}/src/root-index`;
|
|
12
13
|
const ROOT_IDX_CLS = 'RootIndex';
|
|
@@ -30,13 +31,10 @@ interface MetadataInfo {
|
|
|
30
31
|
*/
|
|
31
32
|
export class RegisterTransformer {
|
|
32
33
|
|
|
33
|
-
static #valid(
|
|
34
|
-
return !
|
|
35
|
-
(
|
|
36
|
-
|
|
37
|
-
!state.importName.includes('/support/') &&
|
|
38
|
-
state.importName !== MANIFEST_IDX
|
|
39
|
-
);
|
|
34
|
+
static #valid({ importName: imp }: TransformerState): boolean {
|
|
35
|
+
return !imp.startsWith(MANIFEST_MOD) ?
|
|
36
|
+
!imp.includes(ENTRY_POINT) :
|
|
37
|
+
!(/[/](src|support)[/]/.test(imp) || imp === MANIFEST_IDX);
|
|
40
38
|
}
|
|
41
39
|
|
|
42
40
|
/**
|