Skip to content
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

chore(deps): update to esbuild 0.14.3 #5861

Merged
merged 10 commits into from
Dec 29, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/guide/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ But a few libraries haven't transitioned to this new default yet, including [`li

- [`extends`](https://www.typescriptlang.org/tsconfig#extends)
- [`importsNotUsedAsValues`](https://www.typescriptlang.org/tsconfig#importsNotUsedAsValues)
- [`preserveValueImports`](https://www.typescriptlang.org/tsconfig#preserveValueImports)
- [`jsxFactory`](https://www.typescriptlang.org/tsconfig#jsxFactory)
- [`jsxFragmentFactory`](https://www.typescriptlang.org/tsconfig#jsxFragmentFactory)

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"chalk": "^4.1.2",
"conventional-changelog-cli": "^2.1.1",
"cross-env": "^7.0.3",
"esbuild": "^0.13.12",
"esbuild": "~0.14.0",
patak-dev marked this conversation as resolved.
Show resolved Hide resolved
"eslint": "^8.3.0",
"eslint-define-config": "^1.1.4",
"eslint-plugin-node": "^11.1.0",
Expand All @@ -58,7 +58,7 @@
"sirv": "^1.0.18",
"ts-jest": "^27.0.7",
"ts-node": "^10.4.0",
"typescript": "~4.4.4",
"typescript": "~4.5.2",
"vite": "workspace:*",
"vitepress": "^0.20.1",
"yorkie": "^2.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/create-vite/template-lit-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
},
"devDependencies": {
"vite": "^2.6.13",
"typescript": "^4.4.4"
"typescript": "^4.5.2"
}
}
2 changes: 1 addition & 1 deletion packages/create-vite/template-preact-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"devDependencies": {
"@preact/preset-vite": "^2.1.5",
"typescript": "^4.4.4",
"typescript": "^4.5.2",
"vite": "^2.6.13"
}
}
2 changes: 1 addition & 1 deletion packages/create-vite/template-react-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@types/react": "^17.0.33",
"@types/react-dom": "^17.0.10",
"@vitejs/plugin-react": "^1.0.7",
"typescript": "^4.4.4",
"typescript": "^4.5.2",
"vite": "^2.6.13"
}
}
2 changes: 1 addition & 1 deletion packages/create-vite/template-svelte-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"svelte-check": "^2.2.7",
"svelte-preprocess": "^4.9.8",
"tslib": "^2.3.1",
"typescript": "^4.4.4",
"typescript": "^4.5.2",
"vite": "^2.6.13"
}
}
2 changes: 1 addition & 1 deletion packages/create-vite/template-vanilla-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"preview": "vite preview"
},
"devDependencies": {
"typescript": "^4.4.4",
"typescript": "^4.5.2",
"vite": "^2.6.13"
}
}
2 changes: 1 addition & 1 deletion packages/create-vite/template-vue-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"devDependencies": {
"@vitejs/plugin-vue": "^1.9.4",
"typescript": "^4.4.4",
"typescript": "^4.5.2",
"vite": "^2.6.13",
"vue-tsc": "^0.28.10"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('transformWithEsbuild', () => {
})
// "importsNotUsedAsValues": "preserve" from tsconfig.json should still work
expect(result.code).toContain(
'import { MainTypeOnlyClass } from "./not-used-type";'
'import "./not-used-type";'
)
})

Expand All @@ -49,7 +49,27 @@ describe('transformWithEsbuild', () => {
// "importsNotUsedAsValues": "preserve" from tsconfig.json should not be read
// and defaults to "remove"
expect(result.code).not.toContain(
'import "./not-used-type";'
)
})

/* TODO: preserveValueImports isn't in the types definition in esbuild yet

test('preserveValueImports', async () => {
patak-dev marked this conversation as resolved.
Show resolved Hide resolved
const main = path.resolve(__dirname, '../src/main.ts')
const mainContent = fs.readFileSync(main, 'utf-8')
const result = await transformWithEsbuild(mainContent, main, {
tsconfigRaw: {
compilerOptions: {
useDefineForClassFields: false,
preserveValueImports: true
}
}
})
// "importsNotUsedAsValues": "preserve" from tsconfig.json should still work
expect(result.code).toContain(
'import { MainTypeOnlyClass } from "./not-used-type";'
)
})
*/
})
2 changes: 1 addition & 1 deletion packages/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
},
"//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
"dependencies": {
"esbuild": "^0.13.12",
"esbuild": "~0.14.0",
"postcss": "^8.3.11",
"resolve": "^1.20.0",
"rollup": "^2.59.0"
Expand Down
12 changes: 7 additions & 5 deletions packages/vite/src/node/plugins/esbuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type TSConfigJSON = {
jsxFragmentFactory?: string
useDefineForClassFields?: boolean
importsNotUsedAsValues?: 'remove' | 'preserve' | 'error'
preserveValueImports?: boolean
}
[key: string]: any
}
Expand Down Expand Up @@ -81,7 +82,8 @@ export async function transformWithEsbuild(
'jsxFactory',
'jsxFragmentFactory',
'useDefineForClassFields',
'importsNotUsedAsValues'
'importsNotUsedAsValues',
'preserveValueImports'
]
const compilerOptionsForFile: TSCompilerOptions = {}
if (loader === 'ts' || loader === 'tsx') {
Expand Down Expand Up @@ -240,10 +242,10 @@ export const buildEsbuildPlugin = (config: ResolvedConfig): Plugin => {
target: target || undefined,
...(minify
? {
minify,
treeShaking: true,
format: rollupToEsbuildFormatMap[opts.format]
}
minify,
treeShaking: true,
format: rollupToEsbuildFormatMap[opts.format]
}
: undefined)
})
return res
Expand Down
Loading