mirror of
https://github.com/developit/microbundle.git
synced 2026-01-25 14:06:50 +00:00
Merge #362
362: chore: convert bublé to babel for es2015 compilation r=ForsakenHarmony a=wardpeet Remove bublé and use babel instead. This gives us the opportunity to easily move to modern builds. The file sizes are all kept almost the same. The sizes are raw bytes which means gzip and brotli isn't used so the diff is going to be minimal. I also added 2 scripts so we can generate these tables easier Latest size report from travis: https://travis-ci.org/developit/microbundle/builds/537119810#L330-L380 <details> <summary>File sizes</summary> | file | bublé | babel | |------------------------------------------------|---------|----------| | alias/alias-mapping.js | 42 | 42 | | alias/alias-mapping.mjs | 42 | 42 | | alias/alias-mapping.umd.js | 121 | 121 | | async-iife-ts/async-iife-ts.js | 116 | 116 | | async-iife-ts/async-iife-ts.mjs | 117 | 117 | | async-iife-ts/async-iife-ts.umd.js | 199 | 199 | | async-iife-ts/index.d.ts | 0 | 0 | | async-ts/async-ts.js | **104** | 120 | | async-ts/async-ts.mjs | **108** | 132 | | async-ts/async-ts.umd.js | **287** | 303 | | async-ts/index.d.ts | 62 | 62 | | basic/basic-lib.js | **468** | 502 | | basic/basic-lib.mjs | **468** | 502 | | basic/basic-lib.umd.js | **643** | 677 | | basic-css/basic-css.css | 48 | 48 | | basic-css/basic-css.js | 133 | 133 | | basic-css/basic-css.mjs | 133 | 133 | | basic-css/basic-css.umd.js | 308 | 308 | | basic-json/basic-json.js | 168 | **113** | | basic-json/basic-json.mjs | 168 | **113** | | basic-json/basic-json.umd.js | 344 | **289** | | basic-multi-source/a.js | 53 | 53 | | basic-multi-source/a.mjs | 54 | 54 | | basic-multi-source/a.umd.js | 136 | 136 | | basic-multi-source/b.js | 53 | 53 | | basic-multi-source/b.mjs | 54 | 54 | | basic-multi-source/b.umd.js | 136 | 136 | | basic-ts/basic-lib-ts.js | **130** | 147 | | basic-ts/basic-lib-ts.mjs | **123** | 140 | | basic-ts/basic-lib-ts.umd.js | **299** | 316 | | basic-ts/car.d.ts | 163 | 163 | | basic-ts/index.d.ts | 78 | 78 | | basic-tsx/basic-lib-tsx.js | **304** | 344 | | basic-tsx/basic-lib-tsx.mjs | **305** | 346 | | basic-tsx/basic-lib-tsx.umd.js | **482** | 522 | | basic-tsx/index.d.ts | 51 | 51 | | basic-with-cwd/basic.js | **464** | 498 | | basic-with-cwd/basic.mjs | **464** | 498 | | basic-with-cwd/basic.umd.js | **636** | 670 | | class-decorators-ts/class-decorators-ts.js | 591 | 591 | | class-decorators-ts/class-decorators-ts.mjs | 588 | 588 | | class-decorators-ts/class-decorators-ts.umd.js | 771 | 771 | | class-decorators-ts/index.d.ts | 168 | 168 | | class-properties/class-properties.js | 127 | 127 | | class-properties/class-properties.mjs | 122 | 122 | | class-properties/class-properties.umd.js | 312 | 312 | | custom-source/custom-source.js | **472** | 506 | | custom-source/custom-source.mjs | **472** | 506 | | custom-source/custom-source.umd.js | **651** | 685 | | custom-source-with-cwd/custom-src.js | **469** | 503 | | custom-source-with-cwd/custom-src.mjs | **469** | 503 | | custom-source-with-cwd/custom-src.umd.js | **645** | 679 | | default-named/default-named.js | 87 | 87 | | default-named/default-named.mjs | 97 | 97 | | default-named/default-named.umd.js | 269 | 269 | | define/define.js | 35 | 35 | | define/define.mjs | 35 | 35 | | define/define.umd.js | 114 | 114 | | esnext-ts/esnext-ts.js | 2095 | **1997** | | esnext-ts/esnext-ts.mjs | 2096 | **1998** | | esnext-ts/esnext-ts.umd.js | 2270 | **2172** | | esnext-ts/index.d.ts | 48 | 48 | | jsx/jsx.js | **365** | 405 | | jsx/jsx.mjs | **366** | 407 | | jsx/jsx.umd.js | **535** | 575 | | name-custom-amd/name-custom-amd.js | **474** | 508 | | name-custom-amd/name-custom-amd.mjs | **474** | 508 | | name-custom-amd/name-custom-amd.umd.js | **654** | 688 | | name-custom-cli/name-custom.js | **470** | 504 | | name-custom-cli/name-custom.mjs | **470** | 504 | | name-custom-cli/name-custom.umd.js | **650** | 684 | | no-pkg/no-pkg.js | **465** | 499 | | no-pkg/no-pkg.mjs | **465** | 499 | | no-pkg/no-pkg.umd.js | **637** | 671 | | no-pkg-name/no-pkg-name.js | **470** | 504 | | no-pkg-name/no-pkg-name.mjs | **470** | 504 | | no-pkg-name/no-pkg-name.umd.js | **646** | 680 | | pretty/pretty.js | 12522 | 12522 | | pretty/pretty.mjs | 12534 | 12534 | | pretty/pretty.umd.js | 12704 | 12704 | | raw/raw.js | 2960 | 2960 | | raw/raw.mjs | 2972 | 2972 | | raw/raw.umd.js | 3139 | 3139 | | shebang/shebang.js | 101 | 101 | | shebang/shebang.mjs | 108 | 108 | | shebang/shebang.umd.js | 284 | 284 | | ts-mixed-exports/car.d.ts | 163 | 163 | | ts-mixed-exports/index.d.ts | 95 | 95 | | ts-mixed-exports/ts-mixed-exports.js | **149** | 169 | | ts-mixed-exports/ts-mixed-exports.mjs | **144** | 168 | | ts-mixed-exports/ts-mixed-exports.umd.js | **333** | 353 | </details> Co-authored-by: Ward Peeters <ward@coding-tech.com>
This commit is contained in:
commit
ca64d122f3
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,3 +12,4 @@ yarn.lock
|
||||
.vscode
|
||||
.idea
|
||||
.rts2*
|
||||
sizes.csv
|
||||
|
||||
11
package.json
11
package.json
@ -45,7 +45,9 @@
|
||||
"@babel/core": "^7.4.4",
|
||||
"@babel/plugin-proposal-class-properties": "7.4.4",
|
||||
"@babel/plugin-syntax-jsx": "^7.2.0",
|
||||
"@babel/plugin-transform-react-jsx": "^7.3.0",
|
||||
"@babel/polyfill": "^7.4.4",
|
||||
"@babel/preset-flow": "^7.0.0",
|
||||
"asyncro": "^3.0.0",
|
||||
"autoprefixer": "^9.5.1",
|
||||
"babel-plugin-transform-async-to-promises": "^0.8.10",
|
||||
@ -61,10 +63,9 @@
|
||||
"pretty-bytes": "^5.2.0",
|
||||
"rollup": "^1.11.3",
|
||||
"rollup-plugin-alias": "^1.5.1",
|
||||
"rollup-plugin-babel": "^4.1.0-0",
|
||||
"rollup-plugin-buble": "^0.19.4",
|
||||
"rollup-plugin-bundle-size": "^1.0.3",
|
||||
"rollup-plugin-commonjs": "^9.3.4",
|
||||
"rollup-plugin-babel": "^4.3.2",
|
||||
"rollup-plugin-bundle-size": "^1.0.1",
|
||||
"rollup-plugin-commonjs": "^9.0.0",
|
||||
"rollup-plugin-es3": "^1.1.0",
|
||||
"rollup-plugin-flow": "^1.1.1",
|
||||
"rollup-plugin-json": "^4.0.0",
|
||||
@ -80,6 +81,7 @@
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.4.4",
|
||||
"@babel/node": "^7.2.2",
|
||||
"@babel/plugin-proposal-throw-expressions": "^7.2.0",
|
||||
"@babel/preset-env": "^7.4.4",
|
||||
"babel-core": "^7.0.0-bridge.0",
|
||||
"babel-jest": "^24.8.0",
|
||||
@ -89,6 +91,7 @@
|
||||
"eslint-config-developit": "^1.1.1",
|
||||
"eslint-config-prettier": "^4.2.0",
|
||||
"eslint-plugin-prettier": "^3.0.1",
|
||||
"esm": "^3.2.22",
|
||||
"fs-extra": "^7.0.1",
|
||||
"husky": "^2.2.0",
|
||||
"jest": "^24.8.0",
|
||||
|
||||
58
src/index.js
58
src/index.js
@ -9,7 +9,6 @@ import { rollup, watch } from 'rollup';
|
||||
import commonjs from 'rollup-plugin-commonjs';
|
||||
import babel from 'rollup-plugin-babel';
|
||||
import nodeResolve from 'rollup-plugin-node-resolve';
|
||||
import buble from 'rollup-plugin-buble';
|
||||
import { terser } from 'rollup-plugin-terser';
|
||||
import alias from 'rollup-plugin-alias';
|
||||
import postcss from 'rollup-plugin-postcss';
|
||||
@ -18,7 +17,6 @@ import brotliSize from 'brotli-size';
|
||||
import prettyBytes from 'pretty-bytes';
|
||||
import typescript from 'rollup-plugin-typescript2';
|
||||
import json from 'rollup-plugin-json';
|
||||
import flow from './lib/flow-plugin';
|
||||
import logError from './log-error';
|
||||
import { readFile, isDir, isFile, stdout, stderr } from './utils';
|
||||
import camelCase from 'camelcase';
|
||||
@ -529,7 +527,8 @@ function createConfig(options, entry, format, writeMeta) {
|
||||
compilerOptions: {
|
||||
sourceMap: options.sourcemap,
|
||||
declaration: true,
|
||||
jsx: options.jsx,
|
||||
jsx: 'react',
|
||||
jsxFactory: options.jsx || 'h',
|
||||
},
|
||||
},
|
||||
tsconfigOverride: {
|
||||
@ -538,7 +537,6 @@ function createConfig(options, entry, format, writeMeta) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
!useTypescript && flow({ all: true, pretty: true }),
|
||||
babel({
|
||||
babelrc: false,
|
||||
configFile: false,
|
||||
@ -551,18 +549,31 @@ function createConfig(options, entry, format, writeMeta) {
|
||||
],
|
||||
],
|
||||
}),
|
||||
// Only used for async await
|
||||
babel({
|
||||
// We mainly use bublé to transpile JS and only use babel to
|
||||
// transpile down `async/await`. To prevent conflicts with user
|
||||
// supplied configurations we set this option to false. Note
|
||||
// that we never supported using custom babel configs anyway.
|
||||
babelrc: false,
|
||||
configFile: false,
|
||||
extensions: EXTENSIONS,
|
||||
exclude: 'node_modules/**',
|
||||
passPerPreset: true, // @see https://babeljs.io/docs/en/options#passperpreset
|
||||
presets: [
|
||||
[
|
||||
'@babel/preset-env',
|
||||
{
|
||||
loose: true,
|
||||
modules: false,
|
||||
targets:
|
||||
options.target === 'node' ? { node: '8' } : undefined,
|
||||
exclude: ['transform-async-to-generator'],
|
||||
},
|
||||
],
|
||||
!useTypescript && ['@babel/preset-flow', { all: true }],
|
||||
].filter(Boolean),
|
||||
plugins: [
|
||||
require.resolve('@babel/plugin-syntax-jsx'),
|
||||
[
|
||||
require.resolve('@babel/plugin-transform-react-jsx'),
|
||||
{
|
||||
pragma: options.jsx || 'h',
|
||||
pragmaFrag: options.jsxFragment || 'Fragment',
|
||||
},
|
||||
],
|
||||
[
|
||||
require.resolve('babel-plugin-transform-replace-expressions'),
|
||||
{ replace: defines },
|
||||
@ -577,29 +588,6 @@ function createConfig(options, entry, format, writeMeta) {
|
||||
],
|
||||
],
|
||||
}),
|
||||
buble({
|
||||
exclude: 'node_modules/**',
|
||||
jsx: options.jsx || 'h',
|
||||
objectAssign: options.assign || 'Object.assign',
|
||||
transforms: {
|
||||
dangerousForOf: true,
|
||||
dangerousTaggedTemplateString: true,
|
||||
},
|
||||
}),
|
||||
// We should upstream this to rollup
|
||||
// format==='cjs' && replace({
|
||||
// [`module.exports = ${rollupName};`]: '',
|
||||
// [`var ${rollupName} =`]: 'module.exports ='
|
||||
// }),
|
||||
// This works for the general case, but could cause nasty scope bugs.
|
||||
// format==='umd' && replace({
|
||||
// [`return ${rollupName};`]: '',
|
||||
// [`var ${rollupName} =`]: 'return'
|
||||
// }),
|
||||
// format==='es' && replace({
|
||||
// [`export default ${rollupName};`]: '',
|
||||
// [`var ${rollupName} =`]: 'export default'
|
||||
// }),
|
||||
options.compress !== false && [
|
||||
terser({
|
||||
sourcemap: true,
|
||||
|
||||
@ -1,12 +0,0 @@
|
||||
import flow from 'rollup-plugin-flow';
|
||||
|
||||
export default function fixedFlow(options) {
|
||||
let plugin = flow(options);
|
||||
return Object.assign({}, plugin, {
|
||||
transform(code, id) {
|
||||
let ret = plugin.transform(code, id);
|
||||
if (ret && ret.code === code) return null;
|
||||
return ret;
|
||||
},
|
||||
});
|
||||
}
|
||||
@ -117,30 +117,30 @@ async-ts
|
||||
|
||||
|
||||
Build \\"asyncTs\\" to dist:
|
||||
75 B: async-ts.js.gz
|
||||
57 B: async-ts.js.br
|
||||
77 B: async-ts.mjs.gz
|
||||
63 B: async-ts.mjs.br
|
||||
180 B: async-ts.umd.js.gz
|
||||
139 B: async-ts.umd.js.br"
|
||||
84 B: async-ts.js.gz
|
||||
61 B: async-ts.js.br
|
||||
94 B: async-ts.mjs.gz
|
||||
76 B: async-ts.mjs.br
|
||||
187 B: async-ts.umd.js.gz
|
||||
150 B: async-ts.umd.js.br"
|
||||
`;
|
||||
|
||||
exports[`fixtures build async-ts with microbundle 2`] = `7`;
|
||||
|
||||
exports[`fixtures build async-ts with microbundle 3`] = `
|
||||
"var o=function(){};o.prototype.foo=function(){},exports.MyClass=o;
|
||||
"exports.MyClass=function(){function o(){}return o.prototype.foo=function(){},o}();
|
||||
//# sourceMappingURL=async-ts.js.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build async-ts with microbundle 4`] = `
|
||||
"var o=function(){};o.prototype.foo=function(){};export{o as MyClass};
|
||||
"var o=function(){function o(){}return o.prototype.foo=function(){},o}();export{o as MyClass};
|
||||
//# sourceMappingURL=async-ts.mjs.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build async-ts with microbundle 5`] = `
|
||||
"!function(e,o){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?o(exports):\\"function\\"==typeof define&&define.amd?define([\\"exports\\"],o):o((e=e||self).asyncTs={})}(this,function(e){var o=function(){};o.prototype.foo=function(){},e.MyClass=o});
|
||||
"!function(e,n){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?n(exports):\\"function\\"==typeof define&&define.amd?define([\\"exports\\"],n):n((e=e||self).asyncTs={})}(this,function(e){e.MyClass=function(){function e(){}return e.prototype.foo=function(){},e}()});
|
||||
//# sourceMappingURL=async-ts.umd.js.map
|
||||
"
|
||||
`;
|
||||
@ -172,34 +172,81 @@ basic
|
||||
|
||||
|
||||
Build \\"basicLib\\" to dist:
|
||||
202 B: basic-lib.js.gz
|
||||
145 B: basic-lib.js.br
|
||||
203 B: basic-lib.mjs.gz
|
||||
145 B: basic-lib.mjs.br
|
||||
287 B: basic-lib.umd.js.gz
|
||||
222 B: basic-lib.umd.js.br"
|
||||
229 B: basic-lib.js.gz
|
||||
174 B: basic-lib.js.br
|
||||
230 B: basic-lib.mjs.gz
|
||||
177 B: basic-lib.mjs.br
|
||||
313 B: basic-lib.umd.js.gz
|
||||
251 B: basic-lib.umd.js.br"
|
||||
`;
|
||||
|
||||
exports[`fixtures build basic with microbundle 2`] = `6`;
|
||||
|
||||
exports[`fixtures build basic with microbundle 3`] = `
|
||||
"var r=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];try{return Promise.resolve(r.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};module.exports=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];try{return Promise.resolve(r.apply(void 0,e)).then(function(t){return Promise.resolve(r.apply(void 0,e)).then(function(r){return[t,r]})})}catch(r){return Promise.reject(r)}};
|
||||
"var r=function(){try{for(var r=arguments.length,e=new Array(r),n=0;n<r;n++)e[n]=arguments[n];return Promise.resolve(e.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};module.exports=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];try{return Promise.resolve(r.apply(void 0,n)).then(function(e){return Promise.resolve(r.apply(void 0,n)).then(function(r){return[e,r]})})}catch(r){return Promise.reject(r)}};
|
||||
//# sourceMappingURL=basic-lib.js.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build basic with microbundle 4`] = `
|
||||
"var r=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];try{return Promise.resolve(r.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};export default function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];try{return Promise.resolve(r.apply(void 0,e)).then(function(t){return Promise.resolve(r.apply(void 0,e)).then(function(r){return[t,r]})})}catch(r){return Promise.reject(r)}}
|
||||
"var r=function(){try{for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return Promise.resolve(e.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};export default function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];try{return Promise.resolve(r.apply(void 0,t)).then(function(e){return Promise.resolve(r.apply(void 0,t)).then(function(r){return[e,r]})})}catch(r){return Promise.reject(r)}}
|
||||
//# sourceMappingURL=basic-lib.mjs.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build basic with microbundle 5`] = `
|
||||
"!function(e,r){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=r():\\"function\\"==typeof define&&define.amd?define(r):(e=e||self).basicLib=r()}(this,function(){var e=function(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];try{return Promise.resolve(e.reduce(function(e,r){return e+r},0))}catch(e){return Promise.reject(e)}};return function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];try{return Promise.resolve(e.apply(void 0,r)).then(function(n){return Promise.resolve(e.apply(void 0,r)).then(function(e){return[n,e]})})}catch(e){return Promise.reject(e)}}});
|
||||
"!function(e,r){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=r():\\"function\\"==typeof define&&define.amd?define(r):(e=e||self).basicLib=r()}(this,function(){var e=function(){try{for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return Promise.resolve(r.reduce(function(e,r){return e+r},0))}catch(e){return Promise.reject(e)}};return function(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];try{return Promise.resolve(e.apply(void 0,n)).then(function(r){return Promise.resolve(e.apply(void 0,n)).then(function(e){return[r,e]})})}catch(e){return Promise.reject(e)}}});
|
||||
//# sourceMappingURL=basic-lib.umd.js.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build basic-babelrc with microbundle 1`] = `
|
||||
"Used script: microbundle
|
||||
|
||||
Directory tree:
|
||||
|
||||
basic-babelrc
|
||||
dist
|
||||
basic-babelrc.js
|
||||
basic-babelrc.js.map
|
||||
basic-babelrc.mjs
|
||||
basic-babelrc.mjs.map
|
||||
basic-babelrc.umd.js
|
||||
basic-babelrc.umd.js.map
|
||||
package.json
|
||||
src
|
||||
index.js
|
||||
|
||||
|
||||
Build \\"basicBabelrc\\" to dist:
|
||||
108 B: basic-babelrc.js.gz
|
||||
83 B: basic-babelrc.js.br
|
||||
108 B: basic-babelrc.mjs.gz
|
||||
83 B: basic-babelrc.mjs.br
|
||||
150 B: basic-babelrc.umd.js.gz
|
||||
108 B: basic-babelrc.umd.js.br"
|
||||
`;
|
||||
|
||||
exports[`fixtures build basic-babelrc with microbundle 2`] = `6`;
|
||||
|
||||
exports[`fixtures build basic-babelrc with microbundle 3`] = `
|
||||
"var r;void 0===(r=!0)&&(r=function(r){throw new Error(\\"required!\\")}()),!0===r||function(r){throw new Error(\\"Falsey!\\")}();
|
||||
//# sourceMappingURL=basic-babelrc.js.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build basic-babelrc with microbundle 4`] = `
|
||||
"var r;void 0===(r=!0)&&(r=function(r){throw new Error(\\"required!\\")}()),!0===r||function(r){throw new Error(\\"Falsey!\\")}();
|
||||
//# sourceMappingURL=basic-babelrc.mjs.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build basic-babelrc with microbundle 5`] = `
|
||||
"!function(n){\\"function\\"==typeof define&&define.amd?define(n):n()}(function(){var n;void 0===(n=!0)&&(n=function(n){throw new Error(\\"required!\\")}()),!0===n||function(n){throw new Error(\\"Falsey!\\")}()});
|
||||
//# sourceMappingURL=basic-babelrc.umd.js.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build basic-css with microbundle 1`] = `
|
||||
"Used script: microbundle
|
||||
|
||||
@ -271,30 +318,30 @@ basic-json
|
||||
|
||||
|
||||
Build \\"basicJson\\" to dist:
|
||||
130 B: basic-json.js.gz
|
||||
81 B: basic-json.js.br
|
||||
129 B: basic-json.mjs.gz
|
||||
81 B: basic-json.mjs.br
|
||||
215 B: basic-json.umd.js.gz
|
||||
160 B: basic-json.umd.js.br"
|
||||
93 B: basic-json.js.gz
|
||||
65 B: basic-json.js.br
|
||||
92 B: basic-json.mjs.gz
|
||||
64 B: basic-json.mjs.br
|
||||
181 B: basic-json.umd.js.gz
|
||||
134 B: basic-json.umd.js.br"
|
||||
`;
|
||||
|
||||
exports[`fixtures build basic-json with microbundle 2`] = `6`;
|
||||
|
||||
exports[`fixtures build basic-json with microbundle 3`] = `
|
||||
"var e={test:\\"true\\"};module.exports=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return Promise.resolve(e)};
|
||||
"var e={test:\\"true\\"};module.exports=function(){return Promise.resolve(e)};
|
||||
//# sourceMappingURL=basic-json.js.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build basic-json with microbundle 4`] = `
|
||||
"var e={test:\\"true\\"};export default function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return Promise.resolve(e)}
|
||||
"var e={test:\\"true\\"};export default function(){return Promise.resolve(e)}
|
||||
//# sourceMappingURL=basic-json.mjs.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build basic-json with microbundle 5`] = `
|
||||
"!function(e,n){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=n():\\"function\\"==typeof define&&define.amd?define(n):(e=e||self).basicJson=n()}(this,function(){var e={test:\\"true\\"};return function(){for(var n=[],t=arguments.length;t--;)n[t]=arguments[t];return Promise.resolve(e)}});
|
||||
"!function(e,n){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=n():\\"function\\"==typeof define&&define.amd?define(n):(e=e||self).basicJson=n()}(this,function(){var e={test:\\"true\\"};return function(){return Promise.resolve(e)}});
|
||||
//# sourceMappingURL=basic-json.umd.js.map
|
||||
"
|
||||
`;
|
||||
@ -400,30 +447,30 @@ basic-ts
|
||||
|
||||
|
||||
Build \\"basicLibTs\\" to dist:
|
||||
98 B: basic-lib-ts.js.gz
|
||||
67 B: basic-lib-ts.js.br
|
||||
92 B: basic-lib-ts.mjs.gz
|
||||
58 B: basic-lib-ts.mjs.br
|
||||
183 B: basic-lib-ts.umd.js.gz
|
||||
133 B: basic-lib-ts.umd.js.br"
|
||||
104 B: basic-lib-ts.js.gz
|
||||
76 B: basic-lib-ts.js.br
|
||||
97 B: basic-lib-ts.mjs.gz
|
||||
73 B: basic-lib-ts.mjs.br
|
||||
187 B: basic-lib-ts.umd.js.gz
|
||||
144 B: basic-lib-ts.umd.js.br"
|
||||
`;
|
||||
|
||||
exports[`fixtures build basic-ts with microbundle 2`] = `8`;
|
||||
|
||||
exports[`fixtures build basic-ts with microbundle 3`] = `
|
||||
"var r=function(){};r.prototype.drive=function(r){return!0};var e=new r;module.exports=e;
|
||||
"var n=new(function(){function n(){}return n.prototype.drive=function(n){return!0},n}());module.exports=n;
|
||||
//# sourceMappingURL=basic-lib-ts.js.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build basic-ts with microbundle 4`] = `
|
||||
"var t=function(){};t.prototype.drive=function(t){return!0};export default new t;
|
||||
"export default new(function(){function n(){}return n.prototype.drive=function(n){return!0},n}());
|
||||
//# sourceMappingURL=basic-lib-ts.mjs.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build basic-ts with microbundle 5`] = `
|
||||
"!function(e,n){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=n():\\"function\\"==typeof define&&define.amd?define(n):(e=e||self).basicLibTs=n()}(this,function(){var e=function(){};return e.prototype.drive=function(e){return!0},new e});
|
||||
"!function(e,n){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=n():\\"function\\"==typeof define&&define.amd?define(n):(e=e||self).basicLibTs=n()}(this,function(){return new(function(){function e(){}return e.prototype.drive=function(e){return!0},e}())});
|
||||
//# sourceMappingURL=basic-lib-ts.umd.js.map
|
||||
"
|
||||
`;
|
||||
@ -467,30 +514,30 @@ basic-tsx
|
||||
|
||||
|
||||
Build \\"basicLibTsx\\" to dist:
|
||||
211 B: basic-lib-tsx.js.gz
|
||||
168 B: basic-lib-tsx.js.br
|
||||
212 B: basic-lib-tsx.mjs.gz
|
||||
170 B: basic-lib-tsx.mjs.br
|
||||
298 B: basic-lib-tsx.umd.js.gz
|
||||
235 B: basic-lib-tsx.umd.js.br"
|
||||
235 B: basic-lib-tsx.js.gz
|
||||
188 B: basic-lib-tsx.js.br
|
||||
239 B: basic-lib-tsx.mjs.gz
|
||||
191 B: basic-lib-tsx.mjs.br
|
||||
317 B: basic-lib-tsx.umd.js.gz
|
||||
260 B: basic-lib-tsx.umd.js.br"
|
||||
`;
|
||||
|
||||
exports[`fixtures build basic-tsx with microbundle 2`] = `7`;
|
||||
|
||||
exports[`fixtures build basic-tsx with microbundle 3`] = `
|
||||
"var r=function(r,n){for(var o=[],e=arguments.length-2;e-- >0;)o[e]=arguments[e+2];return{tag:r,props:n,children:o}},n=function(){};n.prototype.render=function(){return r(\\"div\\",{id:\\"app\\"},r(\\"h1\\",null,\\"Hello, World!\\"),r(\\"p\\",null,\\"A JSX demo.\\"))},module.exports=n;
|
||||
"var r=function(r,n){for(var e=arguments.length,o=new Array(e>2?e-2:0),t=2;t<e;t++)o[t-2]=arguments[t];return{tag:r,props:n,children:o}};module.exports=function(){function n(){}return n.prototype.render=function(){return r(\\"div\\",{id:\\"app\\"},r(\\"h1\\",null,\\"Hello, World!\\"),r(\\"p\\",null,\\"A JSX demo.\\"))},n}();
|
||||
//# sourceMappingURL=basic-lib-tsx.js.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build basic-tsx with microbundle 4`] = `
|
||||
"var r=function(r,n){for(var e=[],o=arguments.length-2;o-- >0;)e[o]=arguments[o+2];return{tag:r,props:n,children:e}},n=function(){};n.prototype.render=function(){return r(\\"div\\",{id:\\"app\\"},r(\\"h1\\",null,\\"Hello, World!\\"),r(\\"p\\",null,\\"A JSX demo.\\"))};export default n;
|
||||
"var r=function(r,n){for(var e=arguments.length,t=new Array(e>2?e-2:0),o=2;o<e;o++)t[o-2]=arguments[o];return{tag:r,props:n,children:t}};export default(function(){function n(){}return n.prototype.render=function(){return r(\\"div\\",{id:\\"app\\"},r(\\"h1\\",null,\\"Hello, World!\\"),r(\\"p\\",null,\\"A JSX demo.\\"))},n}());
|
||||
//# sourceMappingURL=basic-lib-tsx.mjs.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build basic-tsx with microbundle 5`] = `
|
||||
"!function(e,n){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=n():\\"function\\"==typeof define&&define.amd?define(n):(e=e||self).basicLibTsx=n()}(this,function(){var e=function(e,n){for(var o=[],t=arguments.length-2;t-- >0;)o[t]=arguments[t+2];return{tag:e,props:n,children:o}},n=function(){};return n.prototype.render=function(){return e(\\"div\\",{id:\\"app\\"},e(\\"h1\\",null,\\"Hello, World!\\"),e(\\"p\\",null,\\"A JSX demo.\\"))},n});
|
||||
"!function(e,n){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=n():\\"function\\"==typeof define&&define.amd?define(n):(e=e||self).basicLibTsx=n()}(this,function(){var e=function(e,n){for(var o=arguments.length,t=new Array(o>2?o-2:0),r=2;r<o;r++)t[r-2]=arguments[r];return{tag:e,props:n,children:t}};return function(){function n(){}return n.prototype.render=function(){return e(\\"div\\",{id:\\"app\\"},e(\\"h1\\",null,\\"Hello, World!\\"),e(\\"p\\",null,\\"A JSX demo.\\"))},n}()});
|
||||
//# sourceMappingURL=basic-lib-tsx.umd.js.map
|
||||
"
|
||||
`;
|
||||
@ -522,30 +569,30 @@ basic
|
||||
|
||||
|
||||
Build \\"basic\\" to dist:
|
||||
202 B: basic.js.gz
|
||||
145 B: basic.js.br
|
||||
203 B: basic.mjs.gz
|
||||
145 B: basic.mjs.br
|
||||
283 B: basic.umd.js.gz
|
||||
216 B: basic.umd.js.br"
|
||||
229 B: basic.js.gz
|
||||
174 B: basic.js.br
|
||||
230 B: basic.mjs.gz
|
||||
177 B: basic.mjs.br
|
||||
310 B: basic.umd.js.gz
|
||||
247 B: basic.umd.js.br"
|
||||
`;
|
||||
|
||||
exports[`fixtures build basic-with-cwd with microbundle 2`] = `6`;
|
||||
|
||||
exports[`fixtures build basic-with-cwd with microbundle 3`] = `
|
||||
"var r=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];try{return Promise.resolve(r.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};module.exports=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];try{return Promise.resolve(r.apply(void 0,e)).then(function(t){return Promise.resolve(r.apply(void 0,e)).then(function(r){return[t,r]})})}catch(r){return Promise.reject(r)}};
|
||||
"var r=function(){try{for(var r=arguments.length,e=new Array(r),n=0;n<r;n++)e[n]=arguments[n];return Promise.resolve(e.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};module.exports=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];try{return Promise.resolve(r.apply(void 0,n)).then(function(e){return Promise.resolve(r.apply(void 0,n)).then(function(r){return[e,r]})})}catch(r){return Promise.reject(r)}};
|
||||
//# sourceMappingURL=basic.js.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build basic-with-cwd with microbundle 4`] = `
|
||||
"var r=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];try{return Promise.resolve(r.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};export default function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];try{return Promise.resolve(r.apply(void 0,e)).then(function(t){return Promise.resolve(r.apply(void 0,e)).then(function(r){return[t,r]})})}catch(r){return Promise.reject(r)}}
|
||||
"var r=function(){try{for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return Promise.resolve(e.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};export default function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];try{return Promise.resolve(r.apply(void 0,t)).then(function(e){return Promise.resolve(r.apply(void 0,t)).then(function(r){return[e,r]})})}catch(r){return Promise.reject(r)}}
|
||||
//# sourceMappingURL=basic.mjs.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build basic-with-cwd with microbundle 5`] = `
|
||||
"!function(e,r){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=r():\\"function\\"==typeof define&&define.amd?define(r):(e=e||self).basic=r()}(this,function(){var e=function(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];try{return Promise.resolve(e.reduce(function(e,r){return e+r},0))}catch(e){return Promise.reject(e)}};return function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];try{return Promise.resolve(e.apply(void 0,r)).then(function(n){return Promise.resolve(e.apply(void 0,r)).then(function(e){return[n,e]})})}catch(e){return Promise.reject(e)}}});
|
||||
"!function(e,r){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=r():\\"function\\"==typeof define&&define.amd?define(r):(e=e||self).basic=r()}(this,function(){var e=function(){try{for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return Promise.resolve(r.reduce(function(e,r){return e+r},0))}catch(e){return Promise.reject(e)}};return function(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];try{return Promise.resolve(e.apply(void 0,n)).then(function(r){return Promise.resolve(e.apply(void 0,n)).then(function(e){return[r,e]})})}catch(e){return Promise.reject(e)}}});
|
||||
//# sourceMappingURL=basic.umd.js.map
|
||||
"
|
||||
`;
|
||||
@ -678,30 +725,30 @@ custom-source
|
||||
|
||||
|
||||
Build \\"customSource\\" to dist:
|
||||
202 B: custom-source.js.gz
|
||||
145 B: custom-source.js.br
|
||||
203 B: custom-source.mjs.gz
|
||||
145 B: custom-source.mjs.br
|
||||
288 B: custom-source.umd.js.gz
|
||||
220 B: custom-source.umd.js.br"
|
||||
229 B: custom-source.js.gz
|
||||
174 B: custom-source.js.br
|
||||
230 B: custom-source.mjs.gz
|
||||
177 B: custom-source.mjs.br
|
||||
316 B: custom-source.umd.js.gz
|
||||
247 B: custom-source.umd.js.br"
|
||||
`;
|
||||
|
||||
exports[`fixtures build custom-source with microbundle 2`] = `6`;
|
||||
|
||||
exports[`fixtures build custom-source with microbundle 3`] = `
|
||||
"var r=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];try{return Promise.resolve(r.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};module.exports=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];try{return Promise.resolve(r.apply(void 0,e)).then(function(t){return Promise.resolve(r.apply(void 0,e)).then(function(r){return[t,r]})})}catch(r){return Promise.reject(r)}};
|
||||
"var r=function(){try{for(var r=arguments.length,e=new Array(r),n=0;n<r;n++)e[n]=arguments[n];return Promise.resolve(e.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};module.exports=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];try{return Promise.resolve(r.apply(void 0,n)).then(function(e){return Promise.resolve(r.apply(void 0,n)).then(function(r){return[e,r]})})}catch(r){return Promise.reject(r)}};
|
||||
//# sourceMappingURL=custom-source.js.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build custom-source with microbundle 4`] = `
|
||||
"var r=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];try{return Promise.resolve(r.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};export default function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];try{return Promise.resolve(r.apply(void 0,e)).then(function(t){return Promise.resolve(r.apply(void 0,e)).then(function(r){return[t,r]})})}catch(r){return Promise.reject(r)}}
|
||||
"var r=function(){try{for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return Promise.resolve(e.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};export default function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];try{return Promise.resolve(r.apply(void 0,t)).then(function(e){return Promise.resolve(r.apply(void 0,t)).then(function(r){return[e,r]})})}catch(r){return Promise.reject(r)}}
|
||||
//# sourceMappingURL=custom-source.mjs.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build custom-source with microbundle 5`] = `
|
||||
"!function(e,r){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=r():\\"function\\"==typeof define&&define.amd?define(r):(e=e||self).customSource=r()}(this,function(){var e=function(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];try{return Promise.resolve(e.reduce(function(e,r){return e+r},0))}catch(e){return Promise.reject(e)}};return function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];try{return Promise.resolve(e.apply(void 0,r)).then(function(t){return Promise.resolve(e.apply(void 0,r)).then(function(e){return[t,e]})})}catch(e){return Promise.reject(e)}}});
|
||||
"!function(e,r){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=r():\\"function\\"==typeof define&&define.amd?define(r):(e=e||self).customSource=r()}(this,function(){var e=function(){try{for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return Promise.resolve(r.reduce(function(e,r){return e+r},0))}catch(e){return Promise.reject(e)}};return function(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];try{return Promise.resolve(e.apply(void 0,n)).then(function(r){return Promise.resolve(e.apply(void 0,n)).then(function(e){return[r,e]})})}catch(e){return Promise.reject(e)}}});
|
||||
//# sourceMappingURL=custom-source.umd.js.map
|
||||
"
|
||||
`;
|
||||
@ -726,30 +773,30 @@ custom-source
|
||||
|
||||
|
||||
Build \\"customSrc\\" to dist:
|
||||
202 B: custom-src.js.gz
|
||||
145 B: custom-src.js.br
|
||||
203 B: custom-src.mjs.gz
|
||||
145 B: custom-src.mjs.br
|
||||
286 B: custom-src.umd.js.gz
|
||||
220 B: custom-src.umd.js.br"
|
||||
229 B: custom-src.js.gz
|
||||
174 B: custom-src.js.br
|
||||
230 B: custom-src.mjs.gz
|
||||
177 B: custom-src.mjs.br
|
||||
314 B: custom-src.umd.js.gz
|
||||
247 B: custom-src.umd.js.br"
|
||||
`;
|
||||
|
||||
exports[`fixtures build custom-source-with-cwd with microbundle 2`] = `6`;
|
||||
|
||||
exports[`fixtures build custom-source-with-cwd with microbundle 3`] = `
|
||||
"var r=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];try{return Promise.resolve(r.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};module.exports=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];try{return Promise.resolve(r.apply(void 0,e)).then(function(t){return Promise.resolve(r.apply(void 0,e)).then(function(r){return[t,r]})})}catch(r){return Promise.reject(r)}};
|
||||
"var r=function(){try{for(var r=arguments.length,e=new Array(r),n=0;n<r;n++)e[n]=arguments[n];return Promise.resolve(e.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};module.exports=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];try{return Promise.resolve(r.apply(void 0,n)).then(function(e){return Promise.resolve(r.apply(void 0,n)).then(function(r){return[e,r]})})}catch(r){return Promise.reject(r)}};
|
||||
//# sourceMappingURL=custom-src.js.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build custom-source-with-cwd with microbundle 4`] = `
|
||||
"var r=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];try{return Promise.resolve(r.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};export default function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];try{return Promise.resolve(r.apply(void 0,e)).then(function(t){return Promise.resolve(r.apply(void 0,e)).then(function(r){return[t,r]})})}catch(r){return Promise.reject(r)}}
|
||||
"var r=function(){try{for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return Promise.resolve(e.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};export default function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];try{return Promise.resolve(r.apply(void 0,t)).then(function(e){return Promise.resolve(r.apply(void 0,t)).then(function(r){return[e,r]})})}catch(r){return Promise.reject(r)}}
|
||||
//# sourceMappingURL=custom-src.mjs.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build custom-source-with-cwd with microbundle 5`] = `
|
||||
"!function(e,r){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=r():\\"function\\"==typeof define&&define.amd?define(r):(e=e||self).customSrc=r()}(this,function(){var e=function(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];try{return Promise.resolve(e.reduce(function(e,r){return e+r},0))}catch(e){return Promise.reject(e)}};return function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];try{return Promise.resolve(e.apply(void 0,r)).then(function(t){return Promise.resolve(e.apply(void 0,r)).then(function(e){return[t,e]})})}catch(e){return Promise.reject(e)}}});
|
||||
"!function(e,r){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=r():\\"function\\"==typeof define&&define.amd?define(r):(e=e||self).customSrc=r()}(this,function(){var e=function(){try{for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return Promise.resolve(r.reduce(function(e,r){return e+r},0))}catch(e){return Promise.reject(e)}};return function(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];try{return Promise.resolve(e.apply(void 0,n)).then(function(r){return Promise.resolve(e.apply(void 0,n)).then(function(e){return[r,e]})})}catch(e){return Promise.reject(e)}}});
|
||||
//# sourceMappingURL=custom-src.umd.js.map
|
||||
"
|
||||
`;
|
||||
@ -863,30 +910,30 @@ esnext-ts
|
||||
|
||||
|
||||
Build \\"esnextTs\\" to dist:
|
||||
853 B: esnext-ts.js.gz
|
||||
769 B: esnext-ts.js.br
|
||||
853 B: esnext-ts.mjs.gz
|
||||
768 B: esnext-ts.mjs.br
|
||||
917 B: esnext-ts.umd.js.gz
|
||||
817 B: esnext-ts.umd.js.br"
|
||||
826 B: esnext-ts.js.gz
|
||||
739 B: esnext-ts.js.br
|
||||
826 B: esnext-ts.mjs.gz
|
||||
742 B: esnext-ts.mjs.br
|
||||
893 B: esnext-ts.umd.js.gz
|
||||
800 B: esnext-ts.umd.js.br"
|
||||
`;
|
||||
|
||||
exports[`fixtures build esnext-ts with microbundle 2`] = `7`;
|
||||
|
||||
exports[`fixtures build esnext-ts with microbundle 3`] = `
|
||||
"var n=function(){function n(){}return n.prototype.then=function(r,e){var i=new n,o=this.s;if(o){var u=1&o?r:e;if(u){try{t(i,1,u(this.v))}catch(n){t(i,2,n)}return i}return this}return this.o=function(n){try{var o=n.v;1&n.s?t(i,1,r?r(o):o):e?t(i,1,e(o)):t(i,2,o)}catch(n){t(i,2,n)}},i},n}();function t(r,e,i){if(!r.s){if(i instanceof n){if(!i.s)return void(i.o=t.bind(null,r,e));1&e&&(e=i.s),i=i.v}if(i&&i.then)return void i.then(t.bind(null,r,e),t.bind(null,r,2));r.s=e,r.v=i;var o=r.o;o&&o(r)}}function r(t){return t instanceof n&&1&t.s}var e=function(){try{var e=[],i=function(e,i,o){if(\\"undefined\\"!=typeof Symbol){var u=Symbol.asyncIterator;if(u&&u in e){var f=new n,c=e[u]();return c.next().then(v).then(void 0,a),f;function h(n){if(o&&!o())return t(f,1,c.return?c.return().then(function(){return n}):n);c.next().then(v).then(void 0,a)}function v(n){n.done?t(f,1):Promise.resolve(i(n.value)).then(h).then(void 0,a)}function a(n){t(f,2,c.return?c.return().then(function(){return n}):n)}}}return Promise.resolve(function(e,i,o){if(\\"undefined\\"!=typeof Symbol){var u=Symbol.iterator;if(u&&u in e){var f,c,h,v=e[u]();if(function e(u){try{for(;!((f=v.next()).done||o&&o());)if((u=i(f.value))&&u.then){if(!r(u))return void u.then(e,h||(h=t.bind(null,c=new n,2)));u=u.v}c?t(c,1,u):c=u}catch(n){t(c||(c=new Pact),2,n)}}(),v.return){var a=function(n){try{f.done||v.return()}catch(n){}return n};if(c&&c.then)return c.then(a,function(n){throw a(n)});a()}return c}}if(!(\\"length\\"in e))throw new TypeError(\\"value is not iterable\\");for(var l=[],s=0;s<e.length;s++)l.push(e[s]);return function(e,i,o){var u,f,c=-1;return function h(v){try{for(;++c<e.length&&(!o||!o());)if((v=i(c))&&v.then){if(!r(v))return void v.then(h,f||(f=t.bind(null,u=new n,2)));v=v.v}u?t(u,1,v):u=v}catch(n){t(u||(u=new Pact),2,n)}}(),u}(l,function(n){return i(l[n])},o)}(e,function(n){return Promise.resolve(n).then(i)},o))}([1,2],function(n){e.push(n)});return Promise.resolve(i&&i.then?i.then(function(){return e}):e)}catch(n){return Promise.reject(n)}};e().then(console.log),module.exports=e;
|
||||
"var n=function(){function n(){}return n.prototype.then=function(e,r){var i=new n,o=this.s;if(o){var u=1&o?e:r;if(u){try{t(i,1,u(this.v))}catch(n){t(i,2,n)}return i}return this}return this.o=function(n){try{var o=n.v;1&n.s?t(i,1,e?e(o):o):r?t(i,1,r(o)):t(i,2,o)}catch(n){t(i,2,n)}},i},n}();function t(e,r,i){if(!e.s){if(i instanceof n){if(!i.s)return void(i.o=t.bind(null,e,r));1&r&&(r=i.s),i=i.v}if(i&&i.then)return void i.then(t.bind(null,e,r),t.bind(null,e,2));e.s=r,e.v=i;var o=e.o;o&&o(e)}}function e(t){return t instanceof n&&1&t.s}var r=function(){try{var r=[],i=function(r,i,o){if(\\"undefined\\"!=typeof Symbol){var u=Symbol.asyncIterator;if(u&&u in r){var f=function(n){a.next().then(c).then(void 0,h)},c=function(n){n.done?t(v,1):Promise.resolve(i(n.value)).then(f).then(void 0,h)},h=function(n){t(v,2,a.return?a.return().then(function(){return n}):n)},v=new n,a=r[u]();return a.next().then(c).then(void 0,h),v}}return Promise.resolve(function(r,i,o){if(\\"undefined\\"!=typeof Symbol){var u=Symbol.iterator;if(u&&u in r){var f,c,h,v=r[u]();if(function r(o){try{for(;!(f=v.next()).done;)if((o=i(f.value))&&o.then){if(!e(o))return void o.then(r,h||(h=t.bind(null,c=new n,2)));o=o.v}c?t(c,1,o):c=o}catch(n){t(c||(c=new Pact),2,n)}}(),v.return){var a=function(n){try{f.done||v.return()}catch(n){}return n};if(c&&c.then)return c.then(a,function(n){throw a(n)});a()}return c}}if(!(\\"length\\"in r))throw new TypeError(\\"value is not iterable\\");for(var l=[],s=0;s<r.length;s++)l.push(r[s]);return function(r,i,o){var u,f,c=-1;return function o(h){try{for(;++c<r.length;)if((h=i(c))&&h.then){if(!e(h))return void h.then(o,f||(f=t.bind(null,u=new n,2)));h=h.v}u?t(u,1,h):u=h}catch(n){t(u||(u=new Pact),2,n)}}(),u}(l,function(n){return i(l[n])})}(r,function(n){return Promise.resolve(n).then(i)}))}([1,2],function(n){r.push(n)});return Promise.resolve(i&&i.then?i.then(function(){return r}):r)}catch(n){return Promise.reject(n)}};r().then(console.log),module.exports=r;
|
||||
//# sourceMappingURL=esnext-ts.js.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build esnext-ts with microbundle 4`] = `
|
||||
"var n=function(){function n(){}return n.prototype.then=function(r,e){var i=new n,o=this.s;if(o){var u=1&o?r:e;if(u){try{t(i,1,u(this.v))}catch(n){t(i,2,n)}return i}return this}return this.o=function(n){try{var o=n.v;1&n.s?t(i,1,r?r(o):o):e?t(i,1,e(o)):t(i,2,o)}catch(n){t(i,2,n)}},i},n}();function t(r,e,i){if(!r.s){if(i instanceof n){if(!i.s)return void(i.o=t.bind(null,r,e));1&e&&(e=i.s),i=i.v}if(i&&i.then)return void i.then(t.bind(null,r,e),t.bind(null,r,2));r.s=e,r.v=i;var o=r.o;o&&o(r)}}function r(t){return t instanceof n&&1&t.s}var e=function(){try{var e=[],i=function(e,i,o){if(\\"undefined\\"!=typeof Symbol){var u=Symbol.asyncIterator;if(u&&u in e){var f=new n,c=e[u]();return c.next().then(v).then(void 0,a),f;function h(n){if(o&&!o())return t(f,1,c.return?c.return().then(function(){return n}):n);c.next().then(v).then(void 0,a)}function v(n){n.done?t(f,1):Promise.resolve(i(n.value)).then(h).then(void 0,a)}function a(n){t(f,2,c.return?c.return().then(function(){return n}):n)}}}return Promise.resolve(function(e,i,o){if(\\"undefined\\"!=typeof Symbol){var u=Symbol.iterator;if(u&&u in e){var f,c,h,v=e[u]();if(function e(u){try{for(;!((f=v.next()).done||o&&o());)if((u=i(f.value))&&u.then){if(!r(u))return void u.then(e,h||(h=t.bind(null,c=new n,2)));u=u.v}c?t(c,1,u):c=u}catch(n){t(c||(c=new Pact),2,n)}}(),v.return){var a=function(n){try{f.done||v.return()}catch(n){}return n};if(c&&c.then)return c.then(a,function(n){throw a(n)});a()}return c}}if(!(\\"length\\"in e))throw new TypeError(\\"value is not iterable\\");for(var l=[],s=0;s<e.length;s++)l.push(e[s]);return function(e,i,o){var u,f,c=-1;return function h(v){try{for(;++c<e.length&&(!o||!o());)if((v=i(c))&&v.then){if(!r(v))return void v.then(h,f||(f=t.bind(null,u=new n,2)));v=v.v}u?t(u,1,v):u=v}catch(n){t(u||(u=new Pact),2,n)}}(),u}(l,function(n){return i(l[n])},o)}(e,function(n){return Promise.resolve(n).then(i)},o))}([1,2],function(n){e.push(n)});return Promise.resolve(i&&i.then?i.then(function(){return e}):e)}catch(n){return Promise.reject(n)}};e().then(console.log);export default e;
|
||||
"var n=function(){function n(){}return n.prototype.then=function(e,r){var i=new n,o=this.s;if(o){var u=1&o?e:r;if(u){try{t(i,1,u(this.v))}catch(n){t(i,2,n)}return i}return this}return this.o=function(n){try{var o=n.v;1&n.s?t(i,1,e?e(o):o):r?t(i,1,r(o)):t(i,2,o)}catch(n){t(i,2,n)}},i},n}();function t(e,r,i){if(!e.s){if(i instanceof n){if(!i.s)return void(i.o=t.bind(null,e,r));1&r&&(r=i.s),i=i.v}if(i&&i.then)return void i.then(t.bind(null,e,r),t.bind(null,e,2));e.s=r,e.v=i;var o=e.o;o&&o(e)}}function e(t){return t instanceof n&&1&t.s}var r=function(){try{var r=[],i=function(r,i,o){if(\\"undefined\\"!=typeof Symbol){var u=Symbol.asyncIterator;if(u&&u in r){var f=function(n){a.next().then(c).then(void 0,h)},c=function(n){n.done?t(v,1):Promise.resolve(i(n.value)).then(f).then(void 0,h)},h=function(n){t(v,2,a.return?a.return().then(function(){return n}):n)},v=new n,a=r[u]();return a.next().then(c).then(void 0,h),v}}return Promise.resolve(function(r,i,o){if(\\"undefined\\"!=typeof Symbol){var u=Symbol.iterator;if(u&&u in r){var f,c,h,v=r[u]();if(function r(o){try{for(;!(f=v.next()).done;)if((o=i(f.value))&&o.then){if(!e(o))return void o.then(r,h||(h=t.bind(null,c=new n,2)));o=o.v}c?t(c,1,o):c=o}catch(n){t(c||(c=new Pact),2,n)}}(),v.return){var a=function(n){try{f.done||v.return()}catch(n){}return n};if(c&&c.then)return c.then(a,function(n){throw a(n)});a()}return c}}if(!(\\"length\\"in r))throw new TypeError(\\"value is not iterable\\");for(var l=[],s=0;s<r.length;s++)l.push(r[s]);return function(r,i,o){var u,f,c=-1;return function o(h){try{for(;++c<r.length;)if((h=i(c))&&h.then){if(!e(h))return void h.then(o,f||(f=t.bind(null,u=new n,2)));h=h.v}u?t(u,1,h):u=h}catch(n){t(u||(u=new Pact),2,n)}}(),u}(l,function(n){return i(l[n])})}(r,function(n){return Promise.resolve(n).then(i)}))}([1,2],function(n){r.push(n)});return Promise.resolve(i&&i.then?i.then(function(){return r}):r)}catch(n){return Promise.reject(n)}};r().then(console.log);export default r;
|
||||
//# sourceMappingURL=esnext-ts.mjs.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build esnext-ts with microbundle 5`] = `
|
||||
"!function(n,t){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=t():\\"function\\"==typeof define&&define.amd?define(t):(n=n||self).esnextTs=t()}(this,function(){var n=function(){function n(){}return n.prototype.then=function(e,r){var i=new n,o=this.s;if(o){var u=1&o?e:r;if(u){try{t(i,1,u(this.v))}catch(n){t(i,2,n)}return i}return this}return this.o=function(n){try{var o=n.v;1&n.s?t(i,1,e?e(o):o):r?t(i,1,r(o)):t(i,2,o)}catch(n){t(i,2,n)}},i},n}();function t(e,r,i){if(!e.s){if(i instanceof n){if(!i.s)return void(i.o=t.bind(null,e,r));1&r&&(r=i.s),i=i.v}if(i&&i.then)return void i.then(t.bind(null,e,r),t.bind(null,e,2));e.s=r,e.v=i;var o=e.o;o&&o(e)}}function e(t){return t instanceof n&&1&t.s}var r=function(){try{var r=[],i=function(r,i,o){if(\\"undefined\\"!=typeof Symbol){var u=Symbol.asyncIterator;if(u&&u in r){var f=new n,c=r[u]();return c.next().then(v).then(void 0,s),f;function h(n){if(o&&!o())return t(f,1,c.return?c.return().then(function(){return n}):n);c.next().then(v).then(void 0,s)}function v(n){n.done?t(f,1):Promise.resolve(i(n.value)).then(h).then(void 0,s)}function s(n){t(f,2,c.return?c.return().then(function(){return n}):n)}}}return Promise.resolve(function(r,i,o){if(\\"undefined\\"!=typeof Symbol){var u=Symbol.iterator;if(u&&u in r){var f,c,h,v=r[u]();if(function r(u){try{for(;!((f=v.next()).done||o&&o());)if((u=i(f.value))&&u.then){if(!e(u))return void u.then(r,h||(h=t.bind(null,c=new n,2)));u=u.v}c?t(c,1,u):c=u}catch(n){t(c||(c=new Pact),2,n)}}(),v.return){var s=function(n){try{f.done||v.return()}catch(n){}return n};if(c&&c.then)return c.then(s,function(n){throw s(n)});s()}return c}}if(!(\\"length\\"in r))throw new TypeError(\\"value is not iterable\\");for(var a=[],l=0;l<r.length;l++)a.push(r[l]);return function(r,i,o){var u,f,c=-1;return function h(v){try{for(;++c<r.length&&(!o||!o());)if((v=i(c))&&v.then){if(!e(v))return void v.then(h,f||(f=t.bind(null,u=new n,2)));v=v.v}u?t(u,1,v):u=v}catch(n){t(u||(u=new Pact),2,n)}}(),u}(a,function(n){return i(a[n])},o)}(r,function(n){return Promise.resolve(n).then(i)},o))}([1,2],function(n){r.push(n)});return Promise.resolve(i&&i.then?i.then(function(){return r}):r)}catch(n){return Promise.reject(n)}};return r().then(console.log),r});
|
||||
"!function(n,t){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=t():\\"function\\"==typeof define&&define.amd?define(t):(n=n||self).esnextTs=t()}(this,function(){var n=function(){function n(){}return n.prototype.then=function(e,r){var i=new n,o=this.s;if(o){var u=1&o?e:r;if(u){try{t(i,1,u(this.v))}catch(n){t(i,2,n)}return i}return this}return this.o=function(n){try{var o=n.v;1&n.s?t(i,1,e?e(o):o):r?t(i,1,r(o)):t(i,2,o)}catch(n){t(i,2,n)}},i},n}();function t(e,r,i){if(!e.s){if(i instanceof n){if(!i.s)return void(i.o=t.bind(null,e,r));1&r&&(r=i.s),i=i.v}if(i&&i.then)return void i.then(t.bind(null,e,r),t.bind(null,e,2));e.s=r,e.v=i;var o=e.o;o&&o(e)}}function e(t){return t instanceof n&&1&t.s}var r=function(){try{var r=[],i=function(r,i,o){if(\\"undefined\\"!=typeof Symbol){var u=Symbol.asyncIterator;if(u&&u in r){var f=function(n){s.next().then(c).then(void 0,h)},c=function(n){n.done?t(v,1):Promise.resolve(i(n.value)).then(f).then(void 0,h)},h=function(n){t(v,2,s.return?s.return().then(function(){return n}):n)},v=new n,s=r[u]();return s.next().then(c).then(void 0,h),v}}return Promise.resolve(function(r,i,o){if(\\"undefined\\"!=typeof Symbol){var u=Symbol.iterator;if(u&&u in r){var f,c,h,v=r[u]();if(function r(o){try{for(;!(f=v.next()).done;)if((o=i(f.value))&&o.then){if(!e(o))return void o.then(r,h||(h=t.bind(null,c=new n,2)));o=o.v}c?t(c,1,o):c=o}catch(n){t(c||(c=new Pact),2,n)}}(),v.return){var s=function(n){try{f.done||v.return()}catch(n){}return n};if(c&&c.then)return c.then(s,function(n){throw s(n)});s()}return c}}if(!(\\"length\\"in r))throw new TypeError(\\"value is not iterable\\");for(var a=[],l=0;l<r.length;l++)a.push(r[l]);return function(r,i,o){var u,f,c=-1;return function o(h){try{for(;++c<r.length;)if((h=i(c))&&h.then){if(!e(h))return void h.then(o,f||(f=t.bind(null,u=new n,2)));h=h.v}u?t(u,1,h):u=h}catch(n){t(u||(u=new Pact),2,n)}}(),u}(a,function(n){return i(a[n])})}(r,function(n){return Promise.resolve(n).then(i)}))}([1,2],function(n){r.push(n)});return Promise.resolve(i&&i.then?i.then(function(){return r}):r)}catch(n){return Promise.reject(n)}};return r().then(console.log),r});
|
||||
//# sourceMappingURL=esnext-ts.umd.js.map
|
||||
"
|
||||
`;
|
||||
@ -914,30 +961,30 @@ jsx
|
||||
|
||||
|
||||
Build \\"jsx\\" to dist:
|
||||
211 B: jsx.js.gz
|
||||
168 B: jsx.js.br
|
||||
212 B: jsx.mjs.gz
|
||||
170 B: jsx.mjs.br
|
||||
290 B: jsx.umd.js.gz
|
||||
229 B: jsx.umd.js.br"
|
||||
262 B: jsx.js.gz
|
||||
209 B: jsx.js.br
|
||||
261 B: jsx.mjs.gz
|
||||
208 B: jsx.mjs.br
|
||||
335 B: jsx.umd.js.gz
|
||||
278 B: jsx.umd.js.br"
|
||||
`;
|
||||
|
||||
exports[`fixtures build jsx with microbundle 2`] = `6`;
|
||||
|
||||
exports[`fixtures build jsx with microbundle 3`] = `
|
||||
"var r=function(r,n){for(var o=[],e=arguments.length-2;e-- >0;)o[e]=arguments[e+2];return{tag:r,props:n,children:o}},n=function(){};n.prototype.render=function(){return r(\\"div\\",{id:\\"app\\"},r(\\"h1\\",null,\\"Hello, World!\\"),r(\\"p\\",null,\\"A JSX demo.\\"))},module.exports=n;
|
||||
"var n=function(n,r){for(var e=arguments.length,t=new Array(e>2?e-2:0),l=2;l<e;l++)t[l-2]=arguments[l];return{tag:n,props:r,children:t}},r=function(n){return n.children};module.exports=function(){function e(){}return e.prototype.render=function(){return n(\\"div\\",{id:\\"app\\"},n(\\"h1\\",null,\\"Hello, World!\\"),n(\\"p\\",null,\\"A JSX demo.\\"),n(r,null,n(\\"p\\",null,\\"Test fragment\\")))},e}();
|
||||
//# sourceMappingURL=jsx.js.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build jsx with microbundle 4`] = `
|
||||
"var r=function(r,n){for(var e=[],o=arguments.length-2;o-- >0;)e[o]=arguments[o+2];return{tag:r,props:n,children:e}},n=function(){};n.prototype.render=function(){return r(\\"div\\",{id:\\"app\\"},r(\\"h1\\",null,\\"Hello, World!\\"),r(\\"p\\",null,\\"A JSX demo.\\"))};export default n;
|
||||
"var n=function(n,r){for(var e=arguments.length,t=new Array(e>2?e-2:0),l=2;l<e;l++)t[l-2]=arguments[l];return{tag:n,props:r,children:t}},r=function(n){return n.children};export default(function(){function e(){}return e.prototype.render=function(){return n(\\"div\\",{id:\\"app\\"},n(\\"h1\\",null,\\"Hello, World!\\"),n(\\"p\\",null,\\"A JSX demo.\\"),n(r,null,n(\\"p\\",null,\\"Test fragment\\")))},e}());
|
||||
//# sourceMappingURL=jsx.mjs.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build jsx with microbundle 5`] = `
|
||||
"!function(e,n){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=n():\\"function\\"==typeof define&&define.amd?define(n):(e=e||self).jsx=n()}(this,function(){var e=function(e,n){for(var o=[],t=arguments.length-2;t-- >0;)o[t]=arguments[t+2];return{tag:e,props:n,children:o}},n=function(){};return n.prototype.render=function(){return e(\\"div\\",{id:\\"app\\"},e(\\"h1\\",null,\\"Hello, World!\\"),e(\\"p\\",null,\\"A JSX demo.\\"))},n});
|
||||
"!function(n,e){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=e():\\"function\\"==typeof define&&define.amd?define(e):(n=n||self).jsx=e()}(this,function(){var n=function(n,e){for(var t=arguments.length,r=new Array(t>2?t-2:0),o=2;o<t;o++)r[o-2]=arguments[o];return{tag:n,props:e,children:r}},e=function(n){return n.children};return function(){function t(){}return t.prototype.render=function(){return n(\\"div\\",{id:\\"app\\"},n(\\"h1\\",null,\\"Hello, World!\\"),n(\\"p\\",null,\\"A JSX demo.\\"),n(e,null,n(\\"p\\",null,\\"Test fragment\\")))},t}()});
|
||||
//# sourceMappingURL=jsx.umd.js.map
|
||||
"
|
||||
`;
|
||||
@ -962,30 +1009,30 @@ name-custom-amd
|
||||
|
||||
|
||||
Build \\"customNameAmd\\" to dist:
|
||||
202 B: name-custom-amd.js.gz
|
||||
145 B: name-custom-amd.js.br
|
||||
203 B: name-custom-amd.mjs.gz
|
||||
145 B: name-custom-amd.mjs.br
|
||||
291 B: name-custom-amd.umd.js.gz
|
||||
225 B: name-custom-amd.umd.js.br"
|
||||
229 B: name-custom-amd.js.gz
|
||||
174 B: name-custom-amd.js.br
|
||||
230 B: name-custom-amd.mjs.gz
|
||||
177 B: name-custom-amd.mjs.br
|
||||
317 B: name-custom-amd.umd.js.gz
|
||||
253 B: name-custom-amd.umd.js.br"
|
||||
`;
|
||||
|
||||
exports[`fixtures build name-custom-amd with microbundle 2`] = `6`;
|
||||
|
||||
exports[`fixtures build name-custom-amd with microbundle 3`] = `
|
||||
"var r=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];try{return Promise.resolve(r.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};module.exports=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];try{return Promise.resolve(r.apply(void 0,e)).then(function(t){return Promise.resolve(r.apply(void 0,e)).then(function(r){return[t,r]})})}catch(r){return Promise.reject(r)}};
|
||||
"var r=function(){try{for(var r=arguments.length,e=new Array(r),n=0;n<r;n++)e[n]=arguments[n];return Promise.resolve(e.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};module.exports=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];try{return Promise.resolve(r.apply(void 0,n)).then(function(e){return Promise.resolve(r.apply(void 0,n)).then(function(r){return[e,r]})})}catch(r){return Promise.reject(r)}};
|
||||
//# sourceMappingURL=name-custom-amd.js.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build name-custom-amd with microbundle 4`] = `
|
||||
"var r=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];try{return Promise.resolve(r.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};export default function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];try{return Promise.resolve(r.apply(void 0,e)).then(function(t){return Promise.resolve(r.apply(void 0,e)).then(function(r){return[t,r]})})}catch(r){return Promise.reject(r)}}
|
||||
"var r=function(){try{for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return Promise.resolve(e.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};export default function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];try{return Promise.resolve(r.apply(void 0,t)).then(function(e){return Promise.resolve(r.apply(void 0,t)).then(function(r){return[e,r]})})}catch(r){return Promise.reject(r)}}
|
||||
//# sourceMappingURL=name-custom-amd.mjs.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build name-custom-amd with microbundle 5`] = `
|
||||
"!function(e,r){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=r():\\"function\\"==typeof define&&define.amd?define(r):(e=e||self).customNameAmd=r()}(this,function(){var e=function(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];try{return Promise.resolve(e.reduce(function(e,r){return e+r},0))}catch(e){return Promise.reject(e)}};return function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];try{return Promise.resolve(e.apply(void 0,r)).then(function(t){return Promise.resolve(e.apply(void 0,r)).then(function(e){return[t,e]})})}catch(e){return Promise.reject(e)}}});
|
||||
"!function(e,r){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=r():\\"function\\"==typeof define&&define.amd?define(r):(e=e||self).customNameAmd=r()}(this,function(){var e=function(){try{for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return Promise.resolve(r.reduce(function(e,r){return e+r},0))}catch(e){return Promise.reject(e)}};return function(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];try{return Promise.resolve(e.apply(void 0,n)).then(function(r){return Promise.resolve(e.apply(void 0,n)).then(function(e){return[r,e]})})}catch(e){return Promise.reject(e)}}});
|
||||
//# sourceMappingURL=name-custom-amd.umd.js.map
|
||||
"
|
||||
`;
|
||||
@ -1010,30 +1057,30 @@ name-custom-cli
|
||||
|
||||
|
||||
Build \\"nameCustomCli\\" to dist:
|
||||
202 B: name-custom.js.gz
|
||||
145 B: name-custom.js.br
|
||||
203 B: name-custom.mjs.gz
|
||||
145 B: name-custom.mjs.br
|
||||
290 B: name-custom.umd.js.gz
|
||||
234 B: name-custom.umd.js.br"
|
||||
229 B: name-custom.js.gz
|
||||
174 B: name-custom.js.br
|
||||
230 B: name-custom.mjs.gz
|
||||
177 B: name-custom.mjs.br
|
||||
316 B: name-custom.umd.js.gz
|
||||
255 B: name-custom.umd.js.br"
|
||||
`;
|
||||
|
||||
exports[`fixtures build name-custom-cli with microbundle 2`] = `6`;
|
||||
|
||||
exports[`fixtures build name-custom-cli with microbundle 3`] = `
|
||||
"var r=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];try{return Promise.resolve(r.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};module.exports=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];try{return Promise.resolve(r.apply(void 0,e)).then(function(t){return Promise.resolve(r.apply(void 0,e)).then(function(r){return[t,r]})})}catch(r){return Promise.reject(r)}};
|
||||
"var r=function(){try{for(var r=arguments.length,e=new Array(r),n=0;n<r;n++)e[n]=arguments[n];return Promise.resolve(e.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};module.exports=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];try{return Promise.resolve(r.apply(void 0,n)).then(function(e){return Promise.resolve(r.apply(void 0,n)).then(function(r){return[e,r]})})}catch(r){return Promise.reject(r)}};
|
||||
//# sourceMappingURL=name-custom.js.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build name-custom-cli with microbundle 4`] = `
|
||||
"var r=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];try{return Promise.resolve(r.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};export default function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];try{return Promise.resolve(r.apply(void 0,e)).then(function(t){return Promise.resolve(r.apply(void 0,e)).then(function(r){return[t,r]})})}catch(r){return Promise.reject(r)}}
|
||||
"var r=function(){try{for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return Promise.resolve(e.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};export default function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];try{return Promise.resolve(r.apply(void 0,t)).then(function(e){return Promise.resolve(r.apply(void 0,t)).then(function(r){return[e,r]})})}catch(r){return Promise.reject(r)}}
|
||||
//# sourceMappingURL=name-custom.mjs.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build name-custom-cli with microbundle 5`] = `
|
||||
"!function(e,r){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=r():\\"function\\"==typeof define&&define.amd?define(r):(e=e||self).nameCustomCli=r()}(this,function(){var e=function(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];try{return Promise.resolve(e.reduce(function(e,r){return e+r},0))}catch(e){return Promise.reject(e)}};return function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];try{return Promise.resolve(e.apply(void 0,r)).then(function(n){return Promise.resolve(e.apply(void 0,r)).then(function(e){return[n,e]})})}catch(e){return Promise.reject(e)}}});
|
||||
"!function(e,r){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=r():\\"function\\"==typeof define&&define.amd?define(r):(e=e||self).nameCustomCli=r()}(this,function(){var e=function(){try{for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return Promise.resolve(r.reduce(function(e,r){return e+r},0))}catch(e){return Promise.reject(e)}};return function(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];try{return Promise.resolve(e.apply(void 0,n)).then(function(r){return Promise.resolve(e.apply(void 0,n)).then(function(e){return[r,e]})})}catch(e){return Promise.reject(e)}}});
|
||||
//# sourceMappingURL=name-custom.umd.js.map
|
||||
"
|
||||
`;
|
||||
@ -1057,30 +1104,30 @@ no-pkg
|
||||
|
||||
|
||||
Build \\"noPkg\\" to dist:
|
||||
202 B: no-pkg.js.gz
|
||||
145 B: no-pkg.js.br
|
||||
203 B: no-pkg.mjs.gz
|
||||
145 B: no-pkg.mjs.br
|
||||
283 B: no-pkg.umd.js.gz
|
||||
235 B: no-pkg.umd.js.br"
|
||||
229 B: no-pkg.js.gz
|
||||
174 B: no-pkg.js.br
|
||||
230 B: no-pkg.mjs.gz
|
||||
177 B: no-pkg.mjs.br
|
||||
310 B: no-pkg.umd.js.gz
|
||||
248 B: no-pkg.umd.js.br"
|
||||
`;
|
||||
|
||||
exports[`fixtures build no-pkg with microbundle 2`] = `6`;
|
||||
|
||||
exports[`fixtures build no-pkg with microbundle 3`] = `
|
||||
"var r=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];try{return Promise.resolve(r.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};module.exports=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];try{return Promise.resolve(r.apply(void 0,e)).then(function(t){return Promise.resolve(r.apply(void 0,e)).then(function(r){return[t,r]})})}catch(r){return Promise.reject(r)}};
|
||||
"var r=function(){try{for(var r=arguments.length,e=new Array(r),n=0;n<r;n++)e[n]=arguments[n];return Promise.resolve(e.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};module.exports=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];try{return Promise.resolve(r.apply(void 0,n)).then(function(e){return Promise.resolve(r.apply(void 0,n)).then(function(r){return[e,r]})})}catch(r){return Promise.reject(r)}};
|
||||
//# sourceMappingURL=no-pkg.js.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build no-pkg with microbundle 4`] = `
|
||||
"var r=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];try{return Promise.resolve(r.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};export default function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];try{return Promise.resolve(r.apply(void 0,e)).then(function(t){return Promise.resolve(r.apply(void 0,e)).then(function(r){return[t,r]})})}catch(r){return Promise.reject(r)}}
|
||||
"var r=function(){try{for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return Promise.resolve(e.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};export default function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];try{return Promise.resolve(r.apply(void 0,t)).then(function(e){return Promise.resolve(r.apply(void 0,t)).then(function(r){return[e,r]})})}catch(r){return Promise.reject(r)}}
|
||||
//# sourceMappingURL=no-pkg.mjs.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build no-pkg with microbundle 5`] = `
|
||||
"!function(e,r){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=r():\\"function\\"==typeof define&&define.amd?define(r):(e=e||self).noPkg=r()}(this,function(){var e=function(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];try{return Promise.resolve(e.reduce(function(e,r){return e+r},0))}catch(e){return Promise.reject(e)}};return function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];try{return Promise.resolve(e.apply(void 0,r)).then(function(n){return Promise.resolve(e.apply(void 0,r)).then(function(e){return[n,e]})})}catch(e){return Promise.reject(e)}}});
|
||||
"!function(e,r){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=r():\\"function\\"==typeof define&&define.amd?define(r):(e=e||self).noPkg=r()}(this,function(){var e=function(){try{for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return Promise.resolve(r.reduce(function(e,r){return e+r},0))}catch(e){return Promise.reject(e)}};return function(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];try{return Promise.resolve(e.apply(void 0,n)).then(function(r){return Promise.resolve(e.apply(void 0,n)).then(function(e){return[r,e]})})}catch(e){return Promise.reject(e)}}});
|
||||
//# sourceMappingURL=no-pkg.umd.js.map
|
||||
"
|
||||
`;
|
||||
@ -1105,30 +1152,30 @@ no-pkg-name
|
||||
|
||||
|
||||
Build \\"noPkgName\\" to dist:
|
||||
202 B: no-pkg-name.js.gz
|
||||
145 B: no-pkg-name.js.br
|
||||
203 B: no-pkg-name.mjs.gz
|
||||
145 B: no-pkg-name.mjs.br
|
||||
287 B: no-pkg-name.umd.js.gz
|
||||
238 B: no-pkg-name.umd.js.br"
|
||||
229 B: no-pkg-name.js.gz
|
||||
174 B: no-pkg-name.js.br
|
||||
230 B: no-pkg-name.mjs.gz
|
||||
177 B: no-pkg-name.mjs.br
|
||||
314 B: no-pkg-name.umd.js.gz
|
||||
246 B: no-pkg-name.umd.js.br"
|
||||
`;
|
||||
|
||||
exports[`fixtures build no-pkg-name with microbundle 2`] = `6`;
|
||||
|
||||
exports[`fixtures build no-pkg-name with microbundle 3`] = `
|
||||
"var r=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];try{return Promise.resolve(r.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};module.exports=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];try{return Promise.resolve(r.apply(void 0,e)).then(function(t){return Promise.resolve(r.apply(void 0,e)).then(function(r){return[t,r]})})}catch(r){return Promise.reject(r)}};
|
||||
"var r=function(){try{for(var r=arguments.length,e=new Array(r),n=0;n<r;n++)e[n]=arguments[n];return Promise.resolve(e.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};module.exports=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];try{return Promise.resolve(r.apply(void 0,n)).then(function(e){return Promise.resolve(r.apply(void 0,n)).then(function(r){return[e,r]})})}catch(r){return Promise.reject(r)}};
|
||||
//# sourceMappingURL=no-pkg-name.js.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build no-pkg-name with microbundle 4`] = `
|
||||
"var r=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];try{return Promise.resolve(r.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};export default function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];try{return Promise.resolve(r.apply(void 0,e)).then(function(t){return Promise.resolve(r.apply(void 0,e)).then(function(r){return[t,r]})})}catch(r){return Promise.reject(r)}}
|
||||
"var r=function(){try{for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return Promise.resolve(e.reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};export default function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];try{return Promise.resolve(r.apply(void 0,t)).then(function(e){return Promise.resolve(r.apply(void 0,t)).then(function(r){return[e,r]})})}catch(r){return Promise.reject(r)}}
|
||||
//# sourceMappingURL=no-pkg-name.mjs.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build no-pkg-name with microbundle 5`] = `
|
||||
"!function(e,r){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=r():\\"function\\"==typeof define&&define.amd?define(r):(e=e||self).noPkgName=r()}(this,function(){var e=function(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];try{return Promise.resolve(e.reduce(function(e,r){return e+r},0))}catch(e){return Promise.reject(e)}};return function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];try{return Promise.resolve(e.apply(void 0,r)).then(function(n){return Promise.resolve(e.apply(void 0,r)).then(function(e){return[n,e]})})}catch(e){return Promise.reject(e)}}});
|
||||
"!function(e,r){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=r():\\"function\\"==typeof define&&define.amd?define(r):(e=e||self).noPkgName=r()}(this,function(){var e=function(){try{for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return Promise.resolve(r.reduce(function(e,r){return e+r},0))}catch(e){return Promise.reject(e)}};return function(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];try{return Promise.resolve(e.apply(void 0,n)).then(function(r){return Promise.resolve(e.apply(void 0,n)).then(function(e){return[r,e]})})}catch(e){return Promise.reject(e)}}});
|
||||
//# sourceMappingURL=no-pkg-name.umd.js.map
|
||||
"
|
||||
`;
|
||||
@ -1301,12 +1348,12 @@ ts-mixed-exports
|
||||
|
||||
|
||||
Build \\"tsMixedExports\\" to dist:
|
||||
106 B: ts-mixed-exports.js.gz
|
||||
88 B: ts-mixed-exports.js.br
|
||||
102 B: ts-mixed-exports.mjs.gz
|
||||
78 B: ts-mixed-exports.mjs.br
|
||||
205 B: ts-mixed-exports.umd.js.gz
|
||||
162 B: ts-mixed-exports.umd.js.br"
|
||||
112 B: ts-mixed-exports.js.gz
|
||||
89 B: ts-mixed-exports.js.br
|
||||
113 B: ts-mixed-exports.mjs.gz
|
||||
98 B: ts-mixed-exports.mjs.br
|
||||
213 B: ts-mixed-exports.umd.js.gz
|
||||
171 B: ts-mixed-exports.umd.js.br"
|
||||
`;
|
||||
|
||||
exports[`fixtures build ts-mixed-exports with microbundle 2`] = `8`;
|
||||
@ -1330,19 +1377,19 @@ export default Ferrari;
|
||||
`;
|
||||
|
||||
exports[`fixtures build ts-mixed-exports with microbundle 5`] = `
|
||||
"var r=function(){};r.prototype.drive=function(r){return!0};var t=new r;exports.Car=r,exports.default=t;
|
||||
"var r=function(){function r(){}return r.prototype.drive=function(r){return!0},r}(),t=new r;exports.Car=r,exports.default=t;
|
||||
//# sourceMappingURL=ts-mixed-exports.js.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build ts-mixed-exports with microbundle 6`] = `
|
||||
"var t=function(){};t.prototype.drive=function(t){return!0};export default new t;export{t as Car};
|
||||
"var t=function(){function t(){}return t.prototype.drive=function(t){return!0},t}();export default new t;export{t as Car};
|
||||
//# sourceMappingURL=ts-mixed-exports.mjs.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build ts-mixed-exports with microbundle 7`] = `
|
||||
"!function(e,t){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?t(exports):\\"function\\"==typeof define&&define.amd?define([\\"exports\\"],t):t((e=e||self).tsMixedExports={})}(this,function(e){var t=function(){};t.prototype.drive=function(e){return!0};var n=new t;e.Car=t,e.default=n});
|
||||
"!function(e,t){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?t(exports):\\"function\\"==typeof define&&define.amd?define([\\"exports\\"],t):t((e=e||self).tsMixedExports={})}(this,function(e){var t=function(){function e(){}return e.prototype.drive=function(e){return!0},e}(),n=new t;e.Car=t,e.default=n});
|
||||
//# sourceMappingURL=ts-mixed-exports.umd.js.map
|
||||
"
|
||||
`;
|
||||
|
||||
3
test/fixtures/basic-babelrc/.babelrc
vendored
Normal file
3
test/fixtures/basic-babelrc/.babelrc
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["@babel/plugin-proposal-throw-expressions"]
|
||||
}
|
||||
3
test/fixtures/basic-babelrc/package.json
vendored
Normal file
3
test/fixtures/basic-babelrc/package.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"name": "basic-babelrc"
|
||||
}
|
||||
5
test/fixtures/basic-babelrc/src/index.js
vendored
Normal file
5
test/fixtures/basic-babelrc/src/index.js
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
function test(param = throw new Error('required!')) {
|
||||
return param === true || throw new Error('Falsey!');
|
||||
}
|
||||
|
||||
test(true);
|
||||
5
test/fixtures/jsx/index.js
vendored
5
test/fixtures/jsx/index.js
vendored
@ -1,4 +1,6 @@
|
||||
const h = (tag, props, ...children) => ({ tag, props, children });
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const Fragment = ({ children }) => children;
|
||||
|
||||
export default class Foo {
|
||||
render() {
|
||||
@ -6,6 +8,9 @@ export default class Foo {
|
||||
<div id="app">
|
||||
<h1>Hello, World!</h1>
|
||||
<p>A JSX demo.</p>
|
||||
<>
|
||||
<p>Test fragment</p>
|
||||
</>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,15 +1,8 @@
|
||||
import { resolve } from 'path';
|
||||
import fs from 'fs-extra';
|
||||
import { promisify } from 'es6-promisify';
|
||||
import dirTree from 'directory-tree';
|
||||
import shellQuote from 'shell-quote';
|
||||
import _rimraf from 'rimraf';
|
||||
import { strip } from './lib/util';
|
||||
import { readFile } from '../src/utils';
|
||||
import createProg from '../src/prog';
|
||||
import microbundle from '../src/index';
|
||||
|
||||
const rimraf = promisify(_rimraf);
|
||||
import { buildDirectory, getBuildScript } from '../tools/build-fixture';
|
||||
|
||||
const FIXTURES_DIR = `${__dirname}/fixtures`;
|
||||
const DEFAULT_SCRIPT = 'microbundle';
|
||||
@ -31,29 +24,6 @@ const printTree = (nodes, indentLevel = 0) => {
|
||||
);
|
||||
};
|
||||
|
||||
const getBuildScript = async (fixturePath, defaultScript) => {
|
||||
let pkg = {};
|
||||
try {
|
||||
pkg = JSON.parse(
|
||||
await readFile(resolve(fixturePath, 'package.json'), 'utf8'),
|
||||
);
|
||||
} catch (err) {
|
||||
if (err.code !== 'ENOENT') throw err;
|
||||
}
|
||||
return (pkg && pkg.scripts && pkg.scripts.build) || defaultScript;
|
||||
};
|
||||
|
||||
const parseScript = (() => {
|
||||
let parsed;
|
||||
const prog = createProg(_parsed => (parsed = _parsed));
|
||||
return script => {
|
||||
const argv = shellQuote.parse(`node ${script}`);
|
||||
// assuming {op: 'glob', pattern} for non-string args
|
||||
prog(argv.map(arg => (typeof arg === 'string' ? arg : arg.pattern)));
|
||||
return parsed;
|
||||
};
|
||||
})();
|
||||
|
||||
describe('fixtures', () => {
|
||||
const dirs = fs
|
||||
.readdirSync(FIXTURES_DIR)
|
||||
@ -69,38 +39,20 @@ describe('fixtures', () => {
|
||||
fixturePath = resolve(fixturePath, fixtureDir.replace('-with-cwd', ''));
|
||||
}
|
||||
|
||||
const dist = resolve(`${fixturePath}/dist`);
|
||||
// clean up
|
||||
await rimraf(dist);
|
||||
await rimraf(resolve(`${fixturePath}/.rts2_cache_cjs`));
|
||||
await rimraf(resolve(`${fixturePath}/.rts2_cache_es`));
|
||||
await rimraf(resolve(`${fixturePath}/.rts2_cache_umd`));
|
||||
|
||||
const script = await getBuildScript(fixturePath, DEFAULT_SCRIPT);
|
||||
|
||||
const prevDir = process.cwd();
|
||||
process.chdir(resolve(fixturePath));
|
||||
|
||||
const parsedOpts = parseScript(script);
|
||||
|
||||
const output = await microbundle({
|
||||
...parsedOpts,
|
||||
cwd: parsedOpts.cwd !== '.' ? parsedOpts.cwd : resolve(fixturePath),
|
||||
});
|
||||
|
||||
process.chdir(prevDir);
|
||||
const output = await buildDirectory(fixtureDir);
|
||||
|
||||
const printedDir = printTree([dirTree(fixturePath)]);
|
||||
|
||||
expect(
|
||||
[
|
||||
`Used script: ${script}`,
|
||||
`Used script: ${await getBuildScript(fixturePath, DEFAULT_SCRIPT)}`,
|
||||
'Directory tree:',
|
||||
printedDir,
|
||||
strip(output),
|
||||
].join('\n\n'),
|
||||
).toMatchSnapshot();
|
||||
|
||||
const dist = resolve(`${fixturePath}/dist`);
|
||||
const files = fs.readdirSync(resolve(dist));
|
||||
expect(files.length).toMatchSnapshot();
|
||||
// we don't realy care about the content of a sourcemap
|
||||
|
||||
66
tools/build-fixture.js
Normal file
66
tools/build-fixture.js
Normal file
@ -0,0 +1,66 @@
|
||||
import { resolve } from 'path';
|
||||
import { promisify } from 'es6-promisify';
|
||||
import shellQuote from 'shell-quote';
|
||||
import _rimraf from 'rimraf';
|
||||
import { readFile } from '../src/utils';
|
||||
import createProg from '../src/prog';
|
||||
import microbundle from '../src/index';
|
||||
|
||||
const rimraf = promisify(_rimraf);
|
||||
|
||||
const FIXTURES_DIR = resolve(`${__dirname}/../test/fixtures`);
|
||||
const DEFAULT_SCRIPT = 'microbundle';
|
||||
|
||||
const parseScript = (() => {
|
||||
let parsed;
|
||||
const prog = createProg(_parsed => (parsed = _parsed));
|
||||
|
||||
return script => {
|
||||
const argv = shellQuote.parse(`node ${script}`);
|
||||
// assuming {op: 'glob', pattern} for non-string args
|
||||
prog(argv.map(arg => (typeof arg === 'string' ? arg : arg.pattern)));
|
||||
return parsed;
|
||||
};
|
||||
})();
|
||||
|
||||
export const getBuildScript = async (fixturePath, defaultScript) => {
|
||||
let pkg = {};
|
||||
try {
|
||||
pkg = JSON.parse(
|
||||
await readFile(resolve(fixturePath, 'package.json'), 'utf8'),
|
||||
);
|
||||
} catch (err) {
|
||||
if (err.code !== 'ENOENT') throw err;
|
||||
}
|
||||
return (pkg && pkg.scripts && pkg.scripts.build) || defaultScript;
|
||||
};
|
||||
|
||||
export const buildDirectory = async fixtureDir => {
|
||||
let fixturePath = resolve(FIXTURES_DIR, fixtureDir);
|
||||
if (fixtureDir.endsWith('-with-cwd')) {
|
||||
fixturePath = resolve(fixturePath, fixtureDir.replace('-with-cwd', ''));
|
||||
}
|
||||
|
||||
const dist = resolve(`${fixturePath}/dist`);
|
||||
// clean up
|
||||
await rimraf(dist);
|
||||
await rimraf(resolve(`${fixturePath}/.rts2_cache_cjs`));
|
||||
await rimraf(resolve(`${fixturePath}/.rts2_cache_es`));
|
||||
await rimraf(resolve(`${fixturePath}/.rts2_cache_umd`));
|
||||
|
||||
const script = await getBuildScript(fixturePath, DEFAULT_SCRIPT);
|
||||
|
||||
const prevDir = process.cwd();
|
||||
process.chdir(resolve(fixturePath));
|
||||
|
||||
const parsedOpts = parseScript(script);
|
||||
let output = '';
|
||||
output = await microbundle({
|
||||
...parsedOpts,
|
||||
cwd: parsedOpts.cwd !== '.' ? parsedOpts.cwd : resolve(fixturePath),
|
||||
});
|
||||
|
||||
process.chdir(prevDir);
|
||||
|
||||
return output;
|
||||
};
|
||||
50
tools/generate-filesize.js
Normal file
50
tools/generate-filesize.js
Normal file
@ -0,0 +1,50 @@
|
||||
// eslint-ignore
|
||||
require = require('esm')(module);
|
||||
|
||||
const { resolve } = require('path');
|
||||
const fs = require('fs-extra');
|
||||
const { buildDirectory } = require('./build-fixture');
|
||||
|
||||
const FIXTURES_DIR = `${__dirname}/../test/fixtures`;
|
||||
|
||||
const each = fn => arr => {
|
||||
arr = Array.isArray(arr) ? arr : [arr];
|
||||
|
||||
return arr
|
||||
.reduce(
|
||||
(prev, curr, i) => prev.then(() => fn(curr, i, arr.length)),
|
||||
Promise.resolve(),
|
||||
)
|
||||
.then(() => arr);
|
||||
};
|
||||
|
||||
const dirs = fs
|
||||
.readdirSync(FIXTURES_DIR)
|
||||
.filter(fixturePath =>
|
||||
fs.statSync(resolve(FIXTURES_DIR, fixturePath)).isDirectory(),
|
||||
);
|
||||
|
||||
(async () => {
|
||||
const csv = [];
|
||||
|
||||
await each(async fixtureDir => {
|
||||
let fixturePath = resolve(FIXTURES_DIR, fixtureDir);
|
||||
if (fixtureDir.endsWith('-with-cwd')) {
|
||||
fixturePath = resolve(fixturePath, fixtureDir.replace('-with-cwd', ''));
|
||||
}
|
||||
|
||||
await buildDirectory(fixtureDir);
|
||||
|
||||
const dist = resolve(`${fixturePath}/dist`);
|
||||
fs.readdirSync(dist)
|
||||
.filter(file => !/\.map$/.test(file))
|
||||
.forEach(file => {
|
||||
const size = fs.statSync(resolve(`${dist}/${file}`)).size;
|
||||
csv.push(`${fixtureDir}/${file},${size}`);
|
||||
});
|
||||
})(dirs);
|
||||
|
||||
csv.unshift('file,size');
|
||||
|
||||
fs.writeFile(resolve(__dirname, '../sizes.csv'), csv.join('\n'));
|
||||
})();
|
||||
Loading…
x
Reference in New Issue
Block a user