Skip to content

Commit

Permalink
feat: upgrade esbuild to 0.16.0 (#279)
Browse files Browse the repository at this point in the history
Upgrade esbuild to the `0.16.0` version line. To stay on the previous release, define an [override](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#overrides)/[resolution](https://classic.yarnpkg.com/lang/en/docs/selective-version-resolutions/) according to your package manager.

As always, this new esbuild release contains some backwards incompatible changes. Please carefully read the [esbuild v0.16.0 release notes](https://github.com/evanw/esbuild/releases/tag/v0.16.0) to migrate. See all recent [esbuild release notes](https://github.com/evanw/esbuild/releases) for a detailed update on all new features.
  • Loading branch information
mrgrain authored Dec 18, 2022
1 parent 162e386 commit 20bdefa
Show file tree
Hide file tree
Showing 7 changed files with 682 additions and 647 deletions.
2 changes: 1 addition & 1 deletion .projen/deps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 20 additions & 1 deletion .projenrc.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { awscdk, github, javascript, release, vscode } from 'projen';
import { SourceFile } from 'ts-morph';
import { GetAccessorDeclaration, SourceFile, SyntaxKind } from 'ts-morph';
import { tagOnNpm, TypeScriptSourceFile } from './projenrc';
import { Esbuild } from './src/esbuild-source';

Expand Down Expand Up @@ -254,8 +254,27 @@ new TypeScriptSourceFile(project, 'src/esbuild-types.ts', {
properties.forEach(property => interfaceDeclaration?.getProperty(property)?.remove());
};

const convertAccessors = (name: string) => {
const interfaceObj = esbuildTypes.getInterface(name);
if (interfaceObj) {
const structure = interfaceObj.getStructure();
const getters = interfaceObj.getMembers().filter(m => m.getKind() === SyntaxKind.GetAccessor);
for (const getter of getters) {
structure.properties?.push({
name: (getter as unknown as GetAccessorDeclaration).getName(),
type: (getter as unknown as GetAccessorDeclaration).getReturnType().getText(),
docs: (getter as unknown as GetAccessorDeclaration).getJsDocs().map(d => d.getStructure()),
});
}

interfaceObj.remove();
esbuildTypes.addInterface(structure);
}
};


['CommonOptions', 'BuildOptions', 'TransformOptions'].forEach(readonlyInterface);
['OutputFile'].forEach(convertAccessors);
removeFromInterface('BuildOptions', ['entryPoints', 'stdin', 'plugins', 'watch']);
esbuildTypes.getInterface('CommonOptions')?.getProperty('mangleProps')?.setType('any');
esbuildTypes.getInterface('CommonOptions')?.getProperty('reserveProps')?.setType('any');
Expand Down
12 changes: 12 additions & 0 deletions API.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 20bdefa

Please sign in to comment.