@travetto/compiler 3.4.0-rc.5 → 3.4.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 +1 -1
- package/bin/trvc.js +9 -8
- package/package.json +5 -5
- package/support/entry.trvc.ts +2 -2
- package/support/server/server.ts +1 -7
- package/support/setup.ts +2 -2
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ The compiler cli supports the following operations:
|
|
|
30
30
|
* `build` - Ensure the project is built and upto date
|
|
31
31
|
* `clean` - Clean out the output and compiler caches
|
|
32
32
|
* `info` - Retrieve the compiler information, if running
|
|
33
|
-
* `manifest` - Generate the project manifest
|
|
33
|
+
* `manifest [output] [prod]` - Generate the project manifest
|
|
34
34
|
In addition to the normal output, the compiler supports an environment variable `TRV_BUILD` that supports the following values: `debug`, `info`, `warn` or `none`. This provides different level of logging during the build process which is helpful to diagnose any odd behaviors. When invoking an unknown command (e.g. `<other>` from above), the default level is `warn`. Otherwise the default logging level is `info`.
|
|
35
35
|
|
|
36
36
|
**Terminal: Sample trv output with debug logging**
|
package/bin/trvc.js
CHANGED
|
@@ -7,17 +7,18 @@ const help = () => [
|
|
|
7
7
|
'npx trvc [command]',
|
|
8
8
|
'',
|
|
9
9
|
'Available Commands:',
|
|
10
|
-
' * start|watch
|
|
11
|
-
' * stop
|
|
12
|
-
' * restart
|
|
13
|
-
' * build
|
|
14
|
-
' * clean
|
|
15
|
-
' * info
|
|
16
|
-
' * manifest
|
|
10
|
+
' * start|watch - Run the compiler in watch mode',
|
|
11
|
+
' * stop - Stop the compiler if running',
|
|
12
|
+
' * restart - Restart the compiler in watch mode',
|
|
13
|
+
' * build - Ensure the project is built and upto date',
|
|
14
|
+
' * clean - Clean out the output and compiler caches',
|
|
15
|
+
' * info - Retrieve the compiler information, if running',
|
|
16
|
+
' * manifest [output] [prod] - Generate the project manifest',
|
|
17
17
|
].join('\n');
|
|
18
18
|
|
|
19
19
|
getEntry().then(async (ops) => {
|
|
20
20
|
const [op, ...args] = process.argv.slice(2);
|
|
21
|
+
const baseArgs = args.filter(x => !x.startsWith('-'));
|
|
21
22
|
|
|
22
23
|
switch (op) {
|
|
23
24
|
case undefined:
|
|
@@ -26,7 +27,7 @@ getEntry().then(async (ops) => {
|
|
|
26
27
|
case 'stop': return ops.stop();
|
|
27
28
|
case 'info': return ops.info().then(v => console.log(JSON.stringify(v, null, 2)));
|
|
28
29
|
case 'clean': return ops.clean();
|
|
29
|
-
case 'manifest': return ops.manifest(
|
|
30
|
+
case 'manifest': return ops.manifest(baseArgs[0], /prod/i.test(baseArgs[1] ?? ''));
|
|
30
31
|
case 'start': return ops.compile('watch');
|
|
31
32
|
case 'watch':
|
|
32
33
|
case 'build': return ops.compile(op);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/compiler",
|
|
3
|
-
"version": "3.4.0
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "The compiler infrastructure for the Travetto framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compiler",
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@parcel/watcher": "^2.3.0",
|
|
34
|
-
"@travetto/manifest": "^3.4.0
|
|
35
|
-
"@travetto/terminal": "^3.4.0
|
|
36
|
-
"@travetto/transformer": "^3.4.0
|
|
34
|
+
"@travetto/manifest": "^3.4.0",
|
|
35
|
+
"@travetto/terminal": "^3.4.0",
|
|
36
|
+
"@travetto/transformer": "^3.4.0",
|
|
37
37
|
"@types/node": "^20.8.10"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@travetto/cli": "^3.4.0
|
|
40
|
+
"@travetto/cli": "^3.4.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependenciesMeta": {
|
|
43
43
|
"@travetto/cli": {
|
package/support/entry.trvc.ts
CHANGED
|
@@ -63,9 +63,9 @@ export const main = (root: ManifestContext, ctx: ManifestContext) => {
|
|
|
63
63
|
},
|
|
64
64
|
|
|
65
65
|
/** Manifest entry point */
|
|
66
|
-
async manifest(
|
|
66
|
+
async manifest(output?: string, prod?: boolean): Promise<void> {
|
|
67
67
|
await ops.compile('run', true);
|
|
68
|
-
await CompilerSetup.exportManifest(ctx,
|
|
68
|
+
await CompilerSetup.exportManifest(ctx, output, prod); return;
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
71
|
return ops;
|
package/support/server/server.ts
CHANGED
|
@@ -146,13 +146,7 @@ export class CompilerServer {
|
|
|
146
146
|
case 'stop': out = await this.close(); break;
|
|
147
147
|
case 'clean': out = await this.#clean(); break;
|
|
148
148
|
case 'info':
|
|
149
|
-
default: {
|
|
150
|
-
out = this.info ?? {};
|
|
151
|
-
if (req.url?.includes('?env')) {
|
|
152
|
-
Object.assign(out!, { env: process.env });
|
|
153
|
-
}
|
|
154
|
-
break;
|
|
155
|
-
}
|
|
149
|
+
default: out = this.info ?? {}; break;
|
|
156
150
|
}
|
|
157
151
|
res.end(JSON.stringify(out));
|
|
158
152
|
}
|
package/support/setup.ts
CHANGED
|
@@ -146,12 +146,12 @@ export class CompilerSetup {
|
|
|
146
146
|
/**
|
|
147
147
|
* Export manifest
|
|
148
148
|
*/
|
|
149
|
-
static async exportManifest(ctx: ManifestContext, output?: string,
|
|
149
|
+
static async exportManifest(ctx: ManifestContext, output?: string, prod?: boolean): Promise<void> {
|
|
150
150
|
const { ManifestUtil } = await this.#importManifest(ctx);
|
|
151
151
|
let manifest = await ManifestUtil.buildManifest(ctx);
|
|
152
152
|
|
|
153
153
|
// If in prod mode, only include std modules
|
|
154
|
-
if (
|
|
154
|
+
if (prod) {
|
|
155
155
|
manifest = ManifestUtil.createProductionManifest(manifest);
|
|
156
156
|
}
|
|
157
157
|
if (output) {
|