Skip to content

Commit

Permalink
cleanup after landing #1238
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed May 6, 2021
1 parent 7c3ff95 commit 53f6048
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Unreleased

* Allow esbuild to be restarted in Deno ([#1238](https://github.com/evanw/esbuild/pull/1238))

The esbuild API for [Deno](https://deno.land) has an extra function called `stop()` that doesn't exist in esbuild's API for node. This is because Deno doesn't provide a way to stop esbuild automatically, so calling `stop()` is required to allow Deno to exit. However, once stopped the esbuild API could not be restarted.

With this release, you can now continue to use esbuild after calling `stop()`. This will restart esbuild's API and means that you will need to call `stop()` again for Deno to be able to exit. This feature was contributed by [@lucacasonato](https://github.com/lucacasonato).

* Fix code generation with `declare` class fields ([#1242](https://github.com/evanw/esbuild/issues/1242))

This fixes a bug with TypeScript code that uses `declare` on a class field and your `tsconfig.json` file has `"useDefineForClassFields": true`. Fields marked as `declare` should not be defined in the generated code, but they were incorrectly being declared as `undefined`. These fields are now correctly omitted from the generated code.
Expand Down
23 changes: 16 additions & 7 deletions scripts/deno-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as path from 'https://deno.land/[email protected]/path/mod.ts'
import * as asserts from 'https://deno.land/[email protected]/testing/asserts.ts'

const rootTestDir = path.join(path.dirname(path.fromFileUrl(import.meta.url)), '.deno-tests')
let testDidFail = false

try {
Deno.removeSync(rootTestDir, { recursive: true })
Expand All @@ -17,20 +18,28 @@ function test(name, fn) {
await Deno.mkdir(testDir, { recursive: true })
try {
await fn({ testDir })
} finally {
await Deno.remove(testDir, { recursive: true }).catch(() => null)
} catch (e) {
testDidFail = true
throw e
} finally {
esbuild.stop()
}
})
}

window.addEventListener("unload", () => {
try {
Deno.removeSync(rootTestDir, { recursive: true })
} catch {
// root test dir possibly already removed, so ignore
window.addEventListener("unload", (e) => {
if (testDidFail) {
console.error(`❌ deno tests failed`)
} else {
console.log(`✅ deno tests passed`)
try {
Deno.removeSync(rootTestDir, { recursive: true })
} catch {
// root test dir possibly already removed, so ignore
}
}
})
})

test("basicBuild", async ({ testDir }) => {
const input = path.join(testDir, 'in.ts')
Expand Down

0 comments on commit 53f6048

Please sign in to comment.