@travetto/compiler 7.1.2 → 8.0.0-alpha.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/bin/hook.js CHANGED
@@ -1,18 +1,21 @@
1
- import { registerHooks, stripTypeScriptTypes } from 'node:module';
1
+ import module from 'node:module';
2
2
  import { readFileSync } from 'node:fs';
3
3
  import { fileURLToPath } from 'node:url';
4
4
 
5
+ import '@travetto/runtime/support/polyfill.js';
6
+
5
7
  process.setSourceMapsEnabled(true); // Ensure source map during compilation/development
6
8
  process.env.NODE_OPTIONS = `${process.env.NODE_OPTIONS ?? ''} --enable-source-maps`; // Ensure it passes to children
7
9
  const ogEmitWarning = process.emitWarning;
10
+ Error.stackTraceLimit = 50;
8
11
 
9
- registerHooks({
12
+ module.registerHooks({
10
13
  load: (url, context, nextLoad) => {
11
14
  if (/[.]tsx?$/.test(url)) {
12
15
  try {
13
16
  process.emitWarning = () => { }; // Suppress ts-node experimental warnings
14
17
  const source = readFileSync(fileURLToPath(url), 'utf8');
15
- return { format: 'module', source: stripTypeScriptTypes(source), shortCircuit: true };
18
+ return { format: 'module', source: module.stripTypeScriptTypes(source), shortCircuit: true };
16
19
  } finally {
17
20
  process.emitWarning = ogEmitWarning;
18
21
  }
@@ -20,4 +23,4 @@ registerHooks({
20
23
  return nextLoad(url, context);
21
24
  }
22
25
  }
23
- });
26
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/compiler",
3
- "version": "7.1.2",
3
+ "version": "8.0.0-alpha.0",
4
4
  "type": "module",
5
5
  "description": "The compiler infrastructure for the Travetto framework",
6
6
  "keywords": [
@@ -30,12 +30,12 @@
30
30
  "directory": "module/compiler"
31
31
  },
32
32
  "dependencies": {
33
- "@parcel/watcher": "^2.5.4",
34
- "@travetto/manifest": "^7.1.2",
35
- "@travetto/transformer": "^7.1.2"
33
+ "@parcel/watcher": "^2.5.6",
34
+ "@travetto/manifest": "^8.0.0-alpha.0",
35
+ "@travetto/transformer": "^8.0.0-alpha.0"
36
36
  },
37
37
  "peerDependencies": {
38
- "@travetto/cli": "^7.1.3"
38
+ "@travetto/cli": "^8.0.0-alpha.0"
39
39
  },
40
40
  "peerDependenciesMeta": {
41
41
  "@travetto/cli": {
package/src/compiler.ts CHANGED
@@ -157,7 +157,7 @@ export class Compiler {
157
157
 
158
158
  EventUtil.sendEvent('state', { state: 'init', extra: { processId: process.pid } });
159
159
 
160
- const emitter = await this.getCompiler();
160
+ const emitter = this.getCompiler();
161
161
  let failure: Error | undefined;
162
162
 
163
163
  log.debug('Compiler loaded');
package/src/state.ts CHANGED
@@ -306,10 +306,9 @@ export class CompilerState implements CompilerHost {
306
306
  }
307
307
 
308
308
  getSourceFile(sourceFile: string, language: ScriptTarget): SourceFile {
309
- if (!this.#sourceFileObjects.has(sourceFile)) {
309
+ return this.#sourceFileObjects.getOrInsertComputed(sourceFile, () => {
310
310
  const content = this.readFile(sourceFile)!;
311
- this.#sourceFileObjects.set(sourceFile, ts.createSourceFile(sourceFile, content ?? '', language));
312
- }
313
- return this.#sourceFileObjects.get(sourceFile)!;
311
+ return ts.createSourceFile(sourceFile, content ?? '', language);
312
+ });
314
313
  }
315
314
  }
package/src/watch.ts CHANGED
@@ -118,7 +118,7 @@ export class CompilerWatcher {
118
118
  const ignore = await this.#getWatchIgnores();
119
119
  const packageFiles = new Set([
120
120
  'package.json',
121
- ...PACKAGE_MANAGERS.flatMap(x => [...x.otherFiles, x.lock])
121
+ ...PACKAGE_MANAGERS.flatMap(x => [x.workspaceFile!, x.lock].filter(Boolean))
122
122
  ].map(file => path.resolve(this.#root, file)));
123
123
 
124
124
  log.debug('Ignore Globs', ignore);
package/support/invoke.ts CHANGED
@@ -60,7 +60,7 @@ export async function invoke(operation?: string, args: string[] = []): Promise<u
60
60
  case 'manifest': {
61
61
  let manifest = await ManifestUtil.buildManifest(ctx);
62
62
  if (operation === 'manifest:production') {
63
- manifest = await ManifestUtil.createProductionManifest(manifest);
63
+ manifest = ManifestUtil.createProductionManifest(manifest);
64
64
  }
65
65
  if (args[0]) {
66
66
  await ManifestUtil.writeManifestToFile(args[0], manifest);
package/tsconfig.trv.json CHANGED
@@ -1,18 +1,19 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "module": "ES2022",
3
+ "module": "esnext",
4
4
  "target": "esnext",
5
- "moduleResolution": "Bundler",
5
+ "moduleResolution": "bundler",
6
6
  "allowImportingTsExtensions": true,
7
7
  "lib": [
8
- "ES2024",
9
- "ESNext.Collection"
8
+ "ESNext",
10
9
  ],
11
10
  "jsx": "react-jsx",
11
+ "stableTypeOrdering": true,
12
12
  "strict": true,
13
13
  "declaration": true,
14
14
  "declarationMap": true,
15
- "esModuleInterop": true,
15
+ "noUncheckedSideEffectImports": true,
16
+ "libReplacement": false,
16
17
  "strictPropertyInitialization": false,
17
18
  "erasableSyntaxOnly": true,
18
19
  "experimentalDecorators": true,