-
Notifications
You must be signed in to change notification settings - Fork 812
chore(esbuild): build mock-doc with esbuild #5012
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Path | Error Count |
---|---|
src/dev-server/index.ts | 37 |
src/mock-doc/serialize-node.ts | 36 |
src/dev-server/server-process.ts | 32 |
src/compiler/style/test/optimize-css.spec.ts | 23 |
src/compiler/output-targets/dist-lazy/generate-lazy-module.ts | 22 |
src/compiler/prerender/prerender-main.ts | 22 |
src/testing/puppeteer/puppeteer-element.ts | 22 |
src/runtime/client-hydrate.ts | 20 |
src/screenshot/connector-base.ts | 19 |
src/runtime/vdom/vdom-render.ts | 18 |
src/compiler/config/test/validate-paths.spec.ts | 16 |
src/dev-server/request-handler.ts | 15 |
src/compiler/prerender/prerender-optimize.ts | 14 |
src/compiler/sys/stencil-sys.ts | 14 |
src/compiler/transpile/transpile-module.ts | 14 |
src/runtime/vdom/vdom-annotations.ts | 14 |
src/sys/node/node-sys.ts | 14 |
src/compiler/prerender/prerender-queue.ts | 13 |
src/compiler/sys/in-memory-fs.ts | 13 |
src/runtime/connected-callback.ts | 13 |
Our most common errors
Typescript Error Code | Count |
---|---|
TS2345 | 399 |
TS2322 | 374 |
TS18048 | 286 |
TS18047 | 101 |
TS2722 | 37 |
TS2532 | 30 |
TS2531 | 23 |
TS2454 | 14 |
TS2352 | 13 |
TS2790 | 10 |
TS2769 | 8 |
TS2538 | 8 |
TS2416 | 6 |
TS2344 | 5 |
TS2493 | 3 |
TS2488 | 2 |
TS18046 | 2 |
TS2684 | 1 |
TS2430 | 1 |
Unused exports report
There are 14 unused exports on this PR. That's the same number of errors on main, so at least we're not creating new ones!
Unused exports
File | Line | Identifier |
---|---|---|
src/runtime/bootstrap-lazy.ts | 21 | setNonce |
src/screenshot/screenshot-fs.ts | 18 | readScreenshotData |
src/testing/testing-utils.ts | 198 | withSilentWarn |
src/utils/index.ts | 145 | CUSTOM |
src/utils/index.ts | 269 | normalize |
src/utils/index.ts | 7 | escapeRegExpSpecialCharacters |
src/compiler/app-core/app-data.ts | 25 | BUILD |
src/compiler/app-core/app-data.ts | 115 | Env |
src/compiler/app-core/app-data.ts | 117 | NAMESPACE |
src/compiler/fs-watch/fs-watch-rebuild.ts | 123 | updateCacheFromRebuild |
src/compiler/types/validate-primary-package-output-target.ts | 61 | satisfies |
src/compiler/types/validate-primary-package-output-target.ts | 61 | Record |
src/testing/puppeteer/puppeteer-declarations.ts | 485 | WaitForEventOptions |
src/compiler/sys/fetch/write-fetch-success.ts | 7 | writeFetchSuccessSync |
cdcbbb6
to
8ae45fd
Compare
f912ec1
to
27a331e
Compare
20394e5
to
b0a2013
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing I'd personally just like a little clarification on
return runBuilds([esmOptions, cjsOptions], opts); | ||
} | ||
|
||
async function bundleMockDocDts(opts: BuildOptions, inputDir: string, outputDir: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function seems quite different from the Rollup equivalent. How different are the written index.d.ts
files? Also, was index.d.ts-bundled.d.ts
file useless (IIUC, that isn't getting created anymore)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a bunch of manual checking and I believe that the files are the same, i.e. they end up exporting the same types. The function in the Rollup bundle (here) is basically a super manual way to bundle up and 'statically link' (sort of) a .d.ts
file to make it standalone and portable, so it actually reads the files from disk, concatenates things, etc.
Here in the esbuild version I wanted to see if we could achieve the same result using our bundleDts
function which leverages dts-bundle-generator. Instead of being a somewhat 'homemade' solution this is a pretty reliable and tested library.
The reason for not writing a -bundled.d.ts
version here (by passing false
for the useCache
parameter) is because I think for this code we always just want to generate a fresh new index.d.ts
since it's not very expensive to do so and we can just avoid a whole potentially class of bugs that way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, that all makes sense. In that case, I think this is g2g!
02d8f63
to
b6a9835
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The build here is currently broken:
/home/runner/work/stencil/stencil/build/sys/node/worker.js → sys/node/worker.js...
created sys/node/worker.js in 15ms
/home/runner/work/stencil/stencil/scripts/build/bundles/plugins/parse5-plugin.js:54
const fileName = `parse5-${opts.parse5Version.replace(/\./g, '_')}-bundle-cache${opts.isProd ? '.min' : ''}.js`;
^
TypeError: Cannot read properties of undefined (reading 'replace')
at bundleParse5 (/home/runner/work/stencil/stencil/scripts/build/bundles/plugins/parse5-plugin.js:54:51)
at buildMockDoc (/home/runner/work/stencil/stencil/scripts/build/esbuild/mock-doc.js:32:67)
at async Promise.all (index 2)
at async main (/home/runner/work/stencil/stencil/scripts/build/esbuild/build.js:14:5)
78a4d95
to
330e5ff
Compare
Fixed the build issue - the |
205b72f
to
41f2f03
Compare
41f2f03
to
e3c81bf
Compare
This adds support for building the mock-doc top-level-module using esbuild. STENCIL-1009: port mock-doc bundle to esbuild
e3c81bf
to
2da9db6
Compare
In #5012 when we put together a script to build `mock-doc/` with Esbuild we refactored a custom, hand-built `.d.ts` bundler that was used in the Rollup build to instead use `dts-bundle-generator`, a library that we depend on elsewhere. Although in theory a better option for avoiding NIH syndrome the output is just too different, so we want to switch to using the old rollup approach in our new, Esbuild-based build script for `mock-doc/`. To accomplish this we can just export the existing function from the Rollup script and then call it in the Esbuild script. STENCIL-1246
In #5012 when we put together a script to build `mock-doc/` with Esbuild we refactored a custom, hand-built `.d.ts` bundler that was used in the Rollup build to instead use `dts-bundle-generator`, a library that we depend on elsewhere. Although in theory a better option for avoiding NIH syndrome the output is just too different, so we want to switch to using the old rollup approach in our new, Esbuild-based build script for `mock-doc/`. To accomplish this we can just export the existing function from the Rollup script and then call it in the Esbuild script. STENCIL-1246
In #5012 when we put together a script to build `mock-doc/` with Esbuild we refactored a custom, hand-built `.d.ts` bundler that was used in the Rollup build to instead use `dts-bundle-generator`, a library that we depend on elsewhere. Although in theory a better option for avoiding NIH syndrome the output is just too different, so we want to switch to using the old rollup approach in our new, Esbuild-based build script for `mock-doc/`. To accomplish this we can just export the existing function from the Rollup script and then call it in the Esbuild script. STENCIL-1246
In #5012 when we put together a script to build `mock-doc/` with Esbuild we refactored a custom, hand-built `.d.ts` bundler that was used in the Rollup build to instead use `dts-bundle-generator`, a library that we depend on elsewhere. Although in theory a better option for avoiding NIH syndrome the output is just too different, so we want to switch to using the old rollup approach in our new, Esbuild-based build script for `mock-doc/`. To accomplish this we can just export the existing function from the Rollup script and then call it in the Esbuild script. STENCIL-1246
…5624) In #5012 when we put together a script to build `mock-doc/` with Esbuild we refactored a custom, hand-built `.d.ts` bundler that was used in the Rollup build to instead use `dts-bundle-generator`, a library that we depend on elsewhere. Although in theory a better option for avoiding NIH syndrome the output is just too different, so we want to switch to using the old rollup approach in our new, Esbuild-based build script for `mock-doc/`. To accomplish this we can just export the existing function from the Rollup script and then call it in the Esbuild script. STENCIL-1246
This adds support for building the mock-doc top-level-module using esbuild.
What is the current behavior?
GitHub Issue Number: N/A
What is the new behavior?
Does this introduce a breaking change?
Testing
CI passing with both the Rollup- and Esbuild-based builds is a good signal that things are alright here. I also build and packed the project locally and then installed it in a sample project, ensuring that I could then run a basic
stencil test --e2e --spec
without issues.Other information