Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@babel/polyfill": "^7.0.0",
"asyncro": "^3.0.0",
"autoprefixer": "^9.0.0",
"babel-plugin-transform-async-to-promises": "^0.8.1",
"babel-plugin-transform-async-to-promises": "^0.8.3",
"brotli-size": "^0.0.3",
"camelcase": "^5.0.0",
"chalk": "^2.4.0",
Expand Down
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ function createConfig(options, entry, format, writeMeta) {
},
tsconfigOverride: {
compilerOptions: {
target: 'es2017',
target: 'esnext',
},
},
}),
Expand All @@ -384,6 +384,7 @@ function createConfig(options, entry, format, writeMeta) {
// supplied configurations we set this option to false. Note
// that we never supported using custom babel configs anyway.
babelrc: false,
extensions: ['.ts', '.tsx', '.js', '.jsx', '.es6', '.es', '.mjs'],
exclude: 'node_modules/**',
plugins: [
require.resolve('@babel/plugin-syntax-jsx'),
Expand Down
70 changes: 64 additions & 6 deletions test/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,63 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`fixtures async-iife-ts 1`] = `
"Used script: microbundle

Directory tree:

async-iife-ts
dist
async-iife-ts.js
async-iife-ts.js.map
async-iife-ts.mjs
async-iife-ts.mjs.map
async-iife-ts.umd.js
async-iife-ts.umd.js.map
index.d.ts
package.json
src
index.ts
tsconfig.json


Build \\"asyncIifeTs\\" to dist:
93 B: async-iife-ts.js.gz
74 B: async-iife-ts.js.br
93 B: async-iife-ts.mjs.gz
74 B: async-iife-ts.mjs.br
164 B: async-iife-ts.umd.js.gz
123 B: async-iife-ts.umd.js.br"
`;

exports[`fixtures async-ts 1`] = `
"Used script: microbundle

Directory tree:

async-ts
dist
async-ts.js
async-ts.js.map
async-ts.mjs
async-ts.mjs.map
async-ts.umd.js
async-ts.umd.js.map
index.d.ts
package.json
src
index.ts
tsconfig.json


Build \\"asyncTs\\" to dist:
158 B: async-ts.js.gz
122 B: async-ts.js.br
160 B: async-ts.mjs.gz
128 B: async-ts.mjs.br
245 B: async-ts.umd.js.gz
202 B: async-ts.umd.js.br"
`;

exports[`fixtures basic 1`] = `
"Used script: microbundle

Expand Down Expand Up @@ -310,12 +368,12 @@ esnext-ts


Build \\"esnextTs\\" to dist:
470 B: esnext-ts.js.gz
404 B: esnext-ts.js.br
470 B: esnext-ts.mjs.gz
409 B: esnext-ts.mjs.br
528 B: esnext-ts.umd.js.gz
461 B: esnext-ts.umd.js.br"
841 B: esnext-ts.js.gz
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While the size increase is looking substantial, we were previously not transpiling all asnyc/await keywords in the example. This PR fixes that

753 B: esnext-ts.js.br
842 B: esnext-ts.mjs.gz
751 B: esnext-ts.mjs.br
902 B: esnext-ts.umd.js.gz
804 B: esnext-ts.umd.js.br"
`;

exports[`fixtures jsx 1`] = `
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/async-iife-ts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name": "async-iife-ts"
}
3 changes: 3 additions & 0 deletions test/fixtures/async-iife-ts/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(async function() {
console.log('foo');
})();
5 changes: 5 additions & 0 deletions test/fixtures/async-iife-ts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"compilerOptions": {
"rootDir": "./src"
}
}
3 changes: 3 additions & 0 deletions test/fixtures/async-ts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name": "async-ts"
}
3 changes: 3 additions & 0 deletions test/fixtures/async-ts/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export class MyClass {
async foo() {}
}
5 changes: 5 additions & 0 deletions test/fixtures/async-ts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"compilerOptions": {
"rootDir": "./src"
}
}
4 changes: 2 additions & 2 deletions test/fixtures/esnext-ts/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export default async function foo() {
const out = [];
for await (const item of [1,2]) {
for await (const item of [1, 2]) {
out.push(item);
}

return out;
}

foo().then(console.log)
foo().then(console.log);