ionic-team / stencil

A toolchain for building scalable, enterprise-ready component systems on top of TypeScript and Web Component standards. Stencil components can be distributed natively to React, Angular, Vue, and traditional web developers from a single, framework-agnostic codebase.
https://stenciljs.com
Other
12.4k stars 775 forks source link

bug: Generation of src/components.d.ts typing broken in latest build #5859

Closed joewoodhouse closed 3 days ago

joewoodhouse commented 4 days ago

Prerequisites

Stencil Version

4.19.0

Current Behavior

The generated src/components.d.ts file is corrupt, with missing identifiers in the import and export statements. For example:

import { HTMLStencilElement, JSXBase } from "@stencil/core/internal";
import {  as BBox } from "geojson";
export {  as BBox } from "geojson";
export namespace Components {
    interface AppHome {
    }
    interface AppProfile {
        "bbox": BBox;
    }
    interface AppRoot {
    }
}
...

Expected Behavior

The src/components.d.ts file should be built correctly.

If you switch back to @stencil/core@4.18.0 then the issue is no longer present.

System Info

❯ npx stencil info

      System: node 18.18.2
    Platform: darwin (23.5.0)
   CPU Model: Apple M1 Pro (8 cpus)
    Compiler: /Users/joewoodhouse/src/stencil-import-type-issue/node_modules/@stencil/core/compiler/stencil.js
       Build: 1719433468
     Stencil: 4.19.0 🏄
  TypeScript: 5.4.5
      Rollup: 2.56.3
      Parse5: 7.1.2
      jQuery: 4.0.0-pre
      Terser: 5.31.1

Steps to Reproduce

git clone https://github.com/joewoodhouse/stencil-import-types-issue
cd stencil-import-types-issue
npm install
npm run build
cat src/components.d.ts

Code Reproduction URL

https://github.com/joewoodhouse/stencil-import-types-issue

Additional Information

Almost certainly related to this change https://github.com/ionic-team/stencil/commit/7ffb25d259de5b863e7dc3bc43270265cc786557#diff-1079cab98429d9a563cc8bb366896edc0ccf6b1c3e113771acf0ddaa3f52484b

tanner-reits commented 3 days ago

@joewoodhouse I've confirmed the issue here. We'll get a fix up for this ASAP!