@travetto/runtime 7.0.0-rc.3 → 7.0.0-rc.4
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 +3 -1
- package/package.json +1 -1
- package/src/context.ts +10 -1
- package/src/watch.ts +1 -2
package/README.md
CHANGED
|
@@ -37,8 +37,10 @@ class $Runtime {
|
|
|
37
37
|
constructor(idx: ManifestIndex, resourceOverrides?: Record<string, string>);
|
|
38
38
|
/** Get env name, with support for the default env */
|
|
39
39
|
get env(): string | undefined;
|
|
40
|
-
/** Are we in
|
|
40
|
+
/** Are we in production mode */
|
|
41
41
|
get production(): boolean;
|
|
42
|
+
/** Get environment type mode */
|
|
43
|
+
get envType(): 'production' | 'development' | 'test';
|
|
42
44
|
/** Get debug value */
|
|
43
45
|
get debug(): false | string;
|
|
44
46
|
/** Manifest main */
|
package/package.json
CHANGED
package/src/context.ts
CHANGED
|
@@ -32,11 +32,20 @@ class $Runtime {
|
|
|
32
32
|
return Env.TRV_ENV.value || (!this.production ? this.#idx.manifest.workspace.defaultEnv : undefined);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
/** Are we in
|
|
35
|
+
/** Are we in production mode */
|
|
36
36
|
get production(): boolean {
|
|
37
37
|
return process.env.NODE_ENV === 'production';
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
/** Get environment type mode */
|
|
41
|
+
get envType(): 'production' | 'development' | 'test' {
|
|
42
|
+
switch (process.env.NODE_ENV) {
|
|
43
|
+
case 'production': return 'production';
|
|
44
|
+
case 'test': return 'test';
|
|
45
|
+
default: return 'development';
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
40
49
|
/** Get debug value */
|
|
41
50
|
get debug(): false | string {
|
|
42
51
|
const value = Env.DEBUG.value ?? '';
|
package/src/watch.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { ManifestModuleUtil, type ChangeEventType, type ManifestModuleFileType }
|
|
|
3
3
|
import { RuntimeIndex } from './manifest-index.ts';
|
|
4
4
|
import { ShutdownManager } from './shutdown.ts';
|
|
5
5
|
import { Util } from './util.ts';
|
|
6
|
-
import { AppError } from './error.ts';
|
|
7
6
|
|
|
8
7
|
type WatchEvent = { file: string, action: ChangeEventType, output: string, module: string, import: string, time: number };
|
|
9
8
|
|
|
@@ -49,7 +48,7 @@ export async function* watchCompiler(config?: WatchCompilerOptions): AsyncIterab
|
|
|
49
48
|
await client.waitForState(['compile-end', 'watch-start'], undefined, controller.signal);
|
|
50
49
|
|
|
51
50
|
if (!await client.isWatching()) { // If we get here, without a watch
|
|
52
|
-
|
|
51
|
+
await Util.nonBlockingTimeout(maxWindow / (maxIterations * 2));
|
|
53
52
|
} else {
|
|
54
53
|
if (iterations.length) {
|
|
55
54
|
config?.onRestart?.();
|