microsoft / rushstack

Monorepo for tools developed by the Rush Stack community
https://rushstack.io/
Other
5.85k stars 594 forks source link

[heft] typescript plugin does not work with Typescript 5.6.2 #4921

Open UberMouse opened 3 weeks ago

UberMouse commented 3 weeks ago

Summary

Just attempted to upgrade to Typescript v5.6.2 Unfortunately something has changed in the typescript internals and now the heft-typescript-plugin crashes when attempting to do a build with the error builderProgram.getState is not a function

Repro steps

  1. Install latest Heft
  2. Install latest heft-typescript-plugin
  3. Configure a typescript build phase
  4. Run heft build

    Standard questions

    Please answer these questions to help us investigate your issue more quickly:

    Question Answer
    @rushstack/heft version? 0.66.18 / @rushstack/heft-typescript-plugin 0.5.0
    Operating system? Linux
    Would you consider contributing a PR? No
    Node.js version (node -v)? v20.15.1
iclanton commented 1 week ago

@dmichon-msft - Can you take a look at this?

dmichon-msft commented 1 week ago

You can get a stack trace from heft --debug build. Likely there have been some breaking changes to internals that we'll have to reconcile.

UberMouse commented 1 week ago

Here's a --debug build


heft --debug build --production --clean
Searching for a locally installed version of Heft. Use the "--unmanaged" flag if you want to avoid this.
Config file "/home/taylorl/code/kawaka/packages/embeds/browse-data/config/heft.json" does not exist. Attempting to load via rig.
Project: @kx/browse-data@1.0.0
Project build folder: /home/taylorl/code/kawaka/packages/embeds/browse-data
Rig package: @kx/rush-rig
Rig profile: web
Heft version: 0.66.18
Node version: v20.15.1

[lifecycle] Applying plugins
[lifecycle] Starting clean
[lifecycle] Finished clean (0.08194499999996196ms)
Executing a maximum of 4 simultaneous tasks...
 ---- build started ----
[build] Applying plugins
[build:pre-compile-copy] Loaded plugin from "/home/taylorl/code/kawaka/common/temp/node_modules/.pnpm/@rushstack+heft@0.66.18_@types+node@20.16.0/node_modules/@rushstack/heft/lib/plugins/CopyFilesPlugin"
[build:typescript] Loaded plugin from "/home/taylorl/code/kawaka/common/temp/node_modules/.pnpm/@rushstack+heft-typescript-plugin@0.5.0/node_modules/@rushstack/heft-typescript-plugin/lib/TypeScriptPlugin"
[build:fix-paths] Loaded plugin from "/home/taylorl/code/kawaka/packages/rush/heft-plugins/lib/tsconfigReplacePathsPlugin"
[build:clean] Starting clean
[build:clean] Deleted folder "/home/taylorl/code/kawaka/packages/embeds/browse-data/temp/build".
[build:clean] Deleted folder "/home/taylorl/code/kawaka/packages/embeds/browse-data/dist-cjs".
[build:clean] Deleted folder "/home/taylorl/code/kawaka/packages/embeds/browse-data/dist".
[build:clean] Deleted 0 files and 3 folders
[build:clean] Finished clean (72.44333ms)
[build:typescript] Config file "/home/taylorl/code/kawaka/packages/embeds/browse-data/config/typescript.json" does not exist. Attempting to load via rig.
[build:typescript] Starting task execution
[build:typescript] Looking for tsconfig at /home/taylorl/code/kawaka/packages/embeds/browse-data/tsconfig.json
[build:typescript] Resolved "typescript" as a direct devDependency of the project.
[build:typescript] The TypeScript compiler version 5.6.2 is newer than the latest version that was tested with Heft (5.4); it may not work correctly.
[build:typescript] Using TypeScript version 5.6.2
[build:typescript] Configure: 18.957778000000076ms
[build:typescript] Error: builderProgram.getState is not a function
[build:typescript] TypeError: builderProgram.getState is not a function
[build:typescript]     at getFilesToTranspileFromBuilderProgram (/home/taylorl/code/kawaka/common/temp/node_modules/.pnpm/@rushstack+heft-typescript-plugin@0.5.0/node_modules/@rushstack/heft-typescript-plugin/lib/TypeScriptBuilder.js:785:44)
[build:typescript]     at TypeScriptBuilder._runBuildAsync (/home/taylorl/code/kawaka/common/temp/node_modules/.pnpm/@rushstack+heft-typescript-plugin@0.5.0/node_modules/@rushstack/heft-typescript-plugin/lib/TypeScriptBuilder.js:256:32)
[build:typescript]     at TypeScriptBuilder.invokeAsync (/home/taylorl/code/kawaka/common/temp/node_modules/.pnpm/@rushstack+heft-typescript-plugin@0.5.0/node_modules/@rushstack/heft-typescript-plugin/lib/TypeScriptBuilder.js:183:24)
[build:typescript]     at async /home/taylorl/code/kawaka/common/temp/node_modules/.pnpm/@rushstack+heft-typescript-plugin@0.5.0/node_modules/@rushstack/heft-typescript-plugin/lib/TypeScriptPlugin.js:144:17
[build:typescript] Finished task execution (5518.660801ms)
-------------------- Failed (5.648s) --------------------
Encountered 1 error
  [build:typescript] builderProgram.getState is not a function

Error: An error occurred.
    at runWithLoggingAsync (/home/taylorl/code/kawaka/common/temp/node_modules/.pnpm/@rushstack+heft@0.66.18_@types+node@20.16.0/node_modules/@rushstack/heft/lib/cli/HeftActionRunner.js:109:15)
    at async HeftActionRunner._executeOnceAsync (/home/taylorl/code/kawaka/common/temp/node_modules/.pnpm/@rushstack+heft@0.66.18_@types+node@20.16.0/node_modules/@rushstack/heft/lib/cli/HeftActionRunner.js:259:16)
    at async HeftActionRunner.executeAsync (/home/taylorl/code/kawaka/common/temp/node_modules/.pnpm/@rushstack+heft@0.66.18_@types+node@20.16.0/node_modules/@rushstack/heft/lib/cli/HeftActionRunner.js:223:17)
    at async PhaseAction.onExecute (/home/taylorl/code/kawaka/common/temp/node_modules/.pnpm/@rushstack+heft@0.66.18_@types+node@20.16.0/node_modules/@rushstack/heft/lib/cli/actions/PhaseAction.js:32:9)
    at async HeftCommandLineParser.onExecute (/home/taylorl/code/kawaka/common/temp/node_modules/.pnpm/@rushstack+ts-command-line@4.22.0_@types+node@20.16.0/node_modules/@rushstack/ts-command-line/lib/providers/CommandLineParser.js:268:13)
    at async HeftCommandLineParser.onExecute (/home/taylorl/code/kawaka/common/temp/node_modules/.pnpm/@rushstack+heft@0.66.18_@types+node@20.16.0/node_modules/@rushstack/heft/lib/cli/HeftCommandLineParser.js:142:13)
    at async HeftCommandLineParser.executeWithoutErrorHandlingAsync (/home/taylorl/code/kawaka/common/temp/node_modules/.pnpm/@rushstack+ts-command-line@4.22.0_@types+node@20.16.0/node_modules/@rushstack/ts-command-line/lib/providers/CommandLineParser.js:212:13)
    at async HeftCommandLineParser.executeAsync (/home/taylorl/code/kawaka/common/temp/node_modules/.pnpm/@rushstack+ts-command-line@4.22.0_@types+node@20.16.0/node_modules/@rushstack/ts-command-line/lib/providers/CommandLineParser.js:98:13)
    at async HeftCommandLineParser.executeAsync (/home/taylorl/code/kawaka/common/temp/node_modules/.pnpm/@rushstack+heft@0.66.18_@types+node@20.16.0/node_modules/@rushstack/heft/lib/cli/HeftCommandLineParser.js:117:20)```