Showing preview only (316K chars total). Download the full file or copy to clipboard to get everything.
Repository: developit/microbundle
Branch: master
Commit: 9f56e06b0d1d
Files: 233
Total size: 265.4 KB
Directory structure:
gitextract_yce_p9ai/
├── .changeset/
│ ├── README.md
│ ├── config.json
│ ├── gold-berries-march.md
│ ├── swift-plums-fix.md
│ └── violet-falcons-dream.md
├── .editorconfig
├── .eslintrc
├── .github/
│ └── workflows/
│ ├── nodejs.yml
│ ├── release.yml
│ └── size.yml
├── .gitignore
├── .prettierignore
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── LICENSE
├── README.md
├── babel.config.js
├── index.d.ts
├── package.json
├── src/
│ ├── cli.js
│ ├── index.js
│ ├── lib/
│ │ ├── __entry__.js
│ │ ├── babel-custom.js
│ │ ├── compressed-size.js
│ │ ├── css-modules.js
│ │ ├── option-normalization.js
│ │ ├── package-info.js
│ │ ├── terser.js
│ │ └── transform-fast-rest.js
│ ├── log-error.js
│ ├── prog.js
│ └── utils.js
├── test/
│ ├── __snapshots__/
│ │ └── index.test.js.snap
│ ├── fixtures/
│ │ ├── alias/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ ├── constants-debug.js
│ │ │ ├── constants.js
│ │ │ └── index.js
│ │ ├── alias-external/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ ├── colossal-glob.js
│ │ │ └── index.js
│ │ ├── async-iife-ts/
│ │ │ ├── package.json
│ │ │ ├── src/
│ │ │ │ └── index.ts
│ │ │ └── tsconfig.json
│ │ ├── async-ts/
│ │ │ ├── package.json
│ │ │ ├── src/
│ │ │ │ └── index.ts
│ │ │ └── tsconfig.json
│ │ ├── basic/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ ├── index.js
│ │ │ └── two.js
│ │ ├── basic-babelrc/
│ │ │ ├── .babelrc
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ └── index.js
│ │ ├── basic-compress-false/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ ├── index.js
│ │ │ └── two.js
│ │ ├── basic-css/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ ├── index.js
│ │ │ └── two.css
│ │ ├── basic-dashed-external/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ ├── index.js
│ │ │ └── two.js
│ │ ├── basic-flow/
│ │ │ ├── .flowconfig
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ ├── fruits.js
│ │ │ └── index.js
│ │ ├── basic-json/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ ├── index.js
│ │ │ └── two.json
│ │ ├── basic-multi-source/
│ │ │ ├── a.js
│ │ │ ├── b.js
│ │ │ └── package.json
│ │ ├── basic-multi-source-css/
│ │ │ ├── a.css
│ │ │ ├── a.js
│ │ │ ├── b.css
│ │ │ ├── b.js
│ │ │ └── package.json
│ │ ├── basic-no-compress/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ ├── index.js
│ │ │ └── two.js
│ │ ├── basic-no-pkg-main/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ ├── index.js
│ │ │ └── two.js
│ │ ├── basic-node-internals/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ └── index.js
│ │ ├── basic-ts/
│ │ │ ├── package.json
│ │ │ ├── src/
│ │ │ │ ├── car.ts
│ │ │ │ └── index.ts
│ │ │ └── tsconfig.json
│ │ ├── basic-tsx/
│ │ │ ├── package.json
│ │ │ ├── src/
│ │ │ │ └── index.tsx
│ │ │ └── tsconfig.json
│ │ ├── basic-with-cwd/
│ │ │ ├── basic/
│ │ │ │ ├── package.json
│ │ │ │ └── src/
│ │ │ │ ├── index.js
│ │ │ │ └── two.js
│ │ │ └── package.json
│ │ ├── class-decorators-ts/
│ │ │ ├── package.json
│ │ │ ├── src/
│ │ │ │ └── index.ts
│ │ │ └── tsconfig.json
│ │ ├── class-properties/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ └── index.js
│ │ ├── css-modules--false/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ ├── index.js
│ │ │ ├── not_scoped.css
│ │ │ └── not_scoped.module.css
│ │ ├── css-modules--null/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ ├── index.js
│ │ │ ├── not_scoped.css
│ │ │ └── scoped.module.css
│ │ ├── css-modules--string/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ ├── index.js
│ │ │ ├── scoped.css
│ │ │ └── scoped.module.css
│ │ ├── css-modules--true/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ ├── index.js
│ │ │ ├── scoped.css
│ │ │ └── scoped.module.css
│ │ ├── custom-babelrc/
│ │ │ ├── .babelrc
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ └── index.js
│ │ ├── custom-outputs/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ ├── index.js
│ │ │ └── two.js
│ │ ├── custom-outputs-alt/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ ├── index.js
│ │ │ └── two.js
│ │ ├── custom-source/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ ├── custom-source.js
│ │ │ └── two.js
│ │ ├── custom-source-with-cwd/
│ │ │ ├── custom-source/
│ │ │ │ ├── package.json
│ │ │ │ └── src/
│ │ │ │ ├── custom-source.js
│ │ │ │ └── two.js
│ │ │ └── package.json
│ │ ├── default-named/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ └── index.js
│ │ ├── define/
│ │ │ ├── index.js
│ │ │ └── package.json
│ │ ├── define-expression/
│ │ │ ├── index.js
│ │ │ └── package.json
│ │ ├── esnext-ts/
│ │ │ ├── package.json
│ │ │ ├── src/
│ │ │ │ └── index.ts
│ │ │ └── tsconfig.json
│ │ ├── inline-source-map/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ ├── index.js
│ │ │ └── two.js
│ │ ├── jsx/
│ │ │ ├── index.js
│ │ │ └── package.json
│ │ ├── macro/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ ├── index.js
│ │ │ └── macro.js
│ │ ├── mangle-json-file/
│ │ │ ├── mangle.json
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ ├── index.js
│ │ │ └── two.js
│ │ ├── minify-config/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ ├── index.js
│ │ │ └── two.js
│ │ ├── minify-config-boolean/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ ├── index.js
│ │ │ └── two.js
│ │ ├── minify-path-config/
│ │ │ ├── minify.json
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ ├── index.js
│ │ │ └── two.js
│ │ ├── minify-path-parent-dir-with-cwd/
│ │ │ ├── minify-path-parent-dir/
│ │ │ │ ├── index.js
│ │ │ │ ├── package.json
│ │ │ │ └── two.js
│ │ │ ├── minify.json
│ │ │ └── package.json
│ │ ├── modern/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ ├── index.js
│ │ │ └── two.js
│ │ ├── modern-generators/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ ├── index.js
│ │ │ └── two.js
│ │ ├── name-custom-amd/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ ├── index.js
│ │ │ └── two.js
│ │ ├── name-custom-cli/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ ├── index.js
│ │ │ └── two.js
│ │ ├── no-pkg/
│ │ │ └── src/
│ │ │ ├── index.js
│ │ │ └── two.js
│ │ ├── no-pkg-name/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ ├── index.js
│ │ │ └── two.js
│ │ ├── optional-chaining-ts/
│ │ │ ├── package.json
│ │ │ ├── src/
│ │ │ │ └── index.ts
│ │ │ └── tsconfig.json
│ │ ├── parameters-rest-closure/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ └── index.js
│ │ ├── pretty/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ └── index.js
│ │ ├── publish-config/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ └── foo.ts
│ │ ├── pure/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ └── index.js
│ │ ├── raw/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ └── index.js
│ │ ├── shebang/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ └── index.js
│ │ ├── terser-annotations/
│ │ │ ├── mangle.json
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ └── index.js
│ │ ├── ts-custom-declaration/
│ │ │ ├── package.json
│ │ │ ├── src/
│ │ │ │ └── index.ts
│ │ │ ├── tsconfig.json
│ │ │ └── types/
│ │ │ └── index.d.ts
│ │ ├── ts-declaration/
│ │ │ ├── package.json
│ │ │ ├── src/
│ │ │ │ └── index.tsx
│ │ │ ├── tsconfig.json
│ │ │ └── types/
│ │ │ └── index.d.ts
│ │ ├── ts-jsx/
│ │ │ ├── package.json
│ │ │ ├── src/
│ │ │ │ └── index.tsx
│ │ │ └── tsconfig.json
│ │ ├── ts-mixed-exports/
│ │ │ ├── package.json
│ │ │ ├── src/
│ │ │ │ ├── car.ts
│ │ │ │ └── index.ts
│ │ │ └── tsconfig.json
│ │ ├── ts-module/
│ │ │ ├── package.json
│ │ │ ├── src/
│ │ │ │ ├── foo.ts
│ │ │ │ └── index.ts
│ │ │ └── tsconfig.json
│ │ ├── visualizer/
│ │ │ ├── package.json
│ │ │ └── src/
│ │ │ └── index.js
│ │ └── worker-loader/
│ │ ├── package.json
│ │ └── src/
│ │ ├── bar.js
│ │ ├── index.js
│ │ └── worker.js
│ ├── index.test.js
│ └── lib/
│ └── util.js
├── tools/
│ ├── build-fixture.js
│ └── generate-filesize.js
└── tsconfig.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .changeset/README.md
================================================
# Changesets
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/master/docs/common-questions.md)
================================================
FILE: .changeset/config.json
================================================
{
"$schema": "https://unpkg.com/@changesets/config@1.3.0/schema.json",
"changelog": [
"@changesets/changelog-github",
{ "repo": "developit/microbundle" }
],
"commit": false,
"linked": [],
"access": "public",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": []
}
================================================
FILE: .changeset/gold-berries-march.md
================================================
---
'microbundle': patch
---
Fix indentation style in `mangle.json` not preserved
================================================
FILE: .changeset/swift-plums-fix.md
================================================
---
'microbundle': patch
---
Silence Rollup's noisy (and usually harmless) `The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten.` warnings
================================================
FILE: .changeset/violet-falcons-dream.md
================================================
---
'microbundle': patch
---
Fixes positioning bug with UMD sourcemaps
================================================
FILE: .editorconfig
================================================
root = true
[*]
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[{package.json,.*rc,*.yml}]
indent_style = space
indent_size = 2
[*.md]
trim_trailing_whitespace = false
================================================
FILE: .eslintrc
================================================
{
"extends": [
"eslint-config-developit",
"prettier",
"plugin:prettier/recommended"
],
"plugins": [
"prettier"
],
"rules": {
"brace-style": "off",
"comma-dangle": ["warn", "always-multiline"],
"indent": "off",
"require-atomic-updates": "off"
},
"settings": {
"react": {
"version": "16.6"
}
},
"ignorePatterns": [
"dist"
]
}
================================================
FILE: .github/workflows/nodejs.yml
================================================
name: Node CI
on:
pull_request: {}
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm ci --ignore-scripts
- name: npm build and test
run: npm test
================================================
FILE: .github/workflows/release.yml
================================================
name: Release
on:
push:
branches:
- master
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
- name: Setup Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: 22.x
- name: Install Dependencies
run: npm install
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@master
with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: npm run release
env:
GITHUB_TOKEN: ${{ secrets.REPO_SCOPED_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
================================================
FILE: .github/workflows/size.yml
================================================
name: compressed-size
on:
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: compressed-size-action
uses: preactjs/compressed-size-action@v2
with:
pattern: 'dist/!(*.js.map)'
build-script: build
repo-token: '${{ secrets.GITHUB_TOKEN }}'
- name: compressed-size-action
uses: preactjs/compressed-size-action@v2
with:
pattern: 'test/fixtures/**/dist/!(*.map)'
# We're using this to report size differences, not test, so update snapshots if they fail.
# The CI can catch the test failures instead.
build-script: 'test -- -u'
repo-token: '${{ secrets.GITHUB_TOKEN }}'
================================================
FILE: .gitignore
================================================
node_modules
.DS_Store
*.log
.rpt2_cache
.rts2_cache_cjs
.rts2_cache_es
.rts2_cache_umd
build
dist
yarn.lock
.vscode
.idea
.rts2*
sizes.csv
test/fixtures/visualizer/stats.html
================================================
FILE: .prettierignore
================================================
dist/
================================================
FILE: CHANGELOG.md
================================================
# microbundle
## 0.15.1
### Patch Changes
- [`cebafa1`](https://github.com/developit/microbundle/commit/cebafa121953a771f010b3cfd250a83bfc754e2c) [#961](https://github.com/developit/microbundle/pull/961) Thanks [@zyrong](https://github.com/zyrong)! - Fix for when multiple entries reference different CSS, only the CSS referenced by the first entry will be packaged
* [`9a4e2b2`](https://github.com/developit/microbundle/commit/9a4e2b2096d3824661738edb142b4658cf3d9d0b) [#954](https://github.com/developit/microbundle/pull/954) Thanks [@rschristian](https://github.com/rschristian)! - Bumps Node target to v12
- [`4ad4b76`](https://github.com/developit/microbundle/commit/4ad4b768f0ef6f434b753c4a42cdcfe85d01c404) [#967](https://github.com/developit/microbundle/pull/967) Thanks [@agilgur5](https://github.com/agilgur5)! - deps: upgrade rpt2 to latest v0.32.0 to fix monorepos
* [`6018e58`](https://github.com/developit/microbundle/commit/6018e586b91125233026ca977a97b72bb6082ec6) [#956](https://github.com/developit/microbundle/pull/956) Thanks [@rschristian](https://github.com/rschristian)! - Silences warnings when using Node builtins with the 'node:...' protocol on imports. Warnings related to bare usage of these builtins were already silenced.
- [`88241dd`](https://github.com/developit/microbundle/commit/88241ddf8fc3ac18cfc1ca8ced99a413f8d2b488) [#968](https://github.com/developit/microbundle/pull/968) Thanks [@PeterBurner](https://github.com/PeterBurner)! - deps: upgrade babel-plugin-transform-async-to-promises to latest v0.8.18 to fix #565
* [`e72377a`](https://github.com/developit/microbundle/commit/e72377a001cc5925ff25aadbe26fdb96a0dab3a4) [#964](https://github.com/developit/microbundle/pull/964) Thanks [@rschristian](https://github.com/rschristian)! - Fixes filename generation for es & modern outputs. Both 'jsnext:main' and 'esmodule' were incorrectly ignored.
## 0.15.0
### Minor Changes
- [`6f6e080`](https://github.com/developit/microbundle/commit/6f6e080f3b9ec9a223d79d24eb6e6c8dd5d72cf7) [#950](https://github.com/developit/microbundle/pull/950) Thanks [@rschristian](https://github.com/rschristian)! - Microbundle will now output ESM using `.mjs` as the file extension when the package type is CJS
* [`242754f`](https://github.com/developit/microbundle/commit/242754f43cce1c25a6c475be64bbd2a525eb7cf0) [#949](https://github.com/developit/microbundle/pull/949) Thanks [@rschristian](https://github.com/rschristian)! - Add --visualize flag to generate build output stats
### Patch Changes
- [`c4532cc`](https://github.com/developit/microbundle/commit/c4532cc9ccd846e6bc8176414ddf2c0fc22af1f1) [#940](https://github.com/developit/microbundle/pull/940) Thanks [@rschristian](https://github.com/rschristian)! - Adds information about `--compress` flag's default value w/ different targets
* [`b51b855`](https://github.com/developit/microbundle/commit/b51b855794866f3e6a0ef7dfc5672d5c1c717831) [#935](https://github.com/developit/microbundle/pull/935) Thanks [@mycoin](https://github.com/mycoin)! - Don't attempt to write build stats in watch mode when there has been a build error/sizeInfo is `undefined`
- [`1d0e305`](https://github.com/developit/microbundle/commit/1d0e305d89ad010793c57fc451991a79907e1f3f) [#941](https://github.com/developit/microbundle/pull/941) Thanks [@rschristian](https://github.com/rschristian)! - Ensures TS plugin will begin its search for a 'tsconfig.json' in the set cwd
* [`f04c85a`](https://github.com/developit/microbundle/commit/f04c85a1885a28a16c767665a1d5f17b13834406) [#926](https://github.com/developit/microbundle/pull/926) Thanks [@developit](https://github.com/developit)! - Fix mangle.json being overwritten with `[object Object]`
- [`ecb0b02`](https://github.com/developit/microbundle/commit/ecb0b022912397bcf98550c1a783e9e0534f33e5) [#947](https://github.com/developit/microbundle/pull/947) Thanks [@rschristian](https://github.com/rschristian)! - Ensures hoisted node_modules are excluded from babel
* [`392d63e`](https://github.com/developit/microbundle/commit/392d63ef437f25403c03826f77790722d0234b58) [#919](https://github.com/developit/microbundle/pull/919) Thanks [@rschristian](https://github.com/rschristian)! - Fixes CSS output from being overwritten when also generating .cjs
- [`fb0a437`](https://github.com/developit/microbundle/commit/fb0a43780a7462f4876955c3412638e51a7adb97) [#930](https://github.com/developit/microbundle/pull/930) Thanks [@rschristian](https://github.com/rschristian)! - Documenting --jsxFragment flag
* [`8223eba`](https://github.com/developit/microbundle/commit/8223ebaee8d750e9757b9ddbfef6384fa00f22ac) [#948](https://github.com/developit/microbundle/pull/948) Thanks [@rschristian](https://github.com/rschristian)! - Corrects formatting in build completion message w/ dynamic import is used
## 0.14.2
### Patch Changes
- [`dd0bdde`](https://github.com/developit/microbundle/commit/dd0bdde9c6ae7d0690fa73aead1c1744ae3b086a) [#904](https://github.com/developit/microbundle/pull/904) Thanks [@rschristian](https://github.com/rschristian)! - Added missing CLI doc for 'jsxImportSource' and correcting the Examples section of the '--help' output
## 0.14.1
### Patch Changes
- [`2a0ca88`](https://github.com/developit/microbundle/commit/2a0ca8843f34c3773bb41eb3f8f571fb6b2b2d52) [#882](https://github.com/developit/microbundle/pull/882) Thanks [@MiKr13](https://github.com/MiKr13)! - feat: :sparkles: Closes #497: preserve trailing newline in mangle.json
* [`26f382a`](https://github.com/developit/microbundle/commit/26f382a989e86fdcc5149f73f7b6c9d314a4bf37) [#895](https://github.com/developit/microbundle/pull/895) Thanks [@rschristian](https://github.com/rschristian)! - Completion message shows pkg's actual name, rather than safe name
## 0.14.0
### Minor Changes
- [`1b61029`](https://github.com/developit/microbundle/commit/1b6102966440bd7000e0e457f8c0b7eeb7e05593) [#867](https://github.com/developit/microbundle/pull/867) Thanks [@bouchenoiremarc](https://github.com/bouchenoiremarc)! - - Add support for Module Workers with a new `--workers` flag
### Patch Changes
- [`5e93a0e`](https://github.com/developit/microbundle/commit/5e93a0e4cc28ea8f080a08e3a8530b6bfdf25f42) [#853](https://github.com/developit/microbundle/pull/853) Thanks [@developit](https://github.com/developit)! - Fix crash when traversing `"exports"` objects (#852)
* [`96b85da`](https://github.com/developit/microbundle/commit/96b85da1e32b4ffbef9d83387ff399d8b3ee3852) [#887](https://github.com/developit/microbundle/pull/887) Thanks [@developit](https://github.com/developit)! - When using `--target node`, resolve "node" conditional Package Export keys, otherwise resolve "browser" keys.
- [`5d0465b`](https://github.com/developit/microbundle/commit/5d0465b39bccff31673d351fc9d29cb4c470407d) [#875](https://github.com/developit/microbundle/pull/875) Thanks [@dwightjack](https://github.com/dwightjack)! - Preserve terser annotations in compressed bundle
* [`b1a6374`](https://github.com/developit/microbundle/commit/b1a637486234a2ae784ccf0c512321e2d3efef7c) [#858](https://github.com/developit/microbundle/pull/858) Thanks [@bouchenoiremarc](https://github.com/bouchenoiremarc)! - - Allow the minify options `compress` and `mangle` to be set as booleans
- [`2980336`](https://github.com/developit/microbundle/commit/29803364fe54cc1a7a8543d61e694c90b4cdce6a) [#865](https://github.com/developit/microbundle/pull/865) Thanks [@rschristian](https://github.com/rschristian)! - Expands generateTypes flag to support libs with TS entrypoints
## 0.13.3
### Patch Changes
- [`3534815`](https://github.com/developit/microbundle/commit/3534815ddabecc080cdec42cd1f6009a81a48ec9) [#848](https://github.com/developit/microbundle/pull/848) Thanks [@developit](https://github.com/developit)! - Bugfix: preserve Terser annotations like `/*@__NOINLINE__*/` during Babel pass
## 0.13.2
### Patch Changes
- [`e3f1933`](https://github.com/developit/microbundle/commit/e3f1933773fd17bb1d97de0dad94d899acee7598) [#847](https://github.com/developit/microbundle/pull/847) Thanks [@developit](https://github.com/developit)! - - Upgrade to Terser [5.7](https://github.com/terser/terser/blob/master/CHANGELOG.md#v570) to re-enable support for `reduce_funcs:false` in `mangle.json` configuration.
* [`86371f0`](https://github.com/developit/microbundle/commit/86371f0db6386089c66cd474a7121d9dbee4c0cf) [#784](https://github.com/developit/microbundle/pull/784) Thanks [@rschristian](https://github.com/rschristian)! - Allows users to customize the modern output's filename using "exports" like they can with "esmodules"
## 0.13.1
### Patch Changes
- [`54402ac`](https://github.com/developit/microbundle/commit/54402ac43cc2f7ccb85fe5df2e9828c7f24091a0) [#830](https://github.com/developit/microbundle/pull/830) Thanks [@JounQin](https://github.com/JounQin)! - fix: add generateTypes cli option, check false value correctly
* [`edcd777`](https://github.com/developit/microbundle/commit/edcd777cfaedfdb436c62b5dcb3cff6291268e4c) [#823](https://github.com/developit/microbundle/pull/823) Thanks [@rschristian](https://github.com/rschristian)! - Ensures ambient type declaration for CSS Modules is included in the published bundle
- [`d87a5dc`](https://github.com/developit/microbundle/commit/d87a5dc286a1edba92ca3ec5b534807688c90854) Thanks [@developit](https://github.com/developit)! - - Fix `--sourcemap=false` to match `--no-sourcemap` and actually turn sourcemaps off.
* [`6f1a20f`](https://github.com/developit/microbundle/commit/6f1a20fa17467176f9bc1acc2b0f78784d28d110) [#777](https://github.com/developit/microbundle/pull/777) Thanks [@rschristian](https://github.com/rschristian)! - Fixing a bug that would cause a CSS file to be generated to match each JS build output
- [`25b73d2`](https://github.com/developit/microbundle/commit/25b73d22caeac7cf74b0533401318a5becc29c11) [#834](https://github.com/developit/microbundle/pull/834) Thanks [@cometkim](https://github.com/cometkim)! - Add support for configuration overrides using the `publishConfig` package.json field.
* [`0a4cddf`](https://github.com/developit/microbundle/commit/0a4cddf98ab54c41f0b2ece1d626e459f73c9997) [#842](https://github.com/developit/microbundle/pull/842) Thanks [@ForsakenHarmony](https://github.com/ForsakenHarmony)! - fix default extension to cjs for package.json "type":"module"
- [`4f7fbc4`](https://github.com/developit/microbundle/commit/4f7fbc4a0b9e03b9c33d10b21c66b8ddef7524a7) Thanks [@developit](https://github.com/developit)! - Fix `transform-fast-rest` to support referencing `...rest` params from within closures.
* [`0c91795`](https://github.com/developit/microbundle/commit/0c917959570c788929766c6f4cd55f3b49433920) [#841](https://github.com/developit/microbundle/pull/841) Thanks [@rschristian](https://github.com/rschristian)! - Ensures JS format is not included in CSS filename output
## 0.13.0
### Minor Changes
- [`bd5d15e`](https://github.com/developit/microbundle/commit/bd5d15e17c882f2090f519d342dd89e694456ab8) [#738](https://github.com/developit/microbundle/pull/738) Thanks [@wardpeet](https://github.com/wardpeet)! - Upgrade rollup to version latest and upgrade all its dependencies
* [`967f8d5`](https://github.com/developit/microbundle/commit/967f8d532785aa7bf8636c5a759759a3e72dcf56) [#769](https://github.com/developit/microbundle/pull/769) Thanks [@developit](https://github.com/developit)! - Add `--css inline` option. The default CSS output for all formats is now external files (as it was supposed to be).
- [`8142704`](https://github.com/developit/microbundle/commit/8142704399efe6b4f34219c711a3932431781b36) [#741](https://github.com/developit/microbundle/pull/741) Thanks [@whitetrefoil](https://github.com/whitetrefoil)! - Use user's typescript first, fallback to bundled
### Patch Changes
- [`12668b9`](https://github.com/developit/microbundle/commit/12668b993906a0267c53c3601ce89d1c0ddfbc27) [#687](https://github.com/developit/microbundle/pull/687) Thanks [@developit](https://github.com/developit)! - Add friendly microbundle-specific errors when modules can't be resolved.
* [`8b60fc8`](https://github.com/developit/microbundle/commit/8b60fc86cbc493e23230a58cd0c99e2e0c675974) [#754](https://github.com/developit/microbundle/pull/754) Thanks [@stipsan](https://github.com/stipsan)! - Enable sourcemaps for CSS
- [`fdafaf7`](https://github.com/developit/microbundle/commit/fdafaf7a4ad76b1757e2c0ff39050f8e11e2f1d5) [#764](https://github.com/developit/microbundle/pull/764) Thanks [@bakerkretzmar](https://github.com/bakerkretzmar)! - Add support for generating inline sourcemaps
* [`52a1771`](https://github.com/developit/microbundle/commit/52a177190eb45791cb4b44d4bf04732b8b98d9c3) [#768](https://github.com/developit/microbundle/pull/768) Thanks [@developit](https://github.com/developit)! - Add ambient typescript declaration for CSS Modules
## 0.12.4
### Patch Changes
- [`ffcc9d9`](https://github.com/developit/microbundle/commit/ffcc9d9b7d9518ae2fa31b2af4d1fd4f98599560) [#713](https://github.com/developit/microbundle/pull/713) Thanks [@developit](https://github.com/developit)! - Support [extending a UMD global](https://rollupjs.org/guide/en/#outputextend) by prefixing the package.json `"amdName"` field (eg: `"global.xyz"`).
* [`0527862`](https://github.com/developit/microbundle/commit/052786223edce8258c73a72a49238e41e5b24850) [#722](https://github.com/developit/microbundle/pull/722) Thanks [@developit](https://github.com/developit)! - Support "esm" (`-f esm`) as an alias of "es" format.
- [`d08f977`](https://github.com/developit/microbundle/commit/d08f977aa6b19b267cf8d12861cc5cc34380d025) [#702](https://github.com/developit/microbundle/pull/702) Thanks [@wardpeet](https://github.com/wardpeet)! - Use @babel/preset-env with bugfixes instead of preset-modules to enable "Optional chaining" & "nullish coalescing" by default.
* [`d33a7ba`](https://github.com/developit/microbundle/commit/d33a7ba2f5475e870d1a0f659b0c3ec0c459a850) [#731](https://github.com/developit/microbundle/pull/731) Thanks [@vaneenige](https://github.com/vaneenige)! - Add jsxImportSource flag for new JSX runtime
- [`0fec414`](https://github.com/developit/microbundle/commit/0fec41493c39669270ba2b58401dc591e551d96d) [#716](https://github.com/developit/microbundle/pull/716) Thanks [@wardpeet](https://github.com/wardpeet)! - Don't transpile generators and async for Node
* [`ba1c047`](https://github.com/developit/microbundle/commit/ba1c047512356e0e48911f5f037be798c5c2b9eb) [#701](https://github.com/developit/microbundle/pull/701) Thanks [@wardpeet](https://github.com/wardpeet)! - re-enable unpkg alias for umd bundles as described in the readme
- [`3488411`](https://github.com/developit/microbundle/commit/34884116e21408305b337a9f6267f6c2ddc9e72d) [#700](https://github.com/developit/microbundle/pull/700) Thanks [@wardpeet](https://github.com/wardpeet)! - Disable warnings for node's builtin-modules when using node as a target environment.
================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project author at jason@developit.ca. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
================================================
FILE: LICENSE
================================================
The MIT License (MIT)
Copyright (c) 2017-present Jason Miller
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
<p align="center">
<img src="https://i.imgur.com/LMEgZMh.gif" width="597" alt="microbundle">
</p>
<h1 align="center">
Microbundle
<a href="https://www.npmjs.org/package/microbundle"><img src="https://img.shields.io/npm/v/microbundle.svg?style=flat" alt="npm"></a> <a href="https://travis-ci.org/developit/microbundle"><img src="https://travis-ci.org/developit/microbundle.svg?branch=master" alt="travis"></a> <a href="https://licenses.dev/npm/microbundle"><img src="https://licenses.dev/b/npm/microbundle" alt="licenses" /></a>
</h1>
<p align="center">The <strong>zero-configuration</strong> bundler for <em>tiny modules</em>, powered by <a href="https://github.com/rollup/rollup">Rollup</a>.</p>
---
<p align="center">
<strong>Guide → </strong>
<a href="#setup">Setup</a> ✯
<a href="#formats">Formats</a> ✯
<a href="#modern">Modern Mode</a> ✯
<a href="#usage">Usage & Configuration</a> ✯
<a href="#options">All Options</a>
</p>
---
## ✨ Features <a name="features"></a>
- **One dependency** to bundle your library using only a `package.json`
- Support for ESnext & async/await _(via [Babel] & [async-to-promises])_
- Produces tiny, optimized code for all inputs
- Supports multiple entry modules _(`cli.js` + `index.js`, etc)_
- Creates multiple output formats for each entry _(<abbr title="CommonJS (node)">CJS</abbr>, <abbr title="Universal Module Definition">UMD</abbr> & <abbr title="ECMAScript Modules">ESM</abbr>)_
- 0 configuration TypeScript support
- Built-in Terser compression & gzipped bundle size tracking
## 🔧 Installation & Setup <a name="setup"></a> <a name="installation"></a>
1️⃣ **Install** by running: `npm i -D microbundle`
2️⃣ **Set up** your `package.json`:
```jsonc
{
"name": "foo", // your package name
"type": "module",
"source": "src/foo.js", // your source code
"exports": {
"require": "./dist/foo.cjs", // used for require() in Node 12+
"default": "./dist/foo.modern.js" // where to generate the modern bundle (see below)
},
"main": "./dist/foo.cjs", // where to generate the CommonJS bundle
"module": "./dist/foo.module.js", // where to generate the ESM bundle
"unpkg": "./dist/foo.umd.js", // where to generate the UMD bundle (also aliased as "umd:main")
"scripts": {
"build": "microbundle", // compiles "source" to "main"/"module"/"unpkg"
"dev": "microbundle watch" // re-build when source files change
}
}
```
3️⃣ **Try it out** by running `npm run build`.
## 💽 Output Formats <a name="formats"></a>
Microbundle produces <code title="ECMAScript Modules (import / export)">esm</code>, <code title="CommonJS (Node-style module.exports)">cjs</code>, <code title="Universal Module Definition (works everywhere)">umd</code> bundles with your code compiled to syntax that works pretty much everywhere.
While it's possible to customize the browser or Node versions you wish to support using a [browserslist configuration](https://github.com/browserslist/browserslist#browserslist-), the default setting is optimal and strongly recommended.
## 🤖 Modern Mode <a name="modern"></a>
In addition to the above formats, Microbundle also outputs a `modern` bundle specially designed to work in _all modern browsers_.
This bundle preserves most modern JS features when compiling your code, but ensures the result runs in 95% of web browsers without needing to be transpiled.
Specifically, it uses Babel's ["bugfixes" mode](https://babeljs.io/blog/2020/03/16/7.9.0#babelpreset-envs-bugfixes-option-11083httpsgithubcombabelbabelpull11083)
(previously known as [preset-modules](https://github.com/babel/preset-modules)) to target the set of browsers that support `<script type="module">` - that allows syntax like async/await, tagged templates, arrow functions, destructured and rest parameters, etc.
The result is generally smaller and faster to execute than the plain `esm` bundle.
Take the following source code for example:
```js
// Our source, "src/make-dom.js":
export default async function makeDom(tag, props, children) {
let el = document.createElement(tag);
el.append(...(await children));
return Object.assign(el, props);
}
```
Compiling the above using Microbundle produces the following `modern` and `esm` bundles:
<table>
<thead><tr>
<th align="left"><code>make-dom.modern.js</code> <sup>(117b)</sup></th>
<th align="left"><code>make-dom.module.js</code> <sup>(194b)</sup></th>
</tr></thead>
<tbody><tr valign="top"><td>
```js
export default async function (e, t, a) {
let n = document.createElement(e);
n.append(...(await a));
return Object.assign(n, t);
}
```
</td><td>
```js
export default function (e, t, r) {
try {
var n = document.createElement(e);
return Promise.resolve(r).then(function (e) {
return n.append.apply(n, e), Object.assign(n, t);
});
} catch (e) {
return Promise.reject(e);
}
}
```
</td></tbody></table>
**This is enabled by default.** All you have to do is add an `"exports"` field to your `package.json`:
```jsonc
{
"main": "./dist/foo.umd.js", // legacy UMD output (for Node & CDN use)
"module": "./dist/foo.module.mjs", // legacy ES Modules output (for bundlers)
"exports": "./dist/foo.modern.mjs", // modern ES2017 output
"scripts": {
"build": "microbundle src/foo.js"
}
}
```
The `"exports"` field can also be an object for packages with multiple entry modules:
```jsonc
{
"name": "foo",
"exports": {
".": "./dist/foo.modern.mjs", // import "foo" (the default)
"./lite": "./dist/lite.modern.mjs", // import "foo/lite"
"./full": "./dist/full.modern.mjs" // import "foo/full"
},
"scripts": {
"build": "microbundle src/*.js" // build foo.js, lite.js and full.js
}
}
```
## 📦 Usage & Configuration <a name="usage"></a>
Microbundle includes two commands - `build` (the default) and `watch`.
Neither require any options, but you can tailor things to suit your needs a bit if you like.
- **`microbundle`** – bundles your code once and exits. (alias: `microbundle build`)
- **`microbundle watch`** – bundles your code, then re-bundles when files change.
> ℹ️ Microbundle automatically determines which dependencies to inline into bundles based on your `package.json`.
>
> Read more about [How Microbundle decides which dependencies to bundle](https://github.com/developit/microbundle/wiki/How-Microbundle-decides-which-dependencies-to-bundle), including some example configurations.
### Specifying filenames in package.json
Unless overridden via the command line, microbundle uses the `source` property in your `package.json` to determine which of your JavaScript files to start bundling from (your "entry module").
The filenames and paths for generated bundles in each format are defined by the `main`, `umd:main`, `module` and `exports` properties in your `package.json`.
```jsonc
{
"source": "src/index.js", // input
"main": "dist/foo.js", // CommonJS output bundle
"umd:main": "dist/foo.umd.js", // UMD output bundle
"module": "dist/foo.mjs", // ES Modules output bundle
"exports": {
"types": "./dist/foo.d.ts", // TypeScript typings for NodeNext modules
"require": "./dist/foo.js", // CommonJS output bundle
"default": "./dist/foo.modern.mjs", // Modern ES Modules output bundle
},
"types": "dist/foo.d.ts" // TypeScript typings
}
```
When deciding which bundle to use, Node.js 12+ and webpack 5+ will prefer the `exports` property, while older Node.js releases use the `main` property, and other bundlers prefer the `module` field.
For more information about the meaning of the different properties, refer to the [Node.js documentation](https://nodejs.org/api/packages.html#packages_package_entry_points).
For UMD builds, microbundle will use a camelCase version of the `name` field in your `package.json` as export name.
Alternatively, this can be explicitly set by adding an `"amdName"` key in your `package.json`, or passing the `--name` command line argument.
### Usage with `{"type":"module"}` in `package.json`
Node.js 12.16+ adds a new "ES Module package", which can be enabled by adding `{"type":"module"}` to your package.json.
This property [changes the default source type](https://nodejs.org/api/packages.html#packages_determining_module_system) of `.js` files to be ES Modules instead of CommonJS.
When using `{"type":"module"}`, the file extension for CommonJS bundles generated by Microbundle must be changed to `.cjs`:
```jsonc
{
"type": "module",
"module": "dist/foo.js", // ES Module bundle
"main": "dist/foo.cjs", // CommonJS bundle
}
```
### Additional Configuration Options
Config also can be overridded by the [`publishConfig`](https://docs.npmjs.com/cli/v7/configuring-npm/package-json#publishconfig) property in your `package.json`.
```jsonc
{
"main": "src/index.ts", // this would be used in the dev environment (e.g. Jest)
"publishConfig": {
"source": "src/index.js", // input
"main": "dist/my-library.js", // output
},
"scripts": {
"build": "microbundle"
}
}
```
### Building a single bundle with fixed output name
By default Microbundle outputs multiple bundles, one bundle per format. A single bundle with a fixed output name can be built like this:
```bash
microbundle -i lib/main.js -o dist/bundle.js --no-pkg-main -f umd
```
### Using with TypeScript
Just point the input to a `.ts` file through either the cli or the `source` key in your `package.json` and you’re done.
Microbundle will generally respect your TypeScript config defined in a `tsconfig.json` file with notable exceptions being the "[target](https://www.typescriptlang.org/tsconfig#target)" and "[module](https://www.typescriptlang.org/tsconfig#module)" settings. To ensure your TypeScript configuration matches the configuration that Microbundle uses internally it's strongly recommended that you set `"module": "ESNext"` and `"target": "ESNext"` in your `tsconfig.json`.
To ensure Microbundle does not process extraneous files, by default it only includes your entry point. If you want to include other files for compilation, such as ambient declarations, make sure to add either "[files](https://www.typescriptlang.org/tsconfig#files)" or "[include](https://www.typescriptlang.org/tsconfig#include)" into your `tsconfig.json`.
If you're using TypeScript with CSS Modules, you will want to set `"include": ["node_modules/microbundle/index.d.ts"]` in your `tsconfig.json` to tell TypeScript how to handle your CSS Module imports.
To ensure that your module's `.d.ts` type info is visible to other TypeScript projects that use [`moduleResolution: 'NodeNext'`](https://www.typescriptlang.org/docs/handbook/esm-node.html), add a [`types` key](https://www.typescriptlang.org/docs/handbook/esm-node.html#packagejson-exports-imports-and-self-referencing) to your `package.json`'s corresponding `exports` mapping.
### CSS and CSS Modules
Importing CSS files is supported via `import "./foo.css"`. By default, generated CSS output is written to disk. The `--css inline` command line option will inline generated CSS into your bundles as a string, returning the CSS string from the import:
```js
// with the default external CSS:
import './foo.css'; // generates a minified .css file in the output directory
// with `microbundle --css inline`:
import css from './foo.css';
console.log(css); // the generated minified stylesheet
```
**CSS Modules:** CSS files with names ending in `.module.css` are treated as a [CSS Modules](https://github.com/css-modules/css-modules).
To instead treat imported `.css` files as modules, run Microbundle with `--css-modules true`. To disable CSS Modules for your project, pass `--no-css-modules` or `--css-modules false`.
The default scope name for CSS Modules is`_[name]__[local]__[hash:base64:5]` in watch mode, and `_[hash:base64:5]` for production builds.
This can be customized by passing the command line argument `--css-modules "[name]_[hash:base64:7]"`, using [these fields and naming conventions](https://github.com/webpack/loader-utils#interpolatename).
| flag | import | is css module? |
| ----- | ------------------------------ | :----------------: |
| null | import './my-file.css'; | :x: |
| null | import './my-file.module.css'; | :white_check_mark: |
| false | import './my-file.css'; | :x: |
| false | import './my-file.module.css'; | :x: |
| true | import './my-file.css'; | :white_check_mark: |
| true | import './my-file.module.css'; | :white_check_mark: |
### Building Module Workers
Microbundle is able to detect and bundle Module Workers when generating bundles in the
`esm` and `modern` formats. To use this feature, instantiate your Web Worker as follows:
```js
worker = new Worker(new URL('./worker.js', import.meta.url), { type: 'module' });
// or simply:
worker = new Worker('./worker.js', { type: 'module' });
```
... then add the `--workers` flag to your build command:
```bash
microbundle --workers
```
For more information see
[@surma/rollup-plugin-off-main-thread](https://github.com/surma/rollup-plugin-off-main-thread#config).
### Visualize Bundle Makeup
Use the `--visualize` flag to generate a `stats.html` file at build time, showing the makeup of your bundle. Uses [rollup-plugin-visualizer](https://www.npmjs.com/package/rollup-plugin-visualizer).
### Mangling Properties
To achieve the smallest possible bundle size, libraries often wish to rename internal object properties or class members to smaller names - transforming `this._internalIdValue` to `this._i`. Microbundle doesn't do this by default, however it can be enabled by creating a `mangle.json` file (or a `"mangle"` property in your package.json). Within that file, you can specify a regular expression pattern to control which properties should be mangled. For example: to mangle all property names beginning an underscore:
```jsonc
{
"mangle": {
"regex": "^_"
}
}
```
It's also possible to configure repeatable short names for each mangled property, so that every build of your library has the same output. **See the wiki for a [complete guide to property mangling in Microbundle](https://github.com/developit/microbundle/wiki/mangle.json).**
### Defining build-time constants
The `--define` option can be used to inject or replace build-time constants when bundling. In addition to injecting string or number constants, prefixing the define name with `@` allows injecting JavaScript expressions.
| Build command | Source code | Output |
| -------------------------------------------- | ---------------------- | ----------------------- |
| `microbundle --define VERSION=2` | `console.log(VERSION)` | `console.log(2)` |
| `microbundle --define API_KEY='abc123'` | `console.log(API_KEY)` | `console.log("abc123")` |
| `microbundle --define @assign=Object.assign` | `assign(a, b)` | `Object.assign(a, b)` |
### All CLI Options <a name="options"></a>
```
Usage
$ microbundle <command> [options]
Available Commands
build Build once and exit
watch Rebuilds on any change
For more info, run any command with the `--help` flag
$ microbundle build --help
$ microbundle watch --help
Options
-v, --version Displays current version
-i, --entry Entry module(s)
-o, --output Directory to place build files into
-f, --format Only build specified formats (any of modern,esm,cjs,umd or iife) (default modern,esm,cjs,umd)
-w, --watch Rebuilds on any change (default false)
--pkg-main Outputs files analog to package.json main entries (default true)
--target Specify your target environment (node or web) (default web)
--external Specify external dependencies, or 'none' (default peerDependencies and dependencies in package.json)
--globals Specify globals dependencies, or 'none'
--define Replace constants with hard-coded values (use @key=exp to replace an expression)
--alias Map imports to different modules
--compress Compress output using Terser (default true when --target is web, false when --target is node)
--strict Enforce undefined global context and add "use strict"
--name Specify name exposed in UMD and IIFE builds
--cwd Use an alternative working directory (default .)
--sourcemap Generate source map (default true)
--raw Show raw byte size (default false)
--jsx A custom JSX pragma like React.createElement (default h)
--jsxFragment A custom JSX fragment pragma like React.Fragment (default Fragment)
--jsxImportSource Declares the module specifier to be used for importing jsx factory functions
--tsconfig Specify the path to a custom tsconfig.json
--generateTypes Whether or not to generate types, if `types` or `typings` is set in `package.json` then it will default to be `true`
--css Where to output CSS: "inline" or "external" (default "external")
--css-modules Configures .css to be treated as modules (default null)
--workers Bundle module workers - see https://github.com/surma/rollup-plugin-off-main-thread#auto-bundling (default false)
--visualize Generate bundle makeup visualization (stats.html)
-h, --help Displays this message
Examples
$ microbundle build --globals react=React,jquery=$
$ microbundle build --define API_KEY=1234
$ microbundle build --alias react=preact/compat
$ microbundle watch --no-sourcemap # don't generate sourcemaps
$ microbundle build --tsconfig tsconfig.build.json
```
## 🛣 Roadmap
Here's what's coming up for Microbundle:
- [ ] [Multiple separate inputs->outputs](https://github.com/developit/microbundle/issues/50)
- [x] [TypeScript support](https://github.com/developit/microbundle/issues/5)
- [x] [Flowtype support](https://github.com/developit/microbundle/issues/5#issuecomment-351075881)
## 🔨 Built with Microbundle
- [Preact](https://github.com/preactjs/preact) Fast 3kB React alternative with the same modern API. Components & Virtual DOM.
- [Stockroom](https://github.com/developit/stockroom) Offload your store management to a worker easily.
- [Microenvi](https://github.com/fwilkerson/microenvi) Bundle, serve, and hot reload with one command.
- [Theme UI](https://github.com/system-ui/theme-ui) Build consistent, themeable React apps based on constraint-based design principles.
- [react-recomponent](https://github.com/philipp-spiess/react-recomponent) Reason-style reducer components for React using ES6 classes.
- [react-hooks-lib](https://github.com/beizhedenglong/react-hooks-lib) A set of reusable react hooks.
- [mdx-deck-live-code](https://github.com/JReinhold/mdx-deck-live-code) A library for [mdx-deck](https://github.com/jxnblk/mdx-deck) to do live React and JS coding directly in slides.
- [react-router-ext](https://github.com/ri7nz/react-router-ext) An Extended [react-router-dom](https://github.com/ReactTraining/react-router/tree/master/packages/react-router-dom) with simple usage.
- [routex.js](https://github.com/alexhoma/routex.js) A dynamic routing library for Next.js.
- [hooked-form](https://github.com/JoviDeCroock/hooked-form) A lightweight form-management library for React.
- [goober](https://github.com/cristianbote/goober) Less than 1KB css-in-js alternative with a familiar API.
- [react-model](https://github.com/byte-fe/react-model) The next generation state management library for React.
- [Teaful](https://github.com/teafuljs/teaful) Tiny, easy and powerful (P)React state management.
- [@studio-freight/lenis](https://github.com/studio-freight/lenis) Tiny, Performant, Vanilla JS, Smooth Scroll library.
- [@studio-freight/tempus](https://github.com/studio-freight/tempus) One rAF to rule them all.
- [@studio-freight/hamo](https://github.com/studio-freight/hamo) Collection of React hooks.
- [glTF Transform](https://github.com/donmccurdy/glTF-Transform) Library for working with .gltf and .glb 3D models.
- [eta](https://github.com/eta-dev/eta) Lightweight, powerful, pluggable embedded JS template engine
- [swup](https://github.com/swup/swup) Page transition library for server-rendered websites.
## 🥂 License
[MIT](https://oss.ninja/mit/developit/)
[rollup]: https://github.com/rollup/rollup
[babel]: https://babeljs.io/
[async-to-promises]: https://github.com/rpetrich/babel-plugin-transform-async-to-promises
================================================
FILE: babel.config.js
================================================
module.exports = {
presets: [
[
'@babel/preset-env',
{
loose: true,
modules: process.env.BABEL_ENV === 'test' ? 'commonjs' : 'auto',
targets: {
node: 'current',
},
exclude: ['transform-async-to-generator', 'transform-regenerator'],
},
],
],
plugins: ['@babel/plugin-syntax-jsx'],
};
================================================
FILE: index.d.ts
================================================
declare module '*.module.css' {
const classes: { [key: string]: string };
export default classes;
}
================================================
FILE: package.json
================================================
{
"name": "microbundle",
"version": "0.15.1",
"description": "Zero-configuration bundler for tiny JS libs, powered by Rollup.",
"main": "dist/microbundle.js",
"source": "src/index.js",
"bin": "dist/cli.js",
"repository": "developit/microbundle",
"keywords": [
"bundle",
"rollup",
"micro library"
],
"files": [
"src",
"dist",
"index.d.ts"
],
"author": "Jason Miller <jason@developit.ca> (http://jasonformat.com)",
"license": "MIT",
"scripts": {
"build": "npm run -s build:babel && npm run -s build:self",
"build:babel": "babel-node src/cli.js --target=node --format cjs src/{cli,index}.js",
"build:self": "node dist/cli.js --target=node --format cjs src/{cli,index}.js",
"prepare": "npm run -s build",
"prepare:babel": "babel src/*.js -d dist && npm t",
"lint": "eslint src",
"test": "npm run -s lint && npm run -s build && cross-env BABEL_ENV=test jest",
"jest": "cross-env BABEL_ENV=test jest",
"format": "prettier --write \"{*,{src,test}/**/*}.+(js|css)\"",
"changeset": "changeset",
"release": "npm run -s prepare && npm test && changeset publish"
},
"prettier": {
"singleQuote": true,
"trailingComma": "all",
"useTabs": true,
"arrowParens": "avoid",
"overrides": [
{
"files": "package.json",
"options": {
"useTabs": false,
"parser": "json-stringify"
}
}
]
},
"lint-staged": {
"{src,test}/**/*.js": [
"eslint --fix",
"prettier --write"
],
"{*,{src,test}/**/*}.+(js|css)": [
"prettier --write"
],
"*.md": [
"prettier --write"
]
},
"jest": {
"testEnvironment": "node",
"testURL": "http://localhost"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"dependencies": {
"@babel/core": "^7.12.10",
"@babel/plugin-proposal-class-properties": "7.12.1",
"@babel/plugin-syntax-import-meta": "^7.10.4",
"@babel/plugin-syntax-jsx": "^7.12.1",
"@babel/plugin-transform-flow-strip-types": "^7.12.10",
"@babel/plugin-transform-react-jsx": "^7.12.11",
"@babel/plugin-transform-regenerator": "^7.12.1",
"@babel/preset-env": "^7.12.11",
"@babel/preset-flow": "^7.12.1",
"@babel/preset-react": "^7.12.10",
"@rollup/plugin-alias": "^3.1.1",
"@rollup/plugin-babel": "^5.2.2",
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^11.0.1",
"@surma/rollup-plugin-off-main-thread": "^2.2.2",
"asyncro": "^3.0.0",
"autoprefixer": "^10.1.0",
"babel-plugin-macros": "^3.0.1",
"babel-plugin-transform-async-to-promises": "^0.8.18",
"babel-plugin-transform-replace-expressions": "^0.2.0",
"brotli-size": "^4.0.0",
"builtin-modules": "^3.1.0",
"camelcase": "^6.2.0",
"escape-string-regexp": "^4.0.0",
"filesize": "^6.1.0",
"gzip-size": "^6.0.0",
"kleur": "^4.1.3",
"lodash.merge": "^4.6.2",
"magic-string": "^0.25.9",
"postcss": "^8.2.1",
"pretty-bytes": "^5.4.1",
"rollup": "^2.35.1",
"rollup-plugin-bundle-size": "^1.0.3",
"rollup-plugin-postcss": "^4.0.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.32.0",
"rollup-plugin-visualizer": "^5.6.0",
"sade": "^1.7.4",
"terser": "^5.7.0",
"tiny-glob": "^0.2.8",
"tslib": "^2.0.3",
"typescript": "^4.1.3"
},
"devDependencies": {
"@babel/cli": "^7.12.10",
"@babel/node": "^7.12.10",
"@babel/plugin-proposal-throw-expressions": "^7.12.1",
"@changesets/changelog-github": "^0.2.7",
"@changesets/cli": "^2.12.0",
"babel-jest": "^26.6.3",
"cross-env": "^7.0.3",
"directory-tree": "^2.2.5",
"eslint": "^7.15.0",
"eslint-config-developit": "^1.2.0",
"eslint-config-prettier": "^7.0.0",
"eslint-plugin-prettier": "^3.3.0",
"esm": "^3.2.25",
"fs-extra": "^9.0.1",
"husky": "^4.3.6",
"jest": "^26.6.3",
"lint-staged": "^10.5.3",
"npm-merge-driver-install": "^1.1.1",
"prettier": "^2.2.1",
"regenerator-runtime": "^0.13.7",
"rimraf": "^3.0.2",
"shell-quote": "^1.7.2",
"strip-ansi": "^6.0.0"
}
}
================================================
FILE: src/cli.js
================================================
#!/usr/bin/env node
import microbundle from './index';
import prog from './prog';
import { stdout } from './utils';
import logError from './log-error';
const run = opts => {
microbundle(opts)
.then(({ output }) => {
if (output != null) stdout(output);
if (!opts.watch) process.exit(0);
})
.catch(err => {
process.exitCode = (typeof err.code === 'number' && err.code) || 1;
logError(err);
process.exit();
});
};
prog(run)(process.argv);
================================================
FILE: src/index.js
================================================
import fs from 'fs';
import { resolve, relative, dirname, basename, extname } from 'path';
import camelCase from 'camelcase';
import escapeStringRegexp from 'escape-string-regexp';
import { blue, yellow, red } from 'kleur';
import { map, series } from 'asyncro';
import glob from 'tiny-glob/sync';
import autoprefixer from 'autoprefixer';
import { rollup, watch } from 'rollup';
import builtinModules from 'builtin-modules';
import resolveFrom from 'resolve-from';
import commonjs from '@rollup/plugin-commonjs';
import babel from '@rollup/plugin-babel';
import customBabel from './lib/babel-custom';
import nodeResolve from '@rollup/plugin-node-resolve';
import { terser } from 'rollup-plugin-terser';
import { visualizer } from 'rollup-plugin-visualizer';
import alias from '@rollup/plugin-alias';
import postcss from 'rollup-plugin-postcss';
import typescript from 'rollup-plugin-typescript2';
import json from '@rollup/plugin-json';
import OMT from '@surma/rollup-plugin-off-main-thread';
import logError from './log-error';
import {
EXTENSION,
isDir,
isFile,
isTruthy,
stdout,
removeScope,
} from './utils';
import { getSizeInfo } from './lib/compressed-size';
import { normalizeMinifyOptions } from './lib/terser';
import {
parseAliasArgument,
parseMappingArgument,
toReplacementExpression,
} from './lib/option-normalization';
import { getConfigFromPkgJson, getName } from './lib/package-info';
import { shouldCssModules, cssModulesConfig } from './lib/css-modules';
import { EOL } from 'os';
import MagicString from 'magic-string';
// Extensions to use when resolving modules
const EXTENSIONS = ['.ts', '.tsx', '.js', '.jsx', '.es6', '.es', '.mjs'];
const WATCH_OPTS = {
exclude: 'node_modules/**',
};
export default async function microbundle(inputOptions) {
let options = { ...inputOptions };
options.cwd = resolve(process.cwd(), inputOptions.cwd);
const cwd = options.cwd;
const { hasPackageJson, pkg } = await getConfigFromPkgJson(cwd);
options.pkg = {
...pkg,
...pkg.publishConfig,
};
const { finalName, pkgName } = getName({
name: options.name,
pkgName: options.pkg.name,
amdName: options.pkg.amdName,
hasPackageJson,
cwd,
});
options.name = finalName;
options.pkg.name = pkgName;
if (options.sourcemap === 'inline') {
console.log(
'Warning: inline sourcemaps should only be used for debugging purposes.',
);
} else if (options.sourcemap === 'false') {
options.sourcemap = false;
} else if (options.sourcemap !== false) {
options.sourcemap = true;
}
options.input = await getInput({
entries: options.entries,
cwd,
source: options.pkg.source,
module: options.pkg.module,
});
options.output = await getOutput({
cwd,
output: options.output,
pkgMain: options.pkg.main,
pkgName: options.pkg.name,
});
options.entries = await getEntries({
cwd,
input: options.input,
});
options.multipleEntries = options.entries.length > 1;
let formats = (options.format || options.formats).split(',');
// de-dupe formats and convert "esm" to "es":
formats = Array.from(new Set(formats.map(f => (f === 'esm' ? 'es' : f))));
// always compile cjs first if it's there:
formats.sort((a, b) => (a === 'cjs' ? -1 : a > b ? 1 : 0));
let steps = [];
for (let i = 0; i < options.entries.length; i++) {
for (let j = 0; j < formats.length; j++) {
steps.push(
createConfig(options, options.entries[i], formats[j], j === 0),
);
}
}
if (options.watch) {
return doWatch(options, cwd, steps);
}
let cache;
let out = await series(
steps.map(config => async () => {
const { inputOptions, outputOptions } = config;
if (inputOptions.cache !== false) {
inputOptions.cache = cache;
}
let bundle = await rollup(inputOptions);
cache = bundle;
await bundle.write(outputOptions);
return await config._sizeInfo;
}),
);
const targetDir = relative(cwd, dirname(options.output)) || '.';
const sourceExist = options.input.length > 0;
const banner = sourceExist
? blue(`Build "${options.pkg.name}" to ${targetDir}:`)
: red(`Error: No entry module found for "${options.pkg.name}"`);
return {
output: `${banner}\n${out.join('\n')}`,
};
}
function doWatch(options, cwd, steps) {
const { onStart, onBuild, onError } = options;
return new Promise((resolve, reject) => {
const targetDir = relative(cwd, dirname(options.output));
stdout(blue(`Watching source, compiling to ${targetDir}:`));
const watchers = steps.reduce((acc, options) => {
acc[options.inputOptions.input] = watch(
Object.assign(
{
output: options.outputOptions,
watch: WATCH_OPTS,
},
options.inputOptions,
),
).on('event', e => {
if (e.code === 'START') {
if (typeof onStart === 'function') {
onStart(e);
}
}
if (e.code === 'ERROR') {
logError(e.error);
if (typeof onError === 'function') {
onError(e);
}
}
if (e.code === 'END') {
if (options._sizeInfo) {
options._sizeInfo.then(text => {
stdout(`Wrote ${text.trim()}`);
});
}
if (typeof onBuild === 'function') {
onBuild(e);
}
}
});
return acc;
}, {});
resolve({ watchers });
});
}
async function jsOrTs(cwd, filename) {
const extension = (await isFile(resolve(cwd, filename + '.ts')))
? '.ts'
: (await isFile(resolve(cwd, filename + '.tsx')))
? '.tsx'
: '.js';
return resolve(cwd, `${filename}${extension}`);
}
async function getInput({ entries, cwd, source, module }) {
const input = [];
[]
.concat(
entries && entries.length
? entries
: (source &&
(Array.isArray(source) ? source : [source]).map(file =>
resolve(cwd, file),
)) ||
((await isDir(resolve(cwd, 'src'))) &&
(await jsOrTs(cwd, 'src/index'))) ||
(await jsOrTs(cwd, 'index')) ||
module,
)
.map(file => glob(file))
.forEach(file => input.push(...file));
return input;
}
async function getOutput({ cwd, output, pkgMain, pkgName }) {
let main = resolve(cwd, output || pkgMain || 'dist');
if (!main.match(/\.[a-z]+$/) || (await isDir(main))) {
main = resolve(main, `${removeScope(pkgName)}.js`);
}
return main;
}
function getDeclarationDir({ options, pkg }) {
const { cwd, output } = options;
let result = output;
if (pkg.types || pkg.typings) {
result = pkg.types || pkg.typings;
result = resolve(cwd, result);
}
result = dirname(result);
return result;
}
async function getEntries({ input, cwd }) {
let entries = (
await map([].concat(input), async file => {
file = resolve(cwd, file);
if (await isDir(file)) {
file = resolve(file, 'index.js');
}
return file;
})
).filter((item, i, arr) => arr.indexOf(item) === i);
return entries;
}
function replaceName(filename, name) {
return resolve(
dirname(filename),
name + basename(filename).replace(/^[^.]+/, ''),
);
}
function walk(exports, includeDefault) {
if (!exports) return null;
if (typeof exports === 'string') return exports;
let p = exports['.'] || exports.import || exports.module;
if (!p && includeDefault) p = exports.default;
return walk(p, includeDefault);
}
function getMain({ options, entry, format }) {
const { pkg } = options;
const pkgMain = options['pkg-main'];
const pkgTypeModule = pkg.type === 'module';
if (!pkgMain) {
return options.output;
}
let mainNoExtension = options.output;
if (options.multipleEntries) {
let name = entry.match(new RegExp(/([\\/])index/.source + EXTENSION.source))
? mainNoExtension
: entry;
mainNoExtension = resolve(dirname(mainNoExtension), basename(name));
}
mainNoExtension = mainNoExtension.replace(EXTENSION, '');
const mainsByFormat = {};
mainsByFormat.es = replaceName(
pkg.module && !pkg.module.match(/src\//)
? pkg.module
: pkg['jsnext:main'] || (pkgTypeModule ? 'x.esm.js' : 'x.esm.mjs'),
mainNoExtension,
);
mainsByFormat.modern = replaceName(
(pkg.exports && walk(pkg.exports, pkgTypeModule)) ||
(pkg.syntax && pkg.syntax.esmodules) ||
pkg.esmodule ||
(pkgTypeModule ? 'x.modern.js' : 'x.modern.mjs'),
mainNoExtension,
);
mainsByFormat.cjs = replaceName(
pkg['cjs:main'] || (pkgTypeModule ? 'x.cjs' : 'x.js'),
mainNoExtension,
);
mainsByFormat.umd = replaceName(
pkg['umd:main'] || pkg.unpkg || 'x.umd.js',
mainNoExtension,
);
return mainsByFormat[format] || mainsByFormat.cjs;
}
// shebang cache map because the transform only gets run once
const shebang = {};
function createConfig(options, entry, format, writeMeta) {
let { pkg } = options;
/** @type {(string|RegExp)[]} */
let external = ['dns', 'fs', 'path', 'url'];
/** @type {Record<string, string>} */
let outputAliases = {};
const moduleAliases = options.alias ? parseAliasArgument(options.alias) : [];
const aliasIds = moduleAliases.map(alias => alias.find);
// We want to silence rollup warnings for node builtins as we rollup-node-resolve threats them as externals anyway
// @see https://github.com/rollup/plugins/tree/master/packages/node-resolve/#resolving-built-ins-like-fs
if (options.target === 'node') {
external = [/node:.*/].concat(builtinModules);
}
const peerDeps = Object.keys(pkg.peerDependencies || {});
if (options.external === 'none') {
// bundle everything (external=[])
} else if (options.external) {
external = external.concat(peerDeps).concat(
// CLI --external supports regular expressions:
options.external.split(',').map(str => new RegExp(str)),
);
} else {
external = external
.concat(peerDeps)
.concat(Object.keys(pkg.dependencies || {}));
}
let globals = external.reduce((globals, name) => {
// Use raw value for CLI-provided RegExp externals:
if (name instanceof RegExp) name = name.source;
// valid JS identifiers are usually library globals:
if (name.match(/^[a-z_$][a-z0-9_\-$]*$/)) {
globals[name] = camelCase(name);
}
return globals;
}, {});
if (options.globals && options.globals !== 'none') {
globals = Object.assign(globals, parseMappingArgument(options.globals));
}
let defines = {};
if (options.define) {
defines = Object.assign(
defines,
parseMappingArgument(options.define, toReplacementExpression),
);
}
const modern = format === 'modern';
// let rollupName = safeVariableName(basename(entry).replace(/\.js$/, ''));
let nameCache = {};
const bareNameCache = nameCache;
// Support "minify" field and legacy "mangle" field via package.json:
const rawMinifyValue = options.pkg.minify || options.pkg.mangle || {};
let minifyOptions = typeof rawMinifyValue === 'string' ? {} : rawMinifyValue;
const getNameCachePath =
typeof rawMinifyValue === 'string'
? () => resolve(options.cwd, rawMinifyValue)
: () => resolve(options.cwd, 'mangle.json');
const useTypescript = extname(entry) === '.ts' || extname(entry) === '.tsx';
const emitDeclaration =
options.generateTypes == null
? !!(pkg.types || pkg.typings)
: options.generateTypes;
const useWorkerLoader = options.workers !== false;
const escapeStringExternals = ext =>
ext instanceof RegExp ? ext.source : escapeStringRegexp(ext);
const externalPredicate = new RegExp(
`^(${external.map(escapeStringExternals).join('|')})($|/)`,
);
const externalTest =
external.length === 0 ? id => false : id => externalPredicate.test(id);
let endsWithNewLine = false;
let nameCacheIndentTabs = false;
function loadNameCache() {
try {
const data = fs.readFileSync(getNameCachePath(), 'utf8');
nameCacheIndentTabs = /^\t+/gm.test(data);
endsWithNewLine = data.endsWith(EOL);
nameCache = JSON.parse(data);
// mangle.json can contain a "minify" field, same format as the pkg.mangle:
if (nameCache.minify) {
minifyOptions = Object.assign(
{},
minifyOptions || {},
nameCache.minify,
);
}
} catch (e) {}
}
loadNameCache();
normalizeMinifyOptions(minifyOptions);
if (nameCache === bareNameCache) nameCache = null;
/** @type {false | import('rollup').RollupCache} */
let cache;
if (modern) cache = false;
const absMain = resolve(options.cwd, getMain({ options, entry, format }));
const outputDir = dirname(absMain);
const outputEntryFileName = basename(absMain);
// Warn about the (somewhat) breaking change in #950
if (format === 'es' && !pkg.module && outputEntryFileName.endsWith('.mjs')) {
stdout(
yellow(
'Warning: your package.json does not specify {"type":"module"}. Microbundle assumes this is a CommonJS package and is generating ES Modules with the ".mjs" file extension.',
),
);
}
let config = {
/** @type {import('rollup').InputOptions} */
inputOptions: {
// disable Rollup's cache for modern builds to prevent re-use of legacy transpiled modules:
cache,
input: entry,
external: id => {
if (id === 'babel-plugin-transform-async-to-promises/helpers') {
return false;
}
if (aliasIds.indexOf(id) >= 0) {
return false;
}
return externalTest(id);
},
onwarn(warning, warn) {
// https://github.com/rollup/rollup/blob/0fa9758cb7b1976537ae0875d085669e3a21e918/src/utils/error.ts#L324
if (warning.code === 'UNRESOLVED_IMPORT') {
stdout(
`Failed to resolve the module ${warning.source} imported by ${warning.importer}` +
`\nIs the module installed? Note:` +
`\n ↳ to inline a module into your bundle, install it to "devDependencies".` +
`\n ↳ to depend on a module via import/require, install it to "dependencies".`,
);
return;
} else if (warning.code === 'THIS_IS_UNDEFINED') return;
warn(warning);
},
treeshake: {
propertyReadSideEffects: false,
},
plugins: []
.concat(
postcss({
plugins: [autoprefixer()],
autoModules: shouldCssModules(options),
modules: cssModulesConfig(options),
// only write out CSS for the first bundle (avoids pointless extra files):
inject: false,
extract:
!!writeMeta &&
options.css !== 'inline' &&
absMain.replace(EXTENSION, '.css'),
minimize: options.compress,
sourceMap: options.sourcemap && options.css !== 'inline',
}),
moduleAliases.length > 0 &&
alias({
// @TODO: this is no longer supported, but didn't appear to be required?
// resolve: EXTENSIONS,
entries: moduleAliases,
}),
nodeResolve({
mainFields: ['module', 'jsnext', 'main'],
browser: options.target !== 'node',
exportConditions: [options.target === 'node' ? 'node' : 'browser'],
// defaults + .jsx
extensions: ['.mjs', '.js', '.jsx', '.json', '.node'],
preferBuiltins: options.target === 'node',
}),
commonjs({
// use a regex to make sure to include eventual hoisted packages
include: /\/node_modules\//,
esmExternals: false,
requireReturnsDefault: 'namespace',
}),
json(),
{
// We have to remove shebang so it doesn't end up in the middle of the code somewhere
transform: code => ({
code: code.replace(/^#![^\n]*/, bang => {
shebang[options.name] = bang;
}),
map: null,
}),
},
(useTypescript || emitDeclaration) &&
typescript({
cwd: options.cwd,
typescript: require(resolveFrom.silent(
options.cwd,
'typescript',
) || 'typescript'),
cacheRoot: `./node_modules/.cache/.rts2_cache_${format}`,
useTsconfigDeclarationDir: true,
tsconfigDefaults: {
compilerOptions: {
sourceMap: options.sourcemap,
declaration: options.generateTypes !== false,
allowJs: true,
emitDeclarationOnly: options.generateTypes && !useTypescript,
...(options.generateTypes !== false && {
declarationDir: getDeclarationDir({ options, pkg }),
}),
jsx: 'preserve',
jsxFactory: options.jsx,
jsxFragmentFactory: options.jsxFragment,
},
files: options.entries,
},
tsconfig: options.tsconfig,
tsconfigOverride: {
compilerOptions: {
module: 'ESNext',
target: 'esnext',
},
},
}),
// if defines is not set, we shouldn't run babel through node_modules
isTruthy(defines) &&
babel({
babelHelpers: 'bundled',
babelrc: false,
compact: false,
configFile: false,
include: 'node_modules/**',
plugins: [
[
require.resolve('babel-plugin-transform-replace-expressions'),
{ replace: defines },
],
],
}),
customBabel()({
babelHelpers: 'bundled',
extensions: EXTENSIONS,
// use a regex to make sure to exclude eventual hoisted packages
exclude: /\/node_modules\//,
passPerPreset: true, // @see https://babeljs.io/docs/en/options#passperpreset
custom: {
defines,
modern,
compress: options.compress !== false,
targets: options.target === 'node' ? { node: '12' } : undefined,
pragma: options.jsx,
pragmaFrag: options.jsxFragment,
typescript: !!useTypescript,
jsxImportSource: options.jsxImportSource || false,
},
}),
options.compress !== false && [
terser({
compress: Object.assign(
{
keep_infinity: true,
pure_getters: true,
// Ideally we'd just get Terser to respect existing Arrow functions...
// unsafe_arrows: true,
passes: 10,
},
typeof minifyOptions.compress === 'boolean'
? minifyOptions.compress
: minifyOptions.compress || {},
),
format: {
// By default, Terser wraps function arguments in extra parens to trigger eager parsing.
// Whether this is a good idea is way too specific to guess, so we optimize for size by default:
wrap_func_args: false,
comments: /^\s*([@#]__[A-Z]+__\s*$|@cc_on)/,
preserve_annotations: true,
},
module: modern,
ecma: modern ? 2017 : 5,
toplevel: modern || format === 'cjs' || format === 'es',
mangle:
typeof minifyOptions.mangle === 'boolean'
? minifyOptions.mangle
: Object.assign({}, minifyOptions.mangle || {}),
nameCache,
}),
nameCache && {
// before hook
options: loadNameCache,
// after hook
writeBundle() {
if (writeMeta && nameCache) {
let filename = getNameCachePath();
let json = JSON.stringify(
nameCache,
null,
nameCacheIndentTabs ? '\t' : 2,
);
if (endsWithNewLine) json += EOL;
fs.writeFile(filename, json, () => {});
}
},
},
],
options.visualize && visualizer(),
// NOTE: OMT only works with amd and esm
// Source: https://github.com/surma/rollup-plugin-off-main-thread#config
useWorkerLoader && (format === 'es' || modern) && OMT(),
/** @type {import('rollup').Plugin} */
({
name: 'postprocessing',
// Rollup 2 injects globalThis, which is nice, but doesn't really make sense for Microbundle.
// Only ESM environments necessitate globalThis, and UMD bundles can't be properly loaded as ESM.
// So we remove the globalThis check, replacing it with `this||self` to match Rollup 1's output:
renderChunk(code, chunk, opts) {
if (opts.format === 'umd') {
// Can swap this out with MagicString.replace() when we bump it:
// https://github.com/developit/microbundle/blob/f815a01cb63d90b9f847a4dcad2a64e6b2f8596f/src/index.js#L657-L671
const s = new MagicString(code);
const minified = code.match(
/([a-zA-Z$_]+)="undefined"!=typeof globalThis\?globalThis:(\1\|\|self)/,
);
if (minified) {
s.overwrite(
minified.index,
minified.index + minified[0].length,
minified[2],
);
}
const unminified = code.match(
/(global *= *)typeof +globalThis *!== *['"]undefined['"] *\? *globalThis *: *(global *\|\| *self)/,
);
if (unminified) {
s.overwrite(
unminified.index,
unminified.index + unminified[0].length,
unminified[1] + unminified[2],
);
}
return {
code: s.toString(),
map: s.generateMap({ hires: true }),
};
}
},
// Grab size info before writing files to disk:
writeBundle(_, bundle) {
config._sizeInfo = Promise.all(
Object.values(bundle).map(({ code, fileName }) => {
if (code) {
return getSizeInfo(code, fileName, options.raw);
}
}),
).then(results => results.filter(Boolean).join('\n'));
},
}),
)
.filter(Boolean),
},
/** @type {import('rollup').OutputOptions} */
outputOptions: {
paths: outputAliases,
globals,
strict: options.strict === true,
freeze: false,
esModule: false,
sourcemap: options.sourcemap,
get banner() {
return shebang[options.name];
},
format: modern ? 'es' : format,
name: options.name && options.name.replace(/^global\./, ''),
extend: /^global\./.test(options.name),
dir: outputDir,
entryFileNames: outputEntryFileName,
exports: 'auto',
},
};
return config;
}
================================================
FILE: src/lib/__entry__.js
================================================
export { default } from '__microbundle_entry__';
================================================
FILE: src/lib/babel-custom.js
================================================
import { createBabelInputPluginFactory } from '@rollup/plugin-babel';
import merge from 'lodash.merge';
import transformFastRest from './transform-fast-rest';
import { isTruthy } from '../utils';
const ESMODULES_TARGET = {
esmodules: true,
};
const mergeConfigItems = (babel, type, ...configItemsToMerge) => {
const mergedItems = [];
configItemsToMerge.forEach(configItemToMerge => {
configItemToMerge.forEach(item => {
const itemToMergeWithIndex = mergedItems.findIndex(
mergedItem =>
(mergedItem.name || mergedItem.file.resolved) ===
(item.name || item.file.resolved),
);
if (itemToMergeWithIndex === -1) {
mergedItems.push(item);
return;
}
mergedItems[itemToMergeWithIndex] = babel.createConfigItem(
[
mergedItems[itemToMergeWithIndex].file.resolved,
merge(mergedItems[itemToMergeWithIndex].options, item.options),
],
{
type,
},
);
});
});
return mergedItems;
};
const createConfigItems = (babel, type, items) => {
return items.map(item => {
let { name, value, ...options } = item;
value = value || [require.resolve(name), options];
return babel.createConfigItem(value, { type });
});
};
const environmentPreset = '@babel/preset-env';
// capture both @babel/env & @babel/preset-env (https://babeljs.io/docs/en/presets#preset-shorthand)
const presetEnvRegex = new RegExp(/@babel\/(preset-)?env/);
export default () => {
return createBabelInputPluginFactory(babelCore => {
return {
// Passed the plugin options.
options({ custom: customOptions, ...pluginOptions }) {
return {
// Pull out any custom options that the plugin might have.
customOptions,
// Pass the options back with the two custom options removed.
pluginOptions,
};
},
config(config, { customOptions }) {
const targets = customOptions.targets;
const isNodeTarget = targets && targets.node != null;
const defaultPlugins = createConfigItems(
babelCore,
'plugin',
[
{
name: '@babel/plugin-syntax-import-meta',
},
!customOptions.jsxImportSource && {
name: '@babel/plugin-transform-react-jsx',
pragma: customOptions.pragma || 'h',
pragmaFrag: customOptions.pragmaFrag || 'Fragment',
},
!customOptions.typescript && {
name: '@babel/plugin-transform-flow-strip-types',
},
isTruthy(customOptions.defines) && {
name: 'babel-plugin-transform-replace-expressions',
replace: customOptions.defines,
},
!customOptions.modern &&
!isNodeTarget && {
name: 'babel-plugin-transform-async-to-promises',
inlineHelpers: true,
externalHelpers: false,
minify: true,
},
!customOptions.modern &&
!isNodeTarget && {
value: [
transformFastRest,
{
// Use inline [].slice.call(arguments)
helper: false,
literal: true,
},
'transform-fast-rest',
],
},
{
name: '@babel/plugin-proposal-class-properties',
loose: true,
},
!customOptions.modern &&
!isNodeTarget && {
name: '@babel/plugin-transform-regenerator',
async: false,
},
{
name: 'babel-plugin-macros',
},
].filter(Boolean),
);
const babelOptions = config.options || {};
const envIdx = (babelOptions.presets || []).findIndex(preset =>
presetEnvRegex.test(preset.file.request),
);
if (envIdx !== -1) {
const preset = babelOptions.presets[envIdx];
babelOptions.presets[envIdx] = babelCore.createConfigItem(
[
require.resolve(environmentPreset),
Object.assign(
merge(
{
loose: true,
useBuiltIns: false,
targets: customOptions.targets,
},
preset.options,
{
bugfixes: customOptions.modern,
modules: false,
exclude: merge(
['transform-async-to-generator', 'transform-regenerator'],
(preset.options && preset.options.exclude) || [],
),
},
),
customOptions.modern ? { targets: ESMODULES_TARGET } : {},
),
],
{
type: `preset`,
},
);
} else {
babelOptions.presets = createConfigItems(
babelCore,
'preset',
[
{
name: environmentPreset,
targets: customOptions.modern
? ESMODULES_TARGET
: customOptions.targets,
modules: false,
loose: true,
useBuiltIns: false,
bugfixes: customOptions.modern,
exclude: [
'transform-async-to-generator',
'transform-regenerator',
],
},
customOptions.jsxImportSource && {
name: '@babel/preset-react',
runtime: 'automatic',
importSource: customOptions.jsxImportSource,
},
].filter(Boolean),
);
}
// Merge babelrc & our plugins together
babelOptions.plugins = mergeConfigItems(
babelCore,
'plugin',
defaultPlugins,
babelOptions.plugins || [],
);
if (customOptions.compress) {
babelOptions.generatorOpts = {
minified: true,
compact: true,
shouldPrintComment: comment => /[@#]__[A-Z]+__/.test(comment),
};
}
return babelOptions;
},
};
});
};
================================================
FILE: src/lib/compressed-size.js
================================================
import { basename } from 'path';
import { green, red, yellow, white } from 'kleur';
import gzipSize from 'gzip-size';
import brotliSize from 'brotli-size';
import prettyBytes from 'pretty-bytes';
function getPadLeft(str, width, char = ' ') {
return char.repeat(width - str.length);
}
function formatSize(size, filename, type, raw) {
const pretty = raw ? `${size} B` : prettyBytes(size);
const color = size < 5000 ? green : size > 40000 ? red : yellow;
const indent = getPadLeft(pretty, 13);
return `${indent}${color(pretty)}: ${white(basename(filename))}.${type}`;
}
export async function getSizeInfo(code, filename, raw) {
raw = raw || code.length < 5000;
const [gzip, brotli] = await Promise.all([
gzipSize(code).catch(() => null),
brotliSize(code).catch(() => null),
]);
let out = formatSize(gzip, filename, 'gz', raw);
if (brotli) {
out += '\n' + formatSize(brotli, filename, 'br', raw);
}
return out;
}
================================================
FILE: src/lib/css-modules.js
================================================
export function shouldCssModules(options) {
const passedInOption = processCssmodulesArgument(options);
// We should module when my-file.module.css or my-file.css
const moduleAllCss = passedInOption === true;
// We should module when my-file.module.css
const allowOnlySuffixModule = passedInOption === null;
return moduleAllCss || allowOnlySuffixModule;
}
export function cssModulesConfig(options) {
const passedInOption = processCssmodulesArgument(options);
const isWatchMode = options.watch;
const hasPassedInScopeName = !(
typeof passedInOption === 'boolean' || passedInOption === null
);
if (shouldCssModules(options) || hasPassedInScopeName) {
let generateScopedName = isWatchMode
? '_[name]__[local]__[hash:base64:5]'
: '_[hash:base64:5]';
if (hasPassedInScopeName) {
generateScopedName = passedInOption; // would be the string from --css-modules "_[hash]".
}
return { generateScopedName };
}
return false;
}
/**
* This is done because if you use the cli default property, you get a primitive "null" or "false",
* but when using the cli arguments, you always get back strings. This method aims at correcting those
* for both realms. So that both realms _convert_ into primitives.
*/
function processCssmodulesArgument(options) {
if (options['css-modules'] === 'true' || options['css-modules'] === true)
return true;
if (options['css-modules'] === 'false' || options['css-modules'] === false)
return false;
if (options['css-modules'] === 'null' || options['css-modules'] === null)
return null;
return options['css-modules'];
}
================================================
FILE: src/lib/option-normalization.js
================================================
/**
* Convert booleans and int define= values to literals.
* This is more intuitive than `microbundle --define A=1` producing A="1".
*/
export function toReplacementExpression(value, name) {
// --define A="1",B='true' produces string:
const matches = value.match(/^(['"])(.+)\1$/);
if (matches) {
return [JSON.stringify(matches[2]), name];
}
// --define @assign=Object.assign replaces expressions with expressions:
if (name[0] === '@') {
return [value, name.substring(1)];
}
// --define A=1,B=true produces int/boolean literal:
if (/^(true|false|\d+)$/i.test(value)) {
return [value, name];
}
// default: string literal
return [JSON.stringify(value), name];
}
/**
* Parses values of the form "$=jQuery,React=react" into key-value object pairs.
*/
export function parseMappingArgument(globalStrings, processValue) {
const globals = {};
globalStrings.split(',').forEach(globalString => {
let [key, value] = globalString.split('=');
if (processValue) {
const r = processValue(value, key);
if (r !== undefined) {
if (Array.isArray(r)) {
[value, key] = r;
} else {
value = r;
}
}
}
globals[key] = value;
});
return globals;
}
/**
* Parses values of the form "$=jQuery,React=react" into key-value object pairs.
*/
export function parseAliasArgument(aliasStrings) {
return aliasStrings.split(',').map(str => {
let [key, value] = str.split('=');
return { find: key, replacement: value };
});
}
================================================
FILE: src/lib/package-info.js
================================================
import { resolve, basename } from 'path';
import { red, yellow } from 'kleur';
import { readFile, stderr, safeVariableName } from '../utils';
/** */
export async function getConfigFromPkgJson(cwd) {
let hasPackageJson = false;
let pkg;
try {
const packageJson = await readFile(resolve(cwd, 'package.json'), 'utf8');
pkg = JSON.parse(packageJson);
hasPackageJson = true;
} catch (err) {
const pkgName = basename(cwd);
stderr(
yellow().inverse('WARN'),
yellow(` no package.json, assuming package name is "${pkgName}".`),
);
let msg = String(err.message || err);
if (!msg.match(/ENOENT/)) stderr(` ${red().dim(msg)}`);
pkg = { name: pkgName };
}
return { hasPackageJson, pkg };
}
export function getName({ name, pkgName, amdName, cwd, hasPackageJson }) {
if (!pkgName) {
pkgName = basename(cwd);
if (hasPackageJson) {
stderr(
yellow().inverse('WARN'),
yellow(` missing package.json "name" field. Assuming "${pkgName}".`),
);
}
}
const finalName = name || amdName || safeVariableName(pkgName);
return { finalName, pkgName };
}
================================================
FILE: src/lib/terser.js
================================================
// Normalize Terser options from microbundle's relaxed JSON format (mutates argument in-place)
export function normalizeMinifyOptions(minifyOptions) {
// ignore normalization if "mangle" is a boolean:
if (typeof minifyOptions.mangle === 'boolean') return;
const mangle = minifyOptions.mangle || (minifyOptions.mangle = {});
let properties = mangle.properties;
// allow top-level "properties" key to override mangle.properties (including {properties:false}):
if (minifyOptions.properties != null) {
properties = mangle.properties =
minifyOptions.properties &&
Object.assign(properties, minifyOptions.properties);
}
// allow previous format ({ mangle:{regex:'^_',reserved:[]} }):
if (minifyOptions.regex || minifyOptions.reserved) {
if (!properties) properties = mangle.properties = {};
properties.regex = properties.regex || minifyOptions.regex;
properties.reserved = properties.reserved || minifyOptions.reserved;
}
if (properties) {
if (properties.regex) properties.regex = new RegExp(properties.regex);
properties.reserved = [].concat(properties.reserved || []);
}
}
================================================
FILE: src/lib/transform-fast-rest.js
================================================
/**
* @type {import('@babel/core')}
*/
/**
* Transform ...rest parameters to [].slice.call(arguments,offset).
* Demo: https://astexplorer.net/#/gist/70aaa0306db9a642171ef3e2f35df2e0/576c150f647e4936fa6960e0453a11cdc5d81f21
* Benchmark: https://jsperf.com/rest-arguments-babel-pr-9152/4
* @param {object} opts
* @param {babel.template} opts.template
* @param {babel.types} opts.types
* @returns {babel.PluginObj}
*/
export default function fastRestTransform({ template, types: t }) {
const slice = template`var IDENT = Array.prototype.slice;`;
const VISITOR = {
RestElement(path, state) {
if (path.parentKey !== 'params') return;
// Create a global _slice alias
let slice = state.get('slice');
if (!slice) {
slice = path.scope.generateUidIdentifier('slice');
state.set('slice', slice);
}
// _slice.call(arguments) or _slice.call(arguments, 1)
const args = [t.identifier('arguments')];
if (path.key) args.push(t.numericLiteral(path.key));
const sliced = t.callExpression(
t.memberExpression(t.clone(slice), t.identifier('call')),
args,
);
const ident = path.node.argument;
const binding = path.scope.getBinding(ident.name);
if (binding.referencePaths.length !== 0) {
// arguments access requires a non-Arrow function:
const func = path.parentPath;
if (t.isArrowFunctionExpression(func)) {
func.arrowFunctionToExpression();
}
if (
binding.constant &&
binding.referencePaths.length === 1 &&
sameArgumentsObject(binding.referencePaths[0], func, t)
) {
// one usage, never assigned - replace usage inline
binding.referencePaths[0].replaceWith(sliced);
} else {
// unknown usage, create a binding
const decl = t.variableDeclaration('var', [
t.variableDeclarator(t.clone(ident), sliced),
]);
func.get('body').unshiftContainer('body', decl);
}
}
path.remove();
},
};
return {
name: 'transform-fast-rest',
visitor: {
Program(path, state) {
const childState = new Map();
const useHelper = state.opts.helper === true; // defaults to false
if (!useHelper) {
let inlineHelper;
if (state.opts.literal === false) {
inlineHelper = template.expression.ast`Array.prototype.slice`;
} else {
inlineHelper = template.expression.ast`[].slice`;
}
childState.set('slice', inlineHelper);
}
path.traverse(VISITOR, childState);
const name = childState.get('slice');
if (name && useHelper) {
const helper = slice({ IDENT: name });
t.addComment(helper.declarations[0].init, 'leading', '#__PURE__');
path.unshiftContainer('body', helper);
}
},
},
};
}
function sameArgumentsObject(node, func, t) {
while ((node = node.parentPath)) {
if (node === func) {
return true;
}
if (t.isFunction(node) && !t.isArrowFunctionExpression(node)) {
return false;
}
}
return false;
}
================================================
FILE: src/log-error.js
================================================
import { red, dim } from 'kleur';
import { stderr } from './utils';
export default function logError(err) {
const error = err.error || err;
const description = `${error.name ? error.name + ': ' : ''}${
error.message || error
}`;
const message = error.plugin
? `(${error.plugin} plugin) ${description}`
: description;
stderr(red().bold(message));
if (error.loc) {
stderr();
stderr(`at ${error.loc.file}:${error.loc.line}:${error.loc.column}`);
}
if (error.frame) {
stderr();
stderr(dim(error.frame));
} else if (err.stack) {
const headlessStack = error.stack.replace(message, '');
stderr(dim(headlessStack));
}
stderr();
}
================================================
FILE: src/prog.js
================================================
import sade from 'sade';
let { version } = require('../package.json');
const toArray = val => (Array.isArray(val) ? val : val == null ? [] : [val]);
export default handler => {
const ENABLE_MODERN = process.env.MICROBUNDLE_MODERN !== 'false';
const DEFAULT_FORMATS = ENABLE_MODERN ? 'modern,esm,cjs,umd' : 'esm,cjs,umd';
const cmd = type => (str, opts) => {
opts.watch = opts.watch || type === 'watch';
opts.entries = toArray(str || opts.entry).concat(opts._);
if (typeof opts.compress !== 'undefined') {
// Convert `--compress true/false/1/0` to booleans:
if (typeof opts.compress !== 'boolean') {
opts.compress = opts.compress !== 'false' && opts.compress !== '0';
}
} else {
// the default compress value is `true` for web, `false` for Node:
opts.compress = opts.target !== 'node';
}
handler(opts);
};
let prog = sade('microbundle');
prog
.version(version)
.option('--entry, -i', 'Entry module(s)')
.option('--output, -o', 'Directory to place build files into')
.option(
'--format, -f',
`Only build specified formats (any of ${DEFAULT_FORMATS} or iife)`,
DEFAULT_FORMATS,
)
.option('--watch, -w', 'Rebuilds on any change', false)
.option(
'--pkg-main',
'Outputs files analog to package.json main entries',
true,
)
.option('--target', 'Specify your target environment (node or web)', 'web')
.option('--external', `Specify external dependencies, or 'none'`)
.option('--globals', `Specify globals dependencies, or 'none'`)
.example('--globals react=React,jquery=$')
.option('--define', 'Replace constants with hard-coded values')
.example('--define API_KEY=1234')
.option('--alias', `Map imports to different modules`)
.example('--alias react=preact')
.option(
'--compress',
'Compress output using Terser (default true when --target is web, false when --target is node)',
)
.example('build --target web --no-compress')
.option('--strict', 'Enforce undefined global context and add "use strict"')
.option('--name', 'Specify name exposed in UMD builds')
.option('--cwd', 'Use an alternative working directory', '.')
.option('--sourcemap', 'Generate source map')
.example("watch --no-sourcemap # don't generate sourcemaps")
.option('--raw', 'Show raw byte size', false)
.option('--jsx', 'A custom JSX pragma like React.createElement', 'h')
.option(
'--jsxFragment',
'A custom JSX fragment pragma like React.Fragment',
'Fragment',
)
.option(
'--jsxImportSource',
'Declares the module specifier to be used for importing jsx factory functions',
)
.option('--tsconfig', 'Specify the path to a custom tsconfig.json')
.example('build --tsconfig tsconfig.build.json')
.option(
'--generateTypes',
'Whether or not to generate types , if `types` or `typings` is set in `package.json` then it will default to be `true`',
)
.option('--css', 'Where to output CSS: "inline" or "external"', 'external')
.option(
'--css-modules',
'Turns on css-modules for all .css imports. Passing a string will override the scopeName. eg --css-modules="_[hash]"',
null,
)
.option(
'--workers',
'Bundle module workers - see https://github.com/surma/rollup-plugin-off-main-thread#auto-bundling',
false,
)
.option(
'--visualize',
'Generate bundle makeup visualization (stats.html)',
false,
);
prog
.command('build [...entries]', '', { default: true })
.describe('Build once and exit')
.action(cmd('build'));
prog
.command('watch [...entries]')
.describe('Rebuilds on any change')
.action(cmd('watch'));
// Parse argv; add extra aliases
return argv =>
prog.parse(argv, {
alias: {
o: ['output', 'd'],
i: ['entry', 'entries', 'e'],
w: ['watch'],
},
boolean: ['generateTypes'],
});
};
================================================
FILE: src/utils.js
================================================
import { promises as fs } from 'fs';
import camelCase from 'camelcase';
export const readFile = fs.readFile;
export const stat = fs.stat;
export function isDir(name) {
return stat(name)
.then(stats => stats.isDirectory())
.catch(() => false);
}
export function isFile(name) {
return stat(name)
.then(stats => stats.isFile())
.catch(() => false);
}
// eslint-disable-next-line no-console
export const stdout = console.log.bind(console);
export const stderr = console.error.bind(console);
export const isTruthy = obj => {
if (!obj) {
return false;
}
return obj.constructor !== Object || Object.keys(obj).length > 0;
};
/** Remove a @scope/ prefix from a package name string */
export const removeScope = name => name.replace(/^@.*\//, '');
const INVALID_ES3_IDENT = /((^[^a-zA-Z]+)|[^\w.-])|([^a-zA-Z0-9]+$)/g;
/**
* Turn a package name into a valid reasonably-unique variable name
* @param {string} name
*/
export function safeVariableName(name) {
const normalized = removeScope(name).toLowerCase();
const identifier = normalized.replace(INVALID_ES3_IDENT, '');
return camelCase(identifier);
}
export const EXTENSION = /(\.(umd|cjs|es|m))?\.([cm]?[tj]sx?)$/;
================================================
FILE: test/__snapshots__/index.test.js.snap
================================================
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`fixtures build alias with microbundle 1`] = `
"Used script: microbundle --no-sourcemap --alias ./constants=./constants-debug
Directory tree:
alias
dist
alias-mapping.esm.mjs
alias-mapping.js
alias-mapping.umd.js
package.json
src
constants-debug.js
constants.js
index.js
Build \\"alias-mapping\\" to dist:
62 B: alias-mapping.js.gz
46 B: alias-mapping.js.br
62 B: alias-mapping.esm.mjs.gz
46 B: alias-mapping.esm.mjs.br
118 B: alias-mapping.umd.js.gz
83 B: alias-mapping.umd.js.br"
`;
exports[`fixtures build alias with microbundle 2`] = `3`;
exports[`fixtures build alias with microbundle 3`] = `
"console.log(\\"DEBUG should be true: \\",!0);
"
`;
exports[`fixtures build alias with microbundle 4`] = `
"console.log(\\"DEBUG should be true: \\",!0);
"
`;
exports[`fixtures build alias with microbundle 5`] = `
"!function(e){\\"function\\"==typeof define&&define.amd?define(e):e()}(function(){console.log(\\"DEBUG should be true: \\",!0)});
"
`;
exports[`fixtures build alias-external with microbundle 1`] = `
"Used script: microbundle --alias tiny-glob=./colossal-glob.js
Directory tree:
alias-external
dist
alias-external.esm.mjs
alias-external.esm.mjs.map
alias-external.js
alias-external.js.map
alias-external.umd.js
alias-external.umd.js.map
package.json
src
colossal-glob.js
index.js
Build \\"alias-external\\" to dist:
37 B: alias-external.js.gz
21 B: alias-external.js.br
37 B: alias-external.esm.mjs.gz
21 B: alias-external.esm.mjs.br
93 B: alias-external.umd.js.gz
89 B: alias-external.umd.js.br"
`;
exports[`fixtures build alias-external with microbundle 2`] = `6`;
exports[`fixtures build alias-external with microbundle 3`] = `
"console.log(42);
//# sourceMappingURL=alias-external.esm.mjs.map
"
`;
exports[`fixtures build alias-external with microbundle 4`] = `
"console.log(42);
//# sourceMappingURL=alias-external.js.map
"
`;
exports[`fixtures build alias-external with microbundle 5`] = `
"!function(n){\\"function\\"==typeof define&&define.amd?define(n):n()}(function(){console.log(42)});
//# sourceMappingURL=alias-external.umd.js.map
"
`;
exports[`fixtures build async-iife-ts with microbundle 1`] = `
"Used script: microbundle
Directory tree:
async-iife-ts
dist
async-iife-ts.esm.mjs
async-iife-ts.esm.mjs.map
async-iife-ts.js
async-iife-ts.js.map
async-iife-ts.umd.js
async-iife-ts.umd.js.map
index.d.ts
node_modules
package.json
src
index.ts
tsconfig.json
Build \\"async-iife-ts\\" to dist:
70 B: async-iife-ts.js.gz
55 B: async-iife-ts.js.br
70 B: async-iife-ts.esm.mjs.gz
55 B: async-iife-ts.esm.mjs.br
125 B: async-iife-ts.umd.js.gz
95 B: async-iife-ts.umd.js.br"
`;
exports[`fixtures build async-iife-ts with microbundle 2`] = `7`;
exports[`fixtures build async-iife-ts with microbundle 3`] = `
"try{console.log(\\"foo\\")}catch(o){Promise.reject(o)}
//# sourceMappingURL=async-iife-ts.esm.mjs.map
"
`;
exports[`fixtures build async-iife-ts with microbundle 4`] = `
"try{console.log(\\"foo\\")}catch(o){Promise.reject(o)}
//# sourceMappingURL=async-iife-ts.js.map
"
`;
exports[`fixtures build async-iife-ts with microbundle 5`] = `
"!function(e){\\"function\\"==typeof define&&define.amd?define(e):e()}(function(){try{console.log(\\"foo\\")}catch(e){Promise.reject(e)}});
//# sourceMappingURL=async-iife-ts.umd.js.map
"
`;
exports[`fixtures build async-iife-ts with microbundle 6`] = `""`;
exports[`fixtures build async-ts with microbundle 1`] = `
"Used script: microbundle
Directory tree:
async-ts
dist
async-ts.esm.mjs
async-ts.esm.mjs.map
async-ts.js
async-ts.js.map
async-ts.umd.js
async-ts.umd.js.map
index.d.ts
node_modules
package.json
src
index.ts
tsconfig.json
Build \\"async-ts\\" to dist:
117 B: async-ts.js.gz
91 B: async-ts.js.br
128 B: async-ts.esm.mjs.gz
108 B: async-ts.esm.mjs.br
217 B: async-ts.umd.js.gz
164 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=/*#__PURE__*/function(){function o(){}return o.prototype.foo=function(){return Promise.resolve()},o}();export{o as MyClass};
//# sourceMappingURL=async-ts.esm.mjs.map
"
`;
exports[`fixtures build async-ts with microbundle 4`] = `
"exports.MyClass=/*#__PURE__*/function(){function o(){}return o.prototype.foo=function(){return Promise.resolve()},o}();
//# sourceMappingURL=async-ts.js.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||self).asyncTs={})}(this,function(e){e.MyClass=/*#__PURE__*/function(){function e(){}return e.prototype.foo=function(){return Promise.resolve()},e}()});
//# sourceMappingURL=async-ts.umd.js.map
"
`;
exports[`fixtures build async-ts with microbundle 6`] = `
"export declare class MyClass {
foo(): Promise<void>;
}
"
`;
exports[`fixtures build basic with microbundle 1`] = `
"Used script: microbundle
Directory tree:
basic
dist
basic-lib.esm.mjs
basic-lib.esm.mjs.map
basic-lib.js
basic-lib.js.map
basic-lib.umd.js
basic-lib.umd.js.map
package.json
src
index.js
two.js
Build \\"basic-lib\\" to dist:
187 B: basic-lib.js.gz
138 B: basic-lib.js.br
188 B: basic-lib.esm.mjs.gz
139 B: basic-lib.esm.mjs.br
273 B: basic-lib.umd.js.gz
211 B: basic-lib.umd.js.br"
`;
exports[`fixtures build basic with microbundle 2`] = `6`;
exports[`fixtures build basic with microbundle 3`] = `
"var r=function(){try{var r=arguments;return Promise.resolve([].slice.call(r).reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};export default function(){try{var e=arguments,t=[].slice.call(e);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.esm.mjs.map
"
`;
exports[`fixtures build basic with microbundle 4`] = `
"var r=function(){try{var r=arguments;return Promise.resolve([].slice.call(r).reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};module.exports=function(){try{var e=arguments,t=[].slice.call(e);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.js.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||self).basicLib=r()}(this,function(){var e=function(){try{var e=arguments;return Promise.resolve([].slice.call(e).reduce(function(e,r){return e+r},0))}catch(e){return Promise.reject(e)}};return function(){try{var r=arguments,n=[].slice.call(r);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.esm.mjs
basic-babelrc.esm.mjs.map
basic-babelrc.js
basic-babelrc.js.map
basic-babelrc.umd.js
basic-babelrc.umd.js.map
package.json
src
index.js
Build \\"basic-babelrc\\" to dist:
122 B: basic-babelrc.js.gz
91 B: basic-babelrc.js.br
122 B: basic-babelrc.esm.mjs.gz
91 B: basic-babelrc.esm.mjs.br
158 B: basic-babelrc.umd.js.gz
121 B: basic-babelrc.umd.js.br"
`;
exports[`fixtures build basic-babelrc with microbundle 2`] = `6`;
exports[`fixtures build basic-babelrc with microbundle 3`] = `
"function r(r){return void 0===r&&(r=function(r){throw new Error(\\"required!\\")}()),!0===r||function(r){throw new Error(\\"Falsey!\\")}()}r(!0),r(!1);
//# sourceMappingURL=basic-babelrc.esm.mjs.map
"
`;
exports[`fixtures build basic-babelrc with microbundle 4`] = `
"function r(r){return void 0===r&&(r=function(r){throw new Error(\\"required!\\")}()),!0===r||function(r){throw new Error(\\"Falsey!\\")}()}r(!0),r(!1);
//# sourceMappingURL=basic-babelrc.js.map
"
`;
exports[`fixtures build basic-babelrc with microbundle 5`] = `
"!function(n){\\"function\\"==typeof define&&define.amd?define(n):n()}(function(){function n(n){return void 0===n&&(n=function(n){throw new Error(\\"required!\\")}()),!0===n||function(n){throw new Error(\\"Falsey!\\")}()}n(!0),n(!1)});
//# sourceMappingURL=basic-babelrc.umd.js.map
"
`;
exports[`fixtures build basic-compress-false with microbundle 1`] = `
"Used script: microbundle --compress=false
Directory tree:
basic-compress-false
dist
basic-compress-false.esm.mjs
basic-compress-false.esm.mjs.map
basic-compress-false.js
basic-compress-false.js.map
basic-compress-false.umd.js
basic-compress-false.umd.js.map
package.json
src
index.js
two.js
Build \\"basic-compress-false\\" to dist:
260 B: basic-compress-false.js.gz
206 B: basic-compress-false.js.br
258 B: basic-compress-false.esm.mjs.gz
209 B: basic-compress-false.esm.mjs.br
383 B: basic-compress-false.umd.js.gz
305 B: basic-compress-false.umd.js.br"
`;
exports[`fixtures build basic-compress-false with microbundle 2`] = `6`;
exports[`fixtures build basic-compress-false with microbundle 3`] = `
"var two = function two() {
try {
var _arguments2 = arguments;
return Promise.resolve([].slice.call(_arguments2).reduce(function (total, value) {
return total + value;
}, 0));
} catch (e) {
return Promise.reject(e);
}
};
var index = (function () {
try {
var _arguments2 = arguments;
var args = [].slice.call(_arguments2);
return Promise.resolve(two.apply(void 0, args)).then(function (_two) {
return Promise.resolve(two.apply(void 0, args)).then(function (_two2) {
return [_two, _two2];
});
});
} catch (e) {
return Promise.reject(e);
}
});
export default index;
//# sourceMappingURL=basic-compress-false.esm.mjs.map
"
`;
exports[`fixtures build basic-compress-false with microbundle 4`] = `
"var two = function two() {
try {
var _arguments2 = arguments;
return Promise.resolve([].slice.call(_arguments2).reduce(function (total, value) {
return total + value;
}, 0));
} catch (e) {
return Promise.reject(e);
}
};
var index = (function () {
try {
var _arguments2 = arguments;
var args = [].slice.call(_arguments2);
return Promise.resolve(two.apply(void 0, args)).then(function (_two) {
return Promise.resolve(two.apply(void 0, args)).then(function (_two2) {
return [_two, _two2];
});
});
} catch (e) {
return Promise.reject(e);
}
});
module.exports = index;
//# sourceMappingURL=basic-compress-false.js.map
"
`;
exports[`fixtures build basic-compress-false with microbundle 5`] = `
"(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.basicCompressFalse = factory());
}(this, (function () {
var two = function two() {
try {
var _arguments2 = arguments;
return Promise.resolve([].slice.call(_arguments2).reduce(function (total, value) {
return total + value;
}, 0));
} catch (e) {
return Promise.reject(e);
}
};
var index = (function () {
try {
var _arguments2 = arguments;
var args = [].slice.call(_arguments2);
return Promise.resolve(two.apply(void 0, args)).then(function (_two) {
return Promise.resolve(two.apply(void 0, args)).then(function (_two2) {
return [_two, _two2];
});
});
} catch (e) {
return Promise.reject(e);
}
});
return index;
})));
//# sourceMappingURL=basic-compress-false.umd.js.map
"
`;
exports[`fixtures build basic-css with microbundle 1`] = `
"Used script: microbundle
Directory tree:
basic-css
dist
basic-css.css
basic-css.css.map
basic-css.esm.mjs
basic-css.esm.mjs.map
basic-css.js
basic-css.js.map
basic-css.umd.js
basic-css.umd.js.map
package.json
src
index.js
two.css
Build \\"basic-css\\" to dist:
107 B: basic-css.js.gz
60 B: basic-css.js.br
109 B: basic-css.esm.mjs.gz
67 B: basic-css.esm.mjs.br
195 B: basic-css.umd.js.gz
138 B: basic-css.umd.js.br"
`;
exports[`fixtures build basic-css with microbundle 2`] = `8`;
exports[`fixtures build basic-css with microbundle 3`] = `
".testing{display:flex;color:red;background:#00f}
/*# sourceMappingURL=basic-css.css.map */"
`;
exports[`fixtures build basic-css with microbundle 4`] = `
"function e(){var e=document.createElement(\\"div\\");return e.className=\\"testing\\",e}export default e;
//# sourceMappingURL=basic-css.esm.mjs.map
"
`;
exports[`fixtures build basic-css with microbundle 5`] = `
"module.exports=function(){var e=document.createElement(\\"div\\");return e.className=\\"testing\\",e};
//# sourceMappingURL=basic-css.js.map
"
`;
exports[`fixtures build basic-css with microbundle 6`] = `
"!function(e,n){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=n():\\"function\\"==typeof define&&define.amd?define(n):(e||self).basicCss=n()}(this,function(){return function(){var e=document.createElement(\\"div\\");return e.className=\\"testing\\",e}});
//# sourceMappingURL=basic-css.umd.js.map
"
`;
exports[`fixtures build basic-dashed-external with microbundle 1`] = `
"Used script: microbundle
Directory tree:
basic-dashed-external
dist
basic-dashed-external.esm.mjs
basic-dashed-external.esm.mjs.map
basic-dashed-external.js
basic-dashed-external.js.map
basic-dashed-external.umd.js
basic-dashed-external.umd.js.map
package.json
src
index.js
two.js
Build \\"basic-dashed-external\\" to dist:
276 B: basic-dashed-external.js.gz
212 B: basic-dashed-external.js.br
214 B: basic-dashed-external.esm.mjs.gz
164 B: basic-dashed-external.esm.mjs.br
357 B: basic-dashed-external.umd.js.gz
285 B: basic-dashed-external.umd.js.br"
`;
exports[`fixtures build basic-dashed-external with microbundle 2`] = `6`;
exports[`fixtures build basic-dashed-external with microbundle 3`] = `
"import r from\\"tiny-glob\\";var e=function(){try{var r=arguments;return Promise.resolve([].slice.call(r).reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};console.log(r);export default function(){try{var r=arguments,t=[].slice.call(r);return Promise.resolve(e.apply(void 0,t)).then(function(r){return Promise.resolve(e.apply(void 0,t)).then(function(e){return[r,e]})})}catch(r){return Promise.reject(r)}}
//# sourceMappingURL=basic-dashed-external.esm.mjs.map
"
`;
exports[`fixtures build basic-dashed-external with microbundle 4`] = `
"var e=require(\\"tiny-glob\\");function r(e){return e&&\\"object\\"==typeof e&&\\"default\\"in e?e:{default:e}}var t=function(){try{var e=arguments;return Promise.resolve([].slice.call(e).reduce(function(e,r){return e+r},0))}catch(e){return Promise.reject(e)}};console.log(/*#__PURE__*/r(e).default),module.exports=function(){try{var e=arguments,r=[].slice.call(e);return Promise.resolve(t.apply(void 0,r)).then(function(e){return Promise.resolve(t.apply(void 0,r)).then(function(r){return[e,r]})})}catch(e){return Promise.reject(e)}};
//# sourceMappingURL=basic-dashed-external.js.map
"
`;
exports[`fixtures build basic-dashed-external with microbundle 5`] = `
"!function(e,t){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=t(require(\\"tiny-glob\\")):\\"function\\"==typeof define&&define.amd?define([\\"tiny-glob\\"],t):(e||self).basicDashedExternal=t(e.tinyGlob)}(this,function(e){function t(e){return e&&\\"object\\"==typeof e&&\\"default\\"in e?e:{default:e}}var n=function(){try{var e=arguments;return Promise.resolve([].slice.call(e).reduce(function(e,t){return e+t},0))}catch(e){return Promise.reject(e)}};return console.log(/*#__PURE__*/t(e).default),function(){try{var e=arguments,t=[].slice.call(e);return Promise.resolve(n.apply(void 0,t)).then(function(e){return Promise.resolve(n.apply(void 0,t)).then(function(t){return[e,t]})})}catch(e){return Promise.reject(e)}}});
//# sourceMappingURL=basic-dashed-external.umd.js.map
"
`;
exports[`fixtures build basic-flow with microbundle 1`] = `
"Used script: microbundle
Directory tree:
basic-flow
dist
basic-lib-flow.esm.mjs
basic-lib-flow.esm.mjs.map
basic-lib-flow.js
basic-lib-flow.js.map
basic-lib-flow.umd.js
basic-lib-flow.umd.js.map
package.json
src
fruits.js
index.js
Build \\"basic-lib-flow\\" to dist:
57 B: basic-lib-flow.js.gz
43 B: basic-lib-flow.js.br
56 B: basic-lib-flow.esm.mjs.gz
42 B: basic-lib-flow.esm.mjs.br
171 B: basic-lib-flow.umd.js.gz
132 B: basic-lib-flow.umd.js.br"
`;
exports[`fixtures build basic-flow with microbundle 2`] = `6`;
exports[`fixtures build basic-flow with microbundle 3`] = `
"export default[\\"banana\\",\\"raspberry\\"];
//# sourceMappingURL=basic-lib-flow.esm.mjs.map
"
`;
exports[`fixtures build basic-flow with microbundle 4`] = `
"module.exports=[\\"banana\\",\\"raspberry\\"];
//# sourceMappingURL=basic-lib-flow.js.map
"
`;
exports[`fixtures build basic-flow with microbundle 5`] = `
"!function(e,n){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=[\\"banana\\",\\"raspberry\\"]:\\"function\\"==typeof define&&define.amd?define(function(){return[\\"banana\\",\\"raspberry\\"]}):(e||self).basicLibFlow=[\\"banana\\",\\"raspberry\\"]}(this);
//# sourceMappingURL=basic-lib-flow.umd.js.map
"
`;
exports[`fixtures build basic-json with microbundle 1`] = `
"Used script: microbundle
Directory tree:
basic-json
dist
basic-json.esm.mjs
basic-json.esm.mjs.map
basic-json.js
basic-json.js.map
basic-json.umd.js
basic-json.umd.js.map
package.json
src
index.js
two.json
Build \\"basic-json\\" to dist:
93 B: basic-json.js.gz
65 B: basic-json.js.br
92 B: basic-json.esm.mjs.gz
64 B: basic-json.esm.mjs.br
180 B: basic-json.umd.js.gz
129 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\\"};export default function(){return Promise.resolve(e)}
//# sourceMappingURL=basic-json.esm.mjs.map
"
`;
exports[`fixtures build basic-json with microbundle 4`] = `
"var e={test:\\"true\\"};module.exports=function(){return Promise.resolve(e)};
//# sourceMappingURL=basic-json.js.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||self).basicJson=n()}(this,function(){var e={test:\\"true\\"};return function(){return Promise.resolve(e)}});
//# sourceMappingURL=basic-json.umd.js.map
"
`;
exports[`fixtures build basic-multi-source with microbundle 1`] = `
"Used script: microbundle
Directory tree:
basic-multi-source
a.js
b.js
dist
a.esm.mjs
a.esm.mjs.map
a.js
a.js.map
a.umd.js
a.umd.js.map
b.esm.mjs
b.esm.mjs.map
b.js
b.js.map
b.umd.js
b.umd.js.map
package.json
Build \\"basic-multi-source\\" to dist:
43 B: a.js.gz
27 B: a.js.br
43 B: a.esm.mjs.gz
27 B: a.esm.mjs.br
99 B: a.umd.js.gz
84 B: a.umd.js.br
43 B: b.js.gz
27 B: b.js.br
43 B: b.esm.mjs.gz
27 B: b.esm.mjs.br
99 B: b.umd.js.gz
79 B: b.umd.js.br"
`;
exports[`fixtures build basic-multi-source with microbundle 2`] = `12`;
exports[`fixtures build basic-multi-source with microbundle 3`] = `
"console.log(\\"i am a\\");
//# sourceMappingURL=a.esm.mjs.map
"
`;
exports[`fixtures build basic-multi-source with microbundle 4`] = `
"console.log(\\"i am a\\");
//# sourceMappingURL=a.js.map
"
`;
exports[`fixtures build basic-multi-source with microbundle 5`] = `
"!function(n){\\"function\\"==typeof define&&define.amd?define(n):n()}(function(){console.log(\\"i am a\\")});
//# sourceMappingURL=a.umd.js.map
"
`;
exports[`fixtures build basic-multi-source with microbundle 6`] = `
"console.log(\\"i am b\\");
//# sourceMappingURL=b.esm.mjs.map
"
`;
exports[`fixtures build basic-multi-source with microbundle 7`] = `
"console.log(\\"i am b\\");
//# sourceMappingURL=b.js.map
"
`;
exports[`fixtures build basic-multi-source with microbundle 8`] = `
"!function(n){\\"function\\"==typeof define&&define.amd?define(n):n()}(function(){console.log(\\"i am b\\")});
//# sourceMappingURL=b.umd.js.map
"
`;
exports[`fixtures build basic-multi-source-css with microbundle 1`] = `
"Used script: microbundle
Directory tree:
basic-multi-source-css
a.css
a.js
b.css
b.js
dist
a.css
a.css.map
a.esm.mjs
a.esm.mjs.map
a.js
a.js.map
a.umd.js
a.umd.js.map
b.css
b.css.map
b.esm.mjs
b.esm.mjs.map
b.js
b.js.map
b.umd.js
b.umd.js.map
package.json
Build \\"basic-multi-source-css\\" to dist:
104 B: a.js.gz
61 B: a.js.br
105 B: a.esm.mjs.gz
67 B: a.esm.mjs.br
201 B: a.umd.js.gz
133 B: a.umd.js.br
104 B: b.js.gz
61 B: b.js.br
106 B: b.esm.mjs.gz
67 B: b.esm.mjs.br
201 B: b.umd.js.gz
134 B: b.umd.js.br"
`;
exports[`fixtures build basic-multi-source-css with microbundle 2`] = `16`;
exports[`fixtures build basic-multi-source-css with microbundle 3`] = `
".a{display:flex;color:green;background:pink}
/*# sourceMappingURL=a.css.map */"
`;
exports[`fixtures build basic-multi-source-css with microbundle 4`] = `
"function e(){var e=document.createElement(\\"div\\");return e.className=\\"a\\",e}export default e;
//# sourceMappingURL=a.esm.mjs.map
"
`;
exports[`fixtures build basic-multi-source-css with microbundle 5`] = `
"module.exports=function(){var e=document.createElement(\\"div\\");return e.className=\\"a\\",e};
//# sourceMappingURL=a.js.map
"
`;
exports[`fixtures build basic-multi-source-css with microbundle 6`] = `
"!function(e,n){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=n():\\"function\\"==typeof define&&define.amd?define(n):(e||self).basicMultiSourceCss=n()}(this,function(){return function(){var e=document.createElement(\\"div\\");return e.className=\\"a\\",e}});
//# sourceMappingURL=a.umd.js.map
"
`;
exports[`fixtures build basic-multi-source-css with microbundle 7`] = `
".b{display:flex;color:red;background:#00f}
/*# sourceMappingURL=b.css.map */"
`;
exports[`fixtures build basic-multi-source-css with microbundle 8`] = `
"function e(){var e=document.createElement(\\"div\\");return e.className=\\"b\\",e}export default e;
//# sourceMappingURL=b.esm.mjs.map
"
`;
exports[`fixtures build basic-multi-source-css with microbundle 9`] = `
"module.exports=function(){var e=document.createElement(\\"div\\");return e.className=\\"b\\",e};
//# sourceMappingURL=b.js.map
"
`;
exports[`fixtures build basic-multi-source-css with microbundle 10`] = `
"!function(e,n){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=n():\\"function\\"==typeof define&&define.amd?define(n):(e||self).basicMultiSourceCss=n()}(this,function(){return function(){var e=document.createElement(\\"div\\");return e.className=\\"b\\",e}});
//# sourceMappingURL=b.umd.js.map
"
`;
exports[`fixtures build basic-no-compress with microbundle 1`] = `
"Used script: microbundle --no-compress
Directory tree:
basic-no-compress
dist
basic-no-compress.esm.mjs
basic-no-compress.esm.mjs.map
basic-no-compress.js
basic-no-compress.js.map
basic-no-compress.umd.js
basic-no-compress.umd.js.map
package.json
src
index.js
two.js
Build \\"basic-no-compress\\" to dist:
260 B: basic-no-compress.js.gz
206 B: basic-no-compress.js.br
258 B: basic-no-compress.esm.mjs.gz
209 B: basic-no-compress.esm.mjs.br
381 B: basic-no-compress.umd.js.gz
310 B: basic-no-compress.umd.js.br"
`;
exports[`fixtures build basic-no-compress with microbundle 2`] = `6`;
exports[`fixtures build basic-no-compress with microbundle 3`] = `
"var two = function two() {
try {
var _arguments2 = arguments;
return Promise.resolve([].slice.call(_arguments2).reduce(function (total, value) {
return total + value;
}, 0));
} catch (e) {
return Promise.reject(e);
}
};
var index = (function () {
try {
var _arguments2 = arguments;
var args = [].slice.call(_arguments2);
return Promise.resolve(two.apply(void 0, args)).then(function (_two) {
return Promise.resolve(two.apply(void 0, args)).then(function (_two2) {
return [_two, _two2];
});
});
} catch (e) {
return Promise.reject(e);
}
});
export default index;
//# sourceMappingURL=basic-no-compress.esm.mjs.map
"
`;
exports[`fixtures build basic-no-compress with microbundle 4`] = `
"var two = function two() {
try {
var _arguments2 = arguments;
return Promise.resolve([].slice.call(_arguments2).reduce(function (total, value) {
return total + value;
}, 0));
} catch (e) {
return Promise.reject(e);
}
};
var index = (function () {
try {
var _arguments2 = arguments;
var args = [].slice.call(_arguments2);
return Promise.resolve(two.apply(void 0, args)).then(function (_two) {
return Promise.resolve(two.apply(void 0, args)).then(function (_two2) {
return [_two, _two2];
});
});
} catch (e) {
return Promise.reject(e);
}
});
module.exports = index;
//# sourceMappingURL=basic-no-compress.js.map
"
`;
exports[`fixtures build basic-no-compress with microbundle 5`] = `
"(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.basicNoCompress = factory());
}(this, (function () {
var two = function two() {
try {
var _arguments2 = arguments;
return Promise.resolve([].slice.call(_arguments2).reduce(function (total, value) {
return total + value;
}, 0));
} catch (e) {
return Promise.reject(e);
}
};
var index = (function () {
try {
var _arguments2 = arguments;
var args = [].slice.call(_arguments2);
return Promise.resolve(two.apply(void 0, args)).then(function (_two) {
return Promise.resolve(two.apply(void 0, args)).then(function (_two2) {
return [_two, _two2];
});
});
} catch (e) {
return Promise.reject(e);
}
});
return index;
})));
//# sourceMappingURL=basic-no-compress.umd.js.map
"
`;
exports[`fixtures build basic-no-pkg-main with microbundle 1`] = `
"Used script: microbundle --pkg-main false
Directory tree:
basic-no-pkg-main
dist
basic-no-pkg-main.js
basic-no-pkg-main.js.map
package.json
src
index.js
two.js
Build \\"basic-no-pkg-main\\" to dist:
187 B: basic-no-pkg-main.js.gz
138 B: basic-no-pkg-main.js.br
188 B: basic-no-pkg-main.js.gz
139 B: basic-no-pkg-main.js.br
278 B: basic-no-pkg-main.js.gz
229 B: basic-no-pkg-main.js.br"
`;
exports[`fixtures build basic-no-pkg-main with microbundle 2`] = `2`;
exports[`fixtures build basic-no-pkg-main with microbundle 3`] = `
"!function(e,n){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=n():\\"function\\"==typeof define&&define.amd?define(n):(e||self).basicNoPkgMain=n()}(this,function(){var e=function(){try{var e=arguments;return Promise.resolve([].slice.call(e).reduce(function(e,n){return e+n},0))}catch(e){return Promise.reject(e)}};return function(){try{var n=arguments,r=[].slice.call(n);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)}}});
//# sourceMappingURL=basic-no-pkg-main.js.map
"
`;
exports[`fixtures build basic-node-internals with microbundle 1`] = `
"Used script: microbundle --target=node -f cjs
Directory tree:
basic-node-internals
dist
basic-node-internals.js
basic-node-internals.js.map
package.json
src
index.js
Build \\"basic-node-internals\\" to dist:
191 B: basic-node-internals.js.gz
149 B: basic-node-internals.js.br"
`;
exports[`fixtures build basic-node-internals with microbundle 2`] = `2`;
exports[`fixtures build basic-node-internals with microbundle 3`] = `
"var child_process = require('child_process');
function runCommand(cmd) {
return new Promise((resolve, reject) => {
child_process.exec(cmd, (error, stdout, stderr) => {
if (error) {
reject(error);
}
resolve(stdout || stderr);
});
});
}
exports.runCommand = runCommand;
//# sourceMappingURL=basic-node-internals.js.map
"
`;
exports[`fixtures build basic-ts with microbundle 1`] = `
"Used script: microbundle
Directory tree:
basic-ts
dist
basic-lib-ts.esm.mjs
basic-lib-ts.esm.mjs.map
basic-lib-ts.js
basic-lib-ts.js.map
basic-lib-ts.umd.js
basic-lib-ts.umd.js.map
car.d.ts
index.d.ts
node_modules
package.json
src
car.ts
index.ts
tsconfig.json
Build \\"basic-lib-ts\\" to dist:
118 B: basic-lib-ts.js.gz
94 B: basic-lib-ts.js.br
118 B: basic-lib-ts.esm.mjs.gz
97 B: basic-lib-ts.esm.mjs.br
201 B: basic-lib-ts.umd.js.gz
150 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 n=new(/*#__PURE__*/function(){function n(){}return n.prototype.drive=function(n){return!0},n}());export default n;
//# sourceMappingURL=basic-lib-ts.esm.mjs.map
"
`;
exports[`fixtures build basic-ts with microbundle 4`] = `
"var n=new(/*#__PURE__*/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 5`] = `
"!function(e,n){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=n():\\"function\\"==typeof define&&define.amd?define(n):(e||self).basicLibTs=n()}(this,function(){return new(/*#__PURE__*/function(){function e(){}return e.prototype.drive=function(e){return!0},e}())});
//# sourceMappingURL=basic-lib-ts.umd.js.map
"
`;
exports[`fixtures build basic-ts with microbundle 6`] = `
"export interface Driveable {
drive(distance: number): boolean;
}
export default class Car implements Driveable {
drive(distance: number): boolean;
}
"
`;
exports[`fixtures build basic-ts with microbundle 7`] = `
"import Car from './car';
declare let Ferrari: Car;
export default Ferrari;
"
`;
exports[`fixtures build basic-tsx with microbundle 1`] = `
"Used script: microbundle
Directory tree:
basic-tsx
dist
basic-lib-tsx.esm.mjs
basic-lib-tsx.esm.mjs.map
basic-lib-tsx.js
basic-lib-tsx.js.map
basic-lib-tsx.umd.js
basic-lib-tsx.umd.js.map
index.d.ts
node_modules
package.json
src
index.tsx
tsconfig.json
Build \\"basic-lib-tsx\\" to dist:
213 B: basic-lib-tsx.js.gz
164 B: basic-lib-tsx.js.br
218 B: basic-lib-tsx.esm.mjs.gz
172 B: basic-lib-tsx.esm.mjs.br
298 B: basic-lib-tsx.umd.js.gz
232 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 n=function(n,r){return{tag:n,props:r,children:[].slice.call(arguments,2)}},r=/*#__PURE__*/function(){function r(){}return r.prototype.render=function(){return n(\\"div\\",{id:\\"app\\"},n(\\"h1\\",null,\\"Hello, World!\\"),n(\\"p\\",null,\\"A JSX demo.\\"))},r}();export default r;
//# sourceMappingURL=basic-lib-tsx.esm.mjs.map
"
`;
exports[`fixtures build basic-tsx with microbundle 4`] = `
"var n=function(n,r){return{tag:n,props:r,children:[].slice.call(arguments,2)}};module.exports=/*#__PURE__*/function(){function r(){}return r.prototype.render=function(){return n(\\"div\\",{id:\\"app\\"},n(\\"h1\\",null,\\"Hello, World!\\"),n(\\"p\\",null,\\"A JSX demo.\\"))},r}();
//# sourceMappingURL=basic-lib-tsx.js.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||self).basicLibTsx=n()}(this,function(){var e=function(e,n){return{tag:e,props:n,children:[].slice.call(arguments,2)}};/*#__PURE__*/
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
"
`;
exports[`fixtures build basic-tsx with microbundle 6`] = `
"export default class Foo {
render(): any;
}
"
`;
exports[`fixtures build basic-with-cwd with microbundle 1`] = `
"Used script: microbundle
Directory tree:
basic
dist
basic.esm.mjs
basic.esm.mjs.map
basic.js
basic.js.map
basic.umd.js
basic.umd.js.map
package.json
src
index.js
two.js
Build \\"basic\\" to dist:
187 B: basic.js.gz
138 B: basic.js.br
188 B: basic.esm.mjs.gz
139 B: basic.esm.mjs.br
269 B: basic.umd.js.gz
198 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(){try{var r=arguments;return Promise.resolve([].slice.call(r).reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};export default function(){try{var e=arguments,t=[].slice.call(e);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.esm.mjs.map
"
`;
exports[`fixtures build basic-with-cwd with microbundle 4`] = `
"var r=function(){try{var r=arguments;return Promise.resolve([].slice.call(r).reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};module.exports=function(){try{var e=arguments,t=[].slice.call(e);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.js.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||self).basic=r()}(this,function(){var e=function(){try{var e=arguments;return Promise.resolve([].slice.call(e).reduce(function(e,r){return e+r},0))}catch(e){return Promise.reject(e)}};return function(){try{var r=arguments,n=[].slice.call(r);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
"
`;
exports[`fixtures build class-decorators-ts with microbundle 1`] = `
"Used script: microbundle --raw
Directory tree:
class-decorators-ts
dist
class-decorators-ts.esm.mjs
class-decorators-ts.esm.mjs.map
class-decorators-ts.js
class-decorators-ts.js.map
class-decorators-ts.umd.js
class-decorators-ts.umd.js.map
index.d.ts
node_modules
package.json
src
index.ts
tsconfig.json
Build \\"class-decorators-ts\\" to dist:
348 B: class-decorators-ts.js.gz
288 B: class-decorators-ts.js.br
348 B: class-decorators-ts.esm.mjs.gz
288 B: class-decorators-ts.esm.mjs.br
415 B: class-decorators-ts.umd.js.gz
353 B: class-decorators-ts.umd.js.br"
`;
exports[`fixtures build class-decorators-ts with microbundle 2`] = `7`;
exports[`fixtures build class-decorators-ts with microbundle 3`] = `
"var e=/*#__PURE__*/function(){function e(e){this.greeting=e}return e.prototype.greet=function(){return\\"Hello, \\"+this.greeting},e}(),t=new(e=function(e,t,r,n){var o,c=arguments.length,l=c<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if(\\"object\\"==typeof Reflect&&\\"function\\"==typeof Reflect.decorate)l=Reflect.decorate(e,t,r,n);else for(var f=e.length-1;f>=0;f--)(o=e[f])&&(l=(c<3?o(l):c>3?o(t,r,l):o(t,r))||l);return c>3&&l&&Object.defineProperty(t,r,l),l}([function(e){Object.seal(e),Object.seal(e.prototype)}],e))(\\"Hello World\\");export default t;
//# sourceMappingURL=class-decorators-ts.esm.mjs.map
"
`;
exports[`fixtures build class-decorators-ts with microbundle 4`] = `
"var e=/*#__PURE__*/function(){function e(e){this.greeting=e}return e.prototype.greet=function(){return\\"Hello, \\"+this.greeting},e}(),t=new(e=function(e,t,r,o){var n,c=arguments.length,l=c<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if(\\"object\\"==typeof Reflect&&\\"function\\"==typeof Reflect.decorate)l=Reflect.decorate(e,t,r,o);else for(var f=e.length-1;f>=0;f--)(n=e[f])&&(l=(c<3?n(l):c>3?n(t,r,l):n(t,r))||l);return c>3&&l&&Object.defineProperty(t,r,l),l}([function(e){Object.seal(e),Object.seal(e.prototype)}],e))(\\"Hello World\\");module.exports=t;
//# sourceMappingURL=class-decorators-ts.js.map
"
`;
exports[`fixtures build class-decorators-ts with microbundle 5`] = `
"!function(e,t){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=t():\\"function\\"==typeof define&&define.amd?define(t):(e||self).classDecoratorsTs=t()}(this,function(){var e=/*#__PURE__*/function(){function e(e){this.greeting=e}return e.prototype.greet=function(){return\\"Hello, \\"+this.greeting},e}();return new(e=function(e,t,o,n){var r,f=arguments.length,i=f<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,o):n;if(\\"object\\"==typeof Reflect&&\\"function\\"==typeof Reflect.decorate)i=Reflect.decorate(e,t,o,n);else for(var c=e.length-1;c>=0;c--)(r=e[c])&&(i=(f<3?r(i):f>3?r(t,o,i):r(t,o))||i);return f>3&&i&&Object.defineProperty(t,o,i),i}([function(e){Object.seal(e),Object.seal(e.prototype)}],e))(\\"Hello World\\")});
//# sourceMappingURL=class-decorators-ts.umd.js.map
"
`;
exports[`fixtures build class-decorators-ts with microbundle 6`] = `
"declare class Greeter {
greeting: string;
constructor(message: string);
greet(): string;
}
declare const _default: Greeter;
export default _default;
"
`;
exports[`fixtures build class-properties with microbundle 1`] = `
"Used script: microbundle
Directory tree:
class-properties
dist
class-properties.esm.mjs
class-properties.esm.mjs.map
class-properties.js
class-properties.js.map
class-properties.umd.js
class-properties.umd.js.map
package.json
src
index.js
Build \\"class-properties\\" to dist:
93 B: class-properties.js.gz
79 B: class-properties.js.br
96 B: class-properties.esm.mjs.gz
85 B: class-properties.esm.mjs.br
197 B: class-properties.umd.js.gz
150 B: class-properties.umd.js.br"
`;
exports[`fixtures build class-properties with microbundle 2`] = `6`;
exports[`fixtures build class-properties with microbundle 3`] = `
"var a=function(){this.baz=3};a.bar=2;var r=new a;export default r;export{a as Foo};
//# sourceMappingURL=class-properties.esm.mjs.map
"
`;
exports[`fixtures build class-properties with microbundle 4`] = `
"var a=function(){this.baz=3};a.bar=2;var o=new a;exports.Foo=a,exports.default=o;
//# sourceMappingURL=class-properties.js.map
"
`;
exports[`fixtures build class-properties with microbundle 5`] = `
"!function(e,o){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?o(exports):\\"function\\"==typeof define&&define.amd?define([\\"exports\\"],o):o((e||self).classProperties={})}(this,function(e){var o=function(){this.baz=3};o.bar=2;var n=new o;e.Foo=o,e.default=n});
//# sourceMappingURL=class-properties.umd.js.map
"
`;
exports[`fixtures build css-modules--false with microbundle 1`] = `
"Used script: microbundle --no-sourcemap --css-modules false
Directory tree:
css-modules--false
dist
css-modules--false.css
css-modules--false.esm.mjs
css-modules--false.js
css-modules--false.umd.js
package.json
src
index.js
not_scoped.css
not_scoped.module.css
Build \\"css-modules--false\\" to dist:
49 B: css-modules--false.js.gz
23 B: css-modules--false.js.br
52 B: css-modules--false.esm.mjs.gz
36 B: css-modules--false.esm.mjs.br
156 B: css-modules--false.umd.js.gz
109 B: css-modules--false.umd.js.br"
`;
exports[`fixtures build css-modules--false with microbundle 2`] = `4`;
exports[`fixtures build css-modules--false with microbundle 3`] = `"body{display:flex;color:red;background:#00f}.test_class_that_shouldnt_be_scoped{background-color:#00f}.not_scoped_class{color:pink}"`;
exports[`fixtures build css-modules--false with microbundle 4`] = `
"function t(){}export default t;
"
`;
exports[`fixtures build css-modules--false with microbundle 5`] = `
"module.exports=function(){};
"
`;
exports[`fixtures build css-modules--false with microbundle 6`] = `
"!function(e,n){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=function(){}:\\"function\\"==typeof define&&define.amd?define(function(){return function(){}}):(e||self).cssModulesFalse=function(){}}(this);
"
`;
exports[`fixtures build css-modules--null with microbundle 1`] = `
"Used script: microbundle --no-sourcemap
Directory tree:
css-modules--null
dist
css-modules--null.css
css-modules--null.esm.mjs
css-modules--null.js
css-modules--null.umd.js
package.json
src
index.js
not_scoped.css
scoped.module.css
Build \\"css-modules--null\\" to dist:
110 B: css-modules--null.js.gz
72 B: css-modules--null.js.br
112 B: css-modules--null.esm.mjs.gz
77 B: css-modules--null.esm.mjs.br
200 B: css-modules--null.umd.js.gz
140 B: css-modules--null.umd.js.br"
`;
exports[`fixtures build css-modules--null with microbundle 2`] = `4`;
exports[`fixtures build css-modules--null with microbundle 3`] = `"body{display:flex;color:red;background:#00f}.test_class_that_shouldnt_be_scoped{background-color:#00f}._2kWDE{color:pink}"`;
exports[`fixtures build css-modules--null with microbundle 4`] = `
"function e(){var e=document.createElement(\\"div\\");return e.className=\\"_2kWDE\\",e}export default e;
"
`;
exports[`fixtures build css-modules--null with microbundle 5`] = `
"module.exports=function(){var e=document.createElement(\\"div\\");return e.className=\\"_2kWDE\\",e};
"
`;
exports[`fixtures build css-modules--null with microbundle 6`] = `
"!function(e,n){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=n():\\"function\\"==typeof define&&define.amd?define(n):(e||self).cssModulesNull=n()}(this,function(){return function(){var e=document.createElement(\\"div\\");return e.className=\\"_2kWDE\\",e}});
"
`;
exports[`fixtures build css-modules--string with microbundle 1`] = `
"Used script: microbundle --no-sourcemap --css-modules '_contains_this_[hash]'
Directory tree:
css-modules--string
dist
css-modules--string.css
css-modules--string.esm.mjs
css-modules--string.js
css-modules--string.umd.js
package.json
src
index.js
scoped.css
scoped.module.css
Build \\"css-modules--string\\" to dist:
166 B: css-modules--string.js.gz
118 B: css-modules--string.js.br
168 B: css-modules--string.esm.mjs.gz
122 B: css-modules--string.esm.mjs.br
263 B: css-modules--string.umd.js.gz
192 B: css-modules--string.umd.js.br"
`;
exports[`fixtures build css-modules--string with microbundle 2`] = `4`;
exports[`fixtures build css-modules--string with microbundle 3`] = `"body{display:flex;color:red;background:#00f}._contains_this_81567d0efc15a456670452d3277e1a68{background-color:#00f}._contains_this_0a8c24df242c2cd708036873307aea94{color:pink}"`;
exports[`fixtures build css-modules--string with microbundle 4`] = `
"function a(){var a=document.createElement(\\"div\\");return a.className=\\"_contains_this_0a8c24df242c2cd708036873307aea94 _contains_this_81567d0efc15a456670452d3277e1a68\\",a}export default a;
"
`;
exports[`fixtures build css-modules--string with microbundle 5`] = `
"module.exports=function(){var e=document.createElement(\\"div\\");return e.className=\\"_contains_this_0a8c24df242c2cd708036873307aea94 _contains_this_81567d0efc15a456670452d3277e1a68\\",e};
"
`;
exports[`fixtures build css-modules--string with microbundle 6`] = `
"!function(e,n){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=n():\\"function\\"==typeof define&&define.amd?define(n):(e||self).cssModulesString=n()}(this,function(){return function(){var e=document.createElement(\\"div\\");return e.className=\\"_contains_this_0a8c24df242c2cd708036873307aea94 _contains_this_81567d0efc15a456670452d3277e1a68\\",e}});
"
`;
exports[`fixtures build css-modules--true with microbundle 1`] = `
"Used script: microbundle --no-sourcemap --css-modules true
Directory tree:
css-modules--true
dist
css-modules--true.css
css-modules--true.esm.mjs
css-modules--true.js
css-modules--true.umd.js
package.json
src
index.js
scoped.css
scoped.module.css
Build \\"css-modules--true\\" to dist:
139 B: css-modules--true.js.gz
94 B: css-modules--true.js.br
141 B: css-modules--true.esm.mjs.gz
108 B: css-modules--true.esm.mjs.br
230 B: css-modules--true.umd.js.gz
165 B: css-modules--true.umd.js.br"
`;
exports[`fixtures build css-modules--true with microbundle 2`] = `4`;
exports[`fixtures build css-modules--true with microbundle 3`] = `"body{display:flex;color:red;background:#00f}.test_class_that_should_be_scoped{background-color:#00f}._2kWDE{color:pink}"`;
exports[`fixtures build css-modules--true with microbundle 4`] = `
"function e(){var e=document.createElement(\\"div\\");return e.className=\\"_2kWDE \\"+(void 0).test_class_that_should_be_scoped,e}export default e;
"
`;
exports[`fixtures build css-modules--true with microbundle 5`] = `
"module.exports=function(){var e=document.createElement(\\"div\\");return e.className=\\"_2kWDE \\"+(void 0).test_class_that_should_be_scoped,e};
"
`;
exports[`fixtures build css-modules--true with microbundle 6`] = `
"!function(e,t){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=t():\\"function\\"==typeof define&&define.amd?define(t):(e||self).cssModulesTrue=t()}(this,function(){return function(){var e=document.createElement(\\"div\\");return e.className=\\"_2kWDE \\"+(void 0).test_class_that_should_be_scoped,e}});
"
`;
exports[`fixtures build custom-babelrc with microbundle 1`] = `
"Used script: microbundle
Directory tree:
custom-babelrc
dist
custom-babelrc.esm.mjs
custom-babelrc.esm.mjs.map
custom-babelrc.js
custom-babelrc.js.map
custom-babelrc.umd.js
custom-babelrc.umd.js.map
package.json
src
index.js
Build \\"custom-babelrc\\" to dist:
218 B: custom-babelrc.js.gz
193 B: custom-babelrc.js.br
222 B: custom-babelrc.esm.mjs.gz
185 B: custom-babelrc.esm.mjs.br
309 B: custom-babelrc.umd.js.gz
260 B: custom-babelrc.umd.js.br"
`;
exports[`fixtures build custom-babelrc with microbundle 2`] = `6`;
exports[`fixtures build custom-babelrc with microbundle 3`] = `
"class e{constructor(){var e,r;r=[\\"foo\\",\\"bar\\"],(e=\\"myFields\\")in this?Object.defineProperty(this,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):this[e]=r}foo(){try{return Promise.resolve(this.myFields.find(e=>\\"bar\\"===e))}catch(e){return Promise.reject(e)}}}export{e as MyClass};
//# sourceMappingURL=custom-babelrc.esm.mjs.map
"
`;
exports[`fixtures build custom-babelrc with microbundle 4`] = `
"exports.MyClass=class{constructor(){var e,r;r=[\\"foo\\",\\"bar\\"],(e=\\"myFields\\")in this?Object.defineProperty(this,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):this[e]=r}foo(){try{return Promise.resolve(this.myFields.find(e=>\\"bar\\"===e))}catch(e){return Promise.reject(e)}}};
//# sourceMappingURL=custom-babelrc.js.map
"
`;
exports[`fixtures build custom-babelrc with microbundle 5`] = `
"!function(e,t){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?t(exports):\\"function\\"==typeof define&&define.amd?define([\\"exports\\"],t):t((e||self).customBabelrc={})}(this,function(e){e.MyClass=class{constructor(){var e,t;t=[\\"foo\\",\\"bar\\"],(e=\\"myFields\\")in this?Object.defineProperty(this,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):this[e]=t}foo(){try{return Promise.resolve(this.myFields.find(e=>\\"bar\\"===e))}catch(e){return Promise.reject(e)}}}});
//# sourceMappingURL=custom-babelrc.umd.js.map
"
`;
exports[`fixtures build custom-outputs with microbundle 1`] = `
"Used script: microbundle -f modern,es,umd,cjs
Directory tree:
custom-outputs
dist
custom-outputs.exportsx.mjs
custom-outputs.exportsx.mjs.map
custom-outputs.js
custom-outputs.js.map
custom-outputs.modulex.mjs
custom-outputs.modulex.mjs.map
custom-outputs.umdx.js
custom-outputs.umdx.js.map
package.json
src
index.js
two.js
Build \\"custom-outputs\\" to dist:
187 B: custom-outputs.js.gz
138 B: custom-outputs.js.br
113 B: custom-outputs.exportsx.mjs.gz
92 B: custom-outputs.exportsx.mjs.br
188 B: custom-outputs.modulex.mjs.gz
139 B: custom-outputs.modulex.mjs.br
273 B: custom-outputs.umdx.js.gz
203 B: custom-outputs.umdx.js.br"
`;
exports[`fixtures build custom-outputs with microbundle 2`] = `8`;
exports[`fixtures build custom-outputs with microbundle 3`] = `
"async function n(...n){return n.reduce((n,t)=>n+t,0)}async function t(...t){return[await n(...t),await n(...t)]}export default t;
//# sourceMappingURL=custom-outputs.exportsx.mjs.map
"
`;
exports[`fixtures build custom-outputs with microbundle 4`] = `
"var r=function(){try{var r=arguments;return Promise.resolve([].slice.call(r).reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};module.exports=function(){try{var e=arguments,t=[].slice.call(e);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-outputs.js.map
"
`;
exports[`fixtures build custom-outputs with microbundle 5`] = `
"var r=function(){try{var r=arguments;return Promise.resolve([].slice.call(r).reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};export default function(){try{var e=arguments,t=[].slice.call(e);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-outputs.modulex.mjs.map
"
`;
exports[`fixtures build custom-outputs with microbundle 6`] = `
"!function(e,t){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=t():\\"function\\"==typeof define&&define.amd?define(t):(e||self).customOutputs=t()}(this,function(){var e=function(){try{var e=arguments;return Promise.resolve([].slice.call(e).reduce(function(e,t){return e+t},0))}catch(e){return Promise.reject(e)}};return function(){try{var t=arguments,r=[].slice.call(t);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)}}});
//# sourceMappingURL=custom-outputs.umdx.js.map
"
`;
exports[`fixtures build custom-outputs-alt with microbundle 1`] = `
"Used script: microbundle -f modern,es,umd,cjs
Directory tree:
custom-outputs-alt
dist
custom-outputs-alt.cjsmain.js
custom-outputs-alt.cjsmain.js.map
custom-outputs-alt.esmodule.mjs
custom-outputs-alt.esmodule.mjs.map
custom-outputs-alt.jsnextmain.mjs
custom-outputs-alt.jsnextmain.mjs.map
custom-outputs-alt.unpkg.js
custom-outputs-alt.unpkg.js.map
package.json
src
index.js
two.js
Build \\"custom-outputs-alt\\" to dist:
187 B: custom-outputs-alt.cjsmain.js.gz
138 B: custom-outputs-alt.cjsmain.js.br
113 B: custom-outputs-alt.esmodule.mjs.gz
92 B: custom-outputs-alt.esmodule.mjs.br
188 B: custom-outputs-alt.jsnextmain.mjs.gz
139 B: custom-outputs-alt.jsnextmain.mjs.br
277 B: custom-outputs-alt.unpkg.js.gz
226 B: custom-outputs-alt.unpkg.js.br"
`;
exports[`fixtures build custom-outputs-alt with microbundle 2`] = `8`;
exports[`fixtures build custom-outputs-alt with microbundle 3`] = `
"var r=function(){try{var r=arguments;return Promise.resolve([].slice.call(r).reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};module.exports=function(){try{var e=arguments,t=[].slice.call(e);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-outputs-alt.cjsmain.js.map
"
`;
exports[`fixtures build custom-outputs-alt with microbundle 4`] = `
"async function n(...n){return n.reduce((n,t)=>n+t,0)}async function t(...t){return[await n(...t),await n(...t)]}export default t;
//# sourceMappingURL=custom-outputs-alt.esmodule.mjs.map
"
`;
exports[`fixtures build custom-outputs-alt with microbundle 5`] = `
"var r=function(){try{var r=arguments;return Promise.resolve([].slice.call(r).reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};export default function(){try{var e=arguments,t=[].slice.call(e);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-outputs-alt.jsnextmain.mjs.map
"
`;
exports[`fixtures build custom-outputs-alt with microbundle 6`] = `
"!function(e,t){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=t():\\"function\\"==typeof define&&define.amd?define(t):(e||self).customOutputsAlt=t()}(this,function(){var e=function(){try{var e=arguments;return Promise.resolve([].slice.call(e).reduce(function(e,t){return e+t},0))}catch(e){return Promise.reject(e)}};return function(){try{var t=arguments,r=[].slice.call(t);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)}}});
//# sourceMappingURL=custom-outputs-alt.unpkg.js.map
"
`;
exports[`fixtures build custom-source with microbundle 1`] = `
"Used script: microbundle
Directory tree:
custom-source
dist
custom-source.esm.mjs
custom-source.esm.mjs.map
custom-source.js
custom-source.js.map
custom-source.umd.js
custom-source.umd.js.map
package.json
src
custom-source.js
two.js
Build \\"custom-source\\" to dist:
187 B: custom-source.js.gz
138 B: custom-source.js.br
188 B: custom-source.esm.mjs.gz
139 B: custom-source.esm.mjs.br
275 B: custom-source.umd.js.gz
203 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(){try{var r=arguments;return Promise.resolve([].slice.call(r).reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};export default function(){try{var e=arguments,t=[].slice.call(e);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.esm.mjs.map
"
`;
exports[`fixtures build custom-source with microbundle 4`] = `
"var r=function(){try{var r=arguments;return Promise.resolve([].slice.call(r).reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};module.exports=function(){try{var e=arguments,t=[].slice.call(e);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.js.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||self).customSource=r()}(this,function(){var e=function(){try{var e=arguments;return Promise.resolve([].slice.call(e).reduce(function(e,r){return e+r},0))}catch(e){return Promise.reject(e)}};return function(){try{var r=arguments,n=[].slice.call(r);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
"
`;
exports[`fixtures build custom-source-with-cwd with microbundle 1`] = `
"Used script: microbundle
Directory tree:
custom-source
dist
custom-src.esm.mjs
custom-src.esm.mjs.map
custom-src.js
custom-src.js.map
custom-src.umd.js
custom-src.umd.js.map
package.json
src
custom-source.js
two.js
Build \\"custom-src\\" to dist:
187 B: custom-src.js.gz
138 B: custom-src.js.br
188 B: custom-src.esm.mjs.gz
139 B: custom-src.esm.mjs.br
273 B: custom-src.umd.js.gz
203 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(){try{var r=arguments;return Promise.resolve([].slice.call(r).reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};export default function(){try{var e=arguments,t=[].slice.call(e);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.esm.mjs.map
"
`;
exports[`fixtures build custom-source-with-cwd with microbundle 4`] = `
"var r=function(){try{var r=arguments;return Promise.resolve([].slice.call(r).reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};module.exports=function(){try{var e=arguments,t=[].slice.call(e);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.js.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||self).customSrc=r()}(this,function(){var e=function(){try{var e=arguments;return Promise.resolve([].slice.call(e).reduce(function(e,r){return e+r},0))}catch(e){return Promise.reject(e)}};return function(){try{var r=arguments,n=[].slice.call(r);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
"
`;
exports[`fixtures build default-named with microbundle 1`] = `
"Used script: microbundle
Directory tree:
default-named
dist
default-named.esm.mjs
default-named.esm.mjs.map
default-named.js
default-named.js.map
default-named.umd.js
default-named.umd.js.map
package.json
src
index.js
Build \\"default-named\\" to dist:
60 B: default-named.js.gz
46 B: default-named.js.br
74 B: default-named.esm.mjs.gz
62 B: default-named.esm.mjs.br
169 B: default-named.umd.js.gz
122 B: default-named.umd.js.br"
`;
exports[`fixtures build default-named with microbundle 2`] = `6`;
exports[`fixtures build default-named with microbundle 3`] = `
"var t=42;function e(){}export default e;export{t as foo};
//# sourceMappingURL=default-named.esm.mjs.map
"
`;
exports[`fixtures build default-named with microbundle 4`] = `
"exports.default=function(){},exports.foo=42;
//# sourceMappingURL=default-named.js.map
"
`;
exports[`fixtures build default-named with microbundle 5`] = `
"!function(e,f){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?f(exports):\\"function\\"==typeof define&&define.amd?define([\\"exports\\"],f):f((e||self).defaultNamed={})}(this,function(e){e.default=function(){},e.foo=42});
//# sourceMappingURL=default-named.umd.js.map
"
`;
exports[`fixtures build define with microbundle 1`] = `
"Used script: microbundle --no-sourcemap --define DEBUG=false
Directory tree:
define
dist
define.esm.mjs
define.js
define.umd.js
index.js
package.json
Build \\"define\\" to dist:
55 B: define.js.gz
37 B: define.js.br
55 B: define.esm.mjs.gz
37 B: define.esm.mjs.br
108 B: define.umd.js.gz
78 B: define.umd.js.br"
`;
exports[`fixtures build define with microbundle 2`] = `3`;
exports[`fixtures build define with microbundle 3`] = `
"console.log(\\"production mode\\",!1);
"
`;
exports[`fixtures build define with microbundle 4`] = `
"console.log(\\"production mode\\",!1);
"
`;
exports[`fixtures build define with microbundle 5`] = `
"!function(n){\\"function\\"==typeof define&&define.amd?define(n):n()}(function(){console.log(\\"production mode\\",!1)});
"
`;
exports[`fixtures build define-expression with microbundle 1`] = `
"Used script: microbundle -f esm --no-sourcemap --define @Object.freeze=Object
Directory tree:
define-expression
dist
define-expression.esm.mjs
index.js
package.json
Build \\"define-expression\\" to dist:
56 B: define-expression.esm.mjs.gz
40 B: define-expression.esm.mjs.br"
`;
exports[`fixtures build define-expression with microbundle 2`] = `1`;
exports[`fixtures build define-expression with microbundle 3`] = `
"console.log(Object({a:\\"b\\",c:\\"d\\"}));
"
`;
exports[`fixtures build esnext-ts with microbundle 1`] = `
"Used script: microbundle --raw
Directory tree:
esnext-ts
dist
esnext-ts.esm.mjs
esnext-ts.esm.mjs.map
esnext-ts.js
esnext-ts.js.map
esnext-ts.umd.js
esnext-ts.umd.js.map
index.d.ts
node_modules
package.json
src
index.ts
tsconfig.json
Build \\"esnext-ts\\" to dist:
1010 B: esnext-ts.js.gz
899 B: esnext-ts.js.br
1011 B: esnext-ts.esm.mjs.gz
896 B: esnext-ts.esm.mjs.br
1072 B: esnext-ts.umd.js.gz
959 B: esnext-ts.umd.js.br"
`;
exports[`fixtures build esnext-ts with microbundle 2`] = `7`;
exports[`fixtures build esnext-ts with microbundle 3`] = `
"function n(t,e,i){if(!t.s){if(i instanceof r){if(!i.s)return void(i.o=n.bind(null,t,e));1&e&&(e=i.s),i=i.v}if(i&&i.then)return void i.then(n.bind(null,t,e),n.bind(null,t,2));t.s=e,t.v=i;var o=t.o;o&&o(t)}}var t=function(){try{var t,o,u,f,h=[],c=!0,v=!1,l=i(function(){return function(i,f){try{var v=function(){t=function(n){var t;if(\\"undefined\\"!=typeof Symbol){if(Symbol.asyncIterator&&null!=(t=n[Symbol.asyncIterator]))return t.call(n);if(Symbol.iterator&&null!=(t=n[Symbol.iterator]))return t.call(n)}throw new TypeError(\\"Object is not async iterable\\")}([1,2]);var i=function(t,i,o){for(var u;;){var f=t();if(e(f)&&(f=f.v),!f)return h;if(f.then){u=0;break}var h=o();if(h&&h.then){if(!e(h)){u=1;break}h=h.s}if(i){var c=i();if(c&&c.then&&!e(c)){u=2;break}}}var v=new r,l=n.bind(null,v,2);return(0===u?f.then(s):1===u?h.then(a):c.then(d)).then(void 0,l),v;function a(r){h=r;do{if(i&&(c=i())&&c.then&&!e(c))return void c.then(d).then(void 0,l);if(!(f=t())||e(f)&&!f.v)return void n(v,1,h);if(f.then)return void f.then(s).then(void 0,l);e(h=o())&&(h=h.v)}while(!h||!h.then);h.then(a).then(void 0,l)}function s(t){t?(h=o())&&h.then?h.then(a).then(void 0,l):a(h):n(v,1,h)}function d(){(f=t())?f.then?f.then(s).then(void 0,l):s(f):n(v,1,h)}}(function(){return Promise.resolve(t.next()).then(function(n){return c=o.done,o=n,Promise.resolve(o.value).then(function(n){return u=n,!c})})},function(){return!!(c=!0)},function(){h.push(u)});if(i&&i.then)return i.then(function(){})}()}catch(n){return f(n)}return v&&v.then?v.then(void 0,f):v}(0,function(n){v=!0,f=n})},function(n,r){function e(t){if(n)throw r;return r}var o=i(function(){var n=function(){if(!c&&null!=t.return)return Promise.resolve(t.return()).then(function(){})}();if(n&&n.then)return n.then(function(){})},function(n,t){if(v)throw f;if(n)throw t;return t});return o&&o.then?o.then(e):e()});return Promise.resolve(l&&l.then?l.then(function(n){return h}):h)}catch(n){return Promise.reject(n)}};const r=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(r,e){const i=new t,o=this.s;if(o){const t=1&o?r:e;if(t){try{n(i,1,t(this.v))}catch(t){n(i,2,t)}return i}return this}return this.o=function(t){try{const o=t.v;1&t.s?n(i,1,r?r(o):o):e?n(i,1,e(o)):n(i,2,o)}catch(t){n(i,2,t)}},i},t}();function e(n){return n instanceof r&&1&n.s}function i(n,t){try{var r=n()}catch(n){return t(!0,n)}return r&&r.then?r.then(t.bind(null,!1),t.bind(null,!0)):t(!1,r)}t().then(console.log);export default t;
//# sourceMappingURL=esnext-ts.esm.mjs.map
"
`;
exports[`fixtures build esnext-ts with microbundle 4`] = `
"function n(t,e,i){if(!t.s){if(i instanceof r){if(!i.s)return void(i.o=n.bind(null,t,e));1&e&&(e=i.s),i=i.v}if(i&&i.then)return void i.then(n.bind(null,t,e),n.bind(null,t,2));t.s=e,t.v=i;var o=t.o;o&&o(t)}}var t=function(){try{var t,o,u,f,h=[],c=!0,v=!1,l=i(function(){return function(i,f){try{var v=function(){t=function(n){var t;if(\\"undefined\\"!=typeof Symbol){if(Symbol.asyncIterator&&null!=(t=n[Symbol.asyncIterator]))return t.call(n);if(Symbol.iterator&&null!=(t=n[Symbol.iterator]))return t.call(n)}throw new TypeError(\\"Object is not async iterable\\")}([1,2]);var i=function(t,i,o){for(var u;;){var f=t();if(e(f)&&(f=f.v),!f)return h;if(f.then){u=0;break}var h=o();if(h&&h.then){if(!e(h)){u=1;break}h=h.s}if(i){var c=i();if(c&&c.then&&!e(c)){u=2;break}}}var v=new r,l=n.bind(null,v,2);return(0===u?f.then(s):1===u?h.then(a):c.then(d)).then(void 0,l),v;function a(r){h=r;do{if(i&&(c=i())&&c.then&&!e(c))return void c.then(d).then(void 0,l);if(!(f=t())||e(f)&&!f.v)return void n(v,1,h);if(f.then)return void f.then(s).then(void 0,l);e(h=o())&&(h=h.v)}while(!h||!h.then);h.then(a).then(void 0,l)}function s(t){t?(h=o())&&h.then?h.then(a).then(void 0,l):a(h):n(v,1,h)}function d(){(f=t())?f.then?f.then(s).then(void 0,l):s(f):n(v,1,h)}}(function(){return Promise.resolve(t.next()).then(function(n){return c=o.done,o=n,Promise.resolve(o.value).then(function(n){return u=n,!c})})},function(){return!!(c=!0)},function(){h.push(u)});if(i&&i.then)return i.then(function(){})}()}catch(n){return f(n)}return v&&v.then?v.then(void 0,f):v}(0,function(n){v=!0,f=n})},function(n,r){function e(t){if(n)throw r;return r}var o=i(function(){var n=function(){if(!c&&null!=t.return)return Promise.resolve(t.return()).then(function(){})}();if(n&&n.then)return n.then(function(){})},function(n,t){if(v)throw f;if(n)throw t;return t});return o&&o.then?o.then(e):e()});return Promise.resolve(l&&l.then?l.then(function(n){return h}):h)}catch(n){return Promise.reject(n)}};const r=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(r,e){const i=new t,o=this.s;if(o){const t=1&o?r:e;if(t){try{n(i,1,t(this.v))}catch(t){n(i,2,t)}return i}return this}return this.o=function(t){try{const o=t.v;1&t.s?n(i,1,r?r(o):o):e?n(i,1,e(o)):n(i,2,o)}catch(t){n(i,2,t)}},i},t}();function e(n){return n instanceof r&&1&n.s}function i(n,t){try{var r=n()}catch(n){return t(!0,n)}return r&&r.then?r.then(t.bind(null,!1),t.bind(null,!0)):t(!1,r)}t().then(console.log),module.exports=t;
//# sourceMappingURL=esnext-ts.js.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||self).esnextTs=t()}(this,function(){function n(t,r,i){if(!t.s){if(i instanceof e){if(!i.s)return void(i.o=n.bind(null,t,r));1&r&&(r=i.s),i=i.v}if(i&&i.then)return void i.then(n.bind(null,t,r),n.bind(null,t,2));t.s=r,t.v=i;var o=t.o;o&&o(t)}}var t=function(){try{var t,o,u,f,c=[],h=!0,l=!1,s=i(function(){return function(i,f){try{var l=function(){t=function(n){var t;if(\\"undefined\\"!=typeof Symbol){if(Symbol.asyncIterator&&null!=(t=n[Symbol.asyncIterator]))return t.call(n);if(Symbol.iterator&&null!=(t=n[Symbol.iterator]))return t.call(n)}throw new TypeError(\\"Object is not async iterable\\")}([1,2]);var i=function(t,i,o){for(var u;;){var f=t();if(r(f)&&(f=f.v),!f)return c;if(f.then){u=0;break}var c=o();if(c&&c.then){if(!r(c)){u=1;break}c=c.s}if(i){var h=i();if(h&&h.then&&!r(h)){u=2;break}}}var l=new e,s=n.bind(null,l,2);return(0===u?f.then(v):1===u?c.then(a):h.then(d)).then(void 0,s),l;function a(e){c=e;do{if(i&&(h=i())&&h.then&&!r(h))return void h.then(d).then(void 0,s);if(!(f=t())||r(f)&&!f.v)return void n(l,1,c);if(f.then)return void f.then(v).then(void 0,s);r(c=o())&&(c=c.v)}while(!c||!c.then);c.then(a).then(void 0,s)}function v(t){t?(c=o())&&c.then?c.then(a).then(void 0,s):a(c):n(l,1,c)}function d(){(f=t())?f.then?f.then(v).then(void 0,s):v(f):n(l,1,c)}}(function(){return Promise.resolve(t.next()).then(function(n){return h=o.done,o=n,Promise.resolve(o.value).then(function(n){return u=n,!h})})},function(){return!!(h=!0)},function(){c.push(u)});if(i&&i.then)return i.then(function(){})}()}catch(n){return f(n)}return l&&l.then?l.then(void 0,f):l}(0,function(n){l=!0,f=n})},function(n,e){function r(t){if(n)throw e;return e}var o=i(function(){var n=function(){if(!h&&null!=t.return)return Promise.resolve(t.return()).then(function(){})}();if(n&&n.then)return n.then(function(){})},function(n,t){if(l)throw f;if(n)throw t;return t});return o&&o.then?o.then(r):r()});return Promise.resolve(s&&s.then?s.then(function(n){return c}):c)}catch(n){return Promise.reject(n)}};const e=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(e,r){const i=new t,o=this.s;if(o){const t=1&o?e:r;if(t){try{n(i,1,t(this.v))}catch(t){n(i,2,t)}return i}return this}return this.o=function(t){try{const o=t.v;1&t.s?n(i,1,e?e(o):o):r?n(i,1,r(o)):n(i,2,o)}catch(t){n(i,2,t)}},i},t}();function r(n){return n instanceof e&&1&n.s}function i(n,t){try{var e=n()}catch(n){return t(!0,n)}return e&&e.then?e.then(t.bind(null,!1),t.bind(null,!0)):t(!1,e)}return t().then(console.log),t});
//# sourceMappingURL=esnext-ts.umd.js.map
"
`;
exports[`fixtures build esnext-ts with microbundle 6`] = `
"export default function foo(): Promise<any[]>;
"
`;
exports[`fixtures build inline-source-map with microbundle 1`] = `
"Used script: microbundle --sourcemap inline
Directory tree:
inline-source-map
dist
inline-source-map.esm.mjs
inline-source-map.js
inline-source-map.umd.js
package.json
src
index.js
two.js
Build \\"inline-source-map\\" to dist:
187 B: inline-source-map.js.gz
138 B: inline-source-map.js.br
188 B: inline-source-map.esm.mjs.gz
139 B: inline-source-map.esm.mjs.br
278 B: inline-source-map.umd.js.gz
217 B: inline-source-map.umd.js.br"
`;
exports[`fixtures build inline-source-map with microbundle 2`] = `3`;
exports[`fixtures build inline-source-map with microbundle 3`] = `
"var r=function(){try{var r=arguments;return Promise.resolve([].slice.call(r).reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};export default function(){try{var e=arguments,t=[].slice.call(e);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=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5saW5lLXNvdXJjZS1tYXAuZXNtLm1qcyIsInNvdXJjZXMiOlsiLi4vc3JjL3R3by5qcyIsIi4uL3NyYy9pbmRleC5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgYXN5bmMgZnVuY3Rpb24gdHdvKC4uLmFyZ3MpIHtcblx0cmV0dXJuIGFyZ3MucmVkdWNlKCh0b3RhbCwgdmFsdWUpID0+IHRvdGFsICsgdmFsdWUsIDApO1xufVxuIiwiaW1wb3J0IHsgdHdvIH0gZnJvbSAnLi90d28nO1xuXG5leHBvcnQgZGVmYXVsdCBhc3luYyBmdW5jdGlvbiAoLi4uYXJncykge1xuXHRyZXR1cm4gW2F3YWl0IHR3byguLi5hcmdzKSwgYXdhaXQgdHdvKC4uLmFyZ3MpXTtcbn1cbiJdLCJuYW1lcyI6WyJ0d28iLCJyZWR1Y2UiLCJ0b3RhbCIsInZhbHVlIiwiYXJncyJdLCJtYXBwaW5ncyI6IklBQXNCQSxpQ0FDckIsdUJBQU8saUJBQUtDLE9BQU8sU0FBQ0MsRUFBT0MsVUFBVUQsRUFBUUMsR0FBTyxJQURyRCxrRkNFa0NDLDBDQUNuQkosZUFBT0ksNENBQWFKLGVBQU9JLHFCQUF6QyxNQUFPLFVBRFIifQ==
"
`;
exports[`fixtures build inline-source-map with microbundle 4`] = `
"var r=function(){try{var r=arguments;return Promise.resolve([].slice.call(r).reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};module.exports=function(){try{var e=arguments,t=[].slice.call(e);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=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5saW5lLXNvdXJjZS1tYXAuanMiLCJzb3VyY2VzIjpbIi4uL3NyYy90d28uanMiLCIuLi9zcmMvaW5kZXguanMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGFzeW5jIGZ1bmN0aW9uIHR3byguLi5hcmdzKSB7XG5cdHJldHVybiBhcmdzLnJlZHVjZSgodG90YWwsIHZhbHVlKSA9PiB0b3RhbCArIHZhbHVlLCAwKTtcbn1cbiIsImltcG9ydCB7IHR3byB9IGZyb20gJy4vdHdvJztcblxuZXhwb3J0IGRlZmF1bHQgYXN5bmMgZnVuY3Rpb24gKC4uLmFyZ3MpIHtcblx0cmV0dXJuIFthd2FpdCB0d28oLi4uYXJncyksIGF3YWl0IHR3byguLi5hcmdzKV07XG59XG4iXSwibmFtZXMiOlsidHdvIiwicmVkdWNlIiwidG90YWwiLCJ2YWx1ZSIsImFyZ3MiXSwibWFwcGluZ3MiOiJJQUFzQkEsaUNBQ3JCLHVCQUFPLGlCQUFLQyxPQUFPLFNBQUNDLEVBQU9DLFVBQVVELEVBQVFDLEdBQU8sSUFEckQsa0ZDRWtDQywwQ0FDbkJKLGVBQU9JLDRDQUFhSixlQUFPSSxxQkFBekMsTUFBTyxVQURSIn0=
"
`;
exports[`fixtures build inline-source-map with microbundle 5`] = `
"!function(e,n){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=n():\\"function\\"==typeof define&&define.amd?define(n):(e||self).inlineSourceMap=n()}(this,function(){var e=function(){try{var e=arguments;return Promise.resolve([].slice.call(e).reduce(function(e,n){return e+n},0))}catch(e){return Promise.reject(e)}};return function(){try{var n=arguments,r=[].slice.call(n);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)}}});
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5saW5lLXNvdXJjZS1tYXAudW1kLmpzIiwic291cmNlcyI6WyIuLi9zcmMvdHdvLmpzIiwiLi4vc3JjL2luZGV4LmpzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBhc3luYyBmdW5jdGlvbiB0d28oLi4uYXJncykge1xuXHRyZXR1cm4gYXJncy5yZWR1Y2UoKHRvdGFsLCB2YWx1ZSkgPT4gdG90YWwgKyB2YWx1ZSwgMCk7XG59XG4iLCJpbXBvcnQgeyB0d28gfSBmcm9tICcuL3R3byc7XG5cbmV4cG9ydCBkZWZhdWx0IGFzeW5jIGZ1bmN0aW9uICguLi5hcmdzKSB7XG5cdHJldHVybiBbYXdhaXQgdHdvKC4uLmFyZ3MpLCBhd2FpdCB0d28oLi4uYXJncyldO1xufVxuIl0sIm5hbWVzIjpbInR3byIsInJlZHVjZSIsInRvdGFsIiwidmFsdWUiLCJhcmdzIl0sIm1hcHBpbmdzIjoiMExBQXNCQSxpQ0FDckIsdUJBQU8saUJBQUtDLE9BQU8sU0FBQ0MsRUFBT0MsVUFBVUQsRUFBUUMsR0FBTyxJQURyRCwwRUNFa0NDLDBDQUNuQkosZUFBT0ksNENBQWFKLGVBQU9JLHFCQUF6QyxNQUFPLFVBRFIifQ==
"
`;
exports[`fixtures build jsx with microbundle 1`] = `
"Used script: microbundle
Directory tree:
jsx
dist
jsx.esm.mjs
jsx.esm.mjs.map
jsx.js
jsx.js.map
jsx.umd.js
jsx.umd.js.map
index.js
package.json
Build \\"jsx\\" to dist:
239 B: jsx.js.gz
195 B: jsx.js.br
237 B: jsx.esm.mjs.gz
201 B: jsx.esm.mjs.br
313 B: jsx.umd.js.gz
248 B: jsx.umd.js.br"
`;
exports[`fixtures build jsx with microbundle 2`] = `6`;
exports[`fixtures build jsx with microbundle 3`] = `
"var n=function(n,r){return{tag:n,props:r,children:[].slice.call(arguments,2)}},r=function(n){return n.children},l=/*#__PURE__*/function(){function l(){}return l.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\\")))},l}();export default l;
//# sourceMappingURL=jsx.esm.mjs.map
"
`;
exports[`fixtures build jsx with microbundle 4`] = `
"var n=function(n,r){return{tag:n,props:r,children:[].slice.call(arguments,2)}},r=function(n){return n.children};module.exports=/*#__PURE__*/function(){function l(){}return l.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\\")))},l}();
//# sourceMappingURL=jsx.js.map
"
`;
exports[`fixtures build jsx with microbundle 5`] = `
"!function(n,e){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=e():\\"function\\"==typeof define&&define.amd?define(e):(n||self).jsx=e()}(this,function(){var n=function(n,e){return{tag:n,props:e,children:[].slice.call(arguments,2)}},e=function(n){return n.children};/*#__PURE__*/
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
"
`;
exports[`fixtures build macro with microbundle 1`] = `
"Used script: microbundle
Directory tree:
macro
dist
macro-lib.esm.mjs
macro-lib.esm.mjs.map
macro-lib.js
macro-lib.js.map
macro-lib.umd.js
macro-lib.umd.js.map
package.json
src
index.js
macro.js
Build \\"macro-lib\\" to dist:
49 B: macro-lib.js.gz
33 B: macro-lib.js.br
48 B: macro-lib.esm.mjs.gz
32 B: macro-lib.esm.mjs.br
156 B: macro-lib.umd.js.gz
126 B: macro-lib.umd.js.br"
`;
exports[`fixtures build macro with microbundle 2`] = `6`;
exports[`fixtures build macro with microbundle 3`] = `
"export default\\"name-macro\\";
//# sourceMappingURL=macro-lib.esm.mjs.map
"
`;
exports[`fixtures build macro with microbundle 4`] = `
"module.exports=\\"name-macro\\";
//# sourceMappingURL=macro-lib.js.map
"
`;
exports[`fixtures build macro with microbundle 5`] = `
"!function(e,o){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=\\"name-macro\\":\\"function\\"==typeof define&&define.amd?define(function(){return\\"name-macro\\"}):(e||self).macroLib=\\"name-macro\\"}(this);
//# sourceMappingURL=macro-lib.umd.js.map
"
`;
exports[`fixtures build mangle-json-file with microbundle 1`] = `
"Used script: microbundle
Directory tree:
mangle-json-file
dist
mangle-json-file.esm.mjs
mangle-json-file.esm.mjs.map
mangle-json-file.js
mangle-json-file.js.map
mangle-json-file.umd.js
mangle-json-file.umd.js.map
mangle.json
package.json
src
index.js
two.js
Build \\"mangle-json-file\\" to dist:
103 B: mangle-json-file.js.gz
89 B: mangle-json-file.js.br
105 B: mangle-json-file.esm.mjs.gz
91 B: mangle-json-file.esm.mjs.br
196 B: mangle-json-file.umd.js.gz
171 B: mangle-json-file.umd.js.br"
`;
exports[`fixtures build mangle-json-file with microbundle 2`] = `6`;
exports[`fixtures build mangle-json-file with microbundle 3`] = `
"var o={prop1:1,__p2:2};function r(){return console.log(o.prop1),console.log(o.__p2),o}export default r;
//# sourceMappingURL=mangle-json-file.esm.mjs.map
"
`;
exports[`fixtures build mangle-json-file with microbundle 4`] = `
"var o={prop1:1,__p2:2};module.exports=function(){return console.log(o.prop1),console.log(o.__p2),o};
//# sourceMappingURL=mangle-json-file.js.map
"
`;
exports[`fixtures build mangle-json-file with microbundle 5`] = `
"!function(e,o){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=o():\\"function\\"==typeof define&&define.amd?define(o):(e||self).mangleJsonFile=o()}(this,function(){var e={prop1:1,__p2:2};return function(){return console.log(e.prop1),console.log(e.__p2),e}});
//# sourceMappingURL=mangle-json-file.umd.js.map
"
`;
exports[`fixtures build minify-config with microbundle 1`] = `
"Used script: microbundle
Directory tree:
minify-config
dist
minify-config.esm.mjs
minify-config.esm.mjs.map
minify-config.js
minify-config.js.map
minify-config.umd.js
minify-config.umd.js.map
package.json
src
index.js
two.js
Build \\"minify-config\\" to dist:
99 B: minify-config.js.gz
85 B: minify-config.js.br
101 B: minify-config.esm.mjs.gz
87 B: minify-config.esm.mjs.br
189 B: minify-config.umd.js.gz
140 B: minify-config.umd.js.br"
`;
exports[`fixtures build minify-config with microbundle 2`] = `6`;
exports[`fixtures build minify-config with microbundle 3`] = `
"var o={prop1:1,o:2};function r(){return console.log(o.prop1),console.log(o.o),o}export default r;
//# sourceMappingURL=minify-config.esm.mjs.map
"
`;
exports[`fixtures build minify-config with microbundle 4`] = `
"var o={prop1:1,o:2};module.exports=function(){return console.log(o.prop1),console.log(o.o),o};
//# sourceMappingURL=minify-config.js.map
"
`;
exports[`fixtures build minify-config with microbundle 5`] = `
"!function(e,o){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=o():\\"function\\"==typeof define&&define.amd?define(o):(e||self).minifyConfig=o()}(this,function(){var e={prop1:1,o:2};return function(){return console.log(e.prop1),console.log(e.o),e}});
//# sourceMappingURL=minify-config.umd.js.map
"
`;
exports[`fixtures build minify-config-boolean with microbundle 1`] = `
"Used script: microbundle
Directory tree:
minify-config-boolean
dist
minify-config-boolean.esm.mjs
minify-config-boolean.esm.mjs.map
minify-config-boolean.js
minify-config-boolean.js.map
minify-config-boolean.umd.js
minify-config-boolean.umd.js.map
package.json
src
index.js
two.js
Build \\"minify-config-boolean\\" to dist:
107 B: minify-config-boolean.js.gz
84 B: minify-config-boolean.js.br
114 B: minify-config-boolean.esm.mjs.gz
90 B: minify-config-boolean.esm.mjs.br
216 B: minify-config-boolean.umd.js.gz
159 B: minify-config-boolean.umd.js.br"
`;
exports[`fixtures build minify-config-boolean with microbundle 2`] = `6`;
exports[`fixtures build minify-config-boolean with microbundle 3`] = `
"var two={prop1:1,_prop2:2};function index(){return console.log(two.prop1),console.log(two._prop2),two}export default index;
//# sourceMappingURL=minify-config-boolean.esm.mjs.map
"
`;
exports[`fixtures build minify-config-boolean with microbundle 4`] = `
"var two={prop1:1,_prop2:2};module.exports=function(){return console.log(two.prop1),console.log(two._prop2),two};
//# sourceMappingURL=minify-config-boolean.js.map
"
`;
exports[`fixtures build minify-config-boolean with microbundle 5`] = `
"!function(global,factory){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=factory():\\"function\\"==typeof define&&define.amd?define(factory):(global||self).minifyConfigBoolean=factory()}(this,function(){var two={prop1:1,_prop2:2};return function(){return console.log(two.prop1),console.log(two._prop2),two}});
//# sourceMappingURL=minify-config-boolean.umd.js.map
"
`;
exports[`fixtures build minify-path-config with microbundle 1`] = `
"Used script: microbundle
Directory tree:
minify-path-config
dist
minify-path-config.esm.mjs
minify-path-config.esm.mjs.map
minify-path-config.js
minify-path-config.js.map
minify-path-config.umd.js
minify-path-config.umd.js.map
minify.json
package.json
src
index.js
two.js
Build \\"minify-path-config\\" to dist:
103 B: minify-path-config.js.gz
89 B: minify-path-config.js.br
105 B: minify-path-config.esm.mjs.gz
91 B: minify-path-config.esm.mjs.br
198 B: minify-path-config.umd.js.gz
152 B: minify-path-config.umd.js.br"
`;
exports[`fixtures build minify-path-config with microbundle 2`] = `6`;
exports[`fixtures build minify-path-config with microbundle 3`] = `
"var o={prop1:1,__p2:2};function r(){return console.log(o.prop1),console.log(o.__p2),o}export default r;
//# sourceMappingURL=minify-path-config.esm.mjs.map
"
`;
exports[`fixtures build minify-path-config with microbundle 4`] = `
"var o={prop1:1,__p2:2};module.exports=function(){return console.log(o.prop1),console.log(o.__p2),o};
//# sourceMappingURL=minify-path-config.js.map
"
`;
exports[`fixtures build minify-path-config with microbundle 5`] = `
"!function(e,o){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=o():\\"function\\"==typeof define&&define.amd?define(o):(e||self).minifyPathConfig=o()}(this,function(){var e={prop1:1,__p2:2};return function(){return console.log(e.prop1),console.log(e.__p2),e}});
//# sourceMappingURL=minify-path-config.umd.js.map
"
`;
exports[`fixtures build minify-path-parent-dir-with-cwd with microbundle 1`] = `
"Used script: microbundle
Directory tree:
minify-path-parent-dir
dist
minify-path-parent-dir.esm.mjs
minify-path-parent-dir.esm.mjs.map
minify-path-parent-dir.js
minify-path-parent-dir.js.map
minify-path-parent-dir.umd.js
minify-path-parent-dir.umd.js.map
index.js
package.json
two.js
Build \\"minify-path-parent-dir\\" to dist:
103 B: minify-path-parent-dir.js.gz
89 B: minify-path-parent-dir.js.br
105 B: minify-path-parent-dir.esm.mjs.gz
91 B: minify-path-parent-dir.esm.mjs.br
200 B: minify-path-parent-dir.umd.js.gz
161 B: minify-path-parent-dir.umd.js.br"
`;
exports[`fixtures build minify-path-parent-dir-with-cwd with microbundle 2`] = `6`;
exports[`fixtures build minify-path-parent-dir-with-cwd with microbundle 3`] = `
"var o={prop1:1,__p2:2};function r(){return console.log(o.prop1),console.log(o.__p2),o}export default r;
//# sourceMappingURL=minify-path-parent-dir.esm.mjs.map
"
`;
exports[`fixtures build minify-path-parent-dir-with-cwd with microbundle 4`] = `
"var o={prop1:1,__p2:2};module.exports=function(){return console.log(o.prop1),console.log(o.__p2),o};
//# sourceMappingURL=minify-path-parent-dir.js.map
"
`;
exports[`fixtures build minify-path-parent-dir-with-cwd with microbundle 5`] = `
"!function(e,o){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=o():\\"function\\"==typeof define&&define.amd?define(o):(e||self).minifyPathParentDir=o()}(this,function(){var e={prop1:1,__p2:2};return function(){return console.log(e.prop1),console.log(e.__p2),e}});
//# sourceMappingURL=minify-path-parent-dir.umd.js.map
"
`;
exports[`fixtures build modern with microbundle 1`] = `
"Used script: microbundle -f modern
Directory tree:
modern
dist
modern-lib.modern.mjs
modern-lib.modern.mjs.map
package.json
src
index.js
two.js
Build \\"modern-lib\\" to dist:
113 B: modern-lib.modern.mjs.gz
92 B: modern-lib.modern.mjs.br"
`;
exports[`fixtures build modern with microbundle 2`] = `2`;
exports[`fixtures build modern with microbundle 3`] = `
"async function n(...n){return n.reduce((n,t)=>n+t,0)}async function t(...t){return[await n(...t),await n(...t)]}export default t;
//# sourceMappingURL=modern-lib.modern.mjs.map
"
`;
exports[`fixtures build modern-generators with microbundle 1`] = `
"Used script: microbundle -f modern,es,umd,cjs
Directory tree:
modern-generators
dist
modern-generators.esm.mjs
modern-generators.esm.mjs.map
modern-generators.js
modern-generators.js.map
modern-generators.modern.mjs
modern-generators.modern.mjs.map
modern-generators.umd.js
modern-generators.umd.js.map
package.json
src
index.js
two.js
Build \\"modern-generators\\" to dist:
248 B: modern-generators.js.gz
201 B: modern-generators.js.br
118 B: modern-generators.modern.mjs.gz
99 B: modern-generators.modern.mjs.br
247 B: modern-generators.esm.mjs.gz
218 B: modern-generators.esm.mjs.br
326 B: modern-generators.umd.js.gz
267 B: modern-generators.umd.js.br"
`;
exports[`fixtures build modern-generators with microbundle 2`] = `8`;
exports[`fixtures build modern-generators with microbundle 3`] = `
"var e=/*#__PURE__*/regeneratorRuntime.mark(r);function r(){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r=0;case 1:return e.next=4,r++;case 4:e.next=1;break;case 6:case\\"end\\":return e.stop()}},e)}export default function(){try{var e=r();return Promise.resolve([e.next().value,e.next().value])}catch(e){return Promise.reject(e)}}
//# sourceMappingURL=modern-generators.esm.mjs.map
"
`;
exports[`fixtures build modern-generators with microbundle 4`] = `
"var e=/*#__PURE__*/regeneratorRuntime.mark(r);function r(){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r=0;case 1:return e.next=4,r++;case 4:e.next=1;break;case 6:case\\"end\\":return e.stop()}},e)}module.exports=function(){try{var e=r();return Promise.resolve([e.next().value,e.next().value])}catch(e){return Promise.reject(e)}};
//# sourceMappingURL=modern-generators.js.map
"
`;
exports[`fixtures build modern-generators with microbundle 5`] = `
"async function e(){const e=function*(){let e=0;for(;;)yield e++}();return[e.next().value,e.next().value]}export default e;
//# sourceMappingURL=modern-generators.modern.mjs.map
"
`;
exports[`fixtures build modern-generators with microbundle 6`] = `
"!function(e,n){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=n():\\"function\\"==typeof define&&define.amd?define(n):(e||self).modernGenerators=n()}(this,function(){var e=/*#__PURE__*/regeneratorRuntime.mark(n);function n(){var n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=0;case 1:return e.next=4,n++;case 4:e.next=1;break;case 6:case\\"end\\":return e.stop()}},e)}return function(){try{var e=n();return Promise.resolve([e.next().value,e.next().value])}catch(e){return Promise.reject(e)}}});
//# sourceMappingURL=modern-generators.umd.js.map
"
`;
exports[`fixtures build name-custom-amd with microbundle 1`] = `
"Used script: microbundle
Directory tree:
name-custom-amd
dist
name-custom-amd.esm.mjs
name-custom-amd.esm.mjs.map
name-custom-amd.js
name-custom-amd.js.map
name-custom-amd.umd.js
name-custom-amd.umd.js.map
package.json
src
index.js
two.js
Build \\"name-custom-amd\\" to dist:
187 B: name-custom-amd.js.gz
138 B: name-custom-amd.js.br
188 B: name-custom-amd.esm.mjs.gz
139 B: name-custom-amd.esm.mjs.br
277 B: name-custom-amd.umd.js.gz
208 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(){try{var r=arguments;return Promise.resolve([].slice.call(r).reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};export default function(){try{var e=arguments,t=[].slice.call(e);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.esm.mjs.map
"
`;
exports[`fixtures build name-custom-amd with microbundle 4`] = `
"var r=function(){try{var r=arguments;return Promise.resolve([].slice.call(r).reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};module.exports=function(){try{var e=arguments,t=[].slice.call(e);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.js.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||self).customNameAmd=r()}(this,function(){var e=function(){try{var e=arguments;return Promise.resolve([].slice.call(e).reduce(function(e,r){return e+r},0))}catch(e){return Promise.reject(e)}};return function(){try{var r=arguments,n=[].slice.call(r);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
"
`;
exports[`fixtures build name-custom-cli with microbundle 1`] = `
"Used script: microbundle --name nameCustomCli
Directory tree:
name-custom-cli
dist
name-custom.esm.mjs
name-custom.esm.mjs.map
name-custom.js
name-custom.js.map
name-custom.umd.js
name-custom.umd.js.map
package.json
src
index.js
two.js
Build \\"name-custom\\" to dist:
187 B: name-custom.js.gz
138 B: name-custom.js.br
188 B: name-custom.esm.mjs.gz
139 B: name-custom.esm.mjs.br
276 B: name-custom.umd.js.gz
215 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(){try{var r=arguments;return Promise.resolve([].slice.call(r).reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};export default function(){try{var e=arguments,t=[].slice.call(e);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.esm.mjs.map
"
`;
exports[`fixtures build name-custom-cli with microbundle 4`] = `
"var r=function(){try{var r=arguments;return Promise.resolve([].slice.call(r).reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};module.exports=function(){try{var e=arguments,t=[].slice.call(e);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.js.map
"
`;
exports[`fixtures build name-custom-cli with microbundle 5`] = `
"!function(e,n){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=n():\\"function\\"==typeof define&&define.amd?define(n):(e||self).nameCustomCli=n()}(this,function(){var e=function(){try{var e=arguments;return Promise.resolve([].slice.call(e).reduce(function(e,n){return e+n},0))}catch(e){return Promise.reject(e)}};return function(){try{var n=arguments,r=[].slice.call(n);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)}}});
//# sourceMappingURL=name-custom.umd.js.map
"
`;
exports[`fixtures build no-pkg with microbundle 1`] = `
"Used script: microbundle
Directory tree:
no-pkg
dist
no-pkg.esm.mjs
no-pkg.esm.mjs.map
no-pkg.js
no-pkg.js.map
no-pkg.umd.js
no-pkg.umd.js.map
src
index.js
two.js
Build \\"no-pkg\\" to dist:
187 B: no-pkg.js.gz
138 B: no-pkg.js.br
188 B: no-pkg.esm.mjs.gz
139 B: no-pkg.esm.mjs.br
270 B: no-pkg.umd.js.gz
216 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(){try{var r=arguments;return Promise.resolve([].slice.call(r).reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};export default function(){try{var e=arguments,t=[].slice.call(e);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.esm.mjs.map
"
`;
exports[`fixtures build no-pkg with microbundle 4`] = `
"var r=function(){try{var r=arguments;return Promise.resolve([].slice.call(r).reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};module.exports=function(){try{var e=arguments,t=[].slice.call(e);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.js.map
"
`;
exports[`fixtures build no-pkg with microbundle 5`] = `
"!function(e,n){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=n():\\"function\\"==typeof define&&define.amd?define(n):(e||self).noPkg=n()}(this,function(){var e=function(){try{var e=arguments;return Promise.resolve([].slice.call(e).reduce(function(e,n){return e+n},0))}catch(e){return Promise.reject(e)}};return function(){try{var n=arguments,r=[].slice.call(n);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)}}});
//# sourceMappingURL=no-pkg.umd.js.map
"
`;
exports[`fixtures build no-pkg-name with microbundle 1`] = `
"Used script: microbundle
Directory tree:
no-pkg-name
dist
no-pkg-name.esm.mjs
no-pkg-name.esm.mjs.map
no-pkg-name.js
no-pkg-name.js.map
no-pkg-name.umd.js
no-pkg-name.umd.js.map
package.json
src
index.js
two.js
Build \\"no-pkg-name\\" to dist:
187 B: no-pkg-name.js.gz
138 B: no-pkg-name.js.br
188 B: no-pkg-name.esm.mjs.gz
139 B: no-pkg-name.esm.mjs.br
274 B: no-pkg-name.umd.js.gz
219 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(){try{var r=arguments;return Promise.resolve([].slice.call(r).reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};export default function(){try{var e=arguments,t=[].slice.call(e);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.esm.mjs.map
"
`;
exports[`fixtures build no-pkg-name with microbundle 4`] = `
"var r=function(){try{var r=arguments;return Promise.resolve([].slice.call(r).reduce(function(r,e){return r+e},0))}catch(r){return Promise.reject(r)}};module.exports=function(){try{var e=arguments,t=[].slice.call(e);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.js.map
"
`;
exports[`fixtures build no-pkg-name with microbundle 5`] = `
"!function(e,n){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=n():\\"function\\"==typeof define&&define.amd?define(n):(e||self).noPkgName=n()}(this,function(){var e=function(){try{var e=arguments;return Promise.resolve([].slice.call(e).reduce(function(e,n){return e+n},0))}catch(e){return Promise.reject(e)}};return function(){try{var n=arguments,r=[].slice.call(n);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)}}});
//# sourceMappingURL=no-pkg-name.umd.js.map
"
`;
exports[`fixtures build optional-chaining-ts with microbundle 1`] = `
"Used script: microbundle
Directory tree:
optional-chaining-ts
dist
index.d.ts
optional-chaining-ts.esm.mjs
optional-chaining-ts.esm.mjs.map
optional-chaining-ts.js
optional-chaining-ts.js.map
optional-chaining-ts.umd.js
optional-chaining-ts.umd.js.map
node_modules
package.json
src
index.ts
tsconfig.json
Build \\"optional-chaining-ts\\" to dist:
109 B: optional-chaining-ts.js.gz
88 B: optional-chaining-ts.js.br
111 B: optional-chaining-ts.esm.mjs.gz
97 B: optional-chaining-ts.esm.mjs.br
210 B: optional-chaining-ts.umd.js.gz
169 B: optional-chaining-ts.umd.js.br"
`;
exports[`fixtures build optional-chaining-ts with microbundle 2`] = `7`;
exports[`fixtures build optional-chaining-ts with microbundle 3`] = `
"export declare function chain(test: {
maybeVar?: {
thing: string;
};
}): string | undefined;
"
`;
exports[`fixtures build optional-chaining-ts with microbundle 4`] = `
"function n(n){var r,i;return null!=(r=null==(i=n.maybeVar)?void 0:i.thing)?r:void 0}export{n as chain};
//# sourceMappingURL=optional-chaining-ts.esm.mjs.map
"
`;
exports[`fixtures build optional-chaining-ts with microbundle 5`] = `
"exports.chain=function(n){var i,r;return null!=(i=null==(r=n.maybeVar)?void 0:r.thing)?i:void 0};
//# sourceMappingURL=optional-chaining-ts.js.map
"
`;
exports[`fixtures build optional-chaining-ts with microbundle 6`] = `
"!function(n,e){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?e(exports):\\"function\\"==typeof define&&define.amd?define([\\"exports\\"],e):e((n||self).optionalChainingTs={})}(this,function(n){n.chain=function(n){var e,i;return null!=(e=null==(i=n.maybeVar)?void 0:i.thing)?e:void 0}});
//# sourceMappingURL=optional-chaining-ts.umd.js.map
"
`;
exports[`fixtures build parameters-rest-closure with microbundle 1`] = `
"Used script: microbundle
Directory tree:
parameters-rest-closure
dist
parameters-rest-closure.esm.mjs
parameters-rest-closure.esm.mjs.map
parameters-rest-closure.js
parameters-rest-closure.js.map
parameters-rest-closure.umd.js
parameters-rest-closure.umd.js.map
package.json
src
index.js
Build \\"parameters-rest-closure\\" to dist:
157 B: parameters-rest-closure.js.gz
115 B: parameters-rest-closure.js.br
165 B: parameters-rest-closure.esm.mjs.gz
124 B: parameters-rest-closure.esm.mjs.br
247 B: parameters-rest-closure.umd.js.gz
189 B: parameters-rest-closure.umd.js.br"
`;
exports[`fixtures build parameters-rest-closure with microbundle 2`] = `6`;
exports[`fixtures build parameters-rest-closure with microbundle 3`] = `
"function n(n){var c=[].slice.call(arguments,1);return function(){n.apply(void 0,c)}}function c(n){var c=arguments;return function(){n.apply(void 0,[].slice.call(c,1))}}export{n as parametersRestWithClosure,c as parametersRestWithInnerArrowFunction};
//# sourceMappingURL=parameters-rest-closure.esm.mjs.map
"
`;
exports[`fixtures build parameters-rest-closure with microbundle 4`] = `
"exports.parametersRestWithClosure=function(r){var t=[].slice.call(arguments,1);return function(){r.apply(void 0,t)}},exports.parametersRestWithInnerArrowFunction=function(r){var t=arguments;return function(){r.apply(void 0,[].slice.call(t,1))}};
//# sourceMappingURL=parameters-rest-closure.js.map
"
`;
exports[`fixtures build parameters-rest-closure with microbundle 5`] = `
"!function(e,n){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?n(exports):\\"function\\"==typeof define&&define.amd?define([\\"exports\\"],n):n((e||self).parametersRestClosure={})}(this,function(e){e.parametersRestWithClosure=function(e){var n=[].slice.call(arguments,1);return function(){e.apply(void 0,n)}},e.parametersRestWithInnerArrowFunction=function(e){var n=arguments;return function(){e.apply(void 0,[].slice.call(n,1))}}});
//# sourceMappingURL=parameters-rest-closure.umd.js.map
"
`;
exports[`fixtures build pretty with microbundle 1`] = `
"Used script: microbundle
Directory tree:
pretty
dist
pretty.esm.mjs
pretty.esm.mjs.map
pretty.js
pretty.js.map
pretty.umd.js
pretty.umd.js.map
package.json
src
index.js
Build \\"pretty\\" to dist:
6.33 kB: pretty.js.gz
5.19 kB: pretty.js.br
6.34 kB: pretty.esm.mjs.gz
5.21 kB: pretty.esm.mjs.br
6.46 kB: pretty.umd.js.gz
5.31 kB: pretty.umd.js.br"
`;
exports[`fixtures build pretty with microbundle 2`] = `6`;
exports[`fixtures build pretty with microbundle 3`] = `
"var n=\\"\\\\n\\\\nThere is immense joy in just watching - watching all the little creatures in nature. I'll go over the colors one more\\\\ntime that we use: Titanium white, Thalo green, Prussian blue, Van Dyke brown, Alizarin crimson, Sap green, Cad yellow,\\\\nand Permanent red. If you don't like it - change it. It's your world. Be brave. Sometimes you learn more from your\\\\nmistakes than you do from your masterpieces.\\\\n\\\\nTrees grow in all kinds of ways. They're not all perfectly straight. Not every limb is perfect. Now let's put some happy\\\\nlittle clouds in here. We have no limits to our world. We're only limited by our imagination. The first step to doing\\\\nanything is to believe you can do it. See it finished in your mind before you ever start. Even trees need a friend. We\\\\nall need friends. And that's when it becomes fun - you don't have to spend your time thinking about what's happening -\\\\nyou just let it happen.\\\\n\\\\nरिती संपादक बेंगलूर अन्तरराष्ट्रीयकरन शीघ्र भाषा चिदंश उद्योग विस्तरणक्षमता चिदंश एकएस तरहथा। प्रोत्साहित उपेक्ष बिन्दुओ\\\\nध्येय देने गुजरना ऎसाजीस निर्माण नवंबर लिए। एसेएवं उपलब्धता मुश्किले डाले। बहतर सहायता माध्यम भाषाओ समूह\\\\n\\\\n井待品亡写回横提和指生志考結。重特天県偏切運録広詳三人転者数代歳。秀天戦機広八型希金生作事国第。年米教止証車断級弘報安楽\\\\n銀必約現獲料切。点額講問課覧傷邸出送跡出懲。編米人験由社迷入解公著片法記択昇必崎掲清。摩出元自越食多県実間旅売主注理併間\\\\n話策。小政退時年福米越給新家入解美露方堀港朝。俊間髪物縦該高報見甲購形州日事。\\\\n\\\\n🌸🍂🌃🐧🍘🏧🍮 🌶👢🔗🐥🔼🎮 🐤🍲📆👧🎼🐒 💑🍖📴🐠🍼 🎱🔮🍦💳👹 💫🏮📅🍑📭🎎 🏭💿🏫🔢👚💩 👇🌄🌗🔵💦 🔺🔡🌍🐗🏀📫\\\\n📻🍵🐰🔜🕧 🌴🌞🕙🎨🎾🔊🏰 🎑🌆🔁🌂 🕐📣📉🌴🕠📢 🎀📖🎋🔱📒💰 🍅🐻🌃🌖. 🎁🕔👎🎷📀📞 🍁🔫🍀🌃📹 💈📂💶👕 🍡📰👛🐻\\\\n🍖🐽💫📼 🍆🎀💛👫🔹 🎷🕙🌱👸🕁🔝 🍸🔅👿🐡. 🐟🔐🏡🔅👾 🐱💱👺🍶 🎠🔆🎤🏥🌻🗾 👽🎯💈🏣🔊📴💆🏫 🔉🌉🍃🌻 🎅🔌🔻💣 🌸🍎🐀🌇\\\\n🗻👔📤💤🔶. 🍆👣🕕👦📦👑 🐍🐉🔶🕕 🍲👩🍍🌕📻👒📵 🔣🌋🌟👼 🔏📀🐆🍖🍮 🐁🌘🐻🏥🐡🔶🔘🏭 👡🔫🔗📊📻 🍂💧🌿📥🔚 📹💻🔌💠🌚\\\\n🐦💴🌎🌞🏤.\\\\n\\\\nThere is immense joy in just watching - watching all the little creatures in nature. I'll go over the colors one more\\\\ntime that we use: Titanium white, Thalo green, Prussian blue, Van Dyke brown, Alizarin crimson, Sap green, Cad yellow,\\\\nand Permanent red. If you don't like it - change it. It's your world. Be brave. Sometimes you learn more from your\\\\nmistakes than you do from your masterpieces. That's why I paint - because I can create the kind of world I want - and I\\\\ncan make this world as happy as I want it. I was blessed with a very steady hand; and it comes in very handy when you're\\\\ndoing these little delicate things. We'll paint one happy little tree right here. These things happen automatically. All\\\\nyou have to do is just let them happen.\\\\n\\\\n🐻🍘💀🐪 🕧🎂🕃🍵🏠 💎🌄🐐📘🐄 🍂🏤👊🍖 👆🍂📫👪🐈🕢👓 👯🕞🏉🍚🎆🔠🌵 🎭🎎💵📮📭 🔪💨📢📕 🐔📬👪🏄🐙🗽📤.\\\\n💛👴💧🎁👗💟👡💎 🎷🕡👮🗾🍷 🎪🍇🍩💰 📫🐗🎄🍍🎃 🎯🌴🐍🔉📰 👼👧🐢🕔🔷📞🍩 🔘👑🌆🌒🔣 🔆👺📴👾 🔝💑💸💒🏡🔸 🔟👞📷🔱👠\\\\n📵🏠📕🕝🐂👪 💐🎾🕁🗾👊📪. 🍉🏁👰🏡🕔💒🐯 🐟🍡📴🌿👱👢 📵💄🌊🌵🐫🍏 🎎🕠🍍💭💀👖 🎵💘🔗🍖 📧🌘🍅🕚📘🔮 👤🌾👿🐍🎽🌹\\\\n🎲🎎💅📪🐐🍢📈 🏣🐑👇👼🐄🍔 🍠📧🌊🕁🔛🐩. 🌺📊🍼🐁💼 🔈💬🌱🎑🔊🐙💲👩 🍇👞📎👻🌔 💑🕁🎲💤 🎮📃🕖📖 📻💬🔢💔🐇👬 🔨🌃📈🔞\\\\n🌒🎈👙🔥🐊 📭👍📢👊📟.\\\\n\\\\n出死問民同歴術荘面族上自。窃指写氷名続球投込光試事樹増。作合副者扶実権守安展感意環待質出。告供体企紙勢構
gitextract_yce_p9ai/ ├── .changeset/ │ ├── README.md │ ├── config.json │ ├── gold-berries-march.md │ ├── swift-plums-fix.md │ └── violet-falcons-dream.md ├── .editorconfig ├── .eslintrc ├── .github/ │ └── workflows/ │ ├── nodejs.yml │ ├── release.yml │ └── size.yml ├── .gitignore ├── .prettierignore ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── babel.config.js ├── index.d.ts ├── package.json ├── src/ │ ├── cli.js │ ├── index.js │ ├── lib/ │ │ ├── __entry__.js │ │ ├── babel-custom.js │ │ ├── compressed-size.js │ │ ├── css-modules.js │ │ ├── option-normalization.js │ │ ├── package-info.js │ │ ├── terser.js │ │ └── transform-fast-rest.js │ ├── log-error.js │ ├── prog.js │ └── utils.js ├── test/ │ ├── __snapshots__/ │ │ └── index.test.js.snap │ ├── fixtures/ │ │ ├── alias/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ ├── constants-debug.js │ │ │ ├── constants.js │ │ │ └── index.js │ │ ├── alias-external/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ ├── colossal-glob.js │ │ │ └── index.js │ │ ├── async-iife-ts/ │ │ │ ├── package.json │ │ │ ├── src/ │ │ │ │ └── index.ts │ │ │ └── tsconfig.json │ │ ├── async-ts/ │ │ │ ├── package.json │ │ │ ├── src/ │ │ │ │ └── index.ts │ │ │ └── tsconfig.json │ │ ├── basic/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ ├── index.js │ │ │ └── two.js │ │ ├── basic-babelrc/ │ │ │ ├── .babelrc │ │ │ ├── package.json │ │ │ └── src/ │ │ │ └── index.js │ │ ├── basic-compress-false/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ ├── index.js │ │ │ └── two.js │ │ ├── basic-css/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ ├── index.js │ │ │ └── two.css │ │ ├── basic-dashed-external/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ ├── index.js │ │ │ └── two.js │ │ ├── basic-flow/ │ │ │ ├── .flowconfig │ │ │ ├── package.json │ │ │ └── src/ │ │ │ ├── fruits.js │ │ │ └── index.js │ │ ├── basic-json/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ ├── index.js │ │ │ └── two.json │ │ ├── basic-multi-source/ │ │ │ ├── a.js │ │ │ ├── b.js │ │ │ └── package.json │ │ ├── basic-multi-source-css/ │ │ │ ├── a.css │ │ │ ├── a.js │ │ │ ├── b.css │ │ │ ├── b.js │ │ │ └── package.json │ │ ├── basic-no-compress/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ ├── index.js │ │ │ └── two.js │ │ ├── basic-no-pkg-main/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ ├── index.js │ │ │ └── two.js │ │ ├── basic-node-internals/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ └── index.js │ │ ├── basic-ts/ │ │ │ ├── package.json │ │ │ ├── src/ │ │ │ │ ├── car.ts │ │ │ │ └── index.ts │ │ │ └── tsconfig.json │ │ ├── basic-tsx/ │ │ │ ├── package.json │ │ │ ├── src/ │ │ │ │ └── index.tsx │ │ │ └── tsconfig.json │ │ ├── basic-with-cwd/ │ │ │ ├── basic/ │ │ │ │ ├── package.json │ │ │ │ └── src/ │ │ │ │ ├── index.js │ │ │ │ └── two.js │ │ │ └── package.json │ │ ├── class-decorators-ts/ │ │ │ ├── package.json │ │ │ ├── src/ │ │ │ │ └── index.ts │ │ │ └── tsconfig.json │ │ ├── class-properties/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ └── index.js │ │ ├── css-modules--false/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ ├── index.js │ │ │ ├── not_scoped.css │ │ │ └── not_scoped.module.css │ │ ├── css-modules--null/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ ├── index.js │ │ │ ├── not_scoped.css │ │ │ └── scoped.module.css │ │ ├── css-modules--string/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ ├── index.js │ │ │ ├── scoped.css │ │ │ └── scoped.module.css │ │ ├── css-modules--true/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ ├── index.js │ │ │ ├── scoped.css │ │ │ └── scoped.module.css │ │ ├── custom-babelrc/ │ │ │ ├── .babelrc │ │ │ ├── package.json │ │ │ └── src/ │ │ │ └── index.js │ │ ├── custom-outputs/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ ├── index.js │ │ │ └── two.js │ │ ├── custom-outputs-alt/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ ├── index.js │ │ │ └── two.js │ │ ├── custom-source/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ ├── custom-source.js │ │ │ └── two.js │ │ ├── custom-source-with-cwd/ │ │ │ ├── custom-source/ │ │ │ │ ├── package.json │ │ │ │ └── src/ │ │ │ │ ├── custom-source.js │ │ │ │ └── two.js │ │ │ └── package.json │ │ ├── default-named/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ └── index.js │ │ ├── define/ │ │ │ ├── index.js │ │ │ └── package.json │ │ ├── define-expression/ │ │ │ ├── index.js │ │ │ └── package.json │ │ ├── esnext-ts/ │ │ │ ├── package.json │ │ │ ├── src/ │ │ │ │ └── index.ts │ │ │ └── tsconfig.json │ │ ├── inline-source-map/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ ├── index.js │ │ │ └── two.js │ │ ├── jsx/ │ │ │ ├── index.js │ │ │ └── package.json │ │ ├── macro/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ ├── index.js │ │ │ └── macro.js │ │ ├── mangle-json-file/ │ │ │ ├── mangle.json │ │ │ ├── package.json │ │ │ └── src/ │ │ │ ├── index.js │ │ │ └── two.js │ │ ├── minify-config/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ ├── index.js │ │ │ └── two.js │ │ ├── minify-config-boolean/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ ├── index.js │ │ │ └── two.js │ │ ├── minify-path-config/ │ │ │ ├── minify.json │ │ │ ├── package.json │ │ │ └── src/ │ │ │ ├── index.js │ │ │ └── two.js │ │ ├── minify-path-parent-dir-with-cwd/ │ │ │ ├── minify-path-parent-dir/ │ │ │ │ ├── index.js │ │ │ │ ├── package.json │ │ │ │ └── two.js │ │ │ ├── minify.json │ │ │ └── package.json │ │ ├── modern/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ ├── index.js │ │ │ └── two.js │ │ ├── modern-generators/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ ├── index.js │ │ │ └── two.js │ │ ├── name-custom-amd/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ ├── index.js │ │ │ └── two.js │ │ ├── name-custom-cli/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ ├── index.js │ │ │ └── two.js │ │ ├── no-pkg/ │ │ │ └── src/ │ │ │ ├── index.js │ │ │ └── two.js │ │ ├── no-pkg-name/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ ├── index.js │ │ │ └── two.js │ │ ├── optional-chaining-ts/ │ │ │ ├── package.json │ │ │ ├── src/ │ │ │ │ └── index.ts │ │ │ └── tsconfig.json │ │ ├── parameters-rest-closure/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ └── index.js │ │ ├── pretty/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ └── index.js │ │ ├── publish-config/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ └── foo.ts │ │ ├── pure/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ └── index.js │ │ ├── raw/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ └── index.js │ │ ├── shebang/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ └── index.js │ │ ├── terser-annotations/ │ │ │ ├── mangle.json │ │ │ ├── package.json │ │ │ └── src/ │ │ │ └── index.js │ │ ├── ts-custom-declaration/ │ │ │ ├── package.json │ │ │ ├── src/ │ │ │ │ └── index.ts │ │ │ ├── tsconfig.json │ │ │ └── types/ │ │ │ └── index.d.ts │ │ ├── ts-declaration/ │ │ │ ├── package.json │ │ │ ├── src/ │ │ │ │ └── index.tsx │ │ │ ├── tsconfig.json │ │ │ └── types/ │ │ │ └── index.d.ts │ │ ├── ts-jsx/ │ │ │ ├── package.json │ │ │ ├── src/ │ │ │ │ └── index.tsx │ │ │ └── tsconfig.json │ │ ├── ts-mixed-exports/ │ │ │ ├── package.json │ │ │ ├── src/ │ │ │ │ ├── car.ts │ │ │ │ └── index.ts │ │ │ └── tsconfig.json │ │ ├── ts-module/ │ │ │ ├── package.json │ │ │ ├── src/ │ │ │ │ ├── foo.ts │ │ │ │ └── index.ts │ │ │ └── tsconfig.json │ │ ├── visualizer/ │ │ │ ├── package.json │ │ │ └── src/ │ │ │ └── index.js │ │ └── worker-loader/ │ │ ├── package.json │ │ └── src/ │ │ ├── bar.js │ │ ├── index.js │ │ └── worker.js │ ├── index.test.js │ └── lib/ │ └── util.js ├── tools/ │ ├── build-fixture.js │ └── generate-filesize.js └── tsconfig.json
SYMBOL INDEX (99 symbols across 56 files)
FILE: src/index.js
constant EXTENSIONS (line 45) | const EXTENSIONS = ['.ts', '.tsx', '.js', '.jsx', '.es6', '.es', '.mjs'];
constant WATCH_OPTS (line 47) | const WATCH_OPTS = {
function microbundle (line 51) | async function microbundle(inputOptions) {
function doWatch (line 148) | function doWatch(options, cwd, steps) {
function jsOrTs (line 195) | async function jsOrTs(cwd, filename) {
function getInput (line 205) | async function getInput({ entries, cwd, source, module }) {
function getOutput (line 227) | async function getOutput({ cwd, output, pkgMain, pkgName }) {
function getDeclarationDir (line 235) | function getDeclarationDir({ options, pkg }) {
function getEntries (line 250) | async function getEntries({ input, cwd }) {
function replaceName (line 263) | function replaceName(filename, name) {
function walk (line 270) | function walk(exports, includeDefault) {
function getMain (line 278) | function getMain({ options, entry, format }) {
function createConfig (line 327) | function createConfig(options, entry, format, writeMeta) {
FILE: src/lib/babel-custom.js
constant ESMODULES_TARGET (line 6) | const ESMODULES_TARGET = {
method options (line 57) | options({ custom: customOptions, ...pluginOptions }) {
method config (line 67) | config(config, { customOptions }) {
FILE: src/lib/compressed-size.js
function getPadLeft (line 7) | function getPadLeft(str, width, char = ' ') {
function formatSize (line 11) | function formatSize(size, filename, type, raw) {
function getSizeInfo (line 18) | async function getSizeInfo(code, filename, raw) {
FILE: src/lib/css-modules.js
function shouldCssModules (line 1) | function shouldCssModules(options) {
function cssModulesConfig (line 13) | function cssModulesConfig(options) {
function processCssmodulesArgument (line 40) | function processCssmodulesArgument(options) {
FILE: src/lib/option-normalization.js
function toReplacementExpression (line 5) | function toReplacementExpression(value, name) {
function parseMappingArgument (line 29) | function parseMappingArgument(globalStrings, processValue) {
function parseAliasArgument (line 51) | function parseAliasArgument(aliasStrings) {
FILE: src/lib/package-info.js
function getConfigFromPkgJson (line 6) | async function getConfigFromPkgJson(cwd) {
function getName (line 29) | function getName({ name, pkgName, amdName, cwd, hasPackageJson }) {
FILE: src/lib/terser.js
function normalizeMinifyOptions (line 2) | function normalizeMinifyOptions(minifyOptions) {
FILE: src/lib/transform-fast-rest.js
function fastRestTransform (line 14) | function fastRestTransform({ template, types: t }) {
function sameArgumentsObject (line 96) | function sameArgumentsObject(node, func, t) {
FILE: src/log-error.js
function logError (line 4) | function logError(err) {
FILE: src/utils.js
function isDir (line 8) | function isDir(name) {
function isFile (line 14) | function isFile(name) {
constant INVALID_ES3_IDENT (line 35) | const INVALID_ES3_IDENT = /((^[^a-zA-Z]+)|[^\w.-])|([^a-zA-Z0-9]+$)/g;
function safeVariableName (line 41) | function safeVariableName(name) {
constant EXTENSION (line 47) | const EXTENSION = /(\.(umd|cjs|es|m))?\.([cm]?[tj]sx?)$/;
FILE: test/fixtures/alias/src/constants-debug.js
constant DEBUG (line 1) | const DEBUG = true;
FILE: test/fixtures/alias/src/constants.js
constant DEBUG (line 1) | const DEBUG = false;
FILE: test/fixtures/async-ts/src/index.ts
class MyClass (line 1) | class MyClass {
method foo (line 2) | async foo() {}
FILE: test/fixtures/basic-babelrc/src/index.js
function test (line 1) | function test(param = throw new Error('required!')) {
FILE: test/fixtures/basic-compress-false/src/two.js
function two (line 1) | async function two(...args) {
FILE: test/fixtures/basic-dashed-external/src/two.js
function two (line 1) | async function two(...args) {
FILE: test/fixtures/basic-no-compress/src/two.js
function two (line 1) | async function two(...args) {
FILE: test/fixtures/basic-no-pkg-main/src/two.js
function two (line 1) | async function two(...args) {
FILE: test/fixtures/basic-node-internals/src/index.js
function runCommand (line 3) | function runCommand(cmd) {
FILE: test/fixtures/basic-ts/src/car.ts
type Driveable (line 1) | interface Driveable {
class Car (line 5) | class Car implements Driveable {
method drive (line 6) | public drive(distance: number): boolean {
FILE: test/fixtures/basic-tsx/src/index.tsx
class Foo (line 3) | class Foo {
method render (line 4) | render() {
FILE: test/fixtures/basic-with-cwd/basic/src/two.js
function two (line 1) | async function two(...args) {
FILE: test/fixtures/basic/src/two.js
function two (line 1) | async function two(...args) {
FILE: test/fixtures/class-decorators-ts/src/index.ts
function sealed (line 1) | function sealed(constructor: Function) {
class Greeter (line 6) | @sealed
method constructor (line 9) | constructor(message: string) {
method greet (line 12) | greet() {
FILE: test/fixtures/class-properties/src/index.js
class Foo (line 1) | class Foo {
FILE: test/fixtures/custom-babelrc/src/index.js
class MyClass (line 1) | class MyClass {
method foo (line 3) | async foo() {
FILE: test/fixtures/custom-outputs-alt/src/two.js
function two (line 1) | async function two(...args) {
FILE: test/fixtures/custom-outputs/src/two.js
function two (line 1) | async function two(...args) {
FILE: test/fixtures/custom-source-with-cwd/custom-source/src/two.js
function two (line 1) | async function two(...args) {
FILE: test/fixtures/custom-source/src/two.js
function two (line 1) | async function two(...args) {
FILE: test/fixtures/default-named/src/index.js
function bar (line 2) | function bar() {}
FILE: test/fixtures/define/index.js
constant DEBUG (line 1) | const DEBUG = true;
FILE: test/fixtures/esnext-ts/src/index.ts
function foo (line 1) | async function foo() {
FILE: test/fixtures/inline-source-map/src/two.js
function two (line 1) | async function two(...args) {
FILE: test/fixtures/jsx/index.js
class Foo (line 5) | class Foo {
method render (line 6) | render() {
FILE: test/fixtures/macro/src/macro.js
function myMacro (line 3) | function myMacro({ references, state, babel }) {
FILE: test/fixtures/modern/src/two.js
function two (line 1) | async function two(...args) {
FILE: test/fixtures/name-custom-amd/src/two.js
function two (line 1) | async function two(...args) {
FILE: test/fixtures/name-custom-cli/src/two.js
function two (line 1) | async function two(...args) {
FILE: test/fixtures/no-pkg-name/src/two.js
function two (line 1) | async function two(...args) {
FILE: test/fixtures/no-pkg/src/two.js
function two (line 1) | async function two(...args) {
FILE: test/fixtures/optional-chaining-ts/src/index.ts
function chain (line 1) | function chain(test: {
FILE: test/fixtures/parameters-rest-closure/src/index.js
function parametersRestWithClosure (line 1) | function parametersRestWithClosure(fn, ...args) {
function parametersRestWithInnerArrowFunction (line 7) | function parametersRestWithInnerArrowFunction(fn, ...args) {
FILE: test/fixtures/publish-config/src/foo.ts
function foo (line 1) | function foo() {
FILE: test/fixtures/pure/src/index.js
function foo (line 4) | function foo() {
FILE: test/fixtures/shebang/src/index.js
function foo (line 3) | function foo() {
FILE: test/fixtures/terser-annotations/src/index.js
function shouldBeInlined (line 1) | function shouldBeInlined(a, b) {
function shouldBePreserved (line 5) | function shouldBePreserved(a, b) {
function main (line 9) | function main(a, b) {
FILE: test/fixtures/ts-custom-declaration/src/index.ts
function foo (line 1) | function foo() {
FILE: test/fixtures/ts-declaration/src/index.tsx
function foo (line 1) | function foo() {
FILE: test/fixtures/ts-mixed-exports/src/car.ts
type Driveable (line 1) | interface Driveable {
class Car (line 5) | class Car implements Driveable {
method drive (line 6) | public drive(distance: number): boolean {
FILE: test/fixtures/ts-module/src/foo.ts
function foo (line 1) | function foo() {
FILE: test/fixtures/ts-module/src/index.ts
function foobar (line 3) | function foobar() {
FILE: test/fixtures/worker-loader/src/bar.js
function bar (line 1) | function bar() {
FILE: test/index.test.js
constant FIXTURES_DIR (line 7) | const FIXTURES_DIR = `${__dirname}/fixtures`;
constant DEFAULT_SCRIPT (line 8) | const DEFAULT_SCRIPT = 'microbundle';
constant TEST_TIMEOUT (line 9) | const TEST_TIMEOUT = 11000;
FILE: tools/build-fixture.js
constant FIXTURES_DIR (line 11) | const FIXTURES_DIR = resolve(`${__dirname}/../test/fixtures`);
constant DEFAULT_SCRIPT (line 12) | const DEFAULT_SCRIPT = 'microbundle';
FILE: tools/generate-filesize.js
constant FIXTURES_DIR (line 8) | const FIXTURES_DIR = `${__dirname}/../test/fixtures`;
Condensed preview — 233 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (307K chars).
[
{
"path": ".changeset/README.md",
"chars": 512,
"preview": "# Changesets\n\nHello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that wo"
},
{
"path": ".changeset/config.json",
"chars": 299,
"preview": "{\n\t\"$schema\": \"https://unpkg.com/@changesets/config@1.3.0/schema.json\",\n\t\"changelog\": [\n\t\t\"@changesets/changelog-github\""
},
{
"path": ".changeset/gold-berries-march.md",
"chars": 83,
"preview": "---\n'microbundle': patch\n---\n\nFix indentation style in `mangle.json` not preserved\n"
},
{
"path": ".changeset/swift-plums-fix.md",
"chars": 193,
"preview": "---\n'microbundle': patch\n---\n\nSilence Rollup's noisy (and usually harmless) `The 'this' keyword is equivalent to 'undefi"
},
{
"path": ".changeset/violet-falcons-dream.md",
"chars": 72,
"preview": "---\n'microbundle': patch\n---\n\nFixes positioning bug with UMD sourcemaps\n"
},
{
"path": ".editorconfig",
"chars": 236,
"preview": "root = true\n\n[*]\nindent_style = tab\nend_of_line = lf\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_newlin"
},
{
"path": ".eslintrc",
"chars": 394,
"preview": "{\n \"extends\": [\n \"eslint-config-developit\",\n \"prettier\",\n \"plugin:prettier/recommended\"\n ],\n \"plugins\": [\n "
},
{
"path": ".github/workflows/nodejs.yml",
"chars": 495,
"preview": "name: Node CI\n\non:\n pull_request: {}\n push:\n branches:\n - master\n\njobs:\n build:\n runs-on: ubuntu-latest\n\n "
},
{
"path": ".github/workflows/release.yml",
"chars": 940,
"preview": "name: Release\n\non:\n push:\n branches:\n - master\n\njobs:\n release:\n name: Release\n runs-on: ubuntu-latest\n "
},
{
"path": ".github/workflows/size.yml",
"chars": 779,
"preview": "name: compressed-size\non:\n pull_request:\n branches:\n - master\n\njobs:\n build:\n runs-on: ubuntu-latest\n st"
},
{
"path": ".gitignore",
"chars": 176,
"preview": "node_modules\n.DS_Store\n*.log\n.rpt2_cache\n.rts2_cache_cjs\n.rts2_cache_es\n.rts2_cache_umd\nbuild\ndist\nyarn.lock\n.vscode\n.id"
},
{
"path": ".prettierignore",
"chars": 5,
"preview": "dist/"
},
{
"path": "CHANGELOG.md",
"chars": 14987,
"preview": "# microbundle\n\n## 0.15.1\n\n### Patch Changes\n\n- [`cebafa1`](https://github.com/developit/microbundle/commit/cebafa121953a"
},
{
"path": "CODE_OF_CONDUCT.md",
"chars": 3217,
"preview": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nIn the interest of fostering an open and welcoming environment, w"
},
{
"path": "LICENSE",
"chars": 1087,
"preview": "The MIT License (MIT)\n\nCopyright (c) 2017-present Jason Miller\n\nPermission is hereby granted, free of charge, to any per"
},
{
"path": "README.md",
"chars": 20559,
"preview": "<p align=\"center\">\n <img src=\"https://i.imgur.com/LMEgZMh.gif\" width=\"597\" alt=\"microbundle\">\n</p>\n<h1 align=\"center\">\n"
},
{
"path": "babel.config.js",
"chars": 324,
"preview": "module.exports = {\n\tpresets: [\n\t\t[\n\t\t\t'@babel/preset-env',\n\t\t\t{\n\t\t\t\tloose: true,\n\t\t\t\tmodules: process.env.BABEL_ENV === "
},
{
"path": "index.d.ts",
"chars": 108,
"preview": "declare module '*.module.css' {\n const classes: { [key: string]: string };\n export default classes;\n}\n"
},
{
"path": "package.json",
"chars": 3954,
"preview": "{\n\t\"name\": \"microbundle\",\n\t\"version\": \"0.15.1\",\n\t\"description\": \"Zero-configuration bundler for tiny JS libs, powered by"
},
{
"path": "src/cli.js",
"chars": 463,
"preview": "#!/usr/bin/env node\n\nimport microbundle from './index';\nimport prog from './prog';\nimport { stdout } from './utils';\nimp"
},
{
"path": "src/index.js",
"chars": 21283,
"preview": "import fs from 'fs';\nimport { resolve, relative, dirname, basename, extname } from 'path';\nimport camelCase from 'camelc"
},
{
"path": "src/lib/__entry__.js",
"chars": 49,
"preview": "export { default } from '__microbundle_entry__';\n"
},
{
"path": "src/lib/babel-custom.js",
"chars": 5379,
"preview": "import { createBabelInputPluginFactory } from '@rollup/plugin-babel';\nimport merge from 'lodash.merge';\nimport transform"
},
{
"path": "src/lib/compressed-size.js",
"chars": 932,
"preview": "import { basename } from 'path';\nimport { green, red, yellow, white } from 'kleur';\nimport gzipSize from 'gzip-size';\nim"
},
{
"path": "src/lib/css-modules.js",
"chars": 1587,
"preview": "export function shouldCssModules(options) {\n\tconst passedInOption = processCssmodulesArgument(options);\n\n\t// We should m"
},
{
"path": "src/lib/option-normalization.js",
"chars": 1465,
"preview": "/**\n * Convert booleans and int define= values to literals.\n * This is more intuitive than `microbundle --define A=1` pr"
},
{
"path": "src/lib/package-info.js",
"chars": 1085,
"preview": "import { resolve, basename } from 'path';\nimport { red, yellow } from 'kleur';\nimport { readFile, stderr, safeVariableNa"
},
{
"path": "src/lib/terser.js",
"chars": 1103,
"preview": "// Normalize Terser options from microbundle's relaxed JSON format (mutates argument in-place)\nexport function normalize"
},
{
"path": "src/lib/transform-fast-rest.js",
"chars": 2932,
"preview": "/**\n * @type {import('@babel/core')}\n */\n\n/**\n * Transform ...rest parameters to [].slice.call(arguments,offset).\n * Dem"
},
{
"path": "src/log-error.js",
"chars": 656,
"preview": "import { red, dim } from 'kleur';\nimport { stderr } from './utils';\n\nexport default function logError(err) {\n\tconst erro"
},
{
"path": "src/prog.js",
"chars": 3788,
"preview": "import sade from 'sade';\nlet { version } = require('../package.json');\n\nconst toArray = val => (Array.isArray(val) ? val"
},
{
"path": "src/utils.js",
"chars": 1190,
"preview": "import { promises as fs } from 'fs';\nimport camelCase from 'camelcase';\n\nexport const readFile = fs.readFile;\n\nexport co"
},
{
"path": "test/__snapshots__/index.test.js.snap",
"chars": 147265,
"preview": "// Jest Snapshot v1, https://goo.gl/fbAQLP\n\nexports[`fixtures build alias with microbundle 1`] = `\n\"Used script: microbu"
},
{
"path": "test/fixtures/alias/package.json",
"chars": 130,
"preview": "{\n \"name\": \"alias-mapping\",\n \"scripts\": {\n \"build\": \"microbundle --no-sourcemap --alias ./constants=./constants-deb"
},
{
"path": "test/fixtures/alias/src/constants-debug.js",
"chars": 27,
"preview": "export const DEBUG = true;\n"
},
{
"path": "test/fixtures/alias/src/constants.js",
"chars": 28,
"preview": "export const DEBUG = false;\n"
},
{
"path": "test/fixtures/alias/src/index.js",
"chars": 83,
"preview": "import { DEBUG } from './constants';\nconsole.log('DEBUG should be true: ', DEBUG);\n"
},
{
"path": "test/fixtures/alias-external/package.json",
"chars": 196,
"preview": "{\n \"name\": \"alias-external\",\n \"scripts\": {\n \"build\": \"microbundle --alias tiny-glob=./colossal-glob.js\"\n },\n \"dep"
},
{
"path": "test/fixtures/alias-external/src/colossal-glob.js",
"chars": 19,
"preview": "export default 42;\n"
},
{
"path": "test/fixtures/alias-external/src/index.js",
"chars": 57,
"preview": "import tinyglob from 'tiny-glob';\nconsole.log(tinyglob);\n"
},
{
"path": "test/fixtures/async-iife-ts/package.json",
"chars": 29,
"preview": "{\n\t\"name\": \"async-iife-ts\"\n}\n"
},
{
"path": "test/fixtures/async-iife-ts/src/index.ts",
"chars": 47,
"preview": "(async function() {\n\tconsole.log('foo');\n})();\n"
},
{
"path": "test/fixtures/async-iife-ts/tsconfig.json",
"chars": 74,
"preview": "{\n\t\"compilerOptions\": {\n\t\t\"baseUrl\": \".\"\n\t},\n\t\"files\": [\"src/index.ts\"]\n}\n"
},
{
"path": "test/fixtures/async-ts/package.json",
"chars": 24,
"preview": "{\n\t\"name\": \"async-ts\"\n}\n"
},
{
"path": "test/fixtures/async-ts/src/index.ts",
"chars": 41,
"preview": "export class MyClass {\n\tasync foo() {}\n}\n"
},
{
"path": "test/fixtures/async-ts/tsconfig.json",
"chars": 74,
"preview": "{\n\t\"compilerOptions\": {\n\t\t\"baseUrl\": \".\"\n\t},\n\t\"files\": [\"src/index.ts\"]\n}\n"
},
{
"path": "test/fixtures/basic/package.json",
"chars": 26,
"preview": "{\n \"name\": \"basic-lib\"\n}\n"
},
{
"path": "test/fixtures/basic/src/index.js",
"chars": 124,
"preview": "import { two } from './two';\n\nexport default async function (...args) {\n\treturn [await two(...args), await two(...args)]"
},
{
"path": "test/fixtures/basic/src/two.js",
"chars": 96,
"preview": "export async function two(...args) {\n\treturn args.reduce((total, value) => total + value, 0);\n}\n"
},
{
"path": "test/fixtures/basic-babelrc/.babelrc",
"chars": 61,
"preview": "{\n\t\"plugins\": [\"@babel/plugin-proposal-throw-expressions\"]\n}\n"
},
{
"path": "test/fixtures/basic-babelrc/package.json",
"chars": 30,
"preview": "{\n \"name\": \"basic-babelrc\"\n}\n"
},
{
"path": "test/fixtures/basic-babelrc/src/index.js",
"chars": 136,
"preview": "function test(param = throw new Error('required!')) {\n\treturn param === true || throw new Error('Falsey!');\n}\n\ntest(true"
},
{
"path": "test/fixtures/basic-compress-false/package.json",
"chars": 101,
"preview": "{\n \"name\": \"basic-compress-false\",\n \"scripts\": {\n \"build\": \"microbundle --compress=false\"\n }\n}\n"
},
{
"path": "test/fixtures/basic-compress-false/src/index.js",
"chars": 124,
"preview": "import { two } from './two';\n\nexport default async function (...args) {\n\treturn [await two(...args), await two(...args)]"
},
{
"path": "test/fixtures/basic-compress-false/src/two.js",
"chars": 96,
"preview": "export async function two(...args) {\n\treturn args.reduce((total, value) => total + value, 0);\n}\n"
},
{
"path": "test/fixtures/basic-css/package.json",
"chars": 26,
"preview": "{\n \"name\": \"basic-css\"\n}\n"
},
{
"path": "test/fixtures/basic-css/src/index.js",
"chars": 134,
"preview": "import './two.css';\n\nexport default function () {\n\tconst el = document.createElement('div');\n\tel.className = 'testing';\n"
},
{
"path": "test/fixtures/basic-css/src/two.css",
"chars": 61,
"preview": ".testing {\n\tdisplay: flex;\n\tcolor: red;\n\tbackground: blue;\n}\n"
},
{
"path": "test/fixtures/basic-dashed-external/package.json",
"chars": 136,
"preview": "{\n \"name\": \"basic-dashed-external\",\n \"scripts\": {\n \"build\": \"microbundle\"\n },\n \"dependencies\": {\n \"tiny-glob\":"
},
{
"path": "test/fixtures/basic-dashed-external/src/index.js",
"chars": 182,
"preview": "import tinyglob from 'tiny-glob';\nconsole.log(tinyglob);\n\nimport { two } from './two';\n\nexport default async function (."
},
{
"path": "test/fixtures/basic-dashed-external/src/two.js",
"chars": 96,
"preview": "export async function two(...args) {\n\treturn args.reduce((total, value) => total + value, 0);\n}\n"
},
{
"path": "test/fixtures/basic-flow/.flowconfig",
"chars": 0,
"preview": ""
},
{
"path": "test/fixtures/basic-flow/package.json",
"chars": 31,
"preview": "{\n \"name\": \"basic-lib-flow\"\n}\n"
},
{
"path": "test/fixtures/basic-flow/src/fruits.js",
"chars": 165,
"preview": "// @flow\nexport type Fruit = 'cherry' | 'banana' | 'raspberry';\n\nexport function mixFruits(fruit1: Fruit, fruit2: Fruit)"
},
{
"path": "test/fixtures/basic-flow/src/index.js",
"chars": 168,
"preview": "// @flow\nimport { mixFruits, type Fruit } from './fruits';\n\nconst banana: Fruit = 'banana';\n\nlet milkshake = mixFruits(b"
},
{
"path": "test/fixtures/basic-json/package.json",
"chars": 27,
"preview": "{\n \"name\": \"basic-json\"\n}\n"
},
{
"path": "test/fixtures/basic-json/src/index.js",
"chars": 88,
"preview": "import two from './two.json';\n\nexport default async function (...args) {\n\treturn two;\n}\n"
},
{
"path": "test/fixtures/basic-json/src/two.json",
"chars": 19,
"preview": "{\n\t\"test\": \"true\"\n}"
},
{
"path": "test/fixtures/basic-multi-source/a.js",
"chars": 23,
"preview": "console.log('i am a');\n"
},
{
"path": "test/fixtures/basic-multi-source/b.js",
"chars": 23,
"preview": "console.log('i am b');\n"
},
{
"path": "test/fixtures/basic-multi-source/package.json",
"chars": 80,
"preview": "{\n \"name\": \"basic-multi-source\",\n \"source\":[\n \"./a.js\",\n \"./b.js\"\n ]\n}\n"
},
{
"path": "test/fixtures/basic-multi-source-css/a.css",
"chars": 57,
"preview": ".a {\n\tdisplay: flex;\n\tcolor: green;\n\tbackground: pink;\n}\n"
},
{
"path": "test/fixtures/basic-multi-source-css/a.js",
"chars": 126,
"preview": "import './a.css';\n\nexport default function () {\n\tconst el = document.createElement('div');\n\tel.className = 'a';\n\treturn "
},
{
"path": "test/fixtures/basic-multi-source-css/b.css",
"chars": 55,
"preview": ".b {\n\tdisplay: flex;\n\tcolor: red;\n\tbackground: blue;\n}\n"
},
{
"path": "test/fixtures/basic-multi-source-css/b.js",
"chars": 126,
"preview": "import './b.css';\n\nexport default function () {\n\tconst el = document.createElement('div');\n\tel.className = 'b';\n\treturn "
},
{
"path": "test/fixtures/basic-multi-source-css/package.json",
"chars": 84,
"preview": "{\n \"name\": \"basic-multi-source-css\",\n \"source\":[\n \"./a.js\",\n \"./b.js\"\n ]\n}\n"
},
{
"path": "test/fixtures/basic-no-compress/package.json",
"chars": 95,
"preview": "{\n \"name\": \"basic-no-compress\",\n \"scripts\": {\n \"build\": \"microbundle --no-compress\"\n }\n}\n"
},
{
"path": "test/fixtures/basic-no-compress/src/index.js",
"chars": 124,
"preview": "import { two } from './two';\n\nexport default async function (...args) {\n\treturn [await two(...args), await two(...args)]"
},
{
"path": "test/fixtures/basic-no-compress/src/two.js",
"chars": 96,
"preview": "export async function two(...args) {\n\treturn args.reduce((total, value) => total + value, 0);\n}\n"
},
{
"path": "test/fixtures/basic-no-pkg-main/package.json",
"chars": 98,
"preview": "{\n \"name\": \"basic-no-pkg-main\",\n \"scripts\": {\n \"build\": \"microbundle --pkg-main false\"\n }\n}\n"
},
{
"path": "test/fixtures/basic-no-pkg-main/src/index.js",
"chars": 124,
"preview": "import { two } from './two';\n\nexport default async function (...args) {\n\treturn [await two(...args), await two(...args)]"
},
{
"path": "test/fixtures/basic-no-pkg-main/src/two.js",
"chars": 96,
"preview": "export async function two(...args) {\n\treturn args.reduce((total, value) => total + value, 0);\n}\n"
},
{
"path": "test/fixtures/basic-node-internals/package.json",
"chars": 105,
"preview": "{\n \"name\": \"basic-node-internals\",\n \"scripts\": {\n \"build\": \"microbundle --target=node -f cjs\"\n }\n}\n"
},
{
"path": "test/fixtures/basic-node-internals/src/index.js",
"chars": 241,
"preview": "import { exec } from 'child_process';\n\nexport function runCommand(cmd) {\n\treturn new Promise((resolve, reject) => {\n\t\tex"
},
{
"path": "test/fixtures/basic-ts/package.json",
"chars": 29,
"preview": "{\n \"name\": \"basic-lib-ts\"\n}\n"
},
{
"path": "test/fixtures/basic-ts/src/car.ts",
"chars": 178,
"preview": "export interface Driveable {\n\tdrive(distance: number): boolean;\n}\n\nexport default class Car implements Driveable {\n\tpubl"
},
{
"path": "test/fixtures/basic-ts/src/index.ts",
"chars": 76,
"preview": "import Car from './car';\n\nlet Ferrari = new Car();\n\nexport default Ferrari;\n"
},
{
"path": "test/fixtures/basic-ts/tsconfig.json",
"chars": 74,
"preview": "{\n\t\"compilerOptions\": {\n\t\t\"baseUrl\": \".\"\n\t},\n\t\"files\": [\"src/index.ts\"]\n}\n"
},
{
"path": "test/fixtures/basic-tsx/package.json",
"chars": 30,
"preview": "{\n \"name\": \"basic-lib-tsx\"\n}\n"
},
{
"path": "test/fixtures/basic-tsx/src/index.tsx",
"chars": 206,
"preview": "const h = (tag, props, ...children) => ({ tag, props, children });\n\nexport default class Foo {\n\trender() {\n\t\treturn (\n\t\t"
},
{
"path": "test/fixtures/basic-tsx/tsconfig.json",
"chars": 114,
"preview": "{\n\t\"compilerOptions\": {\n\t\t\"jsxFactory\": \"h\",\n\t\t\"jsx\": \"react\",\n\t\t\"baseUrl\": \".\"\n\t},\n\t\"files\": [\"src/index.tsx\"]\n}\n"
},
{
"path": "test/fixtures/basic-with-cwd/basic/package.json",
"chars": 22,
"preview": "{\n \"name\": \"basic\"\n}\n"
},
{
"path": "test/fixtures/basic-with-cwd/basic/src/index.js",
"chars": 124,
"preview": "import { two } from './two';\n\nexport default async function (...args) {\n\treturn [await two(...args), await two(...args)]"
},
{
"path": "test/fixtures/basic-with-cwd/basic/src/two.js",
"chars": 96,
"preview": "export async function two(...args) {\n\treturn args.reduce((total, value) => total + value, 0);\n}\n"
},
{
"path": "test/fixtures/basic-with-cwd/package.json",
"chars": 92,
"preview": "{\n \"name\": \"basic-with-cwd\",\n \"scripts\": {\n \"build\": \"microbundle --cwd ./basic\"\n }\n}\n"
},
{
"path": "test/fixtures/class-decorators-ts/package.json",
"chars": 89,
"preview": "{\n \"name\": \"class-decorators-ts\",\n \"scripts\": {\n \"build\": \"microbundle --raw\"\n }\n}\n"
},
{
"path": "test/fixtures/class-decorators-ts/src/index.ts",
"chars": 309,
"preview": "function sealed(constructor: Function) {\n\tObject.seal(constructor);\n\tObject.seal(constructor.prototype);\n}\n\n@sealed\nclas"
},
{
"path": "test/fixtures/class-decorators-ts/tsconfig.json",
"chars": 108,
"preview": "{\n\t\"compilerOptions\": {\n\t\t\"experimentalDecorators\": true,\n\t\t\"baseUrl\": \".\"\n\t},\n\t\"files\": [\"src/index.ts\"]\n}\n"
},
{
"path": "test/fixtures/class-properties/package.json",
"chars": 33,
"preview": "{\n \"name\": \"class-properties\"\n}\n"
},
{
"path": "test/fixtures/class-properties/src/index.js",
"chars": 75,
"preview": "export class Foo {\n\tstatic bar = 2;\n\tbaz = 3;\n}\n\nexport default new Foo();\n"
},
{
"path": "test/fixtures/css-modules--false/package.json",
"chars": 117,
"preview": "{\n \"name\": \"css-modules--false\",\n \"scripts\": {\n \"build\": \"microbundle --no-sourcemap --css-modules false\"\n }\n}\n"
},
{
"path": "test/fixtures/css-modules--false/src/index.js",
"chars": 92,
"preview": "import './not_scoped.css';\nimport './not_scoped.module.css';\n\nexport default function () {}\n"
},
{
"path": "test/fixtures/css-modules--false/src/not_scoped.css",
"chars": 123,
"preview": "body {\n\tdisplay: flex;\n\tcolor: red;\n\tbackground: blue;\n}\n\n.test_class_that_shouldnt_be_scoped {\n\tbackground-color: blue;"
},
{
"path": "test/fixtures/css-modules--false/src/not_scoped.module.css",
"chars": 36,
"preview": ".not_scoped_class {\n\tcolor: pink;\n}\n"
},
{
"path": "test/fixtures/css-modules--null/package.json",
"chars": 96,
"preview": "{\n \"name\": \"css-modules--null\",\n \"scripts\": {\n \"build\": \"microbundle --no-sourcemap\"\n }\n}\n"
},
{
"path": "test/fixtures/css-modules--null/src/index.js",
"chars": 193,
"preview": "import './not_scoped.css';\nimport scoped from './scoped.module.css';\n\nexport default function () {\n\tconst el = document."
},
{
"path": "test/fixtures/css-modules--null/src/not_scoped.css",
"chars": 123,
"preview": "body {\n\tdisplay: flex;\n\tcolor: red;\n\tbackground: blue;\n}\n\n.test_class_that_shouldnt_be_scoped {\n\tbackground-color: blue;"
},
{
"path": "test/fixtures/css-modules--null/src/scoped.module.css",
"chars": 32,
"preview": ".scoped_class {\n\tcolor: pink;\n}\n"
},
{
"path": "test/fixtures/css-modules--string/package.json",
"chars": 136,
"preview": "{\n \"name\": \"css-modules--string\",\n \"scripts\": {\n \"build\": \"microbundle --no-sourcemap --css-modules '_contains_this"
},
{
"path": "test/fixtures/css-modules--string/src/index.js",
"chars": 251,
"preview": "import global from './scoped.css';\nimport scoped from './scoped.module.css';\n\nexport default function () {\n\tconst el = d"
},
{
"path": "test/fixtures/css-modules--string/src/scoped.css",
"chars": 121,
"preview": "body {\n\tdisplay: flex;\n\tcolor: red;\n\tbackground: blue;\n}\n\n.test_class_that_should_be_scoped {\n\tbackground-color: blue;\n}"
},
{
"path": "test/fixtures/css-modules--string/src/scoped.module.css",
"chars": 32,
"preview": ".scoped_class {\n\tcolor: pink;\n}\n"
},
{
"path": "test/fixtures/css-modules--true/package.json",
"chars": 115,
"preview": "{\n \"name\": \"css-modules--true\",\n \"scripts\": {\n \"build\": \"microbundle --no-sourcemap --css-modules true\"\n }\n}\n"
},
{
"path": "test/fixtures/css-modules--true/src/index.js",
"chars": 251,
"preview": "import global from './scoped.css';\nimport scoped from './scoped.module.css';\n\nexport default function () {\n\tconst el = d"
},
{
"path": "test/fixtures/css-modules--true/src/scoped.css",
"chars": 121,
"preview": "body {\n\tdisplay: flex;\n\tcolor: red;\n\tbackground: blue;\n}\n\n.test_class_that_should_be_scoped {\n\tbackground-color: blue;\n}"
},
{
"path": "test/fixtures/css-modules--true/src/scoped.module.css",
"chars": 32,
"preview": ".scoped_class {\n\tcolor: pink;\n}\n"
},
{
"path": "test/fixtures/custom-babelrc/.babelrc",
"chars": 296,
"preview": "{\n\t\"presets\": [\n\t\t[\n\t\t\t\"@babel/preset-env\",\n\t\t\t{\n\t\t\t\t\"loose\": true,\n\t\t\t\t\"modules\": false,\n\t\t\t\t\"useBuiltIns\": \"usage\",\n\t\t"
},
{
"path": "test/fixtures/custom-babelrc/package.json",
"chars": 31,
"preview": "{\n \"name\": \"custom-babelrc\"\n}\n"
},
{
"path": "test/fixtures/custom-babelrc/src/index.js",
"chars": 124,
"preview": "export class MyClass {\n\tmyFields = ['foo', 'bar'];\n\tasync foo() {\n\t\treturn this.myFields.find(item => item === 'bar');\n\t"
},
{
"path": "test/fixtures/custom-outputs/package.json",
"chars": 278,
"preview": "{\n \"name\": \"custom-outputs\",\n \"main\": \"dist/custom-outputs.js\",\n \"umd:main\": \"dist/custom-outputs.umdx.js\",\n \"module"
},
{
"path": "test/fixtures/custom-outputs/src/index.js",
"chars": 124,
"preview": "import { two } from './two';\n\nexport default async function (...args) {\n\treturn [await two(...args), await two(...args)]"
},
{
"path": "test/fixtures/custom-outputs/src/two.js",
"chars": 96,
"preview": "export async function two(...args) {\n\treturn args.reduce((total, value) => total + value, 0);\n}\n"
},
{
"path": "test/fixtures/custom-outputs-alt/package.json",
"chars": 315,
"preview": "{\n \"name\": \"custom-outputs-alt\",\n \"cjs:main\": \"dist/custom-outputs-alt.cjsmain.js\",\n \"unpkg\": \"dist/custom-outputs-al"
},
{
"path": "test/fixtures/custom-outputs-alt/src/index.js",
"chars": 124,
"preview": "import { two } from './two';\n\nexport default async function (...args) {\n\treturn [await two(...args), await two(...args)]"
},
{
"path": "test/fixtures/custom-outputs-alt/src/two.js",
"chars": 96,
"preview": "export async function two(...args) {\n\treturn args.reduce((total, value) => total + value, 0);\n}\n"
},
{
"path": "test/fixtures/custom-source/package.json",
"chars": 66,
"preview": "{\n \"name\": \"custom-source\",\n \"source\": \"src/custom-source.js\"\n}\n"
},
{
"path": "test/fixtures/custom-source/src/custom-source.js",
"chars": 124,
"preview": "import { two } from './two';\n\nexport default async function (...args) {\n\treturn [await two(...args), await two(...args)]"
},
{
"path": "test/fixtures/custom-source/src/two.js",
"chars": 96,
"preview": "export async function two(...args) {\n\treturn args.reduce((total, value) => total + value, 0);\n}\n"
},
{
"path": "test/fixtures/custom-source-with-cwd/custom-source/package.json",
"chars": 63,
"preview": "{\n \"name\": \"custom-src\",\n \"source\": \"src/custom-source.js\"\n}\n"
},
{
"path": "test/fixtures/custom-source-with-cwd/custom-source/src/custom-source.js",
"chars": 124,
"preview": "import { two } from './two';\n\nexport default async function (...args) {\n\treturn [await two(...args), await two(...args)]"
},
{
"path": "test/fixtures/custom-source-with-cwd/custom-source/src/two.js",
"chars": 96,
"preview": "export async function two(...args) {\n\treturn args.reduce((total, value) => total + value, 0);\n}\n"
},
{
"path": "test/fixtures/custom-source-with-cwd/package.json",
"chars": 108,
"preview": "{\n \"name\": \"custom-source-with-cwd\",\n \"scripts\": {\n \"build\": \"microbundle --cwd ./custom-source\"\n }\n}\n"
},
{
"path": "test/fixtures/default-named/package.json",
"chars": 30,
"preview": "{\n \"name\": \"default-named\"\n}\n"
},
{
"path": "test/fixtures/default-named/src/index.js",
"chars": 56,
"preview": "export const foo = 42;\nexport default function bar() {}\n"
},
{
"path": "test/fixtures/define/index.js",
"chars": 119,
"preview": "const DEBUG = true;\nif (DEBUG) {\n\tconsole.log('debug mode', DEBUG);\n} else {\n\tconsole.log('production mode', DEBUG);\n}\n"
},
{
"path": "test/fixtures/define/package.json",
"chars": 106,
"preview": "{\n \"name\": \"define\",\n \"scripts\": {\n \"build\": \"microbundle --no-sourcemap --define DEBUG=false\"\n }\n}\n"
},
{
"path": "test/fixtures/define-expression/index.js",
"chars": 48,
"preview": "console.log(Object.freeze({ a: 'b', c: 'd' }));\n"
},
{
"path": "test/fixtures/define-expression/package.json",
"chars": 134,
"preview": "{\n \"name\": \"define-expression\",\n \"scripts\": {\n \"build\": \"microbundle -f esm --no-sourcemap --define @Object.freeze="
},
{
"path": "test/fixtures/esnext-ts/package.json",
"chars": 79,
"preview": "{\n \"name\": \"esnext-ts\",\n \"scripts\": {\n \"build\": \"microbundle --raw\"\n }\n}\n"
},
{
"path": "test/fixtures/esnext-ts/src/index.ts",
"chars": 154,
"preview": "export default async function foo() {\n\tconst out = [];\n\tfor await (const item of [1, 2]) {\n\t\tout.push(item);\n\t}\n\n\treturn"
},
{
"path": "test/fixtures/esnext-ts/tsconfig.json",
"chars": 74,
"preview": "{\n\t\"compilerOptions\": {\n\t\t\"baseUrl\": \".\"\n\t},\n\t\"files\": [\"src/index.ts\"]\n}\n"
},
{
"path": "test/fixtures/inline-source-map/package.json",
"chars": 100,
"preview": "{\n \"name\": \"inline-source-map\",\n \"scripts\": {\n \"build\": \"microbundle --sourcemap inline\"\n }\n}\n"
},
{
"path": "test/fixtures/inline-source-map/src/index.js",
"chars": 124,
"preview": "import { two } from './two';\n\nexport default async function (...args) {\n\treturn [await two(...args), await two(...args)]"
},
{
"path": "test/fixtures/inline-source-map/src/two.js",
"chars": 96,
"preview": "export async function two(...args) {\n\treturn args.reduce((total, value) => total + value, 0);\n}\n"
},
{
"path": "test/fixtures/jsx/index.js",
"chars": 335,
"preview": "const h = (tag, props, ...children) => ({ tag, props, children });\n// eslint-disable-next-line no-unused-vars\nconst Frag"
},
{
"path": "test/fixtures/jsx/package.json",
"chars": 20,
"preview": "{\n \"name\": \"jsx\"\n}\n"
},
{
"path": "test/fixtures/macro/package.json",
"chars": 26,
"preview": "{\n \"name\": \"macro-lib\"\n}\n"
},
{
"path": "test/fixtures/macro/src/index.js",
"chars": 78,
"preview": "import { macro } from './macro';\n\nconst name = macro();\n\nexport default name;\n"
},
{
"path": "test/fixtures/macro/src/macro.js",
"chars": 599,
"preview": "import { createMacro } from 'babel-plugin-macros';\n\nfunction myMacro({ references, state, babel }) {\n\tconst { types: t }"
},
{
"path": "test/fixtures/mangle-json-file/mangle.json",
"chars": 174,
"preview": "{\n \"minify\": {\n \"mangle\": {\n \"properties\": {\n \"regex\": \"^_\"\n }\n }\n },\n \"props\": {\n \"cname\":"
},
{
"path": "test/fixtures/mangle-json-file/package.json",
"chars": 33,
"preview": "{\n \"name\": \"mangle-json-file\"\n}\n"
},
{
"path": "test/fixtures/mangle-json-file/src/index.js",
"chars": 125,
"preview": "import { two } from './two';\n\nexport default function () {\n\tconsole.log(two.prop1);\n\tconsole.log(two._prop2);\n\treturn tw"
},
{
"path": "test/fixtures/mangle-json-file/src/two.js",
"chars": 47,
"preview": "export const two = {\n\tprop1: 1,\n\t_prop2: 2,\n};\n"
},
{
"path": "test/fixtures/minify-config/package.json",
"chars": 123,
"preview": "{\n \"name\": \"minify-config\",\n \"minify\": {\n \"mangle\": {\n \"properties\": {\n \"regex\": \"^_\"\n }\n }\n }"
},
{
"path": "test/fixtures/minify-config/src/index.js",
"chars": 125,
"preview": "import { two } from './two';\n\nexport default function () {\n\tconsole.log(two.prop1);\n\tconsole.log(two._prop2);\n\treturn tw"
},
{
"path": "test/fixtures/minify-config/src/two.js",
"chars": 47,
"preview": "export const two = {\n\tprop1: 1,\n\t_prop2: 2,\n};\n"
},
{
"path": "test/fixtures/minify-config-boolean/package.json",
"chars": 99,
"preview": "{\n \"name\": \"minify-config-boolean\",\n \"minify\": {\n \"compress\": true,\n \"mangle\": false\n }\n}\n"
},
{
"path": "test/fixtures/minify-config-boolean/src/index.js",
"chars": 125,
"preview": "import { two } from './two';\n\nexport default function () {\n\tconsole.log(two.prop1);\n\tconsole.log(two._prop2);\n\treturn tw"
},
{
"path": "test/fixtures/minify-config-boolean/src/two.js",
"chars": 47,
"preview": "export const two = {\n\tprop1: 1,\n\t_prop2: 2,\n};\n"
},
{
"path": "test/fixtures/minify-path-config/minify.json",
"chars": 174,
"preview": "{\n \"minify\": {\n \"mangle\": {\n \"properties\": {\n \"regex\": \"^_\"\n }\n }\n },\n \"props\": {\n \"cname\":"
},
{
"path": "test/fixtures/minify-path-config/package.json",
"chars": 64,
"preview": "{\n \"name\": \"minify-path-config\",\n \"minify\": \"./minify.json\"\n}\n"
},
{
"path": "test/fixtures/minify-path-config/src/index.js",
"chars": 125,
"preview": "import { two } from './two';\n\nexport default function () {\n\tconsole.log(two.prop1);\n\tconsole.log(two._prop2);\n\treturn tw"
},
{
"path": "test/fixtures/minify-path-config/src/two.js",
"chars": 47,
"preview": "export const two = {\n\tprop1: 1,\n\t_prop2: 2,\n};\n"
},
{
"path": "test/fixtures/minify-path-parent-dir-with-cwd/minify-path-parent-dir/index.js",
"chars": 125,
"preview": "import { two } from './two';\n\nexport default function () {\n\tconsole.log(two.prop1);\n\tconsole.log(two._prop2);\n\treturn tw"
},
{
"path": "test/fixtures/minify-path-parent-dir-with-cwd/minify-path-parent-dir/package.json",
"chars": 69,
"preview": "{\n \"name\": \"minify-path-parent-dir\",\n \"minify\": \"../minify.json\"\n}\n"
},
{
"path": "test/fixtures/minify-path-parent-dir-with-cwd/minify-path-parent-dir/two.js",
"chars": 47,
"preview": "export const two = {\n\tprop1: 1,\n\t_prop2: 2,\n};\n"
},
{
"path": "test/fixtures/minify-path-parent-dir-with-cwd/minify.json",
"chars": 174,
"preview": "{\n \"minify\": {\n \"mangle\": {\n \"properties\": {\n \"regex\": \"^_\"\n }\n }\n },\n \"props\": {\n \"cname\":"
},
{
"path": "test/fixtures/minify-path-parent-dir-with-cwd/package.json",
"chars": 126,
"preview": "{\n \"name\": \"minify-path-parent-dir-with-cwd\",\n \"scripts\": {\n \"build\": \"microbundle --cwd ./minify-path-parent-dir\"\n"
},
{
"path": "test/fixtures/modern/package.json",
"chars": 84,
"preview": "{\n \"name\": \"modern-lib\",\n \"scripts\": {\n \"build\": \"microbundle -f modern\"\n }\n}\n"
},
{
"path": "test/fixtures/modern/src/index.js",
"chars": 124,
"preview": "import { two } from './two';\n\nexport default async function (...args) {\n\treturn [await two(...args), await two(...args)]"
},
{
"path": "test/fixtures/modern/src/two.js",
"chars": 96,
"preview": "export async function two(...args) {\n\treturn args.reduce((total, value) => total + value, 0);\n}\n"
},
{
"path": "test/fixtures/modern-generators/package.json",
"chars": 102,
"preview": "{\n \"name\": \"modern-generators\",\n \"scripts\": {\n \"build\": \"microbundle -f modern,es,umd,cjs\"\n }\n}\n"
},
{
"path": "test/fixtures/modern-generators/src/index.js",
"chars": 141,
"preview": "import { idMaker } from './two';\n\nexport default async function () {\n\tconst gen = idMaker();\n\treturn [gen.next().value, "
},
{
"path": "test/fixtures/modern-generators/src/two.js",
"chars": 76,
"preview": "export function* idMaker() {\n\tlet index = 0;\n\twhile (true) yield index++;\n}\n"
},
{
"path": "test/fixtures/name-custom-amd/package.json",
"chars": 62,
"preview": "{\n \"name\": \"name-custom-amd\",\n \"amdName\": \"customNameAmd\"\n}\n"
},
{
"path": "test/fixtures/name-custom-amd/src/index.js",
"chars": 124,
"preview": "import { two } from './two';\n\nexport default async function (...args) {\n\treturn [await two(...args), await two(...args)]"
},
{
"path": "test/fixtures/name-custom-amd/src/two.js",
"chars": 96,
"preview": "export async function two(...args) {\n\treturn args.reduce((total, value) => total + value, 0);\n}\n"
},
{
"path": "test/fixtures/name-custom-cli/package.json",
"chars": 96,
"preview": "{\n \"name\": \"name-custom\",\n \"scripts\": {\n \"build\": \"microbundle --name nameCustomCli\"\n }\n}\n"
},
{
"path": "test/fixtures/name-custom-cli/src/index.js",
"chars": 124,
"preview": "import { two } from './two';\n\nexport default async function (...args) {\n\treturn [await two(...args), await two(...args)]"
},
{
"path": "test/fixtures/name-custom-cli/src/two.js",
"chars": 96,
"preview": "export async function two(...args) {\n\treturn args.reduce((total, value) => total + value, 0);\n}\n"
},
{
"path": "test/fixtures/no-pkg/src/index.js",
"chars": 124,
"preview": "import { two } from './two';\n\nexport default async function (...args) {\n\treturn [await two(...args), await two(...args)]"
},
{
"path": "test/fixtures/no-pkg/src/two.js",
"chars": 96,
"preview": "export async function two(...args) {\n\treturn args.reduce((total, value) => total + value, 0);\n}\n"
},
{
"path": "test/fixtures/no-pkg-name/package.json",
"chars": 3,
"preview": "{}\n"
},
{
"path": "test/fixtures/no-pkg-name/src/index.js",
"chars": 124,
"preview": "import { two } from './two';\n\nexport default async function (...args) {\n\treturn [await two(...args), await two(...args)]"
},
{
"path": "test/fixtures/no-pkg-name/src/two.js",
"chars": 96,
"preview": "export async function two(...args) {\n\treturn args.reduce((total, value) => total + value, 0);\n}\n"
},
{
"path": "test/fixtures/optional-chaining-ts/package.json",
"chars": 37,
"preview": "{\n \"name\": \"optional-chaining-ts\"\n}\n"
},
{
"path": "test/fixtures/optional-chaining-ts/src/index.ts",
"chars": 131,
"preview": "export function chain(test: {\n\tmaybeVar?: { thing: string };\n}): string | undefined {\n\treturn test.maybeVar?.thing ?? un"
},
{
"path": "test/fixtures/optional-chaining-ts/tsconfig.json",
"chars": 74,
"preview": "{\n\t\"compilerOptions\": {\n\t\t\"baseUrl\": \".\"\n\t},\n\t\"files\": [\"src/index.ts\"]\n}\n"
},
{
"path": "test/fixtures/parameters-rest-closure/package.json",
"chars": 40,
"preview": "{\n \"name\": \"parameters-rest-closure\"\n}\n"
},
{
"path": "test/fixtures/parameters-rest-closure/src/index.js",
"chars": 206,
"preview": "export function parametersRestWithClosure(fn, ...args) {\n\treturn function () {\n\t\tfn(...args);\n\t};\n}\n\nexport function par"
},
{
"path": "test/fixtures/pretty/package.json",
"chars": 23,
"preview": "{\n \"name\": \"pretty\"\n}\n"
},
{
"path": "test/fixtures/pretty/src/index.js",
"chars": 5500,
"preview": "export const allTheIpsum = `\n\nThere is immense joy in just watching - watching all the little creatures in nature. I'll "
},
{
"path": "test/fixtures/publish-config/package.json",
"chars": 189,
"preview": "{\n \"name\": \"publish-config\",\n \"main\": \"src/foo.ts\",\n \"publishConfig\": {\n \"source\": \"src/foo.ts\",\n \"main\": \"dist"
},
{
"path": "test/fixtures/publish-config/src/foo.ts",
"chars": 38,
"preview": "export function foo() {\n\treturn 42;\n}\n"
},
{
"path": "test/fixtures/pure/package.json",
"chars": 21,
"preview": "{\n \"name\": \"pure\"\n}\n"
},
{
"path": "test/fixtures/pure/src/index.js",
"chars": 171,
"preview": "// this is currently broken because of a bug in terser\n// https://github.com/terser-js/terser/issues/353\n/** @__PURE__ *"
},
{
"path": "test/fixtures/raw/package.json",
"chars": 73,
"preview": "{\n \"name\": \"raw\",\n \"scripts\": {\n \"build\": \"microbundle --raw\"\n }\n}\n"
},
{
"path": "test/fixtures/raw/src/index.js",
"chars": 2842,
"preview": "export const OneKilobyteOfBobRoss = `\n\tWe might as well make some Almighty mountains today as well, what the heck.\n\tIn y"
},
{
"path": "test/fixtures/shebang/package.json",
"chars": 24,
"preview": "{\n \"name\": \"shebang\"\n}\n"
},
{
"path": "test/fixtures/shebang/src/index.js",
"chars": 70,
"preview": "#!/usr/bin/env node\n\nexport function foo() {\n\treturn 'hello world';\n}\n"
}
]
// ... and 33 more files (download for full content)
About this extraction
This page contains the full source code of the developit/microbundle GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 233 files (265.4 KB), approximately 95.8k tokens, and a symbol index with 99 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.