Showing preview only (535K chars total). Download the full file or copy to clipboard to get everything.
Repository: esperantojs/esperanto
Branch: master
Commit: 799b307e263d
Files: 1161
Total size: 300.9 KB
Directory structure:
gitextract_0c8mkpe7/
├── .babelrc
├── .editorconfig
├── .gitignore
├── .jshintrc
├── .travis.yml
├── CHANGELOG.md
├── README.md
├── appveyor.yml
├── bin/
│ ├── handleError.js
│ ├── help.md
│ ├── index.js
│ ├── runEsperanto.js
│ └── showHelp.js
├── comparison/
│ ├── README.md
│ ├── index.js
│ ├── output/
│ │ ├── esperanto/
│ │ │ ├── batchImports.js
│ │ │ ├── defaultExport.js
│ │ │ ├── defaultImport.js
│ │ │ ├── groupedExports.js
│ │ │ ├── inlineNamedExports.js
│ │ │ ├── mixedImports.js
│ │ │ ├── namedExports.js
│ │ │ ├── namedImports.js
│ │ │ └── renamingImports.js
│ │ ├── traceur/
│ │ │ ├── batchImports.js
│ │ │ ├── defaultExport.js
│ │ │ ├── defaultImport.js
│ │ │ ├── groupedExports.js
│ │ │ ├── inlineNamedExports.js
│ │ │ ├── mixedImports.js
│ │ │ ├── namedExports.js
│ │ │ ├── namedImports.js
│ │ │ └── renamingImports.js
│ │ └── transpile/
│ │ ├── batchImports.js
│ │ ├── defaultExport.js
│ │ ├── defaultImport.js
│ │ ├── groupedExports.js
│ │ ├── inlineNamedExports.js
│ │ ├── mixedImports.js
│ │ ├── namedExports.js
│ │ ├── namedImports.js
│ │ └── renamingImports.js
│ ├── package.json
│ └── samples/
│ ├── batchImports.js
│ ├── defaultExport.js
│ ├── defaultImport.js
│ ├── groupedExports.js
│ ├── inlineNamedExports.js
│ ├── mixedImports.js
│ ├── namedExports.js
│ ├── namedImports.js
│ └── renamingImports.js
├── gobblefile.js
├── package.json
├── src/
│ ├── banner.js
│ ├── bundler/
│ │ ├── builders/
│ │ │ ├── concat.js
│ │ │ ├── defaultsMode/
│ │ │ │ ├── amd.js
│ │ │ │ ├── cjs.js
│ │ │ │ ├── index.js
│ │ │ │ └── umd.js
│ │ │ ├── index.js
│ │ │ └── strictMode/
│ │ │ ├── amd.js
│ │ │ ├── cjs.js
│ │ │ ├── index.js
│ │ │ ├── umd.js
│ │ │ └── utils/
│ │ │ └── getExportBlock.js
│ │ ├── combine/
│ │ │ ├── getRenamedImports.js
│ │ │ ├── index.js
│ │ │ ├── populateExternalModuleImports.js
│ │ │ ├── populateIdentifierReplacements.js
│ │ │ ├── populateModuleNames.js
│ │ │ ├── resolveExports.js
│ │ │ ├── topLevelScopeConflicts.js
│ │ │ └── transformBody.js
│ │ ├── getBundle.js
│ │ ├── getModule.js
│ │ └── utils/
│ │ ├── resolveChains.js
│ │ └── sortModules.js
│ ├── esperanto.js
│ ├── standalone/
│ │ ├── builders/
│ │ │ ├── defaultsMode/
│ │ │ │ ├── amd.js
│ │ │ │ ├── cjs.js
│ │ │ │ ├── index.js
│ │ │ │ ├── umd.js
│ │ │ │ └── utils/
│ │ │ │ └── transformExportDeclaration.js
│ │ │ ├── index.js
│ │ │ └── strictMode/
│ │ │ ├── amd.js
│ │ │ ├── cjs.js
│ │ │ ├── index.js
│ │ │ ├── umd.js
│ │ │ └── utils/
│ │ │ ├── gatherImports.js
│ │ │ ├── getExportNames.js
│ │ │ ├── getImportSummary.js
│ │ │ └── transformBody.js
│ │ └── getModule.js
│ └── utils/
│ ├── EsperantoError.js
│ ├── amd/
│ │ ├── amdIntro.js
│ │ ├── getImportSummary.js
│ │ ├── processIds.js
│ │ └── processName.js
│ ├── ast/
│ │ ├── annotate.js
│ │ ├── disallowIllegalReassignment.js
│ │ ├── findImportsAndExports.js
│ │ ├── getUnscopedNames.js
│ │ ├── replaceIdentifiers.js
│ │ ├── rewriteExportAssignments.js
│ │ ├── traverse.js
│ │ └── walk.js
│ ├── builtins.js
│ ├── disallowConflictingImports.js
│ ├── getReadOnlyIdentifiers.js
│ ├── hasNamedExports.js
│ ├── hasNamedImports.js
│ ├── hasOwnProp.js
│ ├── mappers.js
│ ├── packageResult.js
│ ├── promiseSequence.js
│ ├── resolveId.js
│ ├── sanitize.js
│ └── umd/
│ ├── requireName.js
│ └── umdIntro.js
└── test/
├── .jshintrc
├── bundle/
│ ├── index.js
│ ├── input/
│ │ ├── 01/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 02/
│ │ │ ├── _config.js
│ │ │ ├── foo/
│ │ │ │ └── index.js
│ │ │ └── main.js
│ │ ├── 03/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 04/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 05/
│ │ │ ├── _config.js
│ │ │ ├── main.js
│ │ │ └── numbers.js
│ │ ├── 06/
│ │ │ ├── _config.js
│ │ │ ├── main.js
│ │ │ └── nested/
│ │ │ └── foo.js
│ │ ├── 07/
│ │ │ ├── _config.js
│ │ │ ├── bar.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 08/
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 09/
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 10/
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 11/
│ │ │ ├── _config.js
│ │ │ ├── a.js
│ │ │ ├── b.js
│ │ │ └── main.js
│ │ ├── 12/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 13/
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 14/
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 15/
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 16/
│ │ │ ├── _config.js
│ │ │ ├── a.js
│ │ │ ├── b.js
│ │ │ ├── c.js
│ │ │ └── main.js
│ │ ├── 17/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 18/
│ │ │ ├── _config.js
│ │ │ ├── bar.js
│ │ │ ├── doThing.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 19/
│ │ │ ├── _config.js
│ │ │ ├── hasOwnProperty.js
│ │ │ └── main.js
│ │ ├── 20/
│ │ │ ├── _config.js
│ │ │ ├── main.js
│ │ │ └── objectUtils.js
│ │ ├── 21/
│ │ │ ├── _config.js
│ │ │ ├── config.js
│ │ │ └── main.js
│ │ ├── 22/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 23/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 24/
│ │ │ ├── _config.js
│ │ │ ├── bar.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 25/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 26/
│ │ │ ├── _config.js
│ │ │ ├── bar.js
│ │ │ └── main.js
│ │ ├── 27/
│ │ │ ├── _config.js
│ │ │ ├── bar.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 28/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 29/
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 30/
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 31/
│ │ │ ├── _config.js
│ │ │ ├── exportedX.js
│ │ │ ├── main.js
│ │ │ └── notExportedX.js
│ │ ├── 32/
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 33/
│ │ │ ├── Math.js
│ │ │ ├── Promise.js
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 34/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 35/
│ │ │ ├── _config.js
│ │ │ ├── js_modules/
│ │ │ │ ├── a.js
│ │ │ │ ├── c.js
│ │ │ │ └── external/
│ │ │ │ ├── js_modules/
│ │ │ │ │ └── b.js
│ │ │ │ ├── package.json
│ │ │ │ └── src/
│ │ │ │ └── external.js
│ │ │ └── main.js
│ │ ├── 36/
│ │ │ ├── _config.js
│ │ │ ├── js_modules/
│ │ │ │ └── external/
│ │ │ │ ├── package.json
│ │ │ │ └── src/
│ │ │ │ ├── dependsOnExternal.js
│ │ │ │ └── external.js
│ │ │ └── main.js
│ │ ├── 37/
│ │ │ ├── _config.js
│ │ │ ├── a.js
│ │ │ └── main.js
│ │ ├── 38/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 39/
│ │ │ ├── _config.js
│ │ │ ├── bar.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 40/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 42/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 43/
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 44/
│ │ │ ├── _config.js
│ │ │ ├── a.js
│ │ │ ├── b.js
│ │ │ └── main.js
│ │ ├── 45/
│ │ │ └── _config.js
│ │ ├── 46/
│ │ │ └── _config.js
│ │ ├── 47/
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 48/
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 49/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 50/
│ │ │ ├── A.js
│ │ │ ├── B.js
│ │ │ ├── C.js
│ │ │ ├── D.js
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 51/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 52/
│ │ │ ├── _config.js
│ │ │ ├── bar.js
│ │ │ ├── external/
│ │ │ │ ├── baz.js
│ │ │ │ └── foo.js
│ │ │ └── main.js
│ │ ├── 53/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 54/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 55/
│ │ │ ├── A.js
│ │ │ ├── B.js
│ │ │ ├── C.js
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 56/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 57/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 58/
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 59/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ └── 60/
│ │ ├── _config.js
│ │ ├── bar.js
│ │ ├── foo.js
│ │ └── main.js
│ └── output/
│ ├── amd/
│ │ ├── 01.js
│ │ ├── 02.js
│ │ ├── 03.js
│ │ ├── 04.js
│ │ ├── 05.js
│ │ ├── 06.js
│ │ ├── 07.js
│ │ ├── 08.js
│ │ ├── 09.js
│ │ ├── 10.js
│ │ ├── 11.js
│ │ ├── 14.js
│ │ ├── 15.js
│ │ ├── 16.js
│ │ ├── 17.js
│ │ ├── 18.js
│ │ ├── 19.js
│ │ ├── 20.js
│ │ ├── 21.js
│ │ ├── 22.js
│ │ ├── 24.js
│ │ ├── 25.js
│ │ ├── 26.js
│ │ ├── 27.js
│ │ ├── 28.js
│ │ ├── 29.js
│ │ ├── 30.js
│ │ ├── 31.js
│ │ ├── 32.js
│ │ ├── 33.js
│ │ ├── 34.js
│ │ ├── 35.js
│ │ ├── 36.js
│ │ ├── 37.js
│ │ ├── 38.js
│ │ ├── 40.js
│ │ ├── 42.js
│ │ ├── 43.js
│ │ ├── 44.js
│ │ ├── 45.js
│ │ ├── 46.js
│ │ ├── 47.js
│ │ ├── 48.js
│ │ ├── 49.js
│ │ ├── 50.js
│ │ ├── 51.js
│ │ ├── 52.js
│ │ ├── 53.js
│ │ ├── 54.js
│ │ ├── 55.js
│ │ ├── 56.js
│ │ ├── 57.js
│ │ ├── 58.js
│ │ ├── 59.js
│ │ └── 60.js
│ ├── amdDefaults/
│ │ ├── 01.js
│ │ ├── 02.js
│ │ ├── 03.js
│ │ ├── 04.js
│ │ ├── 06.js
│ │ ├── 07.js
│ │ ├── 08.js
│ │ ├── 09.js
│ │ ├── 10.js
│ │ ├── 14.js
│ │ ├── 16.js
│ │ ├── 17.js
│ │ ├── 18.js
│ │ ├── 19.js
│ │ ├── 20.js
│ │ ├── 21.js
│ │ ├── 24.js
│ │ ├── 25.js
│ │ ├── 26.js
│ │ ├── 27.js
│ │ ├── 28.js
│ │ ├── 30.js
│ │ ├── 31.js
│ │ ├── 32.js
│ │ ├── 33.js
│ │ ├── 34.js
│ │ ├── 35.js
│ │ ├── 36.js
│ │ ├── 37.js
│ │ ├── 38.js
│ │ ├── 40.js
│ │ ├── 42.js
│ │ ├── 43.js
│ │ ├── 44.js
│ │ ├── 45.js
│ │ ├── 46.js
│ │ ├── 47.js
│ │ ├── 48.js
│ │ ├── 49.js
│ │ ├── 50.js
│ │ ├── 51.js
│ │ ├── 52.js
│ │ ├── 53.js
│ │ ├── 54.js
│ │ ├── 55.js
│ │ ├── 56.js
│ │ ├── 57.js
│ │ ├── 59.js
│ │ └── 60.js
│ ├── cjs/
│ │ ├── 01.js
│ │ ├── 02.js
│ │ ├── 03.js
│ │ ├── 04.js
│ │ ├── 05.js
│ │ ├── 06.js
│ │ ├── 07.js
│ │ ├── 08.js
│ │ ├── 09.js
│ │ ├── 10.js
│ │ ├── 11.js
│ │ ├── 14.js
│ │ ├── 15.js
│ │ ├── 16.js
│ │ ├── 17.js
│ │ ├── 18.js
│ │ ├── 19.js
│ │ ├── 20.js
│ │ ├── 21.js
│ │ ├── 22.js
│ │ ├── 24.js
│ │ ├── 25.js
│ │ ├── 26.js
│ │ ├── 27.js
│ │ ├── 28.js
│ │ ├── 29.js
│ │ ├── 30.js
│ │ ├── 31.js
│ │ ├── 32.js
│ │ ├── 33.js
│ │ ├── 34.js
│ │ ├── 35.js
│ │ ├── 36.js
│ │ ├── 37.js
│ │ ├── 38.js
│ │ ├── 40.js
│ │ ├── 42.js
│ │ ├── 43.js
│ │ ├── 44.js
│ │ ├── 45.js
│ │ ├── 46.js
│ │ ├── 47.js
│ │ ├── 48.js
│ │ ├── 49.js
│ │ ├── 50.js
│ │ ├── 51.js
│ │ ├── 52.js
│ │ ├── 53.js
│ │ ├── 54.js
│ │ ├── 55.js
│ │ ├── 56.js
│ │ ├── 57.js
│ │ ├── 58.js
│ │ ├── 59.js
│ │ └── 60.js
│ ├── cjsDefaults/
│ │ ├── 01.js
│ │ ├── 02.js
│ │ ├── 03.js
│ │ ├── 04.js
│ │ ├── 06.js
│ │ ├── 07.js
│ │ ├── 08.js
│ │ ├── 09.js
│ │ ├── 10.js
│ │ ├── 14.js
│ │ ├── 16.js
│ │ ├── 17.js
│ │ ├── 18.js
│ │ ├── 19.js
│ │ ├── 20.js
│ │ ├── 21.js
│ │ ├── 24.js
│ │ ├── 25.js
│ │ ├── 26.js
│ │ ├── 27.js
│ │ ├── 28.js
│ │ ├── 30.js
│ │ ├── 31.js
│ │ ├── 32.js
│ │ ├── 33.js
│ │ ├── 34.js
│ │ ├── 35.js
│ │ ├── 36.js
│ │ ├── 37.js
│ │ ├── 38.js
│ │ ├── 40.js
│ │ ├── 42.js
│ │ ├── 43.js
│ │ ├── 44.js
│ │ ├── 45.js
│ │ ├── 46.js
│ │ ├── 47.js
│ │ ├── 48.js
│ │ ├── 49.js
│ │ ├── 50.js
│ │ ├── 51.js
│ │ ├── 52.js
│ │ ├── 53.js
│ │ ├── 54.js
│ │ ├── 55.js
│ │ ├── 56.js
│ │ ├── 57.js
│ │ ├── 59.js
│ │ └── 60.js
│ ├── concat/
│ │ ├── 01.js
│ │ ├── 02.js
│ │ ├── 07.js
│ │ ├── 16.js
│ │ ├── 17.js
│ │ ├── 18.js
│ │ ├── 19.js
│ │ ├── 21.js
│ │ ├── 24.js
│ │ ├── 25.js
│ │ ├── 26.js
│ │ ├── 27.js
│ │ ├── 28.js
│ │ ├── 31.js
│ │ ├── 32.js
│ │ ├── 33.js
│ │ ├── 35.js
│ │ ├── 36.js
│ │ ├── 38.js
│ │ ├── 40.js
│ │ ├── 42.js
│ │ ├── 45.js
│ │ ├── 46.js
│ │ ├── 47.js
│ │ ├── 49.js
│ │ ├── 50.js
│ │ ├── 52.js
│ │ ├── 55.js
│ │ ├── 56.js
│ │ ├── 57.js
│ │ ├── 59.js
│ │ └── 60.js
│ ├── umd/
│ │ ├── 01.js
│ │ ├── 02.js
│ │ ├── 03.js
│ │ ├── 04.js
│ │ ├── 05.js
│ │ ├── 06.js
│ │ ├── 07.js
│ │ ├── 08.js
│ │ ├── 09.js
│ │ ├── 10.js
│ │ ├── 11.js
│ │ ├── 14.js
│ │ ├── 15.js
│ │ ├── 16.js
│ │ ├── 17.js
│ │ ├── 18.js
│ │ ├── 19.js
│ │ ├── 20.js
│ │ ├── 21.js
│ │ ├── 22.js
│ │ ├── 24.js
│ │ ├── 25.js
│ │ ├── 26.js
│ │ ├── 27.js
│ │ ├── 28.js
│ │ ├── 29.js
│ │ ├── 30.js
│ │ ├── 31.js
│ │ ├── 32.js
│ │ ├── 33.js
│ │ ├── 34.js
│ │ ├── 35.js
│ │ ├── 36.js
│ │ ├── 37.js
│ │ ├── 38.js
│ │ ├── 40.js
│ │ ├── 42.js
│ │ ├── 43.js
│ │ ├── 44.js
│ │ ├── 45.js
│ │ ├── 46.js
│ │ ├── 47.js
│ │ ├── 48.js
│ │ ├── 49.js
│ │ ├── 50.js
│ │ ├── 51.js
│ │ ├── 52.js
│ │ ├── 53.js
│ │ ├── 54.js
│ │ ├── 55.js
│ │ ├── 56.js
│ │ ├── 57.js
│ │ ├── 58.js
│ │ ├── 59.js
│ │ └── 60.js
│ └── umdDefaults/
│ ├── 01.js
│ ├── 02.js
│ ├── 03.js
│ ├── 04.js
│ ├── 06.js
│ ├── 07.js
│ ├── 08.js
│ ├── 09.js
│ ├── 10.js
│ ├── 14.js
│ ├── 16.js
│ ├── 17.js
│ ├── 18.js
│ ├── 19.js
│ ├── 20.js
│ ├── 21.js
│ ├── 24.js
│ ├── 25.js
│ ├── 26.js
│ ├── 27.js
│ ├── 28.js
│ ├── 30.js
│ ├── 31.js
│ ├── 32.js
│ ├── 33.js
│ ├── 34.js
│ ├── 35.js
│ ├── 36.js
│ ├── 37.js
│ ├── 38.js
│ ├── 40.js
│ ├── 42.js
│ ├── 43.js
│ ├── 44.js
│ ├── 45.js
│ ├── 46.js
│ ├── 47.js
│ ├── 48.js
│ ├── 49.js
│ ├── 50.js
│ ├── 51.js
│ ├── 52.js
│ ├── 53.js
│ ├── 54.js
│ ├── 55.js
│ ├── 56.js
│ ├── 57.js
│ ├── 59.js
│ └── 60.js
├── es6-module-transpiler-tests/
│ ├── README.md
│ ├── bundled-output/
│ │ ├── bare-import.js
│ │ ├── bindings.js
│ │ ├── cycles-defaults.js
│ │ ├── cycles-immediate.js
│ │ ├── cycles.js
│ │ ├── export-and-import-reference-share-var.js
│ │ ├── export-default-function.js
│ │ ├── export-default-named-function.js
│ │ ├── export-default.js
│ │ ├── export-from-default.js
│ │ ├── export-from.js
│ │ ├── export-function.js
│ │ ├── export-list.js
│ │ ├── export-mixins.js
│ │ ├── export-var.js
│ │ ├── import-as.js
│ │ ├── import-chain.js
│ │ ├── import-order.js
│ │ ├── module-level-declarations.js
│ │ ├── named-function-expression.js
│ │ ├── namespaces.js
│ │ ├── re-export-default-import.js
│ │ └── this-binding-undefined.js
│ ├── input/
│ │ ├── bare-import/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── bindings/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── cycles/
│ │ │ ├── _config.js
│ │ │ ├── a.js
│ │ │ ├── b.js
│ │ │ └── c.js
│ │ ├── cycles-defaults/
│ │ │ ├── _config.js
│ │ │ ├── a.js
│ │ │ ├── b.js
│ │ │ └── importer.js
│ │ ├── cycles-immediate/
│ │ │ ├── _config.js
│ │ │ ├── evens.js
│ │ │ ├── main.js
│ │ │ └── odds.js
│ │ ├── duplicate-import-fails/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── duplicate-import-specifier-fails/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── export-and-import-reference-share-var/
│ │ │ ├── _config.js
│ │ │ ├── first.js
│ │ │ └── second.js
│ │ ├── export-default/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── export-default-function/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── export-default-named-function/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── export-from/
│ │ │ ├── _config.js
│ │ │ ├── first.js
│ │ │ ├── second.js
│ │ │ └── third.js
│ │ ├── export-from-default/
│ │ │ ├── _config.js
│ │ │ ├── first.js
│ │ │ ├── second.js
│ │ │ └── third.js
│ │ ├── export-function/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── export-list/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── export-mixins/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── export-not-at-top-level-fails/
│ │ │ ├── _config.js
│ │ │ └── index.js
│ │ ├── export-var/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── import-as/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── import-chain/
│ │ │ ├── _config.js
│ │ │ ├── first.js
│ │ │ ├── second.js
│ │ │ └── third.js
│ │ ├── import-not-at-top-level-fails/
│ │ │ ├── _config.js
│ │ │ └── index.js
│ │ ├── import-order/
│ │ │ ├── _config.js
│ │ │ ├── consumer.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── module-level-declarations/
│ │ │ ├── _config.js
│ │ │ └── mod.js
│ │ ├── named-function-expression/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── namespace-reassign-import-fails/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── namespace-update-import-fails/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── namespaces/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── re-export-default-import/
│ │ │ ├── _config.js
│ │ │ ├── first.js
│ │ │ ├── second.js
│ │ │ └── third.js
│ │ ├── reassign-import-fails/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── reassign-import-not-at-top-level-fails/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── this-binding-undefined/
│ │ │ ├── _config.js
│ │ │ └── mod.js
│ │ └── update-expression-of-import-fails/
│ │ ├── _config.js
│ │ ├── exporter.js
│ │ └── importer.js
│ └── output/
│ ├── bare-import/
│ │ ├── exporter.js
│ │ └── importer.js
│ ├── bindings/
│ │ ├── exporter.js
│ │ └── importer.js
│ ├── cycles/
│ │ ├── a.js
│ │ ├── b.js
│ │ └── c.js
│ ├── cycles-defaults/
│ │ ├── a.js
│ │ ├── b.js
│ │ └── importer.js
│ ├── cycles-immediate/
│ │ ├── evens.js
│ │ ├── main.js
│ │ └── odds.js
│ ├── duplicate-import-fails/
│ │ └── exporter.js
│ ├── duplicate-import-specifier-fails/
│ │ └── exporter.js
│ ├── export-and-import-reference-share-var/
│ │ ├── first.js
│ │ └── second.js
│ ├── export-default/
│ │ ├── exporter.js
│ │ └── importer.js
│ ├── export-default-function/
│ │ ├── exporter.js
│ │ └── importer.js
│ ├── export-default-named-function/
│ │ ├── exporter.js
│ │ └── importer.js
│ ├── export-from/
│ │ ├── first.js
│ │ ├── second.js
│ │ └── third.js
│ ├── export-from-default/
│ │ ├── first.js
│ │ ├── second.js
│ │ └── third.js
│ ├── export-function/
│ │ ├── exporter.js
│ │ └── importer.js
│ ├── export-list/
│ │ ├── exporter.js
│ │ └── importer.js
│ ├── export-mixins/
│ │ ├── exporter.js
│ │ └── importer.js
│ ├── export-var/
│ │ ├── exporter.js
│ │ └── importer.js
│ ├── import-as/
│ │ ├── exporter.js
│ │ └── importer.js
│ ├── import-chain/
│ │ ├── first.js
│ │ ├── second.js
│ │ └── third.js
│ ├── import-order/
│ │ ├── consumer.js
│ │ ├── exporter.js
│ │ └── importer.js
│ ├── module-level-declarations/
│ │ └── mod.js
│ ├── named-function-expression/
│ │ ├── exporter.js
│ │ └── importer.js
│ ├── namespace-reassign-import-fails/
│ │ └── exporter.js
│ ├── namespace-update-import-fails/
│ │ └── exporter.js
│ ├── namespaces/
│ │ ├── exporter.js
│ │ └── importer.js
│ ├── re-export-default-import/
│ │ ├── first.js
│ │ ├── second.js
│ │ └── third.js
│ ├── reassign-import-fails/
│ │ └── exporter.js
│ ├── reassign-import-not-at-top-level-fails/
│ │ └── exporter.js
│ ├── this-binding-undefined/
│ │ └── mod.js
│ └── update-expression-of-import-fails/
│ └── exporter.js
├── fastMode/
│ ├── index.js
│ └── output/
│ ├── amd/
│ │ ├── absolutePaths.js
│ │ ├── banner.js
│ │ ├── bannerAndFooter.js
│ │ ├── constructor.js
│ │ ├── earlyExport.js
│ │ ├── emptyImport.js
│ │ ├── emptyImportWithDefaultExport.js
│ │ ├── escapedSource.js
│ │ ├── exportAnonFunction.js
│ │ ├── exportClassWithSuper.js
│ │ ├── exportDefault.js
│ │ ├── exportFunction.js
│ │ ├── footer.js
│ │ ├── importAll.js
│ │ ├── importDefault.js
│ │ ├── intermediateSourcemaps.js
│ │ ├── multipleImports.js
│ │ ├── namedAmdModule.js
│ │ ├── preparsed.js
│ │ ├── sparseArray.js
│ │ ├── trailingEmptyImport.js
│ │ └── useStrictFalse.js
│ ├── cjs/
│ │ ├── absolutePaths.js
│ │ ├── banner.js
│ │ ├── bannerAndFooter.js
│ │ ├── constructor.js
│ │ ├── earlyExport.js
│ │ ├── emptyImport.js
│ │ ├── emptyImportWithDefaultExport.js
│ │ ├── escapedSource.js
│ │ ├── exportAnonFunction.js
│ │ ├── exportClassWithSuper.js
│ │ ├── exportDefault.js
│ │ ├── exportFunction.js
│ │ ├── footer.js
│ │ ├── importAll.js
│ │ ├── importDefault.js
│ │ ├── intermediateSourcemaps.js
│ │ ├── multipleImports.js
│ │ ├── namedAmdModule.js
│ │ ├── preparsed.js
│ │ ├── sparseArray.js
│ │ ├── trailingEmptyImport.js
│ │ └── useStrictFalse.js
│ └── umd/
│ ├── absolutePaths.js
│ ├── banner.js
│ ├── bannerAndFooter.js
│ ├── constructor.js
│ ├── earlyExport.js
│ ├── emptyImport.js
│ ├── emptyImportWithDefaultExport.js
│ ├── escapedSource.js
│ ├── exportAnonFunction.js
│ ├── exportClassWithSuper.js
│ ├── exportDefault.js
│ ├── exportFunction.js
│ ├── footer.js
│ ├── importAll.js
│ ├── importDefault.js
│ ├── intermediateSourcemaps.js
│ ├── multipleImports.js
│ ├── namedAmdModule.js
│ ├── preparsed.js
│ ├── sparseArray.js
│ ├── trailingEmptyImport.js
│ └── useStrictFalse.js
├── samples/
│ ├── absolutePaths/
│ │ ├── _config.js
│ │ └── source.js
│ ├── banner/
│ │ ├── _config.js
│ │ └── source.js
│ ├── bannerAndFooter/
│ │ ├── _config.js
│ │ └── source.js
│ ├── clashingDefaultImports/
│ │ ├── _config.js
│ │ └── source.js
│ ├── clashingFunctionArguments/
│ │ ├── _config.js
│ │ └── source.js
│ ├── clashingMixedImports/
│ │ ├── _config.js
│ │ └── source.js
│ ├── clashingNamedDefaultImports/
│ │ ├── _config.js
│ │ └── source.js
│ ├── clashingNamedImports/
│ │ ├── _config.js
│ │ └── source.js
│ ├── clashingNames/
│ │ ├── _config.js
│ │ └── source.js
│ ├── clashingObjectProperties/
│ │ ├── _config.js
│ │ └── source.js
│ ├── conditionalExport/
│ │ ├── _config.js
│ │ └── source.js
│ ├── constructor/
│ │ ├── _config.js
│ │ └── source.js
│ ├── duplicateImportFalsePositive/
│ │ ├── _config.js
│ │ └── source.js
│ ├── duplicateImports/
│ │ ├── _config.js
│ │ └── source.js
│ ├── earlyExport/
│ │ ├── _config.js
│ │ └── source.js
│ ├── emptyImport/
│ │ ├── _config.js
│ │ └── source.js
│ ├── emptyImportWithDefaultExport/
│ │ ├── _config.js
│ │ └── source.js
│ ├── escapedSource/
│ │ ├── _config.js
│ │ └── source.js
│ ├── exportAnonFunction/
│ │ ├── _config.js
│ │ └── source.js
│ ├── exportClass/
│ │ ├── _config.js
│ │ └── source.js
│ ├── exportClassWithSuper/
│ │ ├── _config.js
│ │ └── source.js
│ ├── exportDefault/
│ │ ├── _config.js
│ │ └── source.js
│ ├── exportFunction/
│ │ ├── _config.js
│ │ └── source.js
│ ├── exportInlineFunction/
│ │ ├── _config.js
│ │ └── source.js
│ ├── exportLet/
│ │ ├── _config.js
│ │ └── source.js
│ ├── exportNamed/
│ │ ├── _config.js
│ │ └── source.js
│ ├── exportNamedCollidesWithFunctionExpression/
│ │ ├── _config.js
│ │ └── source.js
│ ├── exportNamedFromNamedImportES3/
│ │ ├── _config.js
│ │ └── source.js
│ ├── exportNamedFunction/
│ │ ├── _config.js
│ │ └── source.js
│ ├── exportVar/
│ │ ├── _config.js
│ │ └── source.js
│ ├── footer/
│ │ ├── _config.js
│ │ └── source.js
│ ├── hasExportsVariable/
│ │ ├── _config.js
│ │ └── source.js
│ ├── importAll/
│ │ ├── _config.js
│ │ └── source.js
│ ├── importDefault/
│ │ ├── _config.js
│ │ └── source.js
│ ├── importNamed/
│ │ ├── _config.js
│ │ └── source.js
│ ├── intermediateSourcemaps/
│ │ ├── _config.js
│ │ └── source.js
│ ├── mixedImports/
│ │ ├── _config.js
│ │ └── source.js
│ ├── multipleImports/
│ │ ├── _config.js
│ │ └── source.js
│ ├── namedAmdModule/
│ │ ├── _config.js
│ │ └── source.js
│ ├── preparsed/
│ │ ├── _config.js
│ │ └── source.js
│ ├── reExportES3/
│ │ ├── _config.js
│ │ └── source.js
│ ├── renamedExport/
│ │ ├── _config.js
│ │ └── source.js
│ ├── renamedImport/
│ │ ├── _config.js
│ │ └── source.js
│ ├── safeCommentRemoval/
│ │ ├── _config.js
│ │ └── source.js
│ ├── shadowedExport/
│ │ ├── _config.js
│ │ └── source.js
│ ├── shadowedImport/
│ │ ├── _config.js
│ │ └── source.js
│ ├── sparseArray/
│ │ ├── _config.js
│ │ └── source.js
│ ├── trailingEmptyImport/
│ │ ├── _config.js
│ │ └── source.js
│ ├── unscopedNameConflicts/
│ │ ├── _config.js
│ │ └── source.js
│ ├── updateExportInArgument/
│ │ ├── _config.js
│ │ └── source.js
│ ├── updateExpressionInFunction/
│ │ ├── _config.js
│ │ └── source.js
│ └── useStrictFalse/
│ ├── _config.js
│ └── source.js
├── sourcemaps/
│ ├── bundle/
│ │ ├── foo.js
│ │ └── main.js
│ └── index.js
├── strictMode/
│ ├── index.js
│ └── output/
│ ├── amd/
│ │ ├── absolutePaths.js
│ │ ├── banner.js
│ │ ├── bannerAndFooter.js
│ │ ├── clashingFunctionArguments.js
│ │ ├── clashingMixedImports.js
│ │ ├── clashingNames.js
│ │ ├── clashingObjectProperties.js
│ │ ├── conditionalExport.js
│ │ ├── constructor.js
│ │ ├── duplicateImportFalsePositive.js
│ │ ├── duplicateImports.js
│ │ ├── earlyExport.js
│ │ ├── emptyImport.js
│ │ ├── emptyImportWithDefaultExport.js
│ │ ├── escapedSource.js
│ │ ├── exportAnonFunction.js
│ │ ├── exportClass.js
│ │ ├── exportClassWithSuper.js
│ │ ├── exportDefault.js
│ │ ├── exportFunction.js
│ │ ├── exportInlineFunction.js
│ │ ├── exportLet.js
│ │ ├── exportNamed.js
│ │ ├── exportNamedCollidesWithFunctionExpression.js
│ │ ├── exportNamedFromNamedImportES3.js
│ │ ├── exportNamedFunction.js
│ │ ├── exportVar.js
│ │ ├── footer.js
│ │ ├── hasExportsVariable.js
│ │ ├── importAll.js
│ │ ├── importDefault.js
│ │ ├── importNamed.js
│ │ ├── intermediateSourcemaps.js
│ │ ├── mixedImports.js
│ │ ├── multipleImports.js
│ │ ├── namedAmdModule.js
│ │ ├── preparsed.js
│ │ ├── reExportES3.js
│ │ ├── renamedExport.js
│ │ ├── renamedImport.js
│ │ ├── safeCommentRemoval.js
│ │ ├── shadowedExport.js
│ │ ├── shadowedImport.js
│ │ ├── sparseArray.js
│ │ ├── trailingEmptyImport.js
│ │ ├── unscopedNameConflicts.js
│ │ ├── updateExportInArgument.js
│ │ ├── updateExpressionInFunction.js
│ │ └── useStrictFalse.js
│ ├── cjs/
│ │ ├── absolutePaths.js
│ │ ├── banner.js
│ │ ├── bannerAndFooter.js
│ │ ├── clashingFunctionArguments.js
│ │ ├── clashingMixedImports.js
│ │ ├── clashingNames.js
│ │ ├── clashingObjectProperties.js
│ │ ├── conditionalExport.js
│ │ ├── constructor.js
│ │ ├── duplicateImportFalsePositive.js
│ │ ├── duplicateImports.js
│ │ ├── earlyExport.js
│ │ ├── emptyImport.js
│ │ ├── emptyImportWithDefaultExport.js
│ │ ├── escapedSource.js
│ │ ├── exportAnonFunction.js
│ │ ├── exportClass.js
│ │ ├── exportClassWithSuper.js
│ │ ├── exportDefault.js
│ │ ├── exportFunction.js
│ │ ├── exportInlineFunction.js
│ │ ├── exportLet.js
│ │ ├── exportNamed.js
│ │ ├── exportNamedCollidesWithFunctionExpression.js
│ │ ├── exportNamedFromNamedImportES3.js
│ │ ├── exportNamedFunction.js
│ │ ├── exportVar.js
│ │ ├── footer.js
│ │ ├── hasExportsVariable.js
│ │ ├── importAll.js
│ │ ├── importDefault.js
│ │ ├── importNamed.js
│ │ ├── intermediateSourcemaps.js
│ │ ├── mixedImports.js
│ │ ├── multipleImports.js
│ │ ├── namedAmdModule.js
│ │ ├── preparsed.js
│ │ ├── reExportES3.js
│ │ ├── renamedExport.js
│ │ ├── renamedImport.js
│ │ ├── safeCommentRemoval.js
│ │ ├── shadowedExport.js
│ │ ├── shadowedImport.js
│ │ ├── sparseArray.js
│ │ ├── trailingEmptyImport.js
│ │ ├── unscopedNameConflicts.js
│ │ ├── updateExportInArgument.js
│ │ ├── updateExpressionInFunction.js
│ │ └── useStrictFalse.js
│ └── umd/
│ ├── absolutePaths.js
│ ├── banner.js
│ ├── bannerAndFooter.js
│ ├── clashingFunctionArguments.js
│ ├── clashingMixedImports.js
│ ├── clashingNames.js
│ ├── clashingObjectProperties.js
│ ├── conditionalExport.js
│ ├── constructor.js
│ ├── duplicateImportFalsePositive.js
│ ├── duplicateImports.js
│ ├── earlyExport.js
│ ├── emptyImport.js
│ ├── emptyImportWithDefaultExport.js
│ ├── escapedSource.js
│ ├── exportAnonFunction.js
│ ├── exportClass.js
│ ├── exportClassWithSuper.js
│ ├── exportDefault.js
│ ├── exportFunction.js
│ ├── exportInlineFunction.js
│ ├── exportLet.js
│ ├── exportNamed.js
│ ├── exportNamedCollidesWithFunctionExpression.js
│ ├── exportNamedFromNamedImportES3.js
│ ├── exportNamedFunction.js
│ ├── exportVar.js
│ ├── footer.js
│ ├── hasExportsVariable.js
│ ├── importAll.js
│ ├── importDefault.js
│ ├── importNamed.js
│ ├── intermediateSourcemaps.js
│ ├── mixedImports.js
│ ├── multipleImports.js
│ ├── namedAmdModule.js
│ ├── preparsed.js
│ ├── reExportES3.js
│ ├── renamedExport.js
│ ├── renamedImport.js
│ ├── safeCommentRemoval.js
│ ├── shadowedExport.js
│ ├── shadowedImport.js
│ ├── sparseArray.js
│ ├── trailingEmptyImport.js
│ ├── unscopedNameConflicts.js
│ ├── updateExportInArgument.js
│ ├── updateExpressionInFunction.js
│ └── useStrictFalse.js
├── test.js
└── utils/
├── generate.js
└── makeWhitespaceVisible.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .babelrc
================================================
{
"whitelist": [
"es3.memberExpressionLiterals",
"es3.propertyLiterals",
"es6.arrowFunctions",
"es6.blockScoping",
"es6.constants",
"es6.destructuring",
"es6.parameters",
"es6.properties.shorthand",
"es6.templateLiterals",
"es6.classes"
],
"loose": [
"es6.classes",
"es6.destructuring"
]
}
================================================
FILE: .editorconfig
================================================
[*.js]
indent_style = tab
================================================
FILE: .gitignore
================================================
.DS_Store
node_modules
sample/output
.gobble
.gobble-build
out
demo/dist
test/lib
lib
cli-test
sandbox
dist
================================================
FILE: .jshintrc
================================================
{
"esnext": true,
"undef": true,
"unused": true,
"expr": true,
"boss": true,
"globals": {
"process": true,
"__dirname": true,
"module": true,
"exports": true,
"require": true,
"console": true,
"define": true
}
}
================================================
FILE: .travis.yml
================================================
sudo: false
language: node_js
node_js:
- "0.10"
- "0.11"
- "0.12"
env:
global:
- BUILD_TIMEOUT=10000
================================================
FILE: CHANGELOG.md
================================================
# changelog
## 0.7.6
* Update sander to prevent graceful-fs-opocalypse ([#193](https://github.com/esperantojs/esperanto/issues/193))
## 0.7.5
* Add a deprecation warning. (This project is deprecated – for one-to-one transformations you should use [Babel](https://babeljs.io/), for bundling you should use [Rollup](https://github.com/rollup/rollup).)
## 0.7.3
* `this` at the top-level is no longer treated as a syntax error ([#151](https://github.com/esperantojs/esperanto/issues/151))
## 0.7.2
* Fix two bugs with renamed exports ([#170](https://github.com/esperantojs/esperanto/issues/170))
## 0.7.1
* Fix `export { x as y }` namespace imports within a bundle ([#169](https://github.com/esperantojs/esperanto/issues/169))
* Lock magic-string version to 0.4.9 pending investigation of bug
## 0.7.0
* Where possible, default exports are not renamed ([#166](https://github.com/esperantojs/esperanto/issues/166))
* Some internal tidying up
## 0.6.34
* Improve module sorting algorithm to handle tricky cyclical cases ([#159](https://github.com/esperantojs/esperanto/issues/159))
## 0.6.33
* Fix a separate 0.6.31 regression with external modules ([#158](https://github.com/esperantojs/esperanto/issues/158))
## 0.6.32
* Fix regression introduce in 0.6.31, whereby modules within a bundle are prevented from depending on the entry module
## 0.6.31
* Preserve trailing `.js` in external module names (e.g. [highlight.js](https://www.npmjs.com/package/highlight.js)) ([#155](https://github.com/esperantojs/esperanto/issues/155))
* Fix naming bug with modules imported via both `resolvePath` and normal import ([#156](https://github.com/esperantojs/esperanto/issues/156))
## 0.6.30
* Mutually dependent modules within a bundle are re-ordered based on whether one is referenced at the top level of the other ([#152](https://github.com/esperantojs/esperanto/issues/152))
## 0.6.29
* Relative source URLs in sourcemaps are correct
* `src` directory included in npm package
## 0.6.28
* `resolvePath` option is not required to return a path (e.g. `esperanto.toAmd({ code, ast })`) ([#148](https://github.com/esperantojs/esperanto/issues/148))
## 0.6.27
* AST can be supplied when doing one-to-one transformations (e.g. `esperanto.toAmd({ code, ast })`) ([#140](https://github.com/esperantojs/esperanto/issues/140))
* Modules can be supplied directly when bundling, rather than reading from disk ([docs here](https://github.com/esperantojs/esperanto/wiki/Bundling-multiple-ES6-modules#modules)) ([#140](https://github.com/esperantojs/esperanto/issues/140))
* 'use strict' pragma is omitted if `useStrict: false` option is supplied ([#141](https://github.com/esperantojs/esperanto/issues/141))
## 0.6.26
* AST walker handles sparse arrays ([#144](https://github.com/esperantojs/esperanto/issues/144))
## 0.6.25
* Reliable updating of exported expressions ([#142](https://github.com/esperantojs/esperanto/issues/142))
## 0.6.24
* Renamed exports (`export { foo as bar }`) works
* Internal tidy up/refactoring, resulting in smaller library
## 0.6.23
* Function arguments are considered when naming imports to avoid conflicts ([#119](https://github.com/esperantojs/esperanto/issues/119))
* Bindings are always exported at the end of a module, regardless of re-assignments ([#130](https://github.com/esperantojs/esperanto/issues/130))
* Generated import names cannot be shadowed by non-root-scope declarations ([#133](https://github.com/esperantojs/esperanto/issues/133))
## 0.6.22
* Allow imports to be re-exported ([#124](https://github.com/esperantojs/esperanto/issues/124))
## 0.6.21
* Fix npm versioning snafu
## 0.6.20
* Replaced estraverse with internal utility that doesn't depend on hardcoded node types to traverse AST ([#129](https://github.com/esperantojs/esperanto/issues/129))
## 0.6.19
* Sourcemap comments are removed from bundles as well as one-to-one transformations ([#120](https://github.com/esperantojs/esperanto/issues/120))
## 0.6.18
* Upgrade to acorn v1.x ([#125](https://github.com/esperantojs/esperanto/issues/125))
* Sourcemap comments from prior transformations are removed ([#120](https://github.com/esperantojs/esperanto/issues/120))
* Named function expressions are not erroneously renamed ([#122](https://github.com/esperantojs/esperanto/issues/122))
## 0.6.17
* Sourcemap mappings are set explicitly - rather than mapping every single character, the locations from the acorn AST are used. As well as smaller sourcemaps, this results in modest performance improvements internally, and large performance improvements for external tools that work with the sourcemap
## 0.6.16
* Prevent import naming collisions ([#116](https://github.com/esperantojs/esperanto/issues/116))
* Throw error on duplicate imports ([#95](https://github.com/esperantojs/esperanto/issues/95))
* Prevent internal assigment exports clashing within a bundle ([#117](https://github.com/esperantojs/esperanto/issues/117))
* Update chalk to 1.0.0
## 0.6.15
* Clashes with names for external dependencies are avoided ([#114](https://github.com/esperantojs/esperanto/issues/114))
## 0.6.14
* The `sourceMapFile` requirement is waived when `options.sourceMap === 'inline'` ([#105](https://github.com/esperantojs/esperanto/issues/105))
## 0.6.13
* Windows fixes
## 0.6.12
* Bundled external modules are deduplicated in the rare case that they import themselves ([#103](https://github.com/esperantojs/esperanto/issues/103))
## 0.6.11
* Use robust `module.relativePath` internally rather than `module.file` - necessary for bundled external modules with dependencies of their own
* Browser-flavoured version of Esperanto (`dist/esperanto.browser.js`) bundles ES6 dependencies (`magic-string` and its `vlq` dependency), as both a convenience and a form of dogfooding
## 0.6.10
* The `resolvePath` option can be used with `esperanto.bundle()` to locate modules, if they do not exist relative to `base`. It should return an absolute path as a string, or a promise that resolves to one ([#68](https://github.com/esperantojs/esperanto/issues/68))
## 0.6.9
* `sourceMapFile` can be an absolute path, in which case it is left unchanged ([#101](https://github.com/esperantojs/esperanto/issues/101))
## 0.6.8
* Module load order is guaranteed by import order - empty imports are represented by `__dep0__` etc within the module, or `undefined` globally ([#92](https://github.com/esperantojs/esperanto/issues/92))
* Fix absolute path resolution in cases like `./../foo` ([#97](https://github.com/esperantojs/esperanto/issues/97))
* If `bundle.concat()` fails due to external dependencies, or exports from the entry module, the error message lists them
## 0.6.7
* Using the `_evilES3SafeReExports` will cause re-exported bindings to be done with direct property assignment rather than `Object.defineProperty()`. In most cases, the resulting behaviour will be no different, but it could result in undefined bindings in cases of cyclical dependencies, and values are fixed at the time of re-export rather than live.
## 0.6.6
* Conflicts between module names and unscoped (i.e. global) names and `exports` are prevented ([#74](https://github.com/esperantojs/esperanto/issues/74)), ([#79](https://github.com/esperantojs/esperanto/issues/79))
* Names in function expressions (as opposed to declarations) are disregarded ([#73](https://github.com/esperantojs/esperanto/issues/73))
* Re-exports remain enumerable
* Continuous integration via Travis-CI
## 0.6.5
* Relative AMD dependency paths can be made absolute with `absolutePaths: true` - requires `amdName` to be specified ([#58](https://github.com/esperantojs/esperanto/issues/58))
* Within a bundle, built-in names like `Math` and `Promise` are avoided ([#70](https://github.com/esperantojs/esperanto/issues/70))
* Bundle imports and exports are reported as `bundle.imports` and `bundle.exports` ([#59](https://github.com/esperantojs/esperanto/issues/59))
## 0.6.4
* Fixes duplicate import bug ([#63](https://github.com/esperantojs/esperanto/issues/63))
* Module names are correctly escaped ([#50](https://github.com/esperantojs/esperanto/issues/50))
* Accessing properties on top-level `this` throws error at parse time
* CLI: if no `--output` option is given, bundle is written to stdout (if no separate sourcemap) ([#60](https://github.com/esperantojs/esperanto/issues/60))
* CLI: Better errors ([#66](https://github.com/esperantojs/esperanto/issues/66))
* Test suite refactor
## 0.6.3
* Support for Windows file paths
* `bundle.concat()` can be called without an options argument
* Options argument passed to `bundle.concat()` can include `intro`, `outro`, `indent` properties which will override defaults (`indent: true` is equivalent to 'automatic', otherwise pass a string)
* Bundle transform function can return an empty string
## 0.6.2
* Implement `bundle.concat()` for self-contained bundles ([#48](https://github.com/esperantojs/esperanto/issues/48))
## 0.6.1
* Fix for ([#45](https://github.com/esperantojs/esperanto/issues/45))
* External modules only have `__default` appended where necessary ([#46](https://github.com/esperantojs/esperanto/issues/46))
## 0.6.0
* UMD export detects CJS environment *before* AMD ([#42](https://github.com/esperantojs/esperanto/issues/42))
* `this` at module top-level is replaced with `undefined`, as per the spec ([#43](https://github.com/esperantojs/esperanto/issues/43))
* More compact CommonJS export
* Bundler transform function receives path as second argument
## 0.5.10
* One-to-one conversions get the same compact UMD form as bundles
* Default imports are not hedged unnecessarily ([#40](https://github.com/esperantojs/esperanto/issues/40))
## 0.5.9
* More concise UMD output ([#36](https://github.com/esperantojs/esperanto/issues/36))
## 0.5.8
* Functions are always exported early ([#37](https://github.com/esperantojs/esperanto/issues/37))
* Modules can be transformed before bundling with `esperanto.bundle({ transform: someFunction })`, where `someFunction` returns either a string, or a promise that resolves to a string
## 0.5.7
* Classes are exported after declaration, not before ([#33](https://github.com/esperantojs/esperanto/issues/33))
## 0.5.6
* Support for named AMD modules, via `amdName` option (works for both standalone and bundle conversions)
## 0.5.5
* No actual changes - just shuffling things about so we can separate demo page into separate repo
## 0.5.4
* Performance improvements and internal refactoring
## 0.5.3
* You can specify a `banner` and/or `footer` option when converting or bundling
* An error will be thrown if a module attempts to import itself
## 0.5.2
* Imported objects (other than namespace imports) can be assigned properties ([#29](https://github.com/esperantojs/esperanto/issues/29))
* Default imports can be exported as named exports from the entry module in a bundle
## 0.5.1
* Identifiers that match object prototype properties are not mistakenly exported (and garbled)
## 0.5.0
* Chained imports/exports are renamed correctly within a bundle ([#17](https://github.com/esperantojs/esperanto/issues/17))
* Bundle exports are written at assignment time, rather than at the end of the bundle with an `Object.defineProperty` hack
* Attempting to import a non-exported identifier within the same bundle throws an error
* External modules are imported correctly ([#28](https://github.com/esperantojs/esperanto/issues/28))
* Identifiers are only rewritten as necessary ([#25](https://github.com/esperantojs/esperanto/issues/25))
* Redundant assignments in a bundle (`mod__default = mod__foo`) are avoided ([#14](https://github.com/esperantojs/esperanto/issues/14))
* Shadowed imports are handled ([#18](https://github.com/esperantojs/esperanto/issues/18))
* Modules are indented consistently within a bundle
## 0.4.10
* Update acorn (greater ES6 coverage) and estraverse dependencies - thanks [@leebyron](https://github.com/leebyron)
## 0.4.9
* Adds `class` support - thanks [@leebyron](https://github.com/leebyron)
* Use `hasOwnProperty` check to prevent garbled output - thanks [@leebyron](https://github.com/leebyron)
## 0.4.8
* `exports['default']` is used in favour of `exports.default`, for the benefit of IE8 - thanks [@evs-chris](https://github.com/evs-chris/)
## 0.4.7
* In standalone conversions, import names are inferred from the source code where possible (batch/default imports), and will avoid naming collisions ([#15](https://github.com/esperantojs/esperanto/issues/15))
## 0.4.6
* Fix missing closing parenthesis on strict mode UMD output
## 0.4.5
* Only print `defaultOnly` deprecation warning once, rather than flooding the console
## 0.4.4
* Parse errors (from acorn) are augmented with file info when bundling
## 0.4.3
* Added CLI files to npm package (oops!)
## 0.4.2
* Sourcemap support for bundles
## 0.4.1
* Command line interface
* Sourcemap support for one-to-one conversions
* Neater UMD exports
* Remove `addUseStrict` option (ES6 modules are always in strict mode)
## 0.4.0
* Started maintaining a changelog
* Complete rewrite!
* Spec-compliance - Esperanto now supports bindings and cycles (only in [strict mode](https://github.com/Rich-Harris/esperanto/wiki/strictMode))
* The `defaultOnly` option has been deprecated - esperanto's standard behaviour is now to import and exports defaults. If you want to use named imports/exports, pass `strict: true` (this basically means that your default export becomes `exports.default` rather than `module.exports`). For more information see the [wiki page on strict mode](https://github.com/Rich-Harris/esperanto/wiki/strictMode)
* UMD output: `esperanto.toUmd(es6source, {name:'myModule'});
* Bundling - see the [wiki page on esperanto.bundle()](https://github.com/Rich-Harris/esperanto/wiki/esperanto-bundle)
================================================
FILE: README.md
================================================
# esperanto [](https://travis-ci.org/esperantojs/esperanto)
## This project is no longer under active development. To bundle ES6 modules, use [Rollup](https://github.com/rollup/rollup). To convert ES6 modules to another format, use [Babel](https://babeljs.io/docs/usage/modules/). See [#191](https://github.com/esperantojs/esperanto/pull/191) for details.
A better way to transpile ES6 modules to AMD and CommonJS:
* Easier - no laborious configuration
* Simpler - doesn't make dangerous assumptions about your project setup
* Smarter - non-destructive source code transformation, no runtime Traceur dependency, and no ES5-only features
* Faster - roughly 10x quicker than the alternatives
Try it online here: [esperantojs.org](http://esperantojs.org)
## Installation
Install esperanto from npm:
```bash
npm install esperanto
```
## Usage
You can use Esperanto in one of two modes:
* [Converting a single module](https://github.com/esperantojs/esperanto/wiki/Converting-a-single-module)
* [Bundling multiple ES6 modules](https://github.com/esperantojs/esperanto/wiki/Bundling-multiple-ES6-modules)
## Why not use existing module transpilers?
See [comparisons with other tools](https://github.com/esperantojs/esperanto/wiki/Comparisons-with-other-tools) for some of the reasons to use Esperanto.
## Credits
Many thanks to [Marijn Haverbeke](http://marijnhaverbeke.nl/) for [Acorn](https://github.com/marijnh/acorn), which does all the heavy lifting.
## License
Copyright 2014 Rich Harris. MIT Licensed.
================================================
FILE: appveyor.yml
================================================
# Test against this version of Node.js
environment:
matrix:
# node.js
- nodejs_version: "0.10"
- nodejs_version: "0.12"
# io.js
- nodejs_version: "1.0"
# Install scripts. (runs after repo cloning)
install:
# Get the latest stable version of Node.js or io.js
- ps: Install-Product node $env:nodejs_version
# install modules
- npm install
# Post-install test scripts.
test_script:
# Output useful info for debugging.
- node --version
- npm --version
# run tests
- npm test
# Don't actually build.
build: off
================================================
FILE: bin/handleError.js
================================================
var chalk = require( 'chalk' );
var handlers = {
MISSING_INPUT_OPTION: function () {
console.error( chalk.red( 'You must specify an --input (-i) option when bundling' ) );
},
MISSING_OUTPUT_OPTION: function () {
console.error( chalk.red( 'You must specify an --output (-o) directory option when converting a directory of files' ) );
},
NO_INPUT_DETECTED: function () {
console.error( chalk.red( 'No input detected! Try using the --input (-i) option' ) );
},
MISSING_NAME: function ( err ) {
console.error( chalk.red( 'You must supply a name for UMD exports (e.g. `--name myModule`)' ) );
}
};
module.exports = function handleError ( err ) {
var handler;
if ( handler = handlers[ err && err.code ] ) {
handler( err );
} else {
console.error( chalk.red( err.message || err ) );
if ( err.stack ) {
console.error( chalk.grey( err.stack ) );
}
}
console.error( 'Type ' + chalk.cyan( 'esperanto --help' ) + ' for help, or visit https://github.com/esperantojs/esperanto/wiki' );
process.exit( 1 );
};
================================================
FILE: bin/help.md
================================================
Esperanto version <%= version %>
=====================================
Usage: esperanto [options]
Basic options:
-v, --version Show version number
-h, --help Show this help message
-i, --input Input file (if absent, reads from stdin)
-o, --output <output> Output file (if absent, prints to stdout)
-t, --type [amd] Type of output (amd, cjs, umd)
-s, --strict Use strict mode
-b, --bundle Create a bundle including <file>'s dependencies
-n, --name Name for UMD export
-a, --amdName Name for AMD module (default is anonymous)
-m, --sourcemap Generate sourcemap (`-m inline` for inline map)
Additional options when bundling
-d, --basedir=<basedir> Base directory for module resolution
-k, --skip=<files...> Comma-separated list of files to skip (relative to basedir)
Example:
esperanto --type=cjs --output=build/app.js --bundle -- src/app.js
Notes:
* You must supply an --input option when bundling (i.e. no piping from stdin)
* Non-inline sourcemaps will be discarded when piping to stdout
For more information visit https://github.com/Rich-Harris/esperanto/wiki
================================================
FILE: bin/index.js
================================================
#!/usr/bin/env node
var minimist = require( 'minimist' ),
command;
command = minimist( process.argv.slice( 2 ), {
alias: {
i: 'input',
o: 'output',
v: 'version',
h: 'help',
b: 'bundle',
s: 'strict',
t: 'type',
m: 'sourcemap',
n: 'name',
d: 'basedir',
k: 'skip',
a: 'amdName'
}
});
if ( command.help || ( process.argv.length <= 2 && process.stdin.isTTY ) ) {
require( './showHelp' )();
}
else if ( command.version ) {
console.log( 'Esperanto version ' + require( '../package.json' ).version );
}
else {
require( './runEsperanto' )( command );
}
================================================
FILE: bin/runEsperanto.js
================================================
var path = require( 'path' ),
sander = require( 'sander' ),
Promise = sander.Promise,
handleError = require( './handleError' ),
esperanto = require( '../' );
var methods = {
amd: 'toAmd',
cjs: 'toCjs',
umd: 'toUmd'
};
module.exports = function ( options ) {
var method;
if ( options.type && !methods[ options.type ] ) {
console.error( 'The --type (-t) option must be one of amd, cjs, umd' );
process.exit( 1 );
}
method = methods[ options.type ] || 'toAmd';
try {
if ( options.bundle ) {
bundle( options, method ).catch( handleError );
} else {
convert( options, method ).catch( handleError );
}
} catch ( err ) {
handleError( err );
}
};
function bundle ( options, method ) {
var bundleOptions, file;
if ( !options.input ) {
handleError({ code: 'MISSING_INPUT_OPTION' });
}
bundleOptions = {
base: path.resolve( options.basedir || '' )
};
if ( options.skip ) {
bundleOptions.skip = options.skip.split( ',' ).map( function ( file ) {
return file.replace( /\.js$/, '' );
});
}
// entry should be relative to base
if ( options.basedir && !sander.existsSync( path.join( bundleOptions.base, options.input ) ) ) {
// file doesn't exist relative to base...
file = path.resolve( options.input ).replace( bundleOptions.base + '/', '' );
} else {
file = path.resolve( bundleOptions.base, options.input );
}
bundleOptions.entry = file;
return esperanto.bundle( bundleOptions ).then( function ( bundle ) {
var transpiled, promises;
transpiled = bundle[ method ]({
name: options.name,
amdName: options.amdName,
strict: options.strict,
sourceMap: options.sourcemap,
sourceMapFile: options.sourcemap ? path.resolve( options.output ) : null
});
if ( options.output ) {
promises = [ sander.writeFile( options.output, transpiled.code ) ];
if ( options.sourcemap === true ) {
promises.push( sander.writeFile( options.output + '.map', transpiled.map ) );
}
return Promise.all( promises );
} else {
process.stdout.write( transpiled.code );
}
});
}
function convert ( options, method ) {
if ( options.input ) {
return sander.stat( options.input ).then( function ( stats ) {
if ( stats.isDirectory() ) {
if ( !options.output ) {
handleError({ code: 'MISSING_OUTPUT_OPTION' });
}
// transpile all the things
return sander.lsr( options.input )
.then( filterOutNonJs )
.then( function ( files ) {
var promises = files.map( function ( file ) {
var input = path.join( options.input, file );
var output = path.join( options.output, file );
var fileOptions = assign( {}, options, {
input: input,
output: output,
sourceMapSource: input,
sourceMapFile: output
});
return convert( fileOptions, method );
});
return Promise.all( promises );
});
}
return sander.readFile( options.input )
.then( String )
.then( run );
});
} else {
return readFromStdin().then( run );
}
function run ( source ) {
var transpiled, promises;
transpiled = esperanto[ method ]( source, {
strict: options.strict,
name: options.name,
amdName: options.amdName,
sourceMap: options.sourcemap,
sourceMapSource: options.input,
sourceMapFile: options.output
});
if ( options.output ) {
promises = [ sander.writeFile( options.output, transpiled.code ) ];
if ( options.sourcemap === true ) {
promises.push( sander.writeFile( options.output + '.map', transpiled.map ) );
}
return Promise.all( promises );
}
process.stdout.write( transpiled.code );
}
}
function readFromStdin () {
return new Promise( function ( fulfil, reject ) {
var data = '';
if ( process.stdin.isTTY ) {
handleError({ code: 'NO_INPUT_DETECTED' });
}
process.stdin.setEncoding( 'utf8' );
process.stdin.on( 'readable', function () {
var chunk = process.stdin.read();
if ( chunk !== null ) {
data += chunk;
}
});
process.stdin.on( 'end', function() {
fulfil( data );
});
process.stdin.on( 'error', reject );
});
}
function assign ( target ) {
var sources = [].slice.call( arguments, 1 );
sources.forEach( function ( source ) {
var prop;
for ( prop in source ) {
if ( source.hasOwnProperty( prop ) ) {
target[ prop ] = source[ prop ];
}
}
});
return target;
}
function filterOutNonJs ( files ) {
var isJs = /\.js$/;
return files.filter( function ( file ) {
return isJs.test( file );
});
}
================================================
FILE: bin/showHelp.js
================================================
var fs = require( 'fs' ),
path = require( 'path' );
module.exports = function () {
fs.readFile( path.join( __dirname, 'help.md' ), function ( err, result ) {
var help;
if ( err ) throw err;
help = result.toString().replace( '<%= version %>', require( '../package.json' ).version );
console.log( '\n' + help + '\n' );
});
};
================================================
FILE: comparison/README.md
================================================
# ES6 module transpilers comparison
**Parental advisory: benchmarks are nonsense. Do not rely on benchmarks alone to make decisions!**
In particular, this test is unfair to traceur, since it is trying to transpile ES6 language features other than module syntax. Since transpile uses traceur under the hood, the same thing probably applies (in some cases, the output from the two transpilers is identical).
The esnext/es6-module-transpiler project has been excluded as there doesn't seem to be a way to compile code synchronously from a string - instead the filesystem has to get involved, so it would be misleading and unfair to include the results. (It also errors out if it can't follow the dependency graph of your modules, making it very difficult to test.)
Instead, focus on how much nicer, slimmer, and more faithful esperanto's output is. The `output` folder contains the result of transpiling each of the modules in the `input` folder. Note that both transpile and traceur fail to convert certain modules (both fail at `mixedImports.js`, transpile fails at `batchImports.js`).
## Running the tests
Inside this folder, do...
```bash
node index.js
```
to run the tests with esperanto and transpile. To run the tests with traceur, do
```bash
node index.js traceur
```
This is necessary because transpile uses traceur, and you can't have two copies of traceur running simultaneously because it monkey patches stuff, or something.
================================================
FILE: comparison/index.js
================================================
var fs = require( 'fs' ),
path = require( 'path' ),
esperanto = require( '../lib/esperanto' ),
samples,
iterations = 1000;
samples = fs.readdirSync( path.join( __dirname, 'samples' ) ).map( function ( file ) {
return {
name: file,
code: fs.readFileSync( path.join( __dirname, 'samples', file ) ).toString()
};
});
tests = [
{
name: 'esperanto',
fn: function ( code, filename, type ) {
code = esperanto[ type === 'amd' ? 'toAmd' : 'toCjs' ]( code, { strict: true });
return code;
}
},
{
name: 'traceur',
skip: process.argv[2] !== 'traceur',
before: function () {
traceur = require( 'traceur' );
},
fn: function ( code, filename, type ) {
return traceur.compile( code, {
filename: filename,
modules: type,
sourceMaps: false
}).js;
},
after: function () {
delete require.cache[ require.resolve( 'traceur' ) ];
},
alias: { cjs: 'commonjs' }
},
{
name: 'transpile',
skip: process.argv[2] === 'traceur',
before: function () {
transpile = require( 'transpile' );
},
fn: function ( code, filename, type ) {
return transpile.to({
name: filename,
source: code,
metadata: { format: 'es6' }
}, type )
},
after: function () {
delete require.cache[ require.resolve( 'transpile' ) ];
}
}
];
tests.forEach( function ( test ) {
var out, type = 'cjs';
if ( test.skip ) {
return;
}
if ( test.alias ) {
type = test.alias[ type ] || type;
}
console.log( '\nRunning %s test...', test.name );
test.before && test.before();
// First, save the result to disk
out = path.join( __dirname, 'output', test.name );
try { fs.mkdirSync( out ); } catch ( err ) {}
samples.forEach( function ( sample ) {
var result = test.fn( sample.code, sample.name, type );
fs.writeFileSync( path.join( out, sample.name ), result );
});
// Then run the tests
var start = Date.now();
samples.forEach( function ( sample ) {
var i = iterations;
while ( i-- ) {
test.fn( sample.code, sample.name, type );
}
});
console.log( '...finished %s iterations in %sms\n', iterations, Date.now() - start );
test.after && test.after();
})
================================================
FILE: comparison/output/esperanto/batchImports.js
================================================
(function () {
'use strict';
var fs = require('fs');
// example from http://jsmodules.io
fs.unlink(filename, function(err) { /* check errors */ });
}).call(global);
================================================
FILE: comparison/output/esperanto/defaultExport.js
================================================
(function () {
'use strict';
// example from http://jsmodules.io
var asap;
var isNode = typeof process !== "undefined" &&
{}.toString.call(process) === "[object process]";
if (isNode) {
asap = process.nextTick;
} else if (typeof setImmediate !== "undefined") {
asap = setImmediate;
} else {
asap = setTimeout;
}
exports.default = asap;
}).call(global);
================================================
FILE: comparison/output/esperanto/defaultImport.js
================================================
(function () {
'use strict';
var asap = require('asap');
// example from http://jsmodules.io
asap.default(function() {
console.log("hello async world!");
});
}).call(global);
================================================
FILE: comparison/output/esperanto/groupedExports.js
================================================
(function () {
'use strict';
// example from http://jsmodules.io
function getJSON() {
// implementation
}
function postJSON() {
// implementation
}
function animate() {
// implementation
}
exports.getJSON = getJSON;
exports.postJSON = postJSON;
exports.animate = animate;
}).call(global);
================================================
FILE: comparison/output/esperanto/inlineNamedExports.js
================================================
(function () {
'use strict';
exports.requestAnimationFrame = requestAnimationFrame;
// example from http://jsmodules.io
// exports this function as "requestAnimationFrame"
function requestAnimationFrame() {
// cross-browser requestAnimationFrame
}
// exports document.location as "location"
var location = document.location;
exports.location = location;
}).call(global);
================================================
FILE: comparison/output/esperanto/mixedImports.js
================================================
(function () {
'use strict';
var asap = require('asap');
// example from http://jsmodules.io
}).call(global);
================================================
FILE: comparison/output/esperanto/namedExports.js
================================================
(function () {
'use strict';
// example from http://jsmodules.io
var asap;
var isNode = typeof process !== "undefined" &&
{}.toString.call(process) === "[object process]";
if (isNode) {
asap = process.nextTick;
} else if (typeof setImmediate !== "undefined") {
asap = setImmediate;
} else {
asap = setTimeout;
}
exports.default = asap;
var later = isNode ? process.setImmediate : asap;
exports.later = later;
}).call(global);
================================================
FILE: comparison/output/esperanto/namedImports.js
================================================
(function () {
'use strict';
var asap = require('asap');
// example from http://jsmodules.io
asap.later(function() {
console.log("Running after other network events");
});
}).call(global);
================================================
FILE: comparison/output/esperanto/renamingImports.js
================================================
(function () {
'use strict';
var fs = require('fs');
// example from http://jsmodules.io
fs.unlink(filename, function(err) { /* check errors */ });
}).call(global);
================================================
FILE: comparison/output/traceur/batchImports.js
================================================
"use strict";
var $__fs__;
var fs = ($__fs__ = require("fs"), $__fs__ && $__fs__.__esModule && $__fs__ || {default: $__fs__});
fs.unlink(filename, function(err) {});
================================================
FILE: comparison/output/traceur/defaultExport.js
================================================
"use strict";
Object.defineProperties(exports, {
default: {get: function() {
return $__default;
}},
__esModule: {value: true}
});
var asap;
var isNode = typeof process !== "undefined" && {}.toString.call(process) === "[object process]";
if (isNode) {
asap = process.nextTick;
} else if (typeof setImmediate !== "undefined") {
asap = setImmediate;
} else {
asap = setTimeout;
}
var $__default = asap;
================================================
FILE: comparison/output/traceur/defaultImport.js
================================================
"use strict";
var $__asap__;
var asap = ($__asap__ = require("asap"), $__asap__ && $__asap__.__esModule && $__asap__ || {default: $__asap__}).default;
asap(function() {
console.log("hello async world!");
});
================================================
FILE: comparison/output/traceur/groupedExports.js
================================================
"use strict";
Object.defineProperties(exports, {
getJSON: {get: function() {
return getJSON;
}},
postJSON: {get: function() {
return postJSON;
}},
animate: {get: function() {
return animate;
}},
__esModule: {value: true}
});
;
function getJSON() {}
function postJSON() {}
function animate() {}
================================================
FILE: comparison/output/traceur/inlineNamedExports.js
================================================
"use strict";
Object.defineProperties(exports, {
requestAnimationFrame: {get: function() {
return requestAnimationFrame;
}},
location: {get: function() {
return location;
}},
__esModule: {value: true}
});
function requestAnimationFrame() {}
var location = document.location;
================================================
FILE: comparison/output/traceur/mixedImports.js
================================================
undefined
================================================
FILE: comparison/output/traceur/namedExports.js
================================================
"use strict";
Object.defineProperties(exports, {
default: {get: function() {
return $__default;
}},
later: {get: function() {
return later;
}},
__esModule: {value: true}
});
var asap;
var isNode = typeof process !== "undefined" && {}.toString.call(process) === "[object process]";
if (isNode) {
asap = process.nextTick;
} else if (typeof setImmediate !== "undefined") {
asap = setImmediate;
} else {
asap = setTimeout;
}
var $__default = asap;
var later = isNode ? process.setImmediate : asap;
================================================
FILE: comparison/output/traceur/namedImports.js
================================================
"use strict";
var $__asap__;
var later = ($__asap__ = require("asap"), $__asap__ && $__asap__.__esModule && $__asap__ || {default: $__asap__}).later;
later(function() {
console.log("Running after other network events");
});
================================================
FILE: comparison/output/traceur/renamingImports.js
================================================
"use strict";
var $__fs__;
var rm = ($__fs__ = require("fs"), $__fs__ && $__fs__.__esModule && $__fs__ || {default: $__fs__}).unlink;
rm(filename, function(err) {});
================================================
FILE: comparison/output/transpile/batchImports.js
================================================
undefined
================================================
FILE: comparison/output/transpile/defaultExport.js
================================================
"use strict";
Object.defineProperties(exports, {
default: {get: function() {
return $__default;
}},
__esModule: {value: true}
});
var asap;
var isNode = typeof process !== "undefined" && {}.toString.call(process) === "[object process]";
if (isNode) {
asap = process.nextTick;
} else if (typeof setImmediate !== "undefined") {
asap = setImmediate;
} else {
asap = setTimeout;
}
var $__default = asap;
================================================
FILE: comparison/output/transpile/defaultImport.js
================================================
"use strict";
var asap = $traceurRuntime.assertObject(require("asap")).default;
asap(function() {
console.log("hello async world!");
});
================================================
FILE: comparison/output/transpile/groupedExports.js
================================================
"use strict";
Object.defineProperties(exports, {
getJSON: {get: function() {
return getJSON;
}},
postJSON: {get: function() {
return postJSON;
}},
animate: {get: function() {
return animate;
}},
__esModule: {value: true}
});
;
function getJSON() {}
function postJSON() {}
function animate() {}
================================================
FILE: comparison/output/transpile/inlineNamedExports.js
================================================
"use strict";
Object.defineProperties(exports, {
requestAnimationFrame: {get: function() {
return requestAnimationFrame;
}},
location: {get: function() {
return location;
}},
__esModule: {value: true}
});
function requestAnimationFrame() {}
var location = document.location;
================================================
FILE: comparison/output/transpile/mixedImports.js
================================================
undefined
================================================
FILE: comparison/output/transpile/namedExports.js
================================================
"use strict";
Object.defineProperties(exports, {
default: {get: function() {
return $__default;
}},
later: {get: function() {
return later;
}},
__esModule: {value: true}
});
var asap;
var isNode = typeof process !== "undefined" && {}.toString.call(process) === "[object process]";
if (isNode) {
asap = process.nextTick;
} else if (typeof setImmediate !== "undefined") {
asap = setImmediate;
} else {
asap = setTimeout;
}
var $__default = asap;
var later = isNode ? process.setImmediate : asap;
================================================
FILE: comparison/output/transpile/namedImports.js
================================================
"use strict";
var later = $traceurRuntime.assertObject(require("asap")).later;
later(function() {
console.log("Running after other network events");
});
================================================
FILE: comparison/output/transpile/renamingImports.js
================================================
"use strict";
var rm = $traceurRuntime.assertObject(require("fs")).unlink;
rm(filename, function(err) {});
================================================
FILE: comparison/package.json
================================================
{
"name": "esperanto-benchmark",
"description": "quick and dirty script to illustrate esperanto speed advantage",
"version": "0.1.0",
"devDependencies": {
"traceur": "0.0.58",
"transpile": "~0.2.0",
"es6-module-transpiler": "~0.6.0"
}
}
================================================
FILE: comparison/samples/batchImports.js
================================================
// example from http://jsmodules.io
import * as fs from "fs";
fs.unlink(filename, function(err) { /* check errors */ });
================================================
FILE: comparison/samples/defaultExport.js
================================================
// example from http://jsmodules.io
var asap;
var isNode = typeof process !== "undefined" &&
{}.toString.call(process) === "[object process]";
if (isNode) {
asap = process.nextTick;
} else if (typeof setImmediate !== "undefined") {
asap = setImmediate;
} else {
asap = setTimeout;
}
export default asap;
================================================
FILE: comparison/samples/defaultImport.js
================================================
// example from http://jsmodules.io
import asap from "asap";
asap(function() {
console.log("hello async world!");
});
================================================
FILE: comparison/samples/groupedExports.js
================================================
// example from http://jsmodules.io
export { getJSON, postJSON, animate };
function getJSON() {
// implementation
}
function postJSON() {
// implementation
}
function animate() {
// implementation
}
================================================
FILE: comparison/samples/inlineNamedExports.js
================================================
// example from http://jsmodules.io
// exports this function as "requestAnimationFrame"
export function requestAnimationFrame() {
// cross-browser requestAnimationFrame
}
// exports document.location as "location"
export var location = document.location;
================================================
FILE: comparison/samples/mixedImports.js
================================================
// example from http://jsmodules.io
import asap, { later } from "asap";
================================================
FILE: comparison/samples/namedExports.js
================================================
// example from http://jsmodules.io
var asap;
var isNode = typeof process !== "undefined" &&
{}.toString.call(process) === "[object process]";
if (isNode) {
asap = process.nextTick;
} else if (typeof setImmediate !== "undefined") {
asap = setImmediate;
} else {
asap = setTimeout;
}
export default asap;
export var later = isNode ? process.setImmediate : asap;
================================================
FILE: comparison/samples/namedImports.js
================================================
// example from http://jsmodules.io
import { later } from "asap";
later(function() {
console.log("Running after other network events");
});
================================================
FILE: comparison/samples/renamingImports.js
================================================
// example from http://jsmodules.io
import { unlink as rm } from "fs";
rm(filename, function(err) { /* check errors */ });
================================================
FILE: gobblefile.js
================================================
var gobble = require( 'gobble' );
var path = require( 'path' );
var resolve = require( 'resolve' );
var Promise = require( 'sander' ).Promise;
gobble.cwd( __dirname );
var banner = require( 'fs' ).readFileSync( __dirname + '/src/banner.js', 'utf-8' )
.replace( '${VERSION}', require( './package.json' ).version )
.replace( '${TODAY}', today() );
var es5 = gobble( 'src' ).transform( 'babel' );
var node = es5
.transform( 'esperanto-bundle', {
entry: 'esperanto',
type: 'cjs',
banner: banner,
strict: true,
sourceMap: true
});
var browser = es5
.transform( 'esperanto-bundle', {
entry: 'esperanto',
dest: 'esperanto.browser.js',
type: 'umd',
name: 'esperanto',
skip: [ 'bundler/getBundle' ],
banner: banner,
strict: true,
sourceMap: true,
// bundle magic-string and its dependency, vlq
resolvePath: function ( importee, importer ) {
return new Promise( function ( fulfil, reject ) {
var callback = function ( err, result ) {
if ( err ) {
reject( err );
} else {
fulfil( result );
}
};
resolve( importee, {
basedir: path.dirname( importer ),
packageFilter: function ( pkg ) {
if ( pkg[ 'jsnext:main' ] ) {
pkg.main = pkg[ 'jsnext:main' ];
return pkg;
}
var err = new Error( 'package ' + pkg.name + ' does not supply a jsnext:main field' );
err.code = 'ENOENT'; // hack
reject( err );
return {};
}
}, callback );
});
}
});
module.exports = gobble([ node, browser ]);
function today () {
var d = new Date();
return [
d.getFullYear(),
pad( d.getMonth() + 1 ),
pad( d.getDate() )
].join( '-' );
}
function pad ( num ) {
return num < 10 ? '0' + num : num;
}
================================================
FILE: package.json
================================================
{
"name": "esperanto",
"description": "An easier way to convert ES6 modules to AMD and CommonJS",
"version": "0.7.6",
"author": "Rich Harris",
"repository": "https://github.com/esperantojs/esperanto",
"license": "MIT",
"dependencies": {
"acorn": "^1.0.1",
"chalk": "^1.0.0",
"magic-string": "^0.4.9",
"minimist": "^1.1.0",
"sander": "^0.5.1"
},
"main": "dist/esperanto.js",
"jsnext:main": "src/esperanto.js",
"bin": {
"esperanto": "./bin/index.js"
},
"devDependencies": {
"gobble": "^0.7.2",
"gobble-babel": "^5.1.0",
"gobble-cli": "^0.4.2",
"gobble-esperanto-bundle": "^0.2.0",
"gobble-uglifyjs": "^0.1.0",
"magic-string": "^0.6.0",
"mocha": "^2.1.0",
"resolve": "^1.1.0",
"source-map": "^0.1.40",
"source-map-support": "^0.2.10"
},
"files": [
"esperanto.js",
"src",
"dist",
"bin",
"README.md"
],
"scripts": {
"build": "gobble build -f dist",
"pretest": "npm run build",
"test": "mocha",
"prepublish": "npm test"
}
}
================================================
FILE: src/banner.js
================================================
/*
esperanto.js v${VERSION} - ${TODAY}
http://esperantojs.org
Released under the MIT License.
*/
================================================
FILE: src/bundler/builders/concat.js
================================================
import packageResult from 'utils/packageResult';
export default function concat ( bundle, options ) {
// This bundle must be self-contained - no imports or exports
if ( bundle.externalModules.length || bundle.entryModule.exports.length ) {
throw new Error( `bundle.concat() can only be used with bundles that have no imports/exports (imports: [${bundle.externalModules.map(x=>x.id).join(', ')}], exports: [${bundle.entryModule.exports.join(', ')}])` );
}
// TODO test these options
let intro = 'intro' in options ? options.intro : `(function () { 'use strict';\n\n`;
let outro = 'outro' in options ? options.outro : '\n\n})();';
let indent;
if ( !( 'indent' in options ) || options.indent === true ) {
indent = bundle.body.getIndentString();
} else {
indent = options.indent || '';
}
bundle.body.trimLines().indent( indent ).prepend( intro ).append( outro );
return packageResult( bundle, bundle.body, options, 'toString', true );
}
================================================
FILE: src/bundler/builders/defaultsMode/amd.js
================================================
import packageResult from '../../../utils/packageResult';
import amdIntro from '../../../utils/amd/amdIntro';
export default function amd ( bundle, options ) {
let defaultName = bundle.entryModule.identifierReplacements.default;
if ( defaultName ) {
bundle.body.append( `\n\nreturn ${defaultName};` );
}
let intro = amdIntro({
name: options.amdName,
imports: bundle.externalModules,
indentStr: bundle.body.getIndentString(),
useStrict: options.useStrict !== false
});
bundle.body.indent().prepend( intro ).trimLines().append( '\n\n});' );
return packageResult( bundle, bundle.body, options, 'toAmd', true );
}
================================================
FILE: src/bundler/builders/defaultsMode/cjs.js
================================================
import packageResult from 'utils/packageResult';
import { req } from 'utils/mappers';
export default function cjs ( bundle, options ) {
let importBlock = bundle.externalModules.map( x => {
return `var ${x.name} = ${req(x.id)};`;
}).join( '\n' );
if ( importBlock ) {
bundle.body.prepend( importBlock + '\n\n' );
}
let defaultName = bundle.entryModule.identifierReplacements.default;
if ( defaultName ) {
bundle.body.append( `\n\nmodule.exports = ${defaultName};` );
}
if ( options.useStrict !== false ) {
bundle.body.prepend("'use strict';\n\n").trimLines();
}
return packageResult( bundle, bundle.body, options, 'toCjs', true );
}
================================================
FILE: src/bundler/builders/defaultsMode/index.js
================================================
import amd from './amd';
import cjs from './cjs';
import umd from './umd';
export default {
amd: amd,
cjs: cjs,
umd: umd
};
================================================
FILE: src/bundler/builders/defaultsMode/umd.js
================================================
import packageResult from 'utils/packageResult';
import umdIntro from 'utils/umd/umdIntro';
import requireName from 'utils/umd/requireName';
export default function umd ( bundle, options ) {
requireName( options );
let entry = bundle.entryModule;
let intro = umdIntro({
hasExports: entry.exports.length > 0,
imports: bundle.externalModules,
amdName: options.amdName,
name: options.name,
indentStr: bundle.body.getIndentString(),
useStrict: options.useStrict !== false
});
if ( entry.defaultExport ) {
bundle.body.append( `\n\nreturn ${entry.identifierReplacements.default};` );
}
bundle.body.indent().prepend( intro ).trimLines().append('\n\n}));');
return packageResult( bundle, bundle.body, options, 'toUmd', true );
}
================================================
FILE: src/bundler/builders/index.js
================================================
// TODO rewrite with named imports/exports
import defaultsMode from './defaultsMode';
import strictMode from './strictMode';
export default {
defaultsMode: defaultsMode,
strictMode: strictMode
};
================================================
FILE: src/bundler/builders/strictMode/amd.js
================================================
import packageResult from '../../../utils/packageResult';
import amdIntro from '../../../utils/amd/amdIntro';
import getExportBlock from './utils/getExportBlock';
export default function amd ( bundle, options ) {
let externalDefaults = bundle.externalModules.filter( needsDefault );
let entry = bundle.entryModule;
if ( externalDefaults.length ) {
let defaultsBlock = externalDefaults.map( x => {
// Case 1: default is used, and named is not
if ( !x.needsNamed ) {
return `${x.name} = ('default' in ${x.name} ? ${x.name}['default'] : ${x.name});`;
}
// Case 2: both default and named are used
return `var ${x.name}__default = ('default' in ${x.name} ? ${x.name}['default'] : ${x.name});`;
}).join( '\n' );
bundle.body.prepend( defaultsBlock + '\n\n' );
}
if ( entry.defaultExport ) {
bundle.body.append( '\n\n' + getExportBlock( entry ) );
}
let intro = amdIntro({
name: options.amdName,
imports: bundle.externalModules,
hasExports: entry.exports.length,
indentStr: bundle.body.getIndentString(),
useStrict: options.useStrict !== false
});
bundle.body.indent().prepend( intro ).trimLines().append( '\n\n});' );
return packageResult( bundle, bundle.body, options, 'toAmd', true );
}
function needsDefault ( externalModule ) {
return externalModule.needsDefault;
}
================================================
FILE: src/bundler/builders/strictMode/cjs.js
================================================
import packageResult from 'utils/packageResult';
import getExportBlock from './utils/getExportBlock';
import { req } from 'utils/mappers';
export default function cjs ( bundle, options ) {
let entry = bundle.entryModule;
let importBlock = bundle.externalModules.map( x => {
let statement = `var ${x.name} = ${req(x.id)};`;
if ( x.needsDefault ) {
statement += '\n' +
( x.needsNamed ? `var ${x.name}__default` : x.name ) +
` = ('default' in ${x.name} ? ${x.name}['default'] : ${x.name});`;
}
return statement;
}).join( '\n' );
if ( importBlock ) {
bundle.body.prepend( importBlock + '\n\n' );
}
if ( entry.defaultExport ) {
bundle.body.append( '\n\n' + getExportBlock( entry ) );
}
if ( options.useStrict !== false ) {
bundle.body.prepend("'use strict';\n\n").trimLines();
}
return packageResult( bundle, bundle.body, options, 'toCjs', true );
}
================================================
FILE: src/bundler/builders/strictMode/index.js
================================================
import amd from './amd';
import cjs from './cjs';
import umd from './umd';
export default {
amd: amd,
cjs: cjs,
umd: umd
};
================================================
FILE: src/bundler/builders/strictMode/umd.js
================================================
import umdIntro from 'utils/umd/umdIntro';
import requireName from 'utils/umd/requireName';
import packageResult from 'utils/packageResult';
import getExportBlock from './utils/getExportBlock';
export default function umd ( bundle, options ) {
requireName( options );
let entry = bundle.entryModule;
let intro = umdIntro({
hasExports: entry.exports.length > 0,
imports: bundle.externalModules,
externalDefaults: bundle.externalModules.filter( needsDefault ),
amdName: options.amdName,
name: options.name,
indentStr: bundle.body.getIndentString(),
strict: true,
useStrict: options.useStrict !== false
});
if ( entry.defaultExport ) {
bundle.body.append( '\n\n' + getExportBlock( entry ) );
}
bundle.body.indent().prepend( intro ).trimLines().append('\n\n}));');
return packageResult( bundle, bundle.body, options, 'toUmd', true );
}
function needsDefault ( externalModule ) {
return externalModule.needsDefault;
}
================================================
FILE: src/bundler/builders/strictMode/utils/getExportBlock.js
================================================
export default function getExportBlock ( entry ) {
let name = entry.identifierReplacements.default;
return `exports['default'] = ${name};`;
}
================================================
FILE: src/bundler/combine/getRenamedImports.js
================================================
export default function getRenamedImports ( mod ) {
let renamed = [];
mod.imports.forEach( x => {
if ( x.specifiers ) {
x.specifiers.forEach( s => {
if ( s.name !== s.as && !~renamed.indexOf( s.name ) ) {
renamed.push( s.name );
}
});
}
});
return renamed;
}
================================================
FILE: src/bundler/combine/index.js
================================================
import MagicString from 'magic-string';
import populateModuleNames from './populateModuleNames';
import populateExternalModuleImports from './populateExternalModuleImports';
import populateIdentifierReplacements from './populateIdentifierReplacements';
import resolveExports from './resolveExports';
import transformBody from './transformBody';
export default function combine ( bundle ) {
bundle.body = new MagicString.Bundle({
separator: '\n\n'
});
// give each module in the bundle a unique name
populateModuleNames( bundle );
// determine which specifiers are imported from
// external modules
populateExternalModuleImports( bundle );
// determine which identifiers need to be replaced
// inside this bundle
populateIdentifierReplacements( bundle );
bundle.exports = resolveExports( bundle );
bundle.modules.forEach( mod => {
// verify that this module doesn't import non-exported identifiers
mod.imports.forEach( x => {
const imported = x.module;
if ( imported.isExternal || imported.isSkipped || x.isBatch ) {
return;
}
x.specifiers.forEach( s => {
if ( !imported.doesExport[ s.name ] ) {
throw new Error( `Module '${imported.id}' does not export '${s.name}' (imported by '${mod.id}')` );
}
});
});
bundle.body.addSource({
filename: mod.path,
content: transformBody( bundle, mod, mod.body ),
indentExclusionRanges: mod.ast._templateLiteralRanges
});
});
}
================================================
FILE: src/bundler/combine/populateExternalModuleImports.js
================================================
export default function populateExternalModuleImports ( bundle ) {
bundle.modules.forEach( mod => {
mod.imports.forEach( x => {
const externalModule = x.module;
if ( !externalModule.isExternal ) {
return;
}
x.specifiers.forEach( s => {
if ( s.isDefault ) {
externalModule.needsDefault = true;
} else {
externalModule.needsNamed = true;
}
});
});
});
}
================================================
FILE: src/bundler/combine/populateIdentifierReplacements.js
================================================
import hasOwnProp from 'utils/hasOwnProp';
import topLevelScopeConflicts from './topLevelScopeConflicts';
/**
* Figures out which identifiers need to be rewritten within
a bundle to avoid conflicts
* @param {object} bundle - the bundle
* @returns {object}
*/
export default function populateIdentifierReplacements ( bundle ) {
// first, discover conflicts
let conflicts = topLevelScopeConflicts( bundle );
// then figure out what identifiers need to be created
// for default exports
bundle.modules.forEach( mod => {
let x = mod.defaultExport;
if ( x ) {
let result;
if ( x.hasDeclaration && x.name ) {
result = hasOwnProp.call( conflicts, x.name ) || otherModulesDeclare( mod, x.name ) ?
`${mod.name}__${x.name}` :
x.name;
} else {
result = hasOwnProp.call( conflicts, mod.name ) || ( x.value !== mod.name && ~mod.ast._topLevelNames.indexOf( mod.name )) || otherModulesDeclare( mod, mod.name ) ?
`${mod.name}__default` :
mod.name;
}
mod.identifierReplacements.default = result;
}
});
// then determine which existing identifiers
// need to be replaced
bundle.modules.forEach( mod => {
let moduleIdentifiers = mod.identifierReplacements;
mod.ast._topLevelNames.forEach( n => {
moduleIdentifiers[n] = hasOwnProp.call( conflicts, n ) ?
`${mod.name}__${n}` :
n;
});
mod.imports.forEach( x => {
if ( x.passthrough ) {
return;
}
const imported = x.module;
x.specifiers.forEach( s => {
let replacement;
if ( s.isBatch ) {
replacement = x.module.name;
}
else {
let mod;
let specifierName;
if ( s.origin ) {
// chained bindings
mod = s.origin.module;
specifierName = s.origin.name;
} else {
mod = imported;
specifierName = s.name;
}
const moduleName = mod && mod.name;
if ( specifierName === 'default' ) {
// if it's an external module, always use __default if the
// bundle also uses named imports
if ( imported.isExternal ) {
replacement = imported.needsNamed ? `${moduleName}__default` : moduleName;
}
// TODO We currently need to check for the existence of `mod`, because modules
// can be skipped. Would be better to replace skipped modules with dummies
// - see https://github.com/Rich-Harris/esperanto/issues/32
else if ( mod && !mod.isSkipped ) {
replacement = mod.identifierReplacements.default;
}
} else if ( !imported.isExternal ) {
replacement = hasOwnProp.call( conflicts, specifierName ) ?
`${moduleName}__${specifierName}` :
specifierName;
} else {
replacement = moduleName + '.' + specifierName;
}
}
if ( replacement !== s.as ) {
moduleIdentifiers[ s.as ] = replacement;
}
});
});
});
function otherModulesDeclare ( mod, replacement ) {
var i, otherMod;
i = bundle.modules.length;
while ( i-- ) {
otherMod = bundle.modules[i];
if ( mod === otherMod ) {
continue;
}
if ( hasOwnProp.call( otherMod.ast._declared, replacement ) ) {
return true;
}
}
}
}
================================================
FILE: src/bundler/combine/populateModuleNames.js
================================================
import hasOwnProp from 'utils/hasOwnProp';
import builtins from 'utils/builtins';
import { default as sanitize, splitPath } from 'utils/sanitize';
export default function getUniqueNames ( bundle ) {
let { modules, externalModules } = bundle;
let userNames = bundle.names;
let names = {};
let used = modules.reduce( ( declared, mod ) => {
const defaultExport = mod.defaultExport;
const defaultExportName = defaultExport &&
!defaultExport.unsafe &&
defaultExport.type === 'expression' &&
defaultExport.node.declaration &&
defaultExport.node.declaration.type === 'Identifier' &&
defaultExport.node.declaration.name;
Object.keys( mod.ast._declared ).forEach( x => {
// special case - `export default foo`
if ( x === defaultExportName ) return;
declared[x] = true;
});
return declared;
}, {} );
// copy builtins
builtins.forEach( n => used[n] = true );
// copy user-specified names
if ( userNames ) {
Object.keys( userNames ).forEach( id => {
names[ id ] = userNames[ id ];
used[ userNames[ id ] ] = true;
});
}
// infer names from default imports - e.g. with `import _ from './utils'`,
// use '_' instead of generating a name from 'utils'
function inferName ( x ) {
if ( x.isDefault && !hasOwnProp.call( names, x.module.id ) && !hasOwnProp.call( used, x.as ) ) {
names[ x.module.id ] = x.as;
used[ x.as ] = true;
}
}
modules.forEach( mod => {
mod.imports.forEach( inferName );
});
// for the rest, make names as compact as possible without
// introducing conflicts
modules.concat( externalModules ).forEach( mod => {
// is this already named?
if ( hasOwnProp.call( names, mod.id ) ) {
mod.name = names[ mod.id ];
return;
}
let name;
let parts = splitPath( mod.id );
let i = parts.length;
while ( i-- ) {
name = sanitize( parts.slice( i ).join( '_' ) );
if ( !hasOwnProp.call( used, name ) ) {
break;
}
}
while ( hasOwnProp.call( used, name ) ) {
name = '_' + name;
}
used[ name ] = true;
mod.name = name;
});
return names;
}
================================================
FILE: src/bundler/combine/resolveExports.js
================================================
export default function resolveExports ( bundle ) {
let bundleExports = {};
bundle.entryModule.exports.forEach( x => {
if ( x.specifiers ) {
x.specifiers.forEach( s => {
let module;
let name;
if ( s.origin ) {
module = s.origin.module;
name = s.origin.name;
} else {
module = bundle.entryModule;
name = s.name;
}
addExport( module, name, s.as );
});
}
else if ( !x.isDefault && x.name ) {
addExport( bundle.entryModule, x.name, x.name );
}
});
function addExport ( module, name, as ) {
if ( !bundleExports[ module.id ] ) {
bundleExports[ module.id ] = {};
}
bundleExports[ module.id ][ name ] = as;
}
return bundleExports;
}
================================================
FILE: src/bundler/combine/topLevelScopeConflicts.js
================================================
import hasOwnProp from 'utils/hasOwnProp';
import builtins from 'utils/builtins';
import getUnscopedNames from 'utils/ast/getUnscopedNames';
import { getName } from 'utils/mappers';
import getRenamedImports from './getRenamedImports';
export default function topLevelScopeConflicts ( bundle ) {
let conflicts = {};
let inBundle = {};
let importNames = bundle.externalModules.map( getName );
bundle.modules.forEach( mod => {
let names = builtins
// all top defined identifiers are in top scope
.concat( mod.ast._topLevelNames )
// all unattributed identifiers could collide with top scope
.concat( getUnscopedNames( mod ) )
.concat( importNames )
.concat( getRenamedImports( mod ) );
if ( mod._exportsNamespace ) {
conflicts[ mod.name ] = true;
}
// merge this module's top scope with bundle top scope
names.forEach( name => {
if ( hasOwnProp.call( inBundle, name ) ) {
conflicts[ name ] = true;
} else {
inBundle[ name ] = true;
}
});
});
return conflicts;
}
================================================
FILE: src/bundler/combine/transformBody.js
================================================
import hasOwnProp from 'utils/hasOwnProp';
import getReadOnlyIdentifiers from 'utils/getReadOnlyIdentifiers';
import traverseAst from 'utils/ast/traverse';
export default function transformBody ( bundle, mod, body ) {
let identifierReplacements = mod.identifierReplacements;
let [ importedBindings, importedNamespaces ] = getReadOnlyIdentifiers( mod.imports );
let exportNames = hasOwnProp.call( bundle.exports, mod.id ) && bundle.exports[ mod.id ];
traverseAst( mod.ast, body, identifierReplacements, importedBindings, importedNamespaces, exportNames );
// Remove import statements
mod.imports.forEach( x => {
if ( !x.passthrough ) {
body.remove( x.start, x.next );
}
});
let shouldExportEarly = {};
// Remove export statements
mod.exports.forEach( x => {
var name;
if ( x.isDefault ) {
if ( x.type === 'namedFunction' || x.type === 'namedClass' ) {
// if you have a default export like
//
// export default function foo () {...}
//
// you need to rewrite it as
//
// function foo () {...}
// exports.default = foo;
//
// as the `foo` reference may be used elsewhere
// remove the `export default `, keep the rest
body.remove( x.start, x.valueStart );
}
else if ( x.node.declaration && ( name = x.node.declaration.name ) ) {
if ( name === identifierReplacements.default ) {
body.remove( x.start, x.end );
} else {
let original = hasOwnProp.call( identifierReplacements, name ) ? identifierReplacements[ name ] : name;
body.replace( x.start, x.end, `var ${identifierReplacements.default} = ${original};` );
}
}
else {
body.replace( x.start, x.valueStart, `var ${identifierReplacements.default} = ` );
}
return;
}
if ( x.hasDeclaration ) {
if ( x.type === 'namedFunction' ) {
shouldExportEarly[ x.name ] = true; // TODO what about `function foo () {}; export { foo }`?
}
body.remove( x.start, x.valueStart );
} else {
body.remove( x.start, x.next );
}
});
// If this module exports a namespace - i.e. another module does
// `import * from 'foo'` - then we need to make all this module's
// exports available, using Object.defineProperty
var indentStr = body.getIndentString();
if ( mod._exportsNamespace ) {
let namespaceExportBlock = `var ${mod.name} = {\n`,
namespaceExports = [];
mod.exports.forEach( x => {
if ( x.hasDeclaration ) {
namespaceExports.push( indentStr + `get ${x.name} () { return ${identifierReplacements[x.name]}; }` );
}
else if ( x.isDefault ) {
namespaceExports.push( indentStr + `get default () { return ${identifierReplacements.default}; }` );
}
else {
x.specifiers.forEach( s => {
let original = hasOwnProp.call( identifierReplacements, s.name ) ? identifierReplacements[ s.name ] : s.name;
namespaceExports.push( indentStr + `get ${s.as} () { return ${original}; }` );
});
}
});
namespaceExportBlock += namespaceExports.join( ',\n' ) + '\n};\n\n';
body.prepend( namespaceExportBlock );
}
// If this module is responsible for one of the bundle's exports
// (it doesn't have to be the entry module, which could re-export
// a binding from another module), we write exports here
if ( exportNames ) {
let exportBlock = [];
Object.keys( exportNames ).forEach( name => {
var exportAs = exportNames[ name ];
exportBlock.push( `exports.${exportAs} = ${identifierReplacements[name]};` );
});
if ( exportBlock.length ) {
body.trim().append( '\n\n' + exportBlock.join( '\n' ) );
}
}
return body.trim();
}
================================================
FILE: src/bundler/getBundle.js
================================================
import { relative, resolve, sep } from 'path';
import hasOwnProp from 'utils/hasOwnProp';
import resolveId from 'utils/resolveId';
import promiseSequence from 'utils/promiseSequence';
import sortModules from './utils/sortModules';
import resolveChains from './utils/resolveChains';
import combine from './combine';
import { readFile, stat, Promise } from 'sander';
import getModule from './getModule';
export default function getBundle ( options ) {
let entry = options.entry.replace( /\.js$/, '' );
let userModules = options.modules || {};
let modules = [];
let moduleLookup = {};
let promiseByPath = {};
let skip = options.skip;
let names = options.names;
let base = ( options.base ? resolve( options.base ) : process.cwd() ) + '/';
let externalModules = [];
let externalModuleLookup = {};
if ( !entry.indexOf( base ) ) {
entry = entry.substring( base.length );
}
// resolve user module paths
options.modules && Object.keys( options.modules ).forEach( relativePath => {
userModules[ resolve( base, relativePath ) ] = options.modules[ relativePath ];
});
let cyclicalModules = [];
return resolvePath( base, userModules, entry, null ).then( absolutePath => {
return fetchModule( entry, absolutePath ).then( entryModule => {
return Promise.all( cyclicalModules ).then( () => {
// if the bundle contains cyclical modules,
// we may need to sort it again
if ( cyclicalModules.length ) {
modules = sortModules( entryModule );
}
let bundle = {
entryModule,
modules,
externalModules,
names
};
resolveChains( modules, moduleLookup );
combine( bundle );
return bundle;
});
});
}, function ( err ) {
if ( err.code === 'ENOENT' ) {
throw new Error( 'Could not find entry module (' + entry + ')' );
}
throw err;
});
function fetchModule ( moduleId, absolutePath ) {
if ( !hasOwnProp.call( promiseByPath, absolutePath ) ) {
promiseByPath[ absolutePath ] = (
hasOwnProp.call( userModules, absolutePath ) ?
Promise.resolve( userModules[ absolutePath ] ) :
readFile( absolutePath ).then( String )
).then( function ( source ) {
let code, ast;
// normalise
if ( typeof source === 'object' ) {
code = source.code;
ast = source.ast;
} else {
code = source;
ast = null;
}
if ( options.transform ) {
code = options.transform( code, absolutePath );
if ( typeof code !== 'string' && !isThenable( code ) ) {
throw new Error( 'transform should return String or Promise' );
}
}
let module = getModule({
id: moduleId,
path: absolutePath,
code,
ast
});
moduleLookup[ moduleId ] = module;
return promiseSequence( module.imports, x => {
const id = resolveId( x.path, module.path ).replace( base.replace(/\\/g, '/'), '' );
if ( id === moduleId ) {
throw new Error( `A module (${moduleId}) cannot import itself` );
}
// Some modules can be skipped
if ( skip && ~skip.indexOf( id ) ) {
const skippedModule = {
id,
isSkipped: true
};
x.module = skippedModule;
return skippedModule;
}
return resolvePath( base, userModules, id, absolutePath, options.resolvePath ).then( absolutePath => {
let promise = hasOwnProp.call( promiseByPath, absolutePath ) && promiseByPath[ absolutePath ];
let cyclical = !!promise;
if ( cyclical ) {
// ensure all modules are set before we
// create the bundle...
cyclicalModules.push(
promise.then( module => x.module = module )
);
// ...then short-circuit
return;
}
return fetchModule( id, absolutePath ).then( module => x.module = module );
}, function handleError ( err ) {
if ( err.code === 'ENOENT' ) {
// Most likely an external module
let externalModule = hasOwnProp.call( externalModuleLookup, id ) && externalModuleLookup[ id ];
if ( !externalModule ) {
externalModule = {
id,
isExternal: true
};
externalModules.push( externalModule );
externalModuleLookup[ id ] = externalModule;
}
x.module = externalModule;
} else {
throw err;
}
} );
})
.then( () => modules.push( module ) )
.then( () => module );
});
}
return promiseByPath[ absolutePath ];
}
}
function resolvePath ( base, userModules, moduleId, importerPath, resolver ) {
const noExt = moduleId.replace( /\.js$/, '' );
return tryPath( base, noExt + '.js', userModules )
.catch( () => tryPath( base, noExt + sep + 'index.js', userModules ) )
.catch( function ( err ) {
const resolvedPromise = resolver && Promise.resolve( resolver( moduleId, importerPath ) );
if ( resolvedPromise ) {
return resolvedPromise.then( resolvedPath => {
if ( !resolvedPath ) {
// hack but whatevs, it saves handling real ENOENTs differently
let err = new Error();
err.code = 'ENOENT';
throw err;
}
return stat( resolvedPath ).then( () => resolve( base, resolvedPath ) );
});
} else {
throw err;
}
});
}
function tryPath ( base, filename, userModules ) {
const absolutePath = resolve( base, filename );
if ( hasOwnProp.call( userModules, absolutePath ) ) {
return Promise.resolve( absolutePath );
}
return stat( absolutePath ).then( () => absolutePath );
}
function isThenable ( obj ) {
return obj && typeof obj.then === 'function';
}
================================================
FILE: src/bundler/getModule.js
================================================
import { parse } from 'acorn';
import MagicString from 'magic-string';
import findImportsAndExports from 'utils/ast/findImportsAndExports';
import annotateAst from 'utils/ast/annotate';
import disallowConflictingImports from '../utils/disallowConflictingImports';
export default function getModule ( mod ) {
mod.body = new MagicString( mod.code );
let toRemove = [];
let comments = [];
try {
mod.ast = mod.ast || ( parse( mod.code, {
ecmaVersion: 6,
sourceType: 'module',
onComment ( block, text, start, end ) {
// sourceMappingURL comments should be removed
if ( !block && /^# sourceMappingURL=/.test( text ) ) {
toRemove.push({ start, end });
} else {
comments.push({ start, end });
}
}
}));
} catch ( err ) {
// If there's a parse error, attach file info
// before throwing the error
if ( err.loc ) {
err.file = mod.path;
}
throw err;
}
// remove sourceMappingURL comments
toRemove.forEach( ({ start, end }) => mod.body.remove( start, end ) );
let { imports, exports, defaultExport } = findImportsAndExports( mod.ast, mod.code, comments );
disallowConflictingImports( imports );
mod.imports = imports;
mod.exports = exports;
mod.defaultExport = defaultExport;
const defaultExportIdentifier = defaultExport &&
defaultExport.type === 'expression' &&
defaultExport.node.declaration &&
defaultExport.node.declaration.type === 'Identifier' &&
defaultExport.node.declaration;
// if the default export is an expression like `export default foo`, we
// can *probably* just use `foo` to refer to said export throughout the
// bundle. Tracking assignments to `foo` allows us to be sure that that's
// the case (i.e. that the module doesn't assign a different value to foo
// after it's been exported)
annotateAst( mod.ast, {
trackAssignments: defaultExportIdentifier
});
if ( defaultExportIdentifier && defaultExportIdentifier._assignments ) {
let i = defaultExportIdentifier._assignments.length;
while ( i-- ) {
const assignment = defaultExportIdentifier._assignments[i];
// if either a) the assignment happens inside a function body, or
// b) it happens after the `export default ...`, then it's unsafe to
// use the identifier, and we need to essentially do `var _foo = foo`
if ( assignment.scope.parent || assignment.node.start > defaultExport.start ) {
defaultExport.unsafe = true; // TODO better property name than 'unsafe'
break;
}
}
}
// identifiers to replace within this module
// (gets filled in later, once bundle is combined)
mod.identifierReplacements = {};
// collect exports by name, for quick lookup when verifying
// that this module exports a given identifier
mod.doesExport = {};
exports.forEach( x => {
if ( x.isDefault ) {
mod.doesExport.default = true;
}
else if ( x.name ) {
mod.doesExport[ x.name ] = true;
}
else if ( x.specifiers ) {
x.specifiers.forEach( s => {
mod.doesExport[ s.as ] = true;
});
}
else {
throw new Error( 'Unexpected export type' );
}
});
return mod;
}
================================================
FILE: src/bundler/utils/resolveChains.js
================================================
import hasOwnProp from 'utils/hasOwnProp';
/**
* Discovers 'chains' within a bundle - e.g. `import { foo } from 'foo'`
may be equivalent to `import { bar } from 'bar'`, if foo.js imports `bar`
and re-exports it as `foo`. Where applicable, import/export specifiers
are augmented with an `origin: { module, name }` property
* @param {array} modules - the bundle's array of modules
* @param {object} moduleLookup - modules indexed by their ID
*/
export default function resolveChains ( modules, moduleLookup ) {
let chains = {};
// First pass - resolving intra-module chains
modules.forEach( mod => {
var origin = {};
mod.imports.forEach( x => {
const imported = x.module;
x.specifiers.forEach( s => {
if ( s.isBatch ) {
// tell that module that it needs to export an object full of getters
imported._exportsNamespace = true;
return; // TODO can batch imports be chained?
}
origin[ s.as ] = `${s.name}@${imported.id}`;
});
});
mod.exports.forEach( x => {
if ( !x.specifiers ) return;
x.specifiers.forEach( s => {
if ( hasOwnProp.call( origin, s.name ) ) {
chains[ `${s.as}@${mod.id}` ] = origin[ s.name ];
} else if ( s.as !== s.name ) {
chains[ `${s.as}@${mod.id}` ] = `${s.name}@${mod.id}`;
}
});
});
});
// Second pass - assigning origins to specifiers
modules.forEach( mod => {
mod.imports.forEach( x => {
const imported = x.module;
x.specifiers.forEach( s => {
if ( s.isBatch ) {
return; // TODO can batch imports be chained?
}
setOrigin( s, `${s.name}@${imported.id}`, chains, moduleLookup );
});
});
mod.exports.forEach( x => {
if ( !x.specifiers ) return;
x.specifiers.forEach( s => {
setOrigin( s, `${s.as}@${mod.id}`, chains, moduleLookup );
});
});
});
}
function setOrigin ( specifier, hash, chains, moduleLookup ) {
let isChained;
while ( hasOwnProp.call( chains, hash ) ) {
hash = chains[ hash ];
isChained = true;
}
if ( isChained ) {
const [ name, moduleId ] = hash.split( '@' );
specifier.origin = { module: moduleLookup[ moduleId ], name };
}
}
================================================
FILE: src/bundler/utils/sortModules.js
================================================
import hasOwnProp from 'utils/hasOwnProp';
import walk from 'utils/ast/walk';
/**
* Sorts an array of modules such that dependencies come before
their dependents, handling complex cases of cyclical dependencies
* @param {object} entry - the bundle's 'entry module'
* @returns {array} - the sorted module list
*/
export default function sortModules ( entry ) {
let seen = {};
let ordered = [];
let hasCycles;
let strongDeps = {};
let stronglyDependsOn = {};
function visit ( mod ) {
const { id } = mod;
seen[ id ] = true;
strongDeps[ id ] = [];
stronglyDependsOn[ id ] = {};
mod.imports.forEach( x => {
const imported = x.module;
if ( imported.isExternal || imported.isSkipped ) return;
// if `mod` references a binding from `imported` at the top
// level (i.e. outside function bodies), we say that `mod`
// strongly depends on `imported. If two modules depend on
// each other, this helps us order them such that if a
// strongly depends on b, and b weakly depends on a, b
// goes first
if ( referencesAtTopLevel( mod, imported ) ) {
strongDeps[ id ].push( imported );
}
if ( hasOwnProp.call( seen, imported.id ) ) {
// we need to prevent an infinite loop, and note that
// we need to check for strong/weak dependency relationships
hasCycles = true;
return;
}
visit( imported );
});
// add second (and third...) order dependencies
function addStrongDependencies ( dependency ) {
if ( hasOwnProp.call( stronglyDependsOn[ id ], dependency.id ) ) return;
stronglyDependsOn[ id ][ dependency.id ] = true;
strongDeps[ dependency.id ].forEach( addStrongDependencies );
}
strongDeps[ id ].forEach( addStrongDependencies );
ordered.push( mod );
}
visit( entry );
let unordered;
if ( hasCycles ) {
unordered = ordered;
ordered = [];
// unordered is actually semi-ordered, as [ fewer dependencies ... more dependencies ]
unordered.forEach( x => {
// ensure strong dependencies of x that don't strongly depend on x go first
strongDeps[ x.id ].forEach( place );
function place ( dep ) {
if ( !stronglyDependsOn[ dep.id ][ x.id ] && !~ordered.indexOf( dep ) ) {
strongDeps[ dep.id ].forEach( place );
ordered.push( dep );
}
}
if ( !~ordered.indexOf( x ) ) {
ordered.push( x );
}
});
}
return ordered;
}
function referencesAtTopLevel ( a, b ) {
let bindings = [];
// find out which bindings a imports from b
let i = a.imports.length;
while ( i-- ) {
if ( a.imports[i].module === b ) {
bindings.push.apply( bindings, a.imports[i].specifiers.map( x => x.as ) );
}
}
// see if any of those bindings are referenced at the top level
let referencedAtTopLevel = false;
walk( a.ast, {
enter ( node ) {
if ( /^Import/.test( node.type ) || ( node._scope && node._scope.parent ) ) {
return this.skip();
}
if ( node.type === 'Identifier' && ~bindings.indexOf( node.name ) ) {
referencedAtTopLevel = true;
this.abort();
}
}
});
return referencedAtTopLevel;
}
================================================
FILE: src/esperanto.js
================================================
import chalk from 'chalk';
import hasNamedImports from 'utils/hasNamedImports';
import hasNamedExports from 'utils/hasNamedExports';
import getStandaloneModule from 'standalone/getModule';
import getBundle from 'bundler/getBundle';
import moduleBuilders from 'standalone/builders';
import bundleBuilders from 'bundler/builders';
import concat from 'bundler/builders/concat';
import { getName } from 'utils/mappers';
let deprecateMessages = {
defaultOnly: 'options.defaultOnly has been deprecated, and is now standard behaviour. To use named imports/exports, pass `strict: true`.',
standalone: chalk.red.bold( '[DEPRECATION NOTICE] Esperanto is no longer under active development. To convert an ES6 module to another format, consider using Babel (https://babeljs.io)' ),
bundle: chalk.red.bold( '[DEPRECATION NOTICE] Esperanto is no longer under active development. To bundle ES6 modules, consider using Rollup (https://github.com/rollup/rollup). See https://github.com/rollup/rollup/wiki/Migrating-from-Esperanto for help migrating' )
};
let alreadyWarned = {
defaultOnly: false,
standalone: false,
bundle: false
};
function transpileMethod ( format ) {
if ( !alreadyWarned.standalone ) {
console.error( deprecateMessages.standalone );
alreadyWarned.standalone = true;
}
return function ( source, options = {} ) {
let mod = getStandaloneModule({
source,
getModuleName: options.getModuleName,
strict: options.strict
});
if ( 'defaultOnly' in options && !alreadyWarned.defaultOnly ) {
// TODO link to a wiki page explaining this, or something
console.error( deprecateMessages.defaultOnly );
alreadyWarned.defaultOnly = true;
}
if ( options.absolutePaths && !options.amdName ) {
throw new Error( 'You must specify an `amdName` in order to use the `absolutePaths` option' );
}
let builder;
if ( !options.strict ) {
// ensure there are no named imports/exports. TODO link to a wiki page...
if ( hasNamedImports( mod ) || hasNamedExports( mod ) ) {
throw new Error( 'You must be in strict mode (pass `strict: true`) to use named imports or exports' );
}
builder = moduleBuilders.defaultsMode[ format ];
} else {
builder = moduleBuilders.strictMode[ format ];
}
return builder( mod, options );
};
}
export const toAmd = transpileMethod( 'amd' );
export const toCjs = transpileMethod( 'cjs' );
export const toUmd = transpileMethod( 'umd' );
export function bundle ( options ) {
if ( !alreadyWarned.bundle ) {
console.error( deprecateMessages.bundle );
alreadyWarned.bundle = true;
}
return getBundle( options ).then( function ( bundle ) {
return {
imports: bundle.externalModules.map( mod => mod.id ),
exports: flattenExports( bundle.entryModule.exports ),
toAmd: options => transpile( 'amd', options ),
toCjs: options => transpile( 'cjs', options ),
toUmd: options => transpile( 'umd', options ),
concat: options => concat( bundle, options || {} )
};
function transpile ( format, options = {} ) {
if ( 'defaultOnly' in options && !alreadyWarned.defaultOnly ) {
// TODO link to a wiki page explaining this, or something
console.error( deprecateMessages.defaultOnly );
alreadyWarned.defaultOnly = true;
}
let builder;
if ( !options.strict ) {
// ensure there are no named imports/exports
if ( hasNamedExports( bundle.entryModule ) ) {
throw new Error( 'Entry module can only have named exports in strict mode (pass `strict: true`)' );
}
bundle.modules.forEach( mod => {
mod.imports.forEach( x => {
if ( x.module.isExternal && ( !x.isDefault && !x.isBatch ) ) {
throw new Error( 'You can only have named external imports in strict mode (pass `strict: true`)' );
}
});
});
builder = bundleBuilders.defaultsMode[ format ];
} else {
builder = bundleBuilders.strictMode[ format ];
}
return builder( bundle, options );
}
});
}
function flattenExports ( exports ) {
let flattened = [];
exports.forEach( x => {
if ( x.isDefault ) {
flattened.push( 'default' );
}
else if ( x.name ) {
flattened.push( x.name );
}
else if ( x.specifiers ) {
flattened.push.apply( flattened, x.specifiers.map( x => x.as ) );
}
});
return flattened;
}
================================================
FILE: src/standalone/builders/defaultsMode/amd.js
================================================
import transformExportDeclaration from './utils/transformExportDeclaration';
import packageResult from 'utils/packageResult';
import amdIntro from '../../../utils/amd/amdIntro';
export default function amd ( mod, options ) {
mod.imports.forEach( x => {
mod.body.remove( x.start, x.next );
});
transformExportDeclaration( mod.exports[0], mod.body );
let intro = amdIntro({
name: options.amdName,
imports: mod.imports,
absolutePaths: options.absolutePaths,
indentStr: mod.body.getIndentString(),
useStrict: options.useStrict !== false
});
mod.body.trim()
.indent()
.prepend( intro )
.trim()
.append( '\n\n});' );
return packageResult( mod, mod.body, options, 'toAmd' );
}
================================================
FILE: src/standalone/builders/defaultsMode/cjs.js
================================================
import hasOwnProp from 'utils/hasOwnProp';
import packageResult from 'utils/packageResult';
import { req } from 'utils/mappers';
export default function cjs ( mod, options ) {
let seen = {};
mod.imports.forEach( x => {
if ( !hasOwnProp.call( seen, x.path ) ) {
let replacement = x.isEmpty ? `${req(x.path)};` : `var ${x.as} = ${req(x.path)};`;
mod.body.replace( x.start, x.end, replacement );
seen[ x.path ] = true;
} else {
mod.body.remove( x.start, x.next );
}
});
let exportDeclaration = mod.exports[0];
if ( exportDeclaration ) {
switch ( exportDeclaration.type ) {
case 'namedFunction':
case 'namedClass':
mod.body.remove( exportDeclaration.start, exportDeclaration.valueStart );
mod.body.replace( exportDeclaration.end, exportDeclaration.end, `\nmodule.exports = ${exportDeclaration.name};` );
break;
default:
mod.body.replace( exportDeclaration.start, exportDeclaration.valueStart, 'module.exports = ' );
break;
}
}
if ( options.useStrict !== false ) {
mod.body.prepend( "'use strict';\n\n" ).trimLines();
}
return packageResult( mod, mod.body, options, 'toCjs' );
}
================================================
FILE: src/standalone/builders/defaultsMode/index.js
================================================
import amd from './amd';
import cjs from './cjs';
import umd from './umd';
export default {
amd: amd,
cjs: cjs,
umd: umd
};
================================================
FILE: src/standalone/builders/defaultsMode/umd.js
================================================
import transformExportDeclaration from './utils/transformExportDeclaration';
import packageResult from 'utils/packageResult';
import umdIntro from 'utils/umd/umdIntro';
import requireName from 'utils/umd/requireName';
export default function umd ( mod, options ) {
requireName( options );
mod.imports.forEach( x => {
mod.body.remove( x.start, x.next );
});
let intro = umdIntro({
hasExports: mod.exports.length > 0,
imports: mod.imports,
amdName: options.amdName,
absolutePaths: options.absolutePaths,
name: options.name,
indentStr: mod.body.getIndentString(),
useStrict: options.useStrict !== false
});
transformExportDeclaration( mod.exports[0], mod.body );
mod.body.indent().prepend( intro ).trimLines().append( '\n\n}));' );
return packageResult( mod, mod.body, options, 'toUmd' );
}
================================================
FILE: src/standalone/builders/defaultsMode/utils/transformExportDeclaration.js
================================================
export default function transformExportDeclaration ( declaration, body ) {
if ( !declaration ) {
return;
}
let exportedValue;
switch ( declaration.type ) {
case 'namedFunction':
case 'namedClass':
body.remove( declaration.start, declaration.valueStart );
exportedValue = declaration.name;
break;
case 'anonFunction':
case 'anonClass':
if ( declaration.isFinal ) {
body.replace( declaration.start, declaration.valueStart, 'return ' );
} else {
body.replace( declaration.start, declaration.valueStart, 'var __export = ' );
exportedValue = '__export';
}
// add semi-colon, if necessary
// TODO body.original is an implementation detail of magic-string - there
// should probably be an API for this sort of thing
if ( body.original[ declaration.end - 1 ] !== ';' ) {
body.insert( declaration.end, ';' );
}
break;
case 'expression':
body.remove( declaration.start, declaration.next );
exportedValue = declaration.value;
break;
default:
throw new Error( `Unexpected export type '${declaration.type}'` );
}
if ( exportedValue ) {
body.append( `\nreturn ${exportedValue};` );
}
}
================================================
FILE: src/standalone/builders/index.js
================================================
// TODO rewrite with named imports/exports
import defaultsMode from './defaultsMode';
import strictMode from './strictMode';
export default {
defaultsMode: defaultsMode,
strictMode: strictMode
};
================================================
FILE: src/standalone/builders/strictMode/amd.js
================================================
import packageResult from '../../../utils/packageResult';
import transformBody from './utils/transformBody';
import amdIntro from '../../../utils/amd/amdIntro';
export default function amd ( mod, options ) {
let intro = amdIntro({
name: options.amdName,
absolutePaths: options.absolutePaths,
imports: mod.imports,
indentStr: mod.body.getIndentString(),
hasExports: mod.exports.length,
useStrict: options.useStrict !== false
});
transformBody( mod, mod.body, {
intro,
outro: '\n\n});',
_evilES3SafeReExports: options._evilES3SafeReExports
});
return packageResult( mod, mod.body, options, 'toAmd' );
}
================================================
FILE: src/standalone/builders/strictMode/cjs.js
================================================
import packageResult from 'utils/packageResult';
import hasOwnProp from 'utils/hasOwnProp';
import transformBody from './utils/transformBody';
import { req } from 'utils/mappers';
export default function cjs ( mod, options ) {
let seen = {};
// Create block of require statements
let importBlock = mod.imports.map( x => {
if ( !hasOwnProp.call( seen, x.path ) ) {
seen[ x.path ] = true;
if ( x.isEmpty ) {
return `${req(x.path)};`;
}
return `var ${x.name} = ${req(x.path)};`;
}
}).filter( Boolean ).join( '\n' );
transformBody( mod, mod.body, {
header: importBlock,
_evilES3SafeReExports: options._evilES3SafeReExports
});
if ( options.useStrict !== false ) {
mod.body.prepend( "'use strict';\n\n" ).trimLines();
}
return packageResult( mod, mod.body, options, 'toCjs' );
}
================================================
FILE: src/standalone/builders/strictMode/index.js
================================================
import amd from './amd';
import cjs from './cjs';
import umd from './umd';
export default {
amd: amd,
cjs: cjs,
umd: umd
};
================================================
FILE: src/standalone/builders/strictMode/umd.js
================================================
import packageResult from 'utils/packageResult';
import umdIntro from 'utils/umd/umdIntro';
import requireName from 'utils/umd/requireName';
import transformBody from './utils/transformBody';
export default function umd ( mod, options ) {
requireName( options );
let intro = umdIntro({
hasExports: mod.exports.length > 0,
imports: mod.imports,
amdName: options.amdName,
absolutePaths: options.absolutePaths,
name: options.name,
indentStr: mod.body.getIndentString(),
strict: true,
useStrict: options.useStrict !== false
});
transformBody( mod, mod.body, {
intro: intro,
outro: '\n\n}));',
_evilES3SafeReExports: options._evilES3SafeReExports
});
return packageResult( mod, mod.body, options, 'toUmd' );
}
================================================
FILE: src/standalone/builders/strictMode/utils/gatherImports.js
================================================
export default function gatherImports ( imports ) {
let chains = {};
let identifierReplacements = {};
imports.forEach( x => {
x.specifiers.forEach( s => {
if ( s.isBatch ) {
return;
}
let name = s.as;
let replacement = x.name + ( s.isDefault ? `['default']` : `.${s.name}` );
if ( !x.passthrough ) {
identifierReplacements[ name ] = replacement;
}
chains[ name ] = replacement;
});
});
return [ chains, identifierReplacements ];
}
================================================
FILE: src/standalone/builders/strictMode/utils/getExportNames.js
================================================
export default function getExportNames ( exports ) {
var result = {};
exports.forEach( x => {
if ( x.isDefault ) return;
if ( x.hasDeclaration ) {
result[ x.name ] = x.name;
return;
}
x.specifiers.forEach( s => {
result[ s.name ] = s.as;
});
});
return result;
}
================================================
FILE: src/standalone/builders/strictMode/utils/getImportSummary.js
================================================
import hasOwnProp from 'utils/hasOwnProp';
export default function getImportSummary ( mod ) {
let importPaths = [];
let importNames = [];
let seen = {};
let placeholders = 0;
mod.imports.forEach( x => {
if ( !hasOwnProp.call( seen, x.path ) ) {
importPaths.push( x.path );
if ( x.specifiers.length ) {
while ( placeholders ) {
importNames.push( `__dep${importNames.length}__` );
placeholders--;
}
importNames.push( x.name );
} else {
placeholders++;
}
seen[ x.path ] = true;
}
});
return [ importPaths, importNames ];
}
================================================
FILE: src/standalone/builders/strictMode/utils/transformBody.js
================================================
import gatherImports from './gatherImports';
import getExportNames from './getExportNames';
import getReadOnlyIdentifiers from 'utils/getReadOnlyIdentifiers';
import traverseAst from 'utils/ast/traverse';
import hasOwnProp from 'utils/hasOwnProp';
export default function transformBody ( mod, body, options ) {
let [ chains, identifierReplacements ] = gatherImports( mod.imports );
let exportNames = getExportNames( mod.exports );
let [ importedBindings, importedNamespaces ] = getReadOnlyIdentifiers( mod.imports );
// ensure no conflict with `exports`
identifierReplacements.exports = deconflict( 'exports', mod.ast._declared );
traverseAst( mod.ast, body, identifierReplacements, importedBindings, importedNamespaces, exportNames );
// Remove import statements from the body of the module
mod.imports.forEach( x => {
body.remove( x.start, x.next );
});
// Prepend require() statements (CommonJS output only)
if ( options.header ) {
body.prepend( options.header + '\n\n' );
}
// Remove export statements (but keep declarations)
mod.exports.forEach( x => {
if ( x.isDefault ) {
if ( /^named/.test( x.type ) ) {
// export default function answer () { return 42; }
body.remove( x.start, x.valueStart );
body.insert( x.end, `\nexports['default'] = ${x.name};` );
} else {
// everything else
body.replace( x.start, x.valueStart, 'exports[\'default\'] = ' );
}
}
else {
switch ( x.type ) {
case 'varDeclaration': // export var answer = 42; (or let)
case 'namedFunction': // export function answer () {...}
case 'namedClass': // export class answer {...}
body.remove( x.start, x.valueStart );
break;
case 'named': // export { foo, bar };
body.remove( x.start, x.next );
break;
default:
body.replace( x.start, x.valueStart, 'exports[\'default\'] = ' );
}
}
});
// Append export block (this is the same for all module types, unlike imports)
let earlyExports = [];
let lateExports = [];
Object.keys( exportNames ).forEach( name => {
var exportAs = exportNames[ name ];
if ( chains.hasOwnProperty( name ) ) {
// special case - a binding from another module
if ( !options._evilES3SafeReExports ) {
earlyExports.push( `Object.defineProperty(exports, '${exportAs}', { enumerable: true, get: function () { return ${chains[name]}; }});` );
} else {
let exportSegment = exportAs === 'default' ? "['default']" : `.${exportAs}`;
lateExports.push( `exports${exportSegment} = ${chains[name]};` );
}
} else if ( ~mod.ast._topLevelFunctionNames.indexOf( name ) ) {
// functions should be exported early, in
// case of cyclic dependencies
earlyExports.push( `exports.${exportAs} = ${name};` );
} else {
lateExports.push( `exports.${exportAs} = ${name};` );
}
});
// Function exports should be exported immediately after 'use strict'
if ( earlyExports.length ) {
body.trim().prepend( earlyExports.join( '\n' ) + '\n\n' );
}
// Everything else should be exported at the end
if ( lateExports.length ) {
body.trim().append( '\n\n' + lateExports.join( '\n' ) );
}
if ( options.intro && options.outro ) {
body.indent().prepend( options.intro ).trimLines().append( options.outro );
}
}
function deconflict ( name, declared ) {
while ( hasOwnProp.call( declared, name ) ) {
name = '_' + name;
}
return name;
}
================================================
FILE: src/standalone/getModule.js
================================================
import { parse } from 'acorn';
import MagicString from 'magic-string';
import annotateAst from 'utils/ast/annotate';
import findImportsAndExports from 'utils/ast/findImportsAndExports';
import getUnscopedNames from 'utils/ast/getUnscopedNames';
import disallowConflictingImports from '../utils/disallowConflictingImports';
import hasOwnProp from 'utils/hasOwnProp';
import { default as sanitize, splitPath } from 'utils/sanitize';
const SOURCEMAPPINGURL_REGEX = /^# sourceMappingURL=/;
export default function getStandaloneModule ( options ) {
let code, ast;
if ( typeof options.source === 'object' ) {
code = options.source.code;
ast = options.source.ast;
} else {
code = options.source;
}
let toRemove = [];
let comments = [];
let mod = {
body: new MagicString( code ),
ast: ast || ( parse( code, {
ecmaVersion: 6,
sourceType: 'module',
onComment ( block, text, start, end ) {
// sourceMappingURL comments should be removed
if ( !block && SOURCEMAPPINGURL_REGEX.test( text ) ) {
toRemove.push({ start, end });
} else {
comments.push({ start, end });
}
}
}))
};
toRemove.forEach( ({ start, end }) => mod.body.remove( start, end ) );
let { imports, exports, defaultExport } = findImportsAndExports( mod.ast, code, comments );
disallowConflictingImports( imports );
mod.imports = imports;
mod.exports = exports;
mod.defaultExport = defaultExport;
let conflicts = {};
if ( options.strict ) {
annotateAst( mod.ast, {
trackAssignments: null
});
// TODO there's probably an easier way to get this array
Object.keys( mod.ast._declared ).concat( getUnscopedNames( mod ) ).forEach( n => {
conflicts[n] = true;
});
}
determineImportNames( imports, options.getModuleName, conflicts );
return mod;
}
function determineImportNames ( imports, userFn, usedNames ) {
let nameById = {};
let inferredNames = {};
imports.forEach( x => {
let moduleId = x.path;
let name;
moduleId = x.path;
// use existing value
if ( hasOwnProp.call( nameById, moduleId ) ) {
x.name = nameById[ moduleId ];
return;
}
// if user supplied a function, defer to it
if ( userFn && ( name = userFn( moduleId ) ) ) {
name = sanitize( name );
if ( hasOwnProp.call( usedNames, name ) ) {
// TODO write a test for this
throw new Error( `Naming collision: module ${moduleId} cannot be called ${name}` );
}
}
else {
let parts = splitPath( moduleId );
let i;
let prefix = '';
let candidate;
do {
i = parts.length;
while ( i-- > 0 ) {
candidate = prefix + sanitize( parts.slice( i ).join( '__' ) );
if ( !hasOwnProp.call( usedNames, candidate ) ) {
name = candidate;
break;
}
}
prefix += '_';
} while ( !name );
}
usedNames[ name ] = true;
nameById[ moduleId ] = name;
x.name = name;
});
// use inferred names for default imports, wherever they
// don't clash with path-based names
imports.forEach( x => {
if ( x.as && !hasOwnProp.call( usedNames, x.as ) ) {
inferredNames[ x.path ] = x.as;
}
});
imports.forEach( x => {
if ( hasOwnProp.call( inferredNames, x.path ) ) {
x.name = inferredNames[ x.path ];
}
});
}
================================================
FILE: src/utils/EsperantoError.js
================================================
var EsperantoError = function ( message, data ) {
var prop;
this.message = message;
this.stack = (new Error()).stack;
for ( prop in data ) {
if ( data.hasOwnProperty( prop ) ) {
this[ prop ] = data[ prop ];
}
}
};
EsperantoError.prototype = new Error();
EsperantoError.prototype.constructor = EsperantoError;
EsperantoError.prototype.name = 'EsperantoError';
export default EsperantoError;
================================================
FILE: src/utils/amd/amdIntro.js
================================================
import getImportSummary from './getImportSummary';
import processName from './processName';
import processIds from './processIds';
export default function amdIntro ({ name, imports, hasExports, indentStr, absolutePaths, useStrict }) {
let { ids, names } = getImportSummary({ name, imports, absolutePaths });
if ( hasExports ) {
ids.unshift( 'exports' );
names.unshift( 'exports' );
}
let intro = `
define(${processName(name)}${processIds(ids)}function (${names.join( ', ' ) }) {
`;
if ( useStrict ) {
intro += `${indentStr}'use strict';\n\n`;
}
return intro;
}
================================================
FILE: src/utils/amd/getImportSummary.js
================================================
import resolveId from '../resolveId';
export default function getImportSummary ({ imports, absolutePaths, name }) {
let paths = [];
let names = [];
let seen = {};
let placeholders = 0;
imports.forEach( x => {
let path = x.id || x.path; // TODO unify these
if ( !seen[ path ] ) {
seen[ path ] = true;
paths.push( path );
// TODO x could be an external module, or an internal one.
// they have different shapes, resulting in the confusing
// code below
if ( ( x.needsDefault || x.needsNamed ) || ( x.specifiers && x.specifiers.length ) ) {
while ( placeholders ) {
names.push( `__dep${names.length}__` );
placeholders--;
}
names.push( x.name );
} else {
placeholders++;
}
}
});
let ids = absolutePaths ? paths.map( relativePath => resolveId( relativePath, name ) ) : paths.slice();
return { ids, paths, names };
}
================================================
FILE: src/utils/amd/processIds.js
================================================
import { quote } from '../mappers';
export default function processIds ( ids ) {
return ids.length ? '[' + ids.map( quote ).join( ', ' ) + '], ' : '';
}
================================================
FILE: src/utils/amd/processName.js
================================================
import { quote } from '../mappers';
export default function processName ( name ) {
return name ? quote( name ) + ', ' : '';
}
================================================
FILE: src/utils/ast/annotate.js
================================================
/*
This module traverse a module's AST, attaching scope information
to nodes as it goes, which is later used to determine which
identifiers need to be rewritten to avoid collisions
*/
import walk from './walk';
import { getName } from '../mappers';
function Scope ( options ) {
options = options || {};
this.parent = options.parent;
this.names = options.params || [];
}
Scope.prototype = {
add: function ( name ) {
if (! ~this.names.indexOf( name ) ) // redeclaration of existing binding
this.names.push( name );
},
contains: function ( name, ignoreTopLevel ) {
if ( ignoreTopLevel && !this.parent ) {
return false;
}
if ( ~this.names.indexOf( name ) ) {
return true;
}
if ( this.parent ) {
return this.parent.contains( name, ignoreTopLevel );
}
return false;
}
};
export default function annotateAst ( ast, options ) {
const trackAssignments = options && options.trackAssignments;
let scope = new Scope();
let blockScope = new Scope();
let declared = {};
let topLevelFunctionNames = [];
let templateLiteralRanges = [];
let envDepth = 0;
walk( ast, {
enter ( node ) {
if ( node.type === 'ImportDeclaration' || node.type === 'ExportSpecifier' ) {
node._skip = true;
}
if ( node._skip ) {
return this.skip();
}
switch ( node.type ) {
case 'FunctionExpression':
case 'FunctionDeclaration':
envDepth += 1;
// fallthrough
case 'ArrowFunctionExpression':
if ( node.id ) {
addToScope( node );
// If this is the root scope, this may need to be
// exported early, so we make a note of it
if ( !scope.parent && node.type === 'FunctionDeclaration' ) {
topLevelFunctionNames.push( node.id.name );
}
}
let names = node.params.map( getName );
names.forEach( name => declared[ name ] = true );
scope = node._scope = new Scope({
parent: scope,
params: names // TODO rest params?
});
break;
case 'BlockStatement':
blockScope = node._blockScope = new Scope({
parent: blockScope
});
break;
case 'VariableDeclaration':
node.declarations.forEach( node.kind === 'let' ? addToBlockScope : addToScope );
break;
case 'ClassExpression':
case 'ClassDeclaration':
addToScope( node );
break;
case 'MemberExpression':
!node.computed && ( node.property._skip = true );
break;
case 'Property':
node.key._skip = true;
break;
case 'TemplateLiteral':
templateLiteralRanges.push([ node.start, node.end ]);
break;
case 'ThisExpression':
if (envDepth === 0) {
node._topLevel = true;
}
break;
case 'AssignmentExpression':
assignTo( node.left );
break;
case 'UpdateExpression':
assignTo( node.argument );
break;
}
},
leave ( node ) {
switch ( node.type ) {
case 'FunctionExpression':
case 'FunctionDeclaration':
envDepth -= 1;
// fallthrough
case 'ArrowFunctionExpression':
scope = scope.parent;
break;
case 'BlockStatement':
blockScope = blockScope.parent;
break;
}
}
});
function assignTo ( node ) {
if ( trackAssignments && node.type === 'Identifier' && node.name === trackAssignments.name ) {
// This is possibly somewhat hacky. Open to alternative approaches...
// It will yield false positives if `foo` in `export default foo` is shadowed
( trackAssignments._assignments || ( trackAssignments._assignments = [] ) ).push({
scope,
node
});
}
}
function addToScope ( declarator ) {
var name = declarator.id.name;
scope.add( name );
declared[ name ] = true;
}
function addToBlockScope ( declarator ) {
var name = declarator.id.name;
blockScope.add( name );
declared[ name ] = true;
}
ast._scope = scope;
ast._blockScope = blockScope;
ast._topLevelNames = ast._scope.names.concat( ast._blockScope.names );
ast._topLevelFunctionNames = topLevelFunctionNames;
ast._declared = declared;
ast._templateLiteralRanges = templateLiteralRanges;
}
================================================
FILE: src/utils/ast/disallowIllegalReassignment.js
================================================
import hasOwnProp from 'utils/hasOwnProp';
var bindingMessage = 'Cannot reassign imported binding ',
namespaceMessage = 'Cannot reassign imported binding of namespace ';
export default function disallowIllegalReassignment ( node, importedBindings, importedNamespaces, scope ) {
let assignee, isNamespaceAssignment;
if ( node.type === 'AssignmentExpression' ) {
assignee = node.left;
} else if ( node.type === 'UpdateExpression' ) {
assignee = node.argument;
} else {
return; // not an assignment
}
if ( assignee.type === 'MemberExpression' ) {
assignee = assignee.object;
isNamespaceAssignment = true;
}
if ( assignee.type !== 'Identifier' ) {
return; // not assigning to a binding
}
let name = assignee.name;
if ( hasOwnProp.call( isNamespaceAssignment ? importedNamespaces : importedBindings, name ) && !scope.contains( name ) ) {
throw new Error( ( isNamespaceAssignment ? namespaceMessage : bindingMessage ) + '`' + name + '`' );
}
}
================================================
FILE: src/utils/ast/findImportsAndExports.js
================================================
/**
* Inspects a module and discovers/categorises import & export declarations
* @param {object} ast - the result of parsing `source` with acorn
* @param {string} source - the module's original source code
* @param {array} comments - {start, end} position of comments
* @returns {object} - { imports, exports, defaultExport }
*/
export default function findImportsAndExports ( ast, source, comments ) {
let imports = [];
let exports = [];
let defaultExport;
let previousDeclaration;
ast.body.forEach( node => {
var passthrough, declaration;
if ( previousDeclaration ) {
if ( previousDeclaration.node.type === 'ImportDeclaration' && node.type !== 'ImportDeclaration' ) {
// For last import statement, next declaration starts at next comment or node, whichever is closest
let nextComment;
for ( let i = 0, len = comments.length; i < len; i++ ) {
if ( comments[i].start > previousDeclaration.end ) {
nextComment = comments[i];
break;
}
}
if ( nextComment && nextComment.start < node.start ) {
previousDeclaration.next = nextComment.start;
} else {
previousDeclaration.next = node.start;
}
} else {
previousDeclaration.next = node.start;
}
if ( node.type !== 'EmptyStatement' ) {
previousDeclaration = null;
}
}
if ( node.type === 'ImportDeclaration' ) {
declaration = processImport( node );
imports.push( declaration );
}
else if ( node.type === 'ExportDefaultDeclaration' ) {
declaration = processDefaultExport( node, source );
exports.push( declaration );
if ( defaultExport ) {
throw new Error( 'Duplicate default exports' );
}
defaultExport = declaration;
}
else if ( node.type === 'ExportNamedDeclaration' ) {
declaration = processExport( node, source );
exports.push( declaration );
if ( node.source ) {
// it's both an import and an export, e.g.
// `export { foo } from './bar';
passthrough = processImport( node, true );
passthrough.specifiers.forEach( e => {
// the import in `export { default } from 'foo';`
// is a default import
if ( e.name === 'default' ) {
e.isDefault = true;
}
});
imports.push( passthrough );
declaration.passthrough = passthrough;
}
}
if ( declaration ) {
previousDeclaration = declaration;
}
});
// catch any trailing semicolons
if ( previousDeclaration ) {
previousDeclaration.next = source.length;
previousDeclaration.isFinal = true;
}
return { imports, exports, defaultExport };
}
/**
* Generates a representation of an import declaration
* @param {object} node - the original AST node
* @param {boolean} passthrough - `true` if this is an `export { foo } from 'bar'`-style declaration
* @returns {object}
*/
function processImport ( node, passthrough ) {
var x = {
module: null, // used by bundler - filled in later
node: node,
start: node.start,
end: node.end,
passthrough: !!passthrough,
path: node.source.value,
specifiers: node.specifiers.map( s => {
if ( s.type === 'ImportNamespaceSpecifier' ) {
return {
isBatch: true,
name: s.local.name, // TODO is this line necessary?
as: s.local.name,
origin: null // filled in later by bundler
};
}
if ( s.type === 'ImportDefaultSpecifier' ) {
return {
isDefault: true,
name: 'default',
as: s.local.name,
origin: null
};
}
return {
name: ( !!passthrough ? s.exported : s.imported ).name,
as: s.local.name,
origin: null
};
})
};
// TODO have different types of imports - batch, default, named
if ( x.specifiers.length === 0 ) {
x.isEmpty = true;
} else if ( x.specifiers.length === 1 && x.specifiers[0].isDefault ) {
x.isDefault = true;
x.as = x.specifiers[0].as;
} else if ( x.specifiers.length === 1 && x.specifiers[0].isBatch ) {
x.isBatch = true;
x.as = x.specifiers[0].name;
} else {
x.isNamed = true;
}
return x;
}
function processDefaultExport ( node, source ) {
const d = node.declaration;
let result = {
node,
isDefault: true,
start: node.start,
end: node.end,
value: source.slice( d.start, d.end ),
valueStart: d.start,
hasDeclaration: null,
type: null,
name: null
};
// possible declaration types:
// * FunctionExpression - `export default function () {...}`
// * FunctionDeclaration - `export default function foo () {...}`
// * ClassExpression - `export default class {...}`
// * ClassDeclaration - `export default class Foo {...}`
const match = /^(Function|Class)(Declaration)?/.exec( d.type );
if ( match ) {
result.hasDeclaration = true;
result.type = ( match[2] ? 'named' : 'anon' ) + match[1];
if ( match[2] ) {
result.name = d.id.name;
}
}
// if no match, we have an expression like `export default whatever`
else {
result.type = 'expression';
result.name = 'default';
}
return result;
}
/**
* Generates a representation of an export declaration
* @param {object} node - the original AST node
* @param {string} source - the original source code
* @returns {object}
*/
function processExport ( node, source ) {
let result = {
node,
start: node.start,
end: node.end,
value: null,
valueStart: null,
hasDeclaration: null,
type: null,
name: null,
specifiers: null
};
const d = node.declaration;
if ( d ) {
result.hasDeclaration = true;
result.value = source.slice( d.start, d.end );
result.valueStart = d.start;
// Case 1: `export var foo = 'bar'`
if ( d.type === 'VariableDeclaration' ) {
result.type = 'varDeclaration';
result.name = d.declarations[0].id.name;
}
// Case 2: `export function foo () {...}`
else if ( d.type === 'FunctionDeclaration' ) {
result.type = 'namedFunction';
result.name = d.id.name;
}
// Case 3: `export class Foo {...}`
else if ( d.type === 'ClassDeclaration' ) {
result.type = 'namedClass';
result.name = d.id.name;
}
}
// Case 9: `export { foo, bar };`
else {
result.type = 'named';
result.specifiers = node.specifiers.map( s => {
return {
origin: null, // filled in later by bundler
name: s.local.name,
as: s.exported.name
};
});
}
return result;
}
================================================
FILE: src/utils/ast/getUnscopedNames.js
================================================
import walk from './walk';
import hasOwnProp from 'utils/hasOwnProp';
export default function getUnscopedNames ( mod ) {
var unscoped = [], importedNames, scope;
function imported ( name ) {
if ( !importedNames ) {
importedNames = {};
mod.imports.forEach( i => {
!i.passthrough && i.specifiers.forEach( s => {
importedNames[ s.as ] = true;
});
});
}
return hasOwnProp.call( importedNames, name );
}
walk( mod.ast, {
enter ( node ) {
// we're only interested in references, not property names etc
if ( node._skip ) return this.skip();
if ( node._scope ) {
scope = node._scope;
}
if ( node.type === 'Identifier' &&
!scope.contains( node.name ) &&
!imported( node.name ) &&
!~unscoped.indexOf( node.name ) ) {
unscoped.push( node.name );
}
},
leave ( node ) {
if ( node.type === 'Program' ) {
return;
}
if ( node._scope ) {
scope = scope.parent;
}
}
});
return unscoped;
}
================================================
FILE: src/utils/ast/replaceIdentifiers.js
================================================
import hasOwnProp from 'utils/hasOwnProp';
export default function replaceIdentifiers ( body, node, identifierReplacements, scope ) {
let name = node.name;
let replacement = hasOwnProp.call( identifierReplacements, name ) && identifierReplacements[ name ];
// TODO unchanged identifiers shouldn't have got this far -
// remove the `replacement !== name` safeguard once that's the case
if ( replacement && replacement !== name && !scope.contains( name, true ) ) {
// rewrite
body.replace( node.start, node.end, replacement );
}
}
================================================
FILE: src/utils/ast/rewriteExportAssignments.js
================================================
import hasOwnProp from 'utils/hasOwnProp';
export default function rewriteExportAssignments ( body, node, parent, exports, scope, capturedUpdates ) {
let assignee;
if ( node.type === 'AssignmentExpression' ) {
assignee = node.left;
} else if ( node.type === 'UpdateExpression' ) {
assignee = node.argument;
} else {
return; // not an assignment
}
if ( assignee.type !== 'Identifier' ) {
return;
}
let name = assignee.name;
if ( scope.contains( name, true ) ) {
return; // shadows an export
}
if ( exports && hasOwnProp.call( exports, name ) ) {
let exportAs = exports[ name ];
if ( !!capturedUpdates ) {
capturedUpdates.push({ name, exportAs });
return;
}
// special case - increment/decrement operators
if ( node.operator === '++' || node.operator === '--' ) {
let prefix = ``;
let suffix = `, exports.${exportAs} = ${name}`;
if ( parent.type !== 'ExpressionStatement' ) {
if ( !node.prefix ) {
suffix += `, ${name} ${node.operator === '++' ? '-' : '+'} 1`;
}
prefix += `( `;
suffix += ` )`;
}
body.insert( node.start, prefix );
body.insert( node.end, suffix );
} else {
body.insert( node.start, `exports.${exportAs} = ` );
}
}
}
================================================
FILE: src/utils/ast/traverse.js
================================================
import walk from './walk';
import disallowIllegalReassignment from './disallowIllegalReassignment';
import replaceIdentifiers from './replaceIdentifiers';
import rewriteExportAssignments from './rewriteExportAssignments';
export default function traverseAst ( ast, body, identifierReplacements, importedBindings, importedNamespaces, exportNames ) {
let scope = ast._scope;
let blockScope = ast._blockScope;
let capturedUpdates = null;
let previousCapturedUpdates = null;
walk( ast, {
enter ( node, parent ) {
// we're only interested in references, not property names etc
if ( node._skip ) return this.skip();
if ( node._scope ) {
scope = node._scope;
} else if ( node._blockScope ) {
blockScope = node._blockScope;
}
// Special case: if you have a variable declaration that updates existing
// bindings as a side-effect, e.g. `var a = b++`, where `b` is an exported
// value, we can't simply append `exports.b = b` to the update (as we
// normally would) because that would be syntactically invalid. Instead,
// we capture the change and update the export (and any others) after the
// variable declaration
if ( node.type === 'VariableDeclaration' ) {
previousCapturedUpdates = capturedUpdates;
capturedUpdates = [];
return;
}
disallowIllegalReassignment( node, importedBindings, importedNamespaces, scope );
// Rewrite assignments to exports inside functions, to keep bindings live.
// This call may mutate `capturedUpdates`, which is used elsewhere
if ( scope !== ast._scope ) {
rewriteExportAssignments( body, node, parent, exportNames, scope, capturedUpdates );
}
if ( node.type === 'Identifier' && parent.type !== 'FunctionExpression' ) {
replaceIdentifiers( body, node, identifierReplacements, scope );
}
// Replace top-level this with undefined ES6 8.1.1.5.4
if ( node.type === 'ThisExpression' && node._topLevel ) {
body.replace( node.start, node.end, 'undefined' );
}
},
leave ( node ) {
// Special case - see above
if ( node.type === 'VariableDeclaration' ) {
if ( capturedUpdates.length ) {
body.insert( node.end, capturedUpdates.map( exportCapturedUpdate ).join( '' ) );
}
capturedUpdates = previousCapturedUpdates;
}
if ( node._scope ) {
scope = scope.parent;
} else if ( node._blockScope ) {
blockScope = blockScope.parent;
}
}
});
}
function exportCapturedUpdate ( c ) {
return ` exports.${c.exportAs} = ${c.name};`;
}
================================================
FILE: src/utils/ast/walk.js
================================================
let shouldSkip;
let shouldAbort;
export default function walk ( ast, { enter, leave }) {
shouldAbort = false;
visit( ast, null, enter, leave );
}
let context = {
skip: () => shouldSkip = true,
abort: () => shouldAbort = true
};
let childKeys = {};
let toString = Object.prototype.toString;
function isArray ( thing ) {
return toString.call( thing ) === '[object Array]';
}
function visit ( node, parent, enter, leave ) {
if ( !node || shouldAbort ) return;
if ( enter ) {
shouldSkip = false;
enter.call( context, node, parent );
if ( shouldSkip || shouldAbort ) return;
}
let keys = childKeys[ node.type ] || (
childKeys[ node.type ] = Object.keys( node ).filter( key => typeof node[ key ] === 'object' )
);
let key, value, i, j;
i = keys.length;
while ( i-- ) {
key = keys[i];
value = node[ key ];
if ( isArray( value ) ) {
j = value.length;
while ( j-- ) {
visit( value[j], node, enter, leave );
}
}
else if ( value && value.type ) {
visit( value, node, enter, leave );
}
}
if ( leave && !shouldAbort ) {
leave( node, parent );
}
}
================================================
FILE: src/utils/builtins.js
================================================
// from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects
// we add `exports` to this list, to avoid conflicts
export default 'Array ArrayBuffer DataView Date Error EvalError Float32Array Float64Array Function Generator GeneratorFunction Infinity Int16Array Int32Array Int8Array InternalError Intl Iterator JSON Map Math NaN Number Object ParallelArray Promise Proxy RangeError ReferenceError Reflect RegExp Set StopIteration String Symbol SyntaxError TypeError TypedArray URIError Uint16Array Uint32Array Uint8Array Uint8ClampedArray WeakMap WeakSet decodeURI decodeURIComponent encodeURI encodeURIComponent escape eval exports isFinite isNaN null parseFloat parseInt undefined unescape uneval'.split( ' ' );
================================================
FILE: src/utils/disallowConflictingImports.js
================================================
import hasOwnProp from './hasOwnProp';
export default function disallowConflictingImports ( imports ) {
let usedNames = {};
imports.forEach( x => {
if ( x.passthrough ) return;
if ( x.as ) {
checkName( x.as );
} else {
x.specifiers.forEach( checkSpecifier );
}
});
function checkSpecifier ( s ) {
checkName( s.as );
}
function checkName ( name ) {
if ( hasOwnProp.call( usedNames, name ) ) {
throw new SyntaxError( `Duplicated import ('${name}')` );
}
usedNames[ name ] = true;
}
}
================================================
FILE: src/utils/getReadOnlyIdentifiers.js
================================================
/**
* Scans an array of imports, and determines which identifiers
are readonly, and which cannot be assigned to. For example
you cannot `import foo from 'foo'` then do `foo = 42`, nor
can you `import * as foo from 'foo'` then do `foo.answer = 42`
* @param {array} imports - the array of imports
* @returns {array} [ importedBindings, importedNamespaces ]
*/
export default function getReadOnlyIdentifiers ( imports ) {
var importedBindings = {}, importedNamespaces = {};
imports.forEach( x => {
if ( x.passthrough ) return;
x.specifiers.forEach( s => {
if ( s.isBatch ) {
importedNamespaces[ s.as ] = true;
} else {
importedBindings[ s.as ] = true;
}
});
});
return [ importedBindings, importedNamespaces ];
}
================================================
FILE: src/utils/hasNamedExports.js
================================================
export default function hasNamedExports ( mod ) {
var i = mod.exports.length;
while ( i-- ) {
if ( !mod.exports[i].isDefault ) {
return true;
}
}
}
================================================
FILE: src/utils/hasNamedImports.js
================================================
export default function hasNamedImports ( mod ) {
var i = mod.imports.length;
while ( i-- ) {
if ( mod.imports[i].isNamed ) {
return true;
}
}
}
================================================
FILE: src/utils/hasOwnProp.js
================================================
var hasOwnProp = Object.prototype.hasOwnProperty;
export default hasOwnProp;
================================================
FILE: src/utils/mappers.js
================================================
export function getId ( m ) {
return m.id;
}
export function getName ( m ) {
return m.name;
}
export function quote ( str ) {
return "'" + JSON.stringify(str).slice(1, -1).replace(/'/g, "\\'") + "'";
}
export function req ( path ) {
return `require(${quote(path)})`;
}
export function globalify ( name ) {
if ( /^__dep\d+__$/.test( name ) ) {
return 'undefined';
} else {
return `global.${name}`;
}
}
================================================
FILE: src/utils/packageResult.js
================================================
import walk from './ast/walk';
import { splitPath } from 'utils/sanitize';
const ABSOLUTE_PATH = /^(?:[A-Z]:)?[\/\\]/i;
let warned = {};
export default function packageResult ( bundleOrModule, body, options, methodName, isBundle ) {
// wrap output
if ( options.banner ) body.prepend( options.banner );
if ( options.footer ) body.append( options.footer );
let code = body.toString();
let map;
if ( !!options.sourceMap ) {
if ( options.sourceMap !== 'inline' && !options.sourceMapFile ) {
throw new Error( 'You must provide `sourceMapFile` option' );
}
if ( !isBundle && !options.sourceMapSource ) {
throw new Error( 'You must provide `sourceMapSource` option' );
}
let sourceMapFile;
if ( options.sourceMap === 'inline' ) {
sourceMapFile = null;
} else {
sourceMapFile = ABSOLUTE_PATH.test( options.sourceMapFile ) ? options.sourceMapFile : './' + splitPath( options.sourceMapFile ).pop();
}
if ( isBundle ) {
markBundleSourcemapLocations( bundleOrModule );
} else {
markModuleSourcemapLocations( bundleOrModule );
}
map = body.generateMap({
includeContent: true,
file: sourceMapFile,
source: ( sourceMapFile && !isBundle ) ? getRelativePath( sourceMapFile, options.sourceMapSource ) : null
});
if ( options.sourceMap === 'inline' ) {
code += '\n//# sourceMa' + 'ppingURL=' + map.toUrl();
map = null;
} else {
code += '\n//# sourceMa' + 'ppingURL=' + sourceMapFile + '.map';
}
} else {
map = null;
}
return {
code,
map,
toString () {
if ( !warned[ methodName ] ) {
console.log( `Warning: esperanto.${methodName}() returns an object with a 'code' property. You should use this instead of using the returned value directly` );
warned[ methodName ] = true;
}
return code;
}
};
}
function getRelativePath ( from, to ) {
var fromParts, toParts, i;
fromParts = splitPath( from );
toParts = splitPath( to );
fromParts.pop(); // get dirname
while ( fromParts[0] === '.' ) {
fromParts.shift();
}
while ( fromParts[0] === toParts[0] ) {
fromParts.shift();
toParts.shift();
}
if ( fromParts.length ) {
i = fromParts.length;
while ( i-- ) fromParts[i] = '..';
return fromParts.concat( toParts ).join( '/' );
} else {
toParts.unshift( '.' );
return toParts.join( '/' );
}
}
function markBundleSourcemapLocations ( bundle ) {
bundle.modules.forEach( mod => {
walk( mod.ast, {
enter: node => {
mod.body.addSourcemapLocation( node.start );
}
});
});
}
function markModuleSourcemapLocations ( mod ) {
walk( mod.ast, {
enter: node => {
mod.body.addSourcemapLocation( node.start );
}
});
}
================================================
FILE: src/utils/promiseSequence.js
================================================
import { Promise } from 'sander';
export default function promiseSequence ( arr, callback ) {
const len = arr.length;
let results = new Array( len );
let promise = Promise.resolve();
function next ( i ) {
return promise
.then( () => callback( arr[i], i ) )
.then( result => results[i] = result );
}
let i;
for ( i = 0; i < len; i += 1 ) {
promise = next( i );
}
return promise.then( () => results );
}
================================================
FILE: src/utils/resolveId.js
================================================
import { splitPath } from 'utils/sanitize';
/**
* Resolves an importPath relative to the module that is importing it
* @param {string} importPath - the (possibly relative) path of an imported module
* @param {string} importerPath - the (relative to `base`) path of the importing module
* @returns {string}
*/
export default function resolveId ( importPath, importerPath ) {
var resolved, importerParts, importParts;
if ( importPath[0] !== '.' ) {
resolved = importPath;
} else {
importerParts = splitPath( importerPath );
importParts = splitPath( importPath );
if ( importParts[0] === '.' ) {
importParts.shift();
}
importerParts.pop(); // get dirname
while ( importParts[0] === '..' ) {
importParts.shift();
importerParts.pop();
}
while ( importParts[0] === '.' ) {
importParts.shift();
}
resolved = importerParts.concat( importParts ).join( '/' );
}
return resolved;
}
export function resolveAgainst ( importerPath ) {
return function ( importPath ) {
return resolveId( importPath, importerPath );
};
}
================================================
FILE: src/utils/sanitize.js
================================================
const RESERVED = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield'.split( ' ' );
const INVALID_CHAR = /[^a-zA-Z0-9_$]/g;
const INVALID_LEADING_CHAR = /[^a-zA-Z_$]/;
/**
* Generates a sanitized (i.e. valid identifier) name from a module ID
* @param {string} id - a module ID, or part thereof
* @returns {string}
*/
export default function sanitize ( name ) {
name = name.replace( INVALID_CHAR, '_' );
if ( INVALID_LEADING_CHAR.test( name[0] ) || ~RESERVED.indexOf( name ) ) {
name = `_${name}`;
}
return name;
}
var pathSplitRE = /\/|\\/;
export function splitPath ( path ) {
return path.split( pathSplitRE );
}
================================================
FILE: src/utils/umd/requireName.js
================================================
import EsperantoError from 'utils/EsperantoError';
export default function requireName ( options ) {
if ( !options.name ) {
throw new EsperantoError( 'You must supply a `name` option for UMD modules', {
code: 'MISSING_NAME'
});
}
}
================================================
FILE: src/utils/umd/umdIntro.js
================================================
import { globalify, req } from 'utils/mappers';
import processName from '../amd/processName';
import processIds from '../amd/processIds';
import getImportSummary from '../amd/getImportSummary';
export default function umdIntro ({ amdName, name, hasExports, imports, absolutePaths, externalDefaults, indentStr, strict, useStrict }) {
const useStrictPragma = useStrict ? ` 'use strict';` : '';
let intro;
if ( !hasExports && !imports.length ) {
intro =
`(function (factory) {
!(typeof exports === 'object' && typeof module !== 'undefined') &&
typeof define === 'function' && define.amd ? define(${processName(amdName)}factory) :
factory()
}(function () {${useStrictPragma}
`;
}
else {
let { ids, paths, names } = getImportSummary({ imports, name: amdName, absolutePaths });
let amdExport, cjsExport, globalExport, defaultsBlock;
if ( strict ) {
cjsExport = `factory(${( hasExports ? [ 'exports' ] : [] ).concat( paths.map( req ) ).join( ', ' )})`;
let globalDeps = ( hasExports ? [ `(global.${name} = {})` ] : [] ).concat( names.map( globalify ) ).join( ', ' );
globalExport = `factory(${globalDeps})`;
if ( hasExports ) {
ids.unshift( 'exports' );
names.unshift( 'exports' );
}
amdExport = `define(${processName(amdName)}${processIds(ids)}factory)`;
defaultsBlock = '';
if ( externalDefaults && externalDefaults.length > 0 ) {
defaultsBlock = externalDefaults.map( x =>
'\t' + ( x.needsNamed ? `var ${x.name}__default` : x.name ) +
` = ('default' in ${x.name} ? ${x.name}['default'] : ${x.name});`
).join('\n') + '\n\n';
}
} else {
amdExport = `define(${processName(amdName)}${processIds(ids)}factory)`;
cjsExport = ( hasExports ? 'module.exports = ' : '' ) + `factory(${paths.map( req ).join( ', ' )})`;
globalExport = ( hasExports ? `global.${name} = ` : '' ) + `factory(${names.map( globalify ).join( ', ' )})`;
defaultsBlock = '';
}
intro =
`(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? ${cjsExport} :
typeof define === 'function' && define.amd ? ${amdExport} :
${globalExport}
}(this, function (${names.join( ', ' )}) {${useStrictPragma}
${defaultsBlock}`;
}
return intro.replace( /^\t\t\t/gm, '' ).replace( /\t/g, indentStr );
}
================================================
FILE: test/.jshintrc
================================================
{
"boss": true,
"unused": true,
"undef": true,
"esnext": true,
"globals": {
"process": true,
"require": true,
"module": true,
"__dirname": true,
"define": true,
"describe": true,
"it": true,
"before": true,
"setTimeout": true,
"console": true,
"window": true
}
}
================================================
FILE: test/bundle/index.js
================================================
var path = require( 'path' );
var assert = require( 'assert' );
var sander = require( 'sander' );
var makeWhitespaceVisible = require( '../utils/makeWhitespaceVisible' );
var esperanto = require( '../../' );
Promise = sander.Promise;
global.assert = assert;
module.exports = function () {
return new Promise( function ( fulfil ) {
var start;
describe( 'esperanto.bundle()', function () {
var profiles;
this.timeout( 20000 );
before( function () {
if ( process.env.BUILD_TIMEOUT ) {
this.timeout( parseInt( process.env.BUILD_TIMEOUT ) );
}
sander.rimrafSync( 'es6-module-transpiler-tests/bundled-output' );
start = Date.now();
});
after( function () {
fulfil( Date.now() - start );
});
describe( 'ES6 module semantics tests from es6-module-transpiler:', function () {
sander.readdirSync( __dirname, '../es6-module-transpiler-tests/input' ).forEach( function ( dir ) {
var config, cjs;
config = require( '../es6-module-transpiler-tests/input/' + dir + '/_config' );
it( dir, function () {
// Create CommonJS modules, then require the entry module
return esperanto.bundle({
base: path.resolve( 'es6-module-transpiler-tests/input', dir ),
entry: config.entry
})
.then( function ( bundle ) {
cjs = bundle.toCjs({ strict: true }).code;
return sander.writeFile( 'es6-module-transpiler-tests/bundled-output', dir + '.js', cjs );
})
.then( function () {
var missingError;
try {
require( path.resolve( 'es6-module-transpiler-tests/bundled-output', dir ) );
if ( config.expectedError ) {
missingError = true;
}
} catch( err ) {
if ( !config.expectedError || !~err.message.indexOf( config.expectedError ) ) {
console.log( 'bundle>>>\n%s\n<<<', cjs );
throw err;
}
}
if ( missingError ) {
console.log( 'bundle>>>\n%s\n<<<', cjs );
throw new Error( 'Expected error "' + config.expectedError + '"' );
}
}, function ( err ) {
if ( !config.expectedError || !~err.message.indexOf( config.expectedError ) ) {
console.log( 'bundle>>>\n%s\n<<<', cjs );
throw err;
}
});
});
});
});
profiles = [
{ description: 'bundle.concat()', method: 'concat', outputdir: 'concat' },
{ description: 'bundle.toAmd()', method: 'toAmd', outputdir: 'amdDefaults' },
{ description: 'bundle.toUmd()', method: 'toUmd', outputdir: 'umdDefaults', options: { name: 'myModule' } },
{ description: 'bundle.toCjs()', method: 'toCjs', outputdir: 'cjsDefaults' },
{ description: 'bundle.toAmd({ strict: true })', method: 'toAmd', outputdir: 'amd', options: { strict: true } },
{ description: 'bundle.toUmd({ strict: true })', method: 'toUmd', outputdir: 'umd', options: { strict: true, name: 'myModule' } },
{ description: 'bundle.toCjs({ strict: true })', method: 'toCjs', outputdir: 'cjs', options: { strict: true } }
];
profiles.forEach( function ( profile ) {
describe( profile.description + ':', function () {
sander.readdirSync( __dirname, 'input' )
.filter( Number ) // filter out .DS_Store and assorted crap
.forEach( function ( dir ) {
var config = require( './input/' + dir + '/_config' );
( config.solo ? it.only : it )( dir + ': ' + config.description, function () {
return esperanto.bundle({
base: path.resolve( 'bundle/input', dir ),
entry: config.entry || 'main',
skip: config.skip,
names: config.names,
transform: config.transform,
resolvePath: config.resolvePath,
modules: config.modules
}).then( function ( bundle ) {
var options, transpiled, actual;
options = profile.options || {};
if ( ( bundle.imports.length && !config.imports ) || ( bundle.exports.length && !config.exports ) ) {
throw new Error( 'config is missing imports/exports (expected ' + JSON.stringify( bundle.imports ) + ', ' + JSON.stringify( bundle.exports ) + ')' );
}
if ( config.imports || bundle.imports.length ) {
assert.deepEqual( bundle.imports.sort(), config.imports.sort() );
}
if ( config.exports || bundle.exports.length ) {
assert.deepEqual( bundle.exports.sort(), config.exports.sort() );
}
transpiled = bundle[ profile.method ]({
strict: options.strict,
name: options.name,
amdName: config.amdName,
banner: config.banner,
footer: config.footer,
useStrict: config.useStrict,
sourceMap: config.sourceMap
});
if ( config.error ) {
throw new Error( 'Expected error but none was raised' );
}
actual = makeWhitespaceVisible( transpiled.code );
// necessary for CI
if ( config.sourceMap ) {
actual = actual.replace( /base64,.+/, 'base64,xyz' );
}
return sander.readFile( 'bundle/output/', profile.outputdir, dir + '.js' ).then( String ).then( function ( str ) {
var expected = makeWhitespaceVisible( str );
if ( config.strict && !options.strict ) {
throw new Error( 'Test should fail in non-strict mode' );
}
assert.equal( actual, expected, 'Expected\n>\n' + actual + '\n>\n\nto match\n\n>\n' + expected + '\n>' );
}).catch( function ( err ) {
if ( err.code === 'ENOENT' ) {
assert.equal( actual, '', 'Expected\n>\n' + actual + '\n>\n\nto match non-existent file' );
} else {
throw err;
}
});
}).catch( function ( err ) {
// strict mode tests should fail
if ( /strict mode/.test( err.message ) && config.strict ) {
return;
}
if ( /bundles that have no imports\/exports/.test( err.message ) && profile.method === 'concat' ) {
return;
}
if ( !config.error ) {
throw err;
}
if ( config.error instanceof RegExp ) {
if ( !config.error.test( err.message ) ) {
throw err;
}
} else if ( !config.error( err ) ) {
throw err;
}
});
});
});
});
});
});
});
};
================================================
FILE: test/bundle/input/01/_config.js
================================================
module.exports = {
description: 'bundles a simple collection of modules'
};
================================================
FILE: test/bundle/input/01/foo.js
================================================
var message = 'yes';
export default message;
================================================
FILE: test/bundle/input/01/main.js
================================================
import foo from './foo';
console.log( foo );
================================================
FILE: test/bundle/input/02/_config.js
================================================
module.exports = {
description: 'bundles modules in index.js files'
};
================================================
FILE: test/bundle/input/02/foo/index.js
================================================
var message = 'yes';
export default message;
================================================
FILE: test/bundle/input/02/main.js
================================================
import foo from './foo';
console.log( foo );
================================================
FILE: test/bundle/input/03/_config.js
================================================
module.exports = {
description: 'allows external imports',
imports: [ 'external' ]
};
================================================
FILE: test/bundle/input/03/foo.js
================================================
var bar = 'yes';
export default bar;
================================================
FILE: test/bundle/input/03/main.js
================================================
import foo from './foo';
import external from 'external';
console.log( external( foo ) );
================================================
FILE: test/bundle/input/04/_config.js
================================================
module.exports = {
description: 'exports a default export',
exports: [ 'default' ]
};
================================================
FILE: test/bundle/input/04/foo.js
================================================
export var answer = 42;
================================================
FILE: test/bundle/input/04/main.js
================================================
import { answer } from './foo';
export default answer * 2;
================================================
FILE: test/bundle/input/05/_config.js
================================================
module.exports = {
description: 'exports named exports',
strict: true,
exports: [ 'four', 'five', 'six' ]
};
================================================
FILE: test/bundle/input/05/main.js
================================================
import { one, two, three } from './numbers';
export var four = one + 3;
export var five = two + 3;
export var six = three + 3;
four = 99;
================================================
FILE: test/bundle/input/05/numbers.js
================================================
export var one = 1;
export var two = 2;
export var three = 3;
================================================
FILE: test/bundle/input/06/_config.js
================================================
module.exports = {
description: 'gives legal names to nested imports',
imports: [ 'utils/external' ]
};
================================================
FILE: test/bundle/input/06/main.js
================================================
import message from 'nested/foo';
import external from 'utils/external';
console.log( message );
================================================
FILE: test/bundle/input/06/nested/foo.js
================================================
export default 'this is a message';
================================================
FILE: test/bundle/input/07/_config.js
================================================
module.exports = {
description: 'modules can be skipped',
skip: [ 'bar' ]
};
================================================
FILE: test/bundle/input/07/bar.js
================================================
export default 'this is bar';
================================================
FILE: test/bundle/input/07/foo.js
================================================
export default 'this is foo';
================================================
FILE: test/bundle/input/07/main.js
================================================
import foo from 'foo';
import bar from 'bar';
function logFoo () {
console.log( foo );
}
function logBar () {
console.log( bar );
}
================================================
FILE: test/bundle/input/08/_config.js
================================================
module.exports = {
description: 'external module names are guessed (affects UMD only)',
imports: [ 'external' ]
};
================================================
FILE: test/bundle/input/08/main.js
================================================
import ImplicitlyNamed from 'external';
================================================
FILE: test/bundle/input/09/_config.js
================================================
module.exports = {
description: 'external module names can be specified (affects UMD only)',
imports: [ 'external' ],
names: {
external: 'Correct'
}
};
================================================
FILE: test/bundle/input/09/main.js
================================================
import ExplicitlyNamed from 'external';
================================================
FILE: test/bundle/input/10/_config.js
================================================
module.exports = {
description: 'does not affect ES6 classes',
exports: [ 'default' ]
};
================================================
FILE: test/bundle/input/10/main.js
================================================
export default class Foo {
constructor( str ) {
this.str = str;
}
toString() {
return this.str;
}
}
================================================
FILE: test/bundle/input/11/_config.js
================================================
module.exports = {
description: 'exports chains correctly in strict mode',
strict: true,
exports: [ 'foo', 'bar', 'baz', 'qux' ]
};
================================================
FILE: test/bundle/input/11/a.js
================================================
export var foo = 1;
export var bar = 2;
foo = 3;
================================================
FILE: test/bundle/input/11/b.js
================================================
export default 4;
================================================
FILE: test/bundle/input/11/main.js
================================================
import { foo, bar } from './a';
import baz from './b';
var qux = 5;
qux = 6;
export { foo, bar, baz, qux };
================================================
FILE: test/bundle/input/12/_config.js
================================================
module.exports = {
description: 'throws an error if a non-exported identifier is imported',
error: /does not export/
};
================================================
FILE: test/bundle/input/12/foo.js
================================================
var bar = 'not exported';
================================================
FILE: test/bundle/input/12/main.js
================================================
import { bar } from './foo';
================================================
FILE: test/bundle/input/13/_config.js
================================================
module.exports = {
description: 'throw error with file and location error if acorn cannot parse',
error: function ( err ) {
return err.file === require( 'path' ).resolve( __dirname, 'main.js' ) && err.loc.line === 1 && err.loc.column === 4;
}
};
================================================
FILE: test/bundle/input/13/main.js
================================================
var 42 = answer;
================================================
FILE: test/bundle/input/14/_config.js
================================================
module.exports = {
description: 'handles default imports from external modules correctly',
imports: [ 'external' ]
};
================================================
FILE: test/bundle/input/14/main.js
================================================
import foo from './external';
foo();
================================================
FILE: test/bundle/input/15/_config.js
================================================
module.exports = {
description: 'handles named imports from external modules correctly',
imports: [ 'external' ],
strict: true
};
================================================
FILE: test/bundle/input/15/main.js
================================================
import { foo } from './external';
foo();
================================================
FILE: test/bundle/input/16/_config.js
================================================
module.exports = {
description: 'handles conflicting imports'
};
================================================
FILE: test/bundle/input/16/a.js
================================================
export default function a () {
console.log( 'a' );
}
================================================
FILE: test/bundle/input/16/b.js
================================================
import a from './c';
export default function () {
// a but actually c
a();
}
================================================
FILE: test/bundle/input/16/c.js
================================================
export default function a () {
console.log( 'a but actually c' );
}
================================================
FILE: test/bundle/input/16/main.js
================================================
import a from './a';
import b from './b';
function foo () {
a();
}
================================================
FILE: test/bundle/input/17/_config.js
================================================
module.exports = {
description: 'handles shadowed renamed imports'
};
================================================
FILE: test/bundle/input/17/foo.js
================================================
export function a ( message ) {
console.log( message );
}
================================================
FILE: test/bundle/input/17/main.js
================================================
import { a as b } from './foo';
b();
(function () {
var a = 'c';
b( a );
}());
================================================
FILE: test/bundle/input/18/_config.js
================================================
module.exports = {
description: 'renames imports that conflict with existing variable names'
};
================================================
FILE: test/bundle/input/18/bar.js
================================================
export default function () {
doThing();
}
var doThing = function ( item ) {
console.log( 'doing bar thing' );
}
================================================
FILE: test/bundle/input/18/doThing.js
================================================
export default function () {
console.log( 'doing foo thing' );
}
================================================
FILE: test/bundle/input/18/foo.js
================================================
import doThing from './doThing';
export default function () {
doThing();
}
================================================
FILE: test/bundle/input/18/main.js
================================================
import foo from './foo';
import bar from './bar';
// foo();
// bar();
================================================
FILE: test/bundle/input/19/_config.js
================================================
module.exports = {
description: 'handles hasOwnProperty edge case (default imports)'
};
================================================
FILE: test/bundle/input/19/hasOwnProperty.js
================================================
var hasOwnProperty = Object.prototype.hasOwnProperty;
export default hasOwnProperty;
================================================
FILE: test/bundle/input/19/main.js
================================================
import hasOwnProperty from './hasOwnProperty';
console.log( hasOwnProperty.call({ foo: 'bar' }, 'foo' ) );
================================================
FILE: test/bundle/input/20/_config.js
================================================
module.exports = {
description: 'handles hasOwnProperty edge case (named imports)',
exports: [ 'default' ]
};
================================================
FILE: test/bundle/input/20/main.js
================================================
import { hasOwnProperty } from './objectUtils';
export default function () {
console.log( hasOwnProperty.call({ foo: 'bar' }, 'foo' ) );
}
================================================
FILE: test/bundle/input/20/objectUtils.js
================================================
export var hasOwnProperty = Object.prototype.hasOwnProperty;
================================================
FILE: test/bundle/input/21/_config.js
================================================
module.exports = {
description: 'handles member assignments of named imports'
};
================================================
FILE: test/bundle/input/21/config.js
================================================
export const config = {};
================================================
FILE: test/bundle/input/21/main.js
================================================
import { config } from './config';
config.async = true;
================================================
FILE: test/bundle/input/22/_config.js
================================================
module.exports = {
description: 'handles named exports of default imports',
strict: true,
exports: [ 'foo' ]
};
================================================
FILE: test/bundle/input/22/foo.js
================================================
export default function foo () {
console.log( 'fooing' );
}
================================================
FILE: test/bundle/input/22/main.js
================================================
import foo from './foo';
// foo
foo();
export { foo };
================================================
FILE: test/bundle/input/23/_config.js
================================================
module.exports = {
description: 'throws error if module imports itself',
error: /cannot import itself/
};
================================================
FILE: test/bundle/input/23/foo.js
================================================
import { baz } from './foo';
export function bar () {
baz();
}
export function baz () {
console.log( 'bazzing' );
}
================================================
FILE: test/bundle/input/23/main.js
================================================
import { bar } from './foo';
bar();
================================================
FILE: test/bundle/input/24/_config.js
================================================
module.exports = {
description: 'adds a banner/footer to bundle',
banner: '/* this is a banner */\n',
footer: '\n/* this is a footer */'
};
================================================
FILE: test/bundle/input/24/bar.js
================================================
export default function bar () {
console.log( 'baring' );
}
================================================
FILE: test/bundle/input/24/foo.js
================================================
export default function foo () {
console.log( 'fooing' );
}
================================================
FILE: test/bundle/input/24/main.js
================================================
import foo from './foo';
import bar from './bar';
foo();
bar();
================================================
FILE: test/bundle/input/25/_config.js
================================================
module.exports = {
description: 'creates a named AMD module',
amdName: 'myModule'
};
================================================
FILE: test/bundle/input/25/foo.js
================================================
export default function () {
console.log( 'fooing' );
}
================================================
FILE: test/bundle/input/25/main.js
================================================
import foo from 'foo';
foo();
================================================
FILE: test/bundle/input/26/_config.js
================================================
module.exports = {
description: 'transforms input sources',
transform: function ( source ) {
return source.replace( /foo/g, 'bar' );
}
};
================================================
FILE: test/bundle/input/26/bar.js
================================================
export default function foo () {
console.log( 'fooing' );
}
================================================
FILE: test/bundle/input/26/main.js
================================================
import foo from 'foo';
foo();
================================================
FILE: test/bundle/input/27/_config.js
================================================
module.exports = {
description: 'correctly infers indentation with single-line edge case'
};
================================================
FILE: test/bundle/input/27/bar.js
================================================
export default 'this is bar';
================================================
FILE: test/bundle/input/27/foo.js
================================================
export default 'this is foo';
================================================
FILE: test/bundle/input/27/main.js
================================================
import foo from 'foo';
import bar from 'bar';
function logFoo () {
console.log( foo );
}
function logBar () {
console.log( bar );
}
================================================
FILE: test/bundle/input/28/_config.js
================================================
module.exports = {
description: 'environment GetThisBinding is always undefined'
};
================================================
FILE: test/bundle/input/28/foo.js
================================================
export default () => this;
================================================
FILE: test/bundle/input/28/main.js
================================================
import foo from 'foo';
assert.strictEqual( this, undefined );
var ctx = {};
var arrow = (x => assert.strictEqual( this, undefined ));
var fn = function () { assert.strictEqual( this, ctx ); };
arrow.call(ctx);
fn.call(ctx);
assert.strictEqual(foo(), undefined);
================================================
FILE: test/bundle/input/29/_config.js
================================================
module.exports = {
description: 'both named and default bindings can be imported from an external module',
imports: [ 'foo' ],
strict: true
};
================================================
FILE: test/bundle/input/29/main.js
================================================
import foo, { bar } from './foo';
foo();
bar();
================================================
FILE: test/bundle/input/30/_config.js
================================================
module.exports = {
description: 'batch import from external module',
imports: [ 'foo' ]
};
================================================
FILE: test/bundle/input/30/main.js
================================================
import * as foo from 'foo';
foo.bar();
================================================
FILE: test/bundle/input/31/_config.js
================================================
module.exports = {
description: 'renames identifiers consistently'
};
================================================
FILE: test/bundle/input/31/exportedX.js
================================================
export default function someOtherName () {}
================================================
FILE: test/bundle/input/31/main.js
================================================
import x from './exportedX';
import './notExportedX';
x();
================================================
FILE: test/bundle/input/31/notExportedX.js
================================================
function x () {}
================================================
FILE: test/bundle/input/32/_config.js
================================================
module.exports = {
description: 'transformer can return an empty string',
transform: function () {
return '';
}
};
================================================
FILE: test/bundle/input/32/main.js
================================================
/* this will be discarded */
================================================
FILE: test/bundle/input/33/Math.js
================================================
export function add ( a, b ) {
return a + b;
}
export function multiply ( a, b ) {
return a * b;
}
================================================
FILE: test/bundle/input/33/Promise.js
================================================
var Promise = function () {};
Promise.prototype = {
keep () { this.state = 'kept'; },
break () { this.state = 'broken'; }
};
export default Promise;
================================================
FILE: test/bundle/input/33/_config.js
================================================
module.exports = {
description: 'Module names do not shadow built-ins'
};
================================================
FILE: test/bundle/input/33/foo.js
================================================
var num = Math.max( 1, 2, 3 );
var resolved = Promise.resolve( num );
export default function foo () {
return resolved;
}
================================================
FILE: test/bundle/input/33/main.js
================================================
import Promise from './Promise';
import * as Math from './Math';
import foo from './foo';
var promise = new Promise();
promise.keep();
console.log( Math.add( 40, 2 ) );
================================================
FILE: test/bundle/input/34/_config.js
================================================
module.exports = {
description: 'avoids conflict between exports and existing variables',
exports: [ 'default' ]
};
================================================
FILE: test/bundle/input/34/foo.js
================================================
var exports = {};
exports.bar = function () {
console.log( 'exports should be renamed' );
};
export default exports;
================================================
FILE: test/bundle/input/34/main.js
================================================
import foo from './foo';
foo.bar();
export default 'whatever';
================================================
FILE: test/bundle/input/35/_config.js
================================================
var path = require( 'path' );
var Promise = require( 'sander' ).Promise;
var resolve = require( 'resolve' );
module.exports = {
description: 'External module paths can be resolved with resolvePath option',
resolvePath: function ( importee, importer ) {
return new Promise( function ( fulfil, reject ) {
var callback = function ( err, result ) {
if ( err ) {
reject( err );
} else {
fulfil( result );
}
};
resolve( importee, {
basedir: path.dirname( importer ),
moduleDirectory: 'js_modules', // to avoid faffing with .gitignore
packageFilter: function ( pkg ) {
if ( pkg[ 'jsnext:main' ] ) {
pkg.main = pkg[ 'jsnext:main' ];
}
return pkg;
}
}, callback );
});
}
};
================================================
FILE: test/bundle/input/35/js_modules/a.js
================================================
export default function a () {
console.log( 'I am module a' );
}
================================================
FILE: test/bundle/input/35/js_modules/c.js
================================================
export default function c () {
console.log( 'I am module c' );
}
================================================
FILE: test/bundle/input/35/js_modules/external/js_modules/b.js
================================================
import c from 'c';
export default function b () {
console.log( 'I am module b' );
c();
}
================================================
FILE: test/bundle/input/35/js_modules/external/package.json
================================================
{
"name": "external",
"version": "0.1.0",
"main": "dist/external.js",
"jsnext:main": "src/external.js"
}
================================================
FILE: test/bundle/input/35/js_modules/external/src/external.js
================================================
import a from 'a';
import b from 'b';
export default function external () {
console.log( 'I am an external dependency' );
a();
b();
}
================================================
FILE: test/bundle/input/35/main.js
================================================
import external from 'external';
external();
================================================
FILE: test/bundle/input/36/_config.js
================================================
var path = require( 'path' );
var Promise = require( 'sander' ).Promise;
var resolve = require( 'resolve' );
module.exports = {
description: 'External module paths can be resolved with resolvePath option',
resolvePath: function ( importee, importer ) {
return new Promise( function ( fulfil, reject ) {
var callback = function ( err, result ) {
if ( err ) {
reject( err );
} else {
fulfil( result );
}
};
resolve( importee, {
basedir: path.dirname( importer ),
moduleDirectory: 'js_modules', // to avoid faffing with .gitignore
packageFilter: function ( pkg ) {
if ( pkg[ 'jsnext:main' ] ) {
pkg.main = pkg[ 'jsnext:main' ];
}
return pkg;
}
}, callback );
});
}
};
================================================
FILE: test/bundle/input/36/js_modules/external/package.json
================================================
{
"name": "external",
"version": "0.1.0",
"main": "dist/external.js",
"jsnext:main": "src/external.js"
}
================================================
FILE: test/bundle/input/36/js_modules/external/src/dependsOnExternal.js
================================================
import external from './external';
export default function dependsOnExternal () {
console.log( external.message );
}
================================================
FILE: test/bundle/input/36/js_modules/external/src/external.js
================================================
import dependsOnExternal from './dependsOnExternal';
export default function external () {
dependsOnExternal();
}
external.message = 'don\'t try this at home';
================================================
FILE: test/bundle/input/36/main.js
================================================
import external from 'external';
external();
================================================
FILE: test/bundle/input/37/_config.js
================================================
module.exports = {
description: 'Clashes with external dependency names are handled',
imports: [ 'moment' ]
};
================================================
FILE: test/bundle/input/37/a.js
================================================
var x = 'wut';
export default x;
================================================
FILE: test/bundle/input/37/main.js
================================================
import x from "moment";
import a from './a';
================================================
FILE: test/bundle/input/38/_config.js
================================================
module.exports = {
description: 'Export reassignments are deconflicted'
};
================================================
FILE: test/bundle/input/38/foo.js
================================================
export default notActuallyFoo;
function notActuallyFoo () {
foo();
}
function foo () {
console.log( 'actually foo' );
}
================================================
FILE: test/bundle/input/38/main.js
================================================
import foo from './foo';
foo();
================================================
FILE: test/bundle/input/39/_config.js
================================================
module.exports = {
description: 'avoids naming collisions between imports',
error: /Duplicated import \('x'\)/
};
================================================
FILE: test/bundle/input/39/bar.js
================================================
export default function () {}
================================================
FILE: test/bundle/input/39/foo.js
================================================
export default function () {}
================================================
FILE: test/bundle/input/39/main.js
================================================
import x from './foo';
import x from './bar';
x();
================================================
FILE: test/bundle/input/40/_config.js
================================================
module.exports = {
description: 'removes existing sourcemap comments'
};
================================================
FILE: test/bundle/input/40/foo.js
================================================
export default function foo () {
console.log( 'foo' );
}
//# sourceMappingURL=foo.js.map
================================================
FILE: test/bundle/input/40/main.js
================================================
import foo from './foo';
foo();
//# sourceMappingURL=main.js.map
================================================
FILE: test/bundle/input/42/_config.js
================================================
module.exports = {
description: 'removes comments without blowing up'
};
================================================
FILE: test/bundle/input/42/foo.js
================================================
function foo () {
console.log( 'foo' );
}
export { foo };
//# sourceMappingURL=foo.js.map
================================================
FILE: test/bundle/input/42/main.js
================================================
import { foo } from './foo';
foo();
//# sourceMappingURL=main.js.map
================================================
FILE: test/bundle/input/43/_config.js
================================================
module.exports = {
description: 'bundles class with super (#129)',
imports: [ 'bar' ]
};
================================================
FILE: test/bundle/input/43/main.js
================================================
import Bar from 'bar';
class Foo extends Bar {
constructor() {
super();
console.log('Foo constructed');
}
}
================================================
FILE: test/bundle/input/44/_config.js
================================================
module.exports = {
description: 'avoids conflicts between imports and declarations not in root scope',
imports: [ 'foo', 'bar' ]
};
================================================
FILE: test/bundle/input/44/a.js
================================================
import foo from 'foo';
================================================
FILE: test/bundle/input/44/b.js
================================================
import foo from 'bar';
(function () {
var bar = 'nope';
foo();
})();
================================================
FILE: test/bundle/input/44/main.js
================================================
import './a';
import './b';
================================================
FILE: test/bundle/input/45/_config.js
================================================
module.exports = {
description: 'uses supplied code',
modules: {
'main.js': 'import foo from \'./foo\';\nfoo();',
'foo/index.js': 'import bar from \'./bar\';\nexport default function foo () {\n\tconsole.log( bar );\n}',
'foo/bar.js': 'export default 42;'
}
};
================================================
FILE: test/bundle/input/46/_config.js
================================================
module.exports = {
description: 'uses supplied AST',
modules: {
'main.js': 'import foo from \'./foo\';\nfoo();',
// the code points to './bar' but the AST points to './baz', so we
// can check the AST is being used
'foo/index.js': {
code: 'import bar from \'./bar\';\nexport default function foo () {\n\tconsole.log( bar );\n}',
ast: {
start: 0,
body: [
{
start: 0,
specifiers: [{
start: 7,
local: {
start: 7,
name: "bar",
type: "Identifier",
end: 10
},
type: "ImportDefaultSpecifier",
end: 10
}],
source: {
start: 16,
value: "./baz",
raw: "\'./baz\'",
type: "Literal",
end: 23
},
type: "ImportDeclaration",
end: 24
},
{
start: 25,
declaration: {
start: 40,
id: {
start: 49,
name: "foo",
type: "Identifier",
end: 52
},
generator: false,
expression: false,
params: [],
body: {
start: 56,
body: [{
start: 59,
expression: {
start: 59,
callee: {
start: 59,
object: {
start: 59,
name: "console",
type: "Identifier",
end: 66
},
property: {
start: 67,
name: "log",
type: "Identifier",
end: 70
},
computed: false,
type: "MemberExpression",
end: 70
},
arguments: [
{
start: 72,
name: "bar",
type: "Identifier",
end: 75
}
],
type: "CallExpression",
end: 77
},
type: "ExpressionStatement",
end: 78
}],
type: "BlockStatement",
end: 80
},
type: "FunctionDeclaration",
end: 80
},
type: "ExportDefaultDeclaration",
end: 80
}],
sourceType: "module",
type: "Program",
end: 80
}
},
'foo/baz.js': 'export default 42;'
}
};
================================================
FILE: test/bundle/input/47/_config.js
================================================
module.exports = {
description: 'omits use strict if necessary',
useStrict: false
};
================================================
FILE: test/bundle/input/47/main.js
================================================
implicitGlobal = 'lol';
================================================
FILE: test/bundle/input/48/_config.js
================================================
module.exports = {
description: 'handles resolvePath failure',
resolvePath: function ( importee ) {
if ( importee[0] !== '.' ) return null;
return importee;
},
imports: [ 'external' ]
};
================================================
FILE: test/bundle/input/48/main.js
================================================
import external from 'external';
external();
================================================
FILE: test/bundle/input/49/_config.js
================================================
module.exports = {
description: 'generates inline sourcemap',
sourceMap: 'inline'
};
================================================
FILE: test/bundle/input/49/foo.js
================================================
export default function foo () {
console.log( 'foo' );
}
================================================
FILE: test/bundle/input/49/main.js
================================================
import foo from './foo';
foo();
================================================
FILE: test/bundle/input/50/A.js
================================================
import B from './B';
export default class A {
constructor () {
console.log( 'creating A' );
}
b () {
return new B();
}
}
================================================
FILE: test/bundle/input/50/B.js
================================================
import A from './A';
export default class B extends A {
constructor () {
console.log( 'creating B' );
}
}
================================================
FILE: test/bundle/input/50/C.js
================================================
import D from './D';
export default class C extends D {
constructor () {
console.log( 'creating C' );
}
}
================================================
FILE: test/bundle/input/50/D.js
================================================
import C from './C';
export default class D {
constructor () {
console.log( 'creating D' );
}
c () {
return new C();
}
}
================================================
FILE: test/bundle/input/50/_config.js
================================================
module.exports = {
description: 'cyclical dependency order is resolved based on need (#152)',
//solo: true
};
================================================
FILE: test/bundle/input/50/main.js
================================================
import A from './A';
import B from './B';
import C from './C';
import D from './D';
new A().b();
new B();
new C();
new D().c();
================================================
FILE: test/bundle/input/51/_config.js
================================================
module.exports = {
description: 'leaves trailing .js in external package name',
imports: [ 'highlight.js' ]
};
================================================
FILE: test/bundle/input/51/foo.js
================================================
export default 42;
================================================
FILE: test/bundle/input/51/main.js
================================================
import highlight from 'highlight.js';
import foo from './foo.js';
================================================
FILE: test/bundle/input/52/_config.js
================================================
var path = require( 'path' );
module.exports = {
description: 'correctly renames bindings from modules referred to by local and external-ish modules',
resolvePath: function ( importee ) {
return path.resolve( __dirname, 'external', importee.slice( 4 ) ) + '.js';
}
};
================================================
FILE: test/bundle/input/52/bar.js
================================================
import baz from 'ext/baz';
// bar.js
console.log( 'baz', baz );
================================================
FILE: test/bundle/input/52/external/baz.js
================================================
export default function () {
// baz.js
};
================================================
FILE: test/bundle/input/52/external/foo.js
================================================
import not_baz from './baz';
// foo.js
================================================
FILE: test/bundle/input/52/main.js
================================================
import 'ext/foo';
import './bar';
// main.js
================================================
FILE: test/bundle/input/53/_config.js
================================================
module.exports = {
description: 'allows modules to depend on entry module',
exports: [ 'default' ]
};
================================================
FILE: test/bundle/input/53/foo.js
================================================
import main from './main';
export default function () {
console.log( 'foo' );
}
================================================
FILE: test/bundle/input/53/main.js
================================================
import foo from './foo';
foo();
export default function () {
console.log( 'main' );
}
================================================
FILE: test/bundle/input/54/_config.js
================================================
module.exports = {
description: 'allows multiple modules to share an external package',
imports: [ 'bluebird' ]
};
================================================
FILE: test/bundle/input/54/foo.js
================================================
import Promise from 'bluebird';
export default 'foo';
================================================
FILE: test/bundle/input/54/main.js
================================================
import Promise from 'bluebird';
import foo from './foo';
================================================
FILE: test/bundle/input/55/A.js
================================================
import B from './B';
import C from './C';
class A {
b () {
return new B();
}
c () {
return new C();
}
}
export default A;
================================================
FILE: test/bundle/input/55/B.js
================================================
import A from './A';
class B extends A {}
export default B;
================================================
FILE: test/bundle/input/55/C.js
================================================
import A from './A';
class C extends A {}
export default C;
================================================
FILE: test/bundle/input/55/_config.js
================================================
module.exports = {
description: 'handles more complex mutually dependent module scenario (#157)'
};
================================================
FILE: test/bundle/input/55/main.js
================================================
import A from './A';
================================================
FILE: test/bundle/input/56/_config.js
================================================
module.exports = {
description: 'default exports are not live'
};
================================================
FILE: test/bundle/input/56/foo.js
================================================
var foo = 42;
export default foo;
foo = 99;
foo += 1;
foo++;
================================================
FILE: test/bundle/input/56/main.js
================================================
import foo from './foo';
console.log( foo ); // 42
================================================
FILE: test/bundle/input/57/_config.js
================================================
module.exports = {
description: 'correctly exports x as y inside a bundle'
};
================================================
FILE: test/bundle/input/57/foo.js
================================================
var x = 42;
export { x as y };
================================================
FILE: test/bundle/input/57/main.js
================================================
import * as foo from './foo';
console.log( foo.y );
================================================
FILE: test/bundle/input/58/_config.js
================================================
module.exports = {
description: 'correctly exports x as y from a bundle',
exports: [ 'y' ],
strict: true
};
================================================
FILE: test/bundle/input/58/main.js
================================================
var x = 42;
export { x as y };
================================================
FILE: test/bundle/input/59/_config.js
================================================
module.exports = {
description: 'correctly handles renamed exports within a bundle'
};
================================================
FILE: test/bundle/input/59/foo.js
================================================
var foo = 'foo';
export { foo as bar };
================================================
FILE: test/bundle/input/59/main.js
================================================
import { bar } from './foo';
console.log( bar ); // 'foo'
================================================
FILE: test/bundle/input/60/_config.js
================================================
module.exports = {
description: 'preserves comments after imports'
};
================================================
FILE: test/bundle/input/60/bar.js
================================================
var bar = 'bar';
export { bar };
================================================
FILE: test/bundle/input/60/foo.js
================================================
var foo = 'foo';
export { foo };
================================================
FILE: test/bundle/input/60/main.js
================================================
import { foo } from './foo';
import { bar } from './bar';
// Preserve comments after imports
console.log( foo );
================================================
FILE: test/bundle/output/amd/01.js
================================================
define(function () {
'use strict';
var message = 'yes';
var foo = message;
console.log( foo );
});
================================================
FILE: test/bundle/output/amd/02.js
================================================
define(function () {
'use strict';
var message = 'yes';
var foo = message;
console.log( foo );
});
================================================
FILE: test/bundle/output/amd/03.js
================================================
define(['external'], function (external) {
'use strict';
external = ('default' in external ? external['default'] : external);
var bar = 'yes';
var foo = bar;
console.log( external( foo ) );
});
================================================
FILE: test/bundle/output/amd/04.js
================================================
define(['exports'], function (exports) {
'use strict';
var answer = 42;
var main = answer * 2;
exports['default'] = main;
});
================================================
FILE: test/bundle/output/amd/05.js
================================================
define(['exports'], function (exports) {
'use strict';
var one = 1;
var two = 2;
var three = 3;
var four = one + 3;
var five = two + 3;
var six = three + 3;
four = 99;
exports.four = four;
exports.five = five;
exports.six = six;
});
================================================
FILE: test/bundle/output/amd/06.js
================================================
define(['utils/external'], function (external) {
'use strict';
external = ('default' in external ? external['default'] : external);
var message = 'this is a message';
console.log( message );
});
================================================
FILE: test/bundle/output/amd/07.js
================================================
define(function () {
'use strict';
var foo = 'this is foo';
function logFoo () {
console.log( foo );
}
function logBar () {
console.log( bar );
}
});
================================================
FILE: test/bundle/output/amd/08.js
================================================
define(['external'], function (ImplicitlyNamed) {
'use strict';
ImplicitlyNamed = ('default' in ImplicitlyNamed ? ImplicitlyNamed['default'] : ImplicitlyNamed);
});
================================================
FILE: test/bundle/output/amd/09.js
================================================
define(['external'], function (Correct) {
'use strict';
Correct = ('default' in Correct ? Correct['default'] : Correct);
});
================================================
FILE: test/bundle/output/amd/10.js
================================================
define(['exports'], function (exports) {
'use strict';
class Foo {
constructor( str ) {
this.str = str;
}
toString() {
return this.str;
}
}
exports['default'] = Foo;
});
================================================
FILE: test/bundle/output/amd/11.js
================================================
define(['exports'], function (exports) {
'use strict';
var foo = 1;
var bar = 2;
foo = 3;
exports.foo = foo;
exports.bar = bar;
var baz = 4;
exports.baz = baz;
var qux = 5;
qux = 6;
exports.qux = qux;
});
================================================
FILE: test/bundle/output/amd/14.js
================================================
define(['external'], function (foo) {
'use strict';
foo = ('default' in foo ? foo['default'] : foo);
foo();
});
================================================
FILE: test/bundle/output/amd/15.js
================================================
define(['external'], function (external) {
'use strict';
external.foo();
});
================================================
FILE: test/bundle/output/amd/16.js
================================================
define(function () {
'use strict';
function _a__a () {
console.log( 'a' );
}
function c__a () {
console.log( 'a but actually c' );
}
var b = function () {
// a but actually c
c__a();
}
function foo () {
_a__a();
}
});
================================================
FILE: test/bundle/output/amd/17.js
================================================
define(function () {
'use strict';
function foo__a ( message ) {
console.log( message );
}
foo__a();
(function () {
var a = 'c';
foo__a( a );
}());
});
================================================
FILE: test/bundle/output/amd/18.js
================================================
define(function () {
'use strict';
var _doThing = function () {
console.log( 'doing foo thing' );
}
var foo = function () {
_doThing();
}
var bar = function () {
doThing();
}
var doThing = function ( item ) {
console.log( 'doing bar thing' );
}
});
================================================
FILE: test/bundle/output/amd/19.js
================================================
define(function () {
'use strict';
var hasOwnProperty = Object.prototype.hasOwnProperty;
console.log( hasOwnProperty.call({ foo: 'bar' }, 'foo' ) );
});
================================================
FILE: test/bundle/output/amd/20.js
================================================
define(['exports'], function (exports) {
'use strict';
var hasOwnProperty = Object.prototype.hasOwnProperty;
var main = function () {
console.log( hasOwnProperty.call({ foo: 'bar' }, 'foo' ) );
}
exports['default'] = main;
});
================================================
FILE: test/bundle/output/amd/21.js
================================================
define(function () {
'use strict';
const config = {};
config.async = true;
});
================================================
FILE: test/bundle/output/amd/22.js
================================================
define(['exports'], function (exports) {
'use strict';
function foo () {
console.log( 'fooing' );
}
exports.foo = foo;
// foo
foo();
});
================================================
FILE: test/bundle/output/amd/24.js
================================================
/* this is a banner */
define(function () {
'use strict';
function foo () {
console.log( 'fooing' );
}
function bar () {
console.log( 'baring' );
}
foo();
bar();
});
/* this is a footer */
================================================
FILE: test/bundle/output/amd/25.js
================================================
define('myModule', function () {
'use strict';
var foo = function () {
console.log( 'fooing' );
}
foo();
});
================================================
FILE: test/bundle/output/amd/26.js
================================================
define(function () {
'use strict';
function bar () {
console.log( 'baring' );
}
bar();
});
================================================
FILE: test/bundle/output/amd/27.js
================================================
define(function () {
'use strict';
var foo = 'this is foo';
var bar = 'this is bar';
function logFoo () {
console.log( foo );
}
function logBar () {
console.log( bar );
}
});
================================================
FILE: test/bundle/output/amd/28.js
================================================
define(function () {
'use strict';
var foo = () => undefined;
assert.strictEqual( undefined, undefined );
var ctx = {};
var arrow = (x => assert.strictEqual( undefined, undefined ));
var fn = function () { assert.strictEqual( this, ctx ); };
arrow.call(ctx);
fn.call(ctx);
assert.strictEqual(foo(), undefined);
});
================================================
FILE: test/bundle/output/amd/29.js
================================================
define(['foo'], function (foo) {
'use strict';
var foo__default = ('default' in foo ? foo['default'] : foo);
foo__default();
foo.bar();
});
================================================
FILE: test/bundle/output/amd/30.js
================================================
define(['foo'], function (foo) {
'use strict';
foo.bar();
});
================================================
FILE: test/bundle/output/amd/31.js
================================================
define(function () {
'use strict';
function someOtherName () {}
function x () {}
someOtherName();
});
================================================
FILE: test/bundle/output/amd/32.js
================================================
define(function () {
'use strict';
});
================================================
FILE: test/bundle/output/amd/33.js
================================================
define(function () {
'use strict';
var _Promise__Promise = function () {};
_Promise__Promise.prototype = {
keep () { this.state = 'kept'; },
break () { this.state = 'broken'; }
};
var _Promise = _Promise__Promise;
var _Math = {
get add () { return add; },
get multiply () { return multiply; }
};
function add ( a, b ) {
return a + b;
}
function multiply ( a, b ) {
return a * b;
}
var num = Math.max( 1, 2, 3 );
var resolved = Promise.resolve( num );
function foo () {
return resolved;
}
var promise = new _Promise();
promise.keep();
console.log( _Math.add( 40, 2 ) );
});
================================================
FILE: test/bundle/output/amd/34.js
================================================
define(['exports'], function (exports) {
'use strict';
var foo__exports = {};
foo__exports.bar = function () {
console.log( 'exports should be renamed' );
};
var foo = foo__exports;
foo.bar();
var main = 'whatever';
exports['default'] = main;
});
================================================
FILE: test/bundle/output/amd/35.js
================================================
define(function () {
'use strict';
function a () {
console.log( 'I am module a' );
}
function c () {
console.log( 'I am module c' );
}
function b () {
console.log( 'I am module b' );
c();
}
function external () {
console.log( 'I am an external dependency' );
a();
b();
}
external();
});
gitextract_0c8mkpe7/
├── .babelrc
├── .editorconfig
├── .gitignore
├── .jshintrc
├── .travis.yml
├── CHANGELOG.md
├── README.md
├── appveyor.yml
├── bin/
│ ├── handleError.js
│ ├── help.md
│ ├── index.js
│ ├── runEsperanto.js
│ └── showHelp.js
├── comparison/
│ ├── README.md
│ ├── index.js
│ ├── output/
│ │ ├── esperanto/
│ │ │ ├── batchImports.js
│ │ │ ├── defaultExport.js
│ │ │ ├── defaultImport.js
│ │ │ ├── groupedExports.js
│ │ │ ├── inlineNamedExports.js
│ │ │ ├── mixedImports.js
│ │ │ ├── namedExports.js
│ │ │ ├── namedImports.js
│ │ │ └── renamingImports.js
│ │ ├── traceur/
│ │ │ ├── batchImports.js
│ │ │ ├── defaultExport.js
│ │ │ ├── defaultImport.js
│ │ │ ├── groupedExports.js
│ │ │ ├── inlineNamedExports.js
│ │ │ ├── mixedImports.js
│ │ │ ├── namedExports.js
│ │ │ ├── namedImports.js
│ │ │ └── renamingImports.js
│ │ └── transpile/
│ │ ├── batchImports.js
│ │ ├── defaultExport.js
│ │ ├── defaultImport.js
│ │ ├── groupedExports.js
│ │ ├── inlineNamedExports.js
│ │ ├── mixedImports.js
│ │ ├── namedExports.js
│ │ ├── namedImports.js
│ │ └── renamingImports.js
│ ├── package.json
│ └── samples/
│ ├── batchImports.js
│ ├── defaultExport.js
│ ├── defaultImport.js
│ ├── groupedExports.js
│ ├── inlineNamedExports.js
│ ├── mixedImports.js
│ ├── namedExports.js
│ ├── namedImports.js
│ └── renamingImports.js
├── gobblefile.js
├── package.json
├── src/
│ ├── banner.js
│ ├── bundler/
│ │ ├── builders/
│ │ │ ├── concat.js
│ │ │ ├── defaultsMode/
│ │ │ │ ├── amd.js
│ │ │ │ ├── cjs.js
│ │ │ │ ├── index.js
│ │ │ │ └── umd.js
│ │ │ ├── index.js
│ │ │ └── strictMode/
│ │ │ ├── amd.js
│ │ │ ├── cjs.js
│ │ │ ├── index.js
│ │ │ ├── umd.js
│ │ │ └── utils/
│ │ │ └── getExportBlock.js
│ │ ├── combine/
│ │ │ ├── getRenamedImports.js
│ │ │ ├── index.js
│ │ │ ├── populateExternalModuleImports.js
│ │ │ ├── populateIdentifierReplacements.js
│ │ │ ├── populateModuleNames.js
│ │ │ ├── resolveExports.js
│ │ │ ├── topLevelScopeConflicts.js
│ │ │ └── transformBody.js
│ │ ├── getBundle.js
│ │ ├── getModule.js
│ │ └── utils/
│ │ ├── resolveChains.js
│ │ └── sortModules.js
│ ├── esperanto.js
│ ├── standalone/
│ │ ├── builders/
│ │ │ ├── defaultsMode/
│ │ │ │ ├── amd.js
│ │ │ │ ├── cjs.js
│ │ │ │ ├── index.js
│ │ │ │ ├── umd.js
│ │ │ │ └── utils/
│ │ │ │ └── transformExportDeclaration.js
│ │ │ ├── index.js
│ │ │ └── strictMode/
│ │ │ ├── amd.js
│ │ │ ├── cjs.js
│ │ │ ├── index.js
│ │ │ ├── umd.js
│ │ │ └── utils/
│ │ │ ├── gatherImports.js
│ │ │ ├── getExportNames.js
│ │ │ ├── getImportSummary.js
│ │ │ └── transformBody.js
│ │ └── getModule.js
│ └── utils/
│ ├── EsperantoError.js
│ ├── amd/
│ │ ├── amdIntro.js
│ │ ├── getImportSummary.js
│ │ ├── processIds.js
│ │ └── processName.js
│ ├── ast/
│ │ ├── annotate.js
│ │ ├── disallowIllegalReassignment.js
│ │ ├── findImportsAndExports.js
│ │ ├── getUnscopedNames.js
│ │ ├── replaceIdentifiers.js
│ │ ├── rewriteExportAssignments.js
│ │ ├── traverse.js
│ │ └── walk.js
│ ├── builtins.js
│ ├── disallowConflictingImports.js
│ ├── getReadOnlyIdentifiers.js
│ ├── hasNamedExports.js
│ ├── hasNamedImports.js
│ ├── hasOwnProp.js
│ ├── mappers.js
│ ├── packageResult.js
│ ├── promiseSequence.js
│ ├── resolveId.js
│ ├── sanitize.js
│ └── umd/
│ ├── requireName.js
│ └── umdIntro.js
└── test/
├── .jshintrc
├── bundle/
│ ├── index.js
│ ├── input/
│ │ ├── 01/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 02/
│ │ │ ├── _config.js
│ │ │ ├── foo/
│ │ │ │ └── index.js
│ │ │ └── main.js
│ │ ├── 03/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 04/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 05/
│ │ │ ├── _config.js
│ │ │ ├── main.js
│ │ │ └── numbers.js
│ │ ├── 06/
│ │ │ ├── _config.js
│ │ │ ├── main.js
│ │ │ └── nested/
│ │ │ └── foo.js
│ │ ├── 07/
│ │ │ ├── _config.js
│ │ │ ├── bar.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 08/
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 09/
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 10/
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 11/
│ │ │ ├── _config.js
│ │ │ ├── a.js
│ │ │ ├── b.js
│ │ │ └── main.js
│ │ ├── 12/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 13/
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 14/
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 15/
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 16/
│ │ │ ├── _config.js
│ │ │ ├── a.js
│ │ │ ├── b.js
│ │ │ ├── c.js
│ │ │ └── main.js
│ │ ├── 17/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 18/
│ │ │ ├── _config.js
│ │ │ ├── bar.js
│ │ │ ├── doThing.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 19/
│ │ │ ├── _config.js
│ │ │ ├── hasOwnProperty.js
│ │ │ └── main.js
│ │ ├── 20/
│ │ │ ├── _config.js
│ │ │ ├── main.js
│ │ │ └── objectUtils.js
│ │ ├── 21/
│ │ │ ├── _config.js
│ │ │ ├── config.js
│ │ │ └── main.js
│ │ ├── 22/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 23/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 24/
│ │ │ ├── _config.js
│ │ │ ├── bar.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 25/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 26/
│ │ │ ├── _config.js
│ │ │ ├── bar.js
│ │ │ └── main.js
│ │ ├── 27/
│ │ │ ├── _config.js
│ │ │ ├── bar.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 28/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 29/
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 30/
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 31/
│ │ │ ├── _config.js
│ │ │ ├── exportedX.js
│ │ │ ├── main.js
│ │ │ └── notExportedX.js
│ │ ├── 32/
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 33/
│ │ │ ├── Math.js
│ │ │ ├── Promise.js
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 34/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 35/
│ │ │ ├── _config.js
│ │ │ ├── js_modules/
│ │ │ │ ├── a.js
│ │ │ │ ├── c.js
│ │ │ │ └── external/
│ │ │ │ ├── js_modules/
│ │ │ │ │ └── b.js
│ │ │ │ ├── package.json
│ │ │ │ └── src/
│ │ │ │ └── external.js
│ │ │ └── main.js
│ │ ├── 36/
│ │ │ ├── _config.js
│ │ │ ├── js_modules/
│ │ │ │ └── external/
│ │ │ │ ├── package.json
│ │ │ │ └── src/
│ │ │ │ ├── dependsOnExternal.js
│ │ │ │ └── external.js
│ │ │ └── main.js
│ │ ├── 37/
│ │ │ ├── _config.js
│ │ │ ├── a.js
│ │ │ └── main.js
│ │ ├── 38/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 39/
│ │ │ ├── _config.js
│ │ │ ├── bar.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 40/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 42/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 43/
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 44/
│ │ │ ├── _config.js
│ │ │ ├── a.js
│ │ │ ├── b.js
│ │ │ └── main.js
│ │ ├── 45/
│ │ │ └── _config.js
│ │ ├── 46/
│ │ │ └── _config.js
│ │ ├── 47/
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 48/
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 49/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 50/
│ │ │ ├── A.js
│ │ │ ├── B.js
│ │ │ ├── C.js
│ │ │ ├── D.js
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 51/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 52/
│ │ │ ├── _config.js
│ │ │ ├── bar.js
│ │ │ ├── external/
│ │ │ │ ├── baz.js
│ │ │ │ └── foo.js
│ │ │ └── main.js
│ │ ├── 53/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 54/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 55/
│ │ │ ├── A.js
│ │ │ ├── B.js
│ │ │ ├── C.js
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 56/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 57/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ ├── 58/
│ │ │ ├── _config.js
│ │ │ └── main.js
│ │ ├── 59/
│ │ │ ├── _config.js
│ │ │ ├── foo.js
│ │ │ └── main.js
│ │ └── 60/
│ │ ├── _config.js
│ │ ├── bar.js
│ │ ├── foo.js
│ │ └── main.js
│ └── output/
│ ├── amd/
│ │ ├── 01.js
│ │ ├── 02.js
│ │ ├── 03.js
│ │ ├── 04.js
│ │ ├── 05.js
│ │ ├── 06.js
│ │ ├── 07.js
│ │ ├── 08.js
│ │ ├── 09.js
│ │ ├── 10.js
│ │ ├── 11.js
│ │ ├── 14.js
│ │ ├── 15.js
│ │ ├── 16.js
│ │ ├── 17.js
│ │ ├── 18.js
│ │ ├── 19.js
│ │ ├── 20.js
│ │ ├── 21.js
│ │ ├── 22.js
│ │ ├── 24.js
│ │ ├── 25.js
│ │ ├── 26.js
│ │ ├── 27.js
│ │ ├── 28.js
│ │ ├── 29.js
│ │ ├── 30.js
│ │ ├── 31.js
│ │ ├── 32.js
│ │ ├── 33.js
│ │ ├── 34.js
│ │ ├── 35.js
│ │ ├── 36.js
│ │ ├── 37.js
│ │ ├── 38.js
│ │ ├── 40.js
│ │ ├── 42.js
│ │ ├── 43.js
│ │ ├── 44.js
│ │ ├── 45.js
│ │ ├── 46.js
│ │ ├── 47.js
│ │ ├── 48.js
│ │ ├── 49.js
│ │ ├── 50.js
│ │ ├── 51.js
│ │ ├── 52.js
│ │ ├── 53.js
│ │ ├── 54.js
│ │ ├── 55.js
│ │ ├── 56.js
│ │ ├── 57.js
│ │ ├── 58.js
│ │ ├── 59.js
│ │ └── 60.js
│ ├── amdDefaults/
│ │ ├── 01.js
│ │ ├── 02.js
│ │ ├── 03.js
│ │ ├── 04.js
│ │ ├── 06.js
│ │ ├── 07.js
│ │ ├── 08.js
│ │ ├── 09.js
│ │ ├── 10.js
│ │ ├── 14.js
│ │ ├── 16.js
│ │ ├── 17.js
│ │ ├── 18.js
│ │ ├── 19.js
│ │ ├── 20.js
│ │ ├── 21.js
│ │ ├── 24.js
│ │ ├── 25.js
│ │ ├── 26.js
│ │ ├── 27.js
│ │ ├── 28.js
│ │ ├── 30.js
│ │ ├── 31.js
│ │ ├── 32.js
│ │ ├── 33.js
│ │ ├── 34.js
│ │ ├── 35.js
│ │ ├── 36.js
│ │ ├── 37.js
│ │ ├── 38.js
│ │ ├── 40.js
│ │ ├── 42.js
│ │ ├── 43.js
│ │ ├── 44.js
│ │ ├── 45.js
│ │ ├── 46.js
│ │ ├── 47.js
│ │ ├── 48.js
│ │ ├── 49.js
│ │ ├── 50.js
│ │ ├── 51.js
│ │ ├── 52.js
│ │ ├── 53.js
│ │ ├── 54.js
│ │ ├── 55.js
│ │ ├── 56.js
│ │ ├── 57.js
│ │ ├── 59.js
│ │ └── 60.js
│ ├── cjs/
│ │ ├── 01.js
│ │ ├── 02.js
│ │ ├── 03.js
│ │ ├── 04.js
│ │ ├── 05.js
│ │ ├── 06.js
│ │ ├── 07.js
│ │ ├── 08.js
│ │ ├── 09.js
│ │ ├── 10.js
│ │ ├── 11.js
│ │ ├── 14.js
│ │ ├── 15.js
│ │ ├── 16.js
│ │ ├── 17.js
│ │ ├── 18.js
│ │ ├── 19.js
│ │ ├── 20.js
│ │ ├── 21.js
│ │ ├── 22.js
│ │ ├── 24.js
│ │ ├── 25.js
│ │ ├── 26.js
│ │ ├── 27.js
│ │ ├── 28.js
│ │ ├── 29.js
│ │ ├── 30.js
│ │ ├── 31.js
│ │ ├── 32.js
│ │ ├── 33.js
│ │ ├── 34.js
│ │ ├── 35.js
│ │ ├── 36.js
│ │ ├── 37.js
│ │ ├── 38.js
│ │ ├── 40.js
│ │ ├── 42.js
│ │ ├── 43.js
│ │ ├── 44.js
│ │ ├── 45.js
│ │ ├── 46.js
│ │ ├── 47.js
│ │ ├── 48.js
│ │ ├── 49.js
│ │ ├── 50.js
│ │ ├── 51.js
│ │ ├── 52.js
│ │ ├── 53.js
│ │ ├── 54.js
│ │ ├── 55.js
│ │ ├── 56.js
│ │ ├── 57.js
│ │ ├── 58.js
│ │ ├── 59.js
│ │ └── 60.js
│ ├── cjsDefaults/
│ │ ├── 01.js
│ │ ├── 02.js
│ │ ├── 03.js
│ │ ├── 04.js
│ │ ├── 06.js
│ │ ├── 07.js
│ │ ├── 08.js
│ │ ├── 09.js
│ │ ├── 10.js
│ │ ├── 14.js
│ │ ├── 16.js
│ │ ├── 17.js
│ │ ├── 18.js
│ │ ├── 19.js
│ │ ├── 20.js
│ │ ├── 21.js
│ │ ├── 24.js
│ │ ├── 25.js
│ │ ├── 26.js
│ │ ├── 27.js
│ │ ├── 28.js
│ │ ├── 30.js
│ │ ├── 31.js
│ │ ├── 32.js
│ │ ├── 33.js
│ │ ├── 34.js
│ │ ├── 35.js
│ │ ├── 36.js
│ │ ├── 37.js
│ │ ├── 38.js
│ │ ├── 40.js
│ │ ├── 42.js
│ │ ├── 43.js
│ │ ├── 44.js
│ │ ├── 45.js
│ │ ├── 46.js
│ │ ├── 47.js
│ │ ├── 48.js
│ │ ├── 49.js
│ │ ├── 50.js
│ │ ├── 51.js
│ │ ├── 52.js
│ │ ├── 53.js
│ │ ├── 54.js
│ │ ├── 55.js
│ │ ├── 56.js
│ │ ├── 57.js
│ │ ├── 59.js
│ │ └── 60.js
│ ├── concat/
│ │ ├── 01.js
│ │ ├── 02.js
│ │ ├── 07.js
│ │ ├── 16.js
│ │ ├── 17.js
│ │ ├── 18.js
│ │ ├── 19.js
│ │ ├── 21.js
│ │ ├── 24.js
│ │ ├── 25.js
│ │ ├── 26.js
│ │ ├── 27.js
│ │ ├── 28.js
│ │ ├── 31.js
│ │ ├── 32.js
│ │ ├── 33.js
│ │ ├── 35.js
│ │ ├── 36.js
│ │ ├── 38.js
│ │ ├── 40.js
│ │ ├── 42.js
│ │ ├── 45.js
│ │ ├── 46.js
│ │ ├── 47.js
│ │ ├── 49.js
│ │ ├── 50.js
│ │ ├── 52.js
│ │ ├── 55.js
│ │ ├── 56.js
│ │ ├── 57.js
│ │ ├── 59.js
│ │ └── 60.js
│ ├── umd/
│ │ ├── 01.js
│ │ ├── 02.js
│ │ ├── 03.js
│ │ ├── 04.js
│ │ ├── 05.js
│ │ ├── 06.js
│ │ ├── 07.js
│ │ ├── 08.js
│ │ ├── 09.js
│ │ ├── 10.js
│ │ ├── 11.js
│ │ ├── 14.js
│ │ ├── 15.js
│ │ ├── 16.js
│ │ ├── 17.js
│ │ ├── 18.js
│ │ ├── 19.js
│ │ ├── 20.js
│ │ ├── 21.js
│ │ ├── 22.js
│ │ ├── 24.js
│ │ ├── 25.js
│ │ ├── 26.js
│ │ ├── 27.js
│ │ ├── 28.js
│ │ ├── 29.js
│ │ ├── 30.js
│ │ ├── 31.js
│ │ ├── 32.js
│ │ ├── 33.js
│ │ ├── 34.js
│ │ ├── 35.js
│ │ ├── 36.js
│ │ ├── 37.js
│ │ ├── 38.js
│ │ ├── 40.js
│ │ ├── 42.js
│ │ ├── 43.js
│ │ ├── 44.js
│ │ ├── 45.js
│ │ ├── 46.js
│ │ ├── 47.js
│ │ ├── 48.js
│ │ ├── 49.js
│ │ ├── 50.js
│ │ ├── 51.js
│ │ ├── 52.js
│ │ ├── 53.js
│ │ ├── 54.js
│ │ ├── 55.js
│ │ ├── 56.js
│ │ ├── 57.js
│ │ ├── 58.js
│ │ ├── 59.js
│ │ └── 60.js
│ └── umdDefaults/
│ ├── 01.js
│ ├── 02.js
│ ├── 03.js
│ ├── 04.js
│ ├── 06.js
│ ├── 07.js
│ ├── 08.js
│ ├── 09.js
│ ├── 10.js
│ ├── 14.js
│ ├── 16.js
│ ├── 17.js
│ ├── 18.js
│ ├── 19.js
│ ├── 20.js
│ ├── 21.js
│ ├── 24.js
│ ├── 25.js
│ ├── 26.js
│ ├── 27.js
│ ├── 28.js
│ ├── 30.js
│ ├── 31.js
│ ├── 32.js
│ ├── 33.js
│ ├── 34.js
│ ├── 35.js
│ ├── 36.js
│ ├── 37.js
│ ├── 38.js
│ ├── 40.js
│ ├── 42.js
│ ├── 43.js
│ ├── 44.js
│ ├── 45.js
│ ├── 46.js
│ ├── 47.js
│ ├── 48.js
│ ├── 49.js
│ ├── 50.js
│ ├── 51.js
│ ├── 52.js
│ ├── 53.js
│ ├── 54.js
│ ├── 55.js
│ ├── 56.js
│ ├── 57.js
│ ├── 59.js
│ └── 60.js
├── es6-module-transpiler-tests/
│ ├── README.md
│ ├── bundled-output/
│ │ ├── bare-import.js
│ │ ├── bindings.js
│ │ ├── cycles-defaults.js
│ │ ├── cycles-immediate.js
│ │ ├── cycles.js
│ │ ├── export-and-import-reference-share-var.js
│ │ ├── export-default-function.js
│ │ ├── export-default-named-function.js
│ │ ├── export-default.js
│ │ ├── export-from-default.js
│ │ ├── export-from.js
│ │ ├── export-function.js
│ │ ├── export-list.js
│ │ ├── export-mixins.js
│ │ ├── export-var.js
│ │ ├── import-as.js
│ │ ├── import-chain.js
│ │ ├── import-order.js
│ │ ├── module-level-declarations.js
│ │ ├── named-function-expression.js
│ │ ├── namespaces.js
│ │ ├── re-export-default-import.js
│ │ └── this-binding-undefined.js
│ ├── input/
│ │ ├── bare-import/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── bindings/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── cycles/
│ │ │ ├── _config.js
│ │ │ ├── a.js
│ │ │ ├── b.js
│ │ │ └── c.js
│ │ ├── cycles-defaults/
│ │ │ ├── _config.js
│ │ │ ├── a.js
│ │ │ ├── b.js
│ │ │ └── importer.js
│ │ ├── cycles-immediate/
│ │ │ ├── _config.js
│ │ │ ├── evens.js
│ │ │ ├── main.js
│ │ │ └── odds.js
│ │ ├── duplicate-import-fails/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── duplicate-import-specifier-fails/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── export-and-import-reference-share-var/
│ │ │ ├── _config.js
│ │ │ ├── first.js
│ │ │ └── second.js
│ │ ├── export-default/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── export-default-function/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── export-default-named-function/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── export-from/
│ │ │ ├── _config.js
│ │ │ ├── first.js
│ │ │ ├── second.js
│ │ │ └── third.js
│ │ ├── export-from-default/
│ │ │ ├── _config.js
│ │ │ ├── first.js
│ │ │ ├── second.js
│ │ │ └── third.js
│ │ ├── export-function/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── export-list/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── export-mixins/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── export-not-at-top-level-fails/
│ │ │ ├── _config.js
│ │ │ └── index.js
│ │ ├── export-var/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── import-as/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── import-chain/
│ │ │ ├── _config.js
│ │ │ ├── first.js
│ │ │ ├── second.js
│ │ │ └── third.js
│ │ ├── import-not-at-top-level-fails/
│ │ │ ├── _config.js
│ │ │ └── index.js
│ │ ├── import-order/
│ │ │ ├── _config.js
│ │ │ ├── consumer.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── module-level-declarations/
│ │ │ ├── _config.js
│ │ │ └── mod.js
│ │ ├── named-function-expression/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── namespace-reassign-import-fails/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── namespace-update-import-fails/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── namespaces/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── re-export-default-import/
│ │ │ ├── _config.js
│ │ │ ├── first.js
│ │ │ ├── second.js
│ │ │ └── third.js
│ │ ├── reassign-import-fails/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── reassign-import-not-at-top-level-fails/
│ │ │ ├── _config.js
│ │ │ ├── exporter.js
│ │ │ └── importer.js
│ │ ├── this-binding-undefined/
│ │ │ ├── _config.js
│ │ │ └── mod.js
│ │ └── update-expression-of-import-fails/
│ │ ├── _config.js
│ │ ├── exporter.js
│ │ └── importer.js
│ └── output/
│ ├── bare-import/
│ │ ├── exporter.js
│ │ └── importer.js
│ ├── bindings/
│ │ ├── exporter.js
│ │ └── importer.js
│ ├── cycles/
│ │ ├── a.js
│ │ ├── b.js
│ │ └── c.js
│ ├── cycles-defaults/
│ │ ├── a.js
│ │ ├── b.js
│ │ └── importer.js
│ ├── cycles-immediate/
│ │ ├── evens.js
│ │ ├── main.js
│ │ └── odds.js
│ ├── duplicate-import-fails/
│ │ └── exporter.js
│ ├── duplicate-import-specifier-fails/
│ │ └── exporter.js
│ ├── export-and-import-reference-share-var/
│ │ ├── first.js
│ │ └── second.js
│ ├── export-default/
│ │ ├── exporter.js
│ │ └── importer.js
│ ├── export-default-function/
│ │ ├── exporter.js
│ │ └── importer.js
│ ├── export-default-named-function/
│ │ ├── exporter.js
│ │ └── importer.js
│ ├── export-from/
│ │ ├── first.js
│ │ ├── second.js
│ │ └── third.js
│ ├── export-from-default/
│ │ ├── first.js
│ │ ├── second.js
│ │ └── third.js
│ ├── export-function/
│ │ ├── exporter.js
│ │ └── importer.js
│ ├── export-list/
│ │ ├── exporter.js
│ │ └── importer.js
│ ├── export-mixins/
│ │ ├── exporter.js
│ │ └── importer.js
│ ├── export-var/
│ │ ├── exporter.js
│ │ └── importer.js
│ ├── import-as/
│ │ ├── exporter.js
│ │ └── importer.js
│ ├── import-chain/
│ │ ├── first.js
│ │ ├── second.js
│ │ └── third.js
│ ├── import-order/
│ │ ├── consumer.js
│ │ ├── exporter.js
│ │ └── importer.js
│ ├── module-level-declarations/
│ │ └── mod.js
│ ├── named-function-expression/
│ │ ├── exporter.js
│ │ └── importer.js
│ ├── namespace-reassign-import-fails/
│ │ └── exporter.js
│ ├── namespace-update-import-fails/
│ │ └── exporter.js
│ ├── namespaces/
│ │ ├── exporter.js
│ │ └── importer.js
│ ├── re-export-default-import/
│ │ ├── first.js
│ │ ├── second.js
│ │ └── third.js
│ ├── reassign-import-fails/
│ │ └── exporter.js
│ ├── reassign-import-not-at-top-level-fails/
│ │ └── exporter.js
│ ├── this-binding-undefined/
│ │ └── mod.js
│ └── update-expression-of-import-fails/
│ └── exporter.js
├── fastMode/
│ ├── index.js
│ └── output/
│ ├── amd/
│ │ ├── absolutePaths.js
│ │ ├── banner.js
│ │ ├── bannerAndFooter.js
│ │ ├── constructor.js
│ │ ├── earlyExport.js
│ │ ├── emptyImport.js
│ │ ├── emptyImportWithDefaultExport.js
│ │ ├── escapedSource.js
│ │ ├── exportAnonFunction.js
│ │ ├── exportClassWithSuper.js
│ │ ├── exportDefault.js
│ │ ├── exportFunction.js
│ │ ├── footer.js
│ │ ├── importAll.js
│ │ ├── importDefault.js
│ │ ├── intermediateSourcemaps.js
│ │ ├── multipleImports.js
│ │ ├── namedAmdModule.js
│ │ ├── preparsed.js
│ │ ├── sparseArray.js
│ │ ├── trailingEmptyImport.js
│ │ └── useStrictFalse.js
│ ├── cjs/
│ │ ├── absolutePaths.js
│ │ ├── banner.js
│ │ ├── bannerAndFooter.js
│ │ ├── constructor.js
│ │ ├── earlyExport.js
│ │ ├── emptyImport.js
│ │ ├── emptyImportWithDefaultExport.js
│ │ ├── escapedSource.js
│ │ ├── exportAnonFunction.js
│ │ ├── exportClassWithSuper.js
│ │ ├── exportDefault.js
│ │ ├── exportFunction.js
│ │ ├── footer.js
│ │ ├── importAll.js
│ │ ├── importDefault.js
│ │ ├── intermediateSourcemaps.js
│ │ ├── multipleImports.js
│ │ ├── namedAmdModule.js
│ │ ├── preparsed.js
│ │ ├── sparseArray.js
│ │ ├── trailingEmptyImport.js
│ │ └── useStrictFalse.js
│ └── umd/
│ ├── absolutePaths.js
│ ├── banner.js
│ ├── bannerAndFooter.js
│ ├── constructor.js
│ ├── earlyExport.js
│ ├── emptyImport.js
│ ├── emptyImportWithDefaultExport.js
│ ├── escapedSource.js
│ ├── exportAnonFunction.js
│ ├── exportClassWithSuper.js
│ ├── exportDefault.js
│ ├── exportFunction.js
│ ├── footer.js
│ ├── importAll.js
│ ├── importDefault.js
│ ├── intermediateSourcemaps.js
│ ├── multipleImports.js
│ ├── namedAmdModule.js
│ ├── preparsed.js
│ ├── sparseArray.js
│ ├── trailingEmptyImport.js
│ └── useStrictFalse.js
├── samples/
│ ├── absolutePaths/
│ │ ├── _config.js
│ │ └── source.js
│ ├── banner/
│ │ ├── _config.js
│ │ └── source.js
│ ├── bannerAndFooter/
│ │ ├── _config.js
│ │ └── source.js
│ ├── clashingDefaultImports/
│ │ ├── _config.js
│ │ └── source.js
│ ├── clashingFunctionArguments/
│ │ ├── _config.js
│ │ └── source.js
│ ├── clashingMixedImports/
│ │ ├── _config.js
│ │ └── source.js
│ ├── clashingNamedDefaultImports/
│ │ ├── _config.js
│ │ └── source.js
│ ├── clashingNamedImports/
│ │ ├── _config.js
│ │ └── source.js
│ ├── clashingNames/
│ │ ├── _config.js
│ │ └── source.js
│ ├── clashingObjectProperties/
│ │ ├── _config.js
│ │ └── source.js
│ ├── conditionalExport/
│ │ ├── _config.js
│ │ └── source.js
│ ├── constructor/
│ │ ├── _config.js
│ │ └── source.js
│ ├── duplicateImportFalsePositive/
│ │ ├── _config.js
│ │ └── source.js
│ ├── duplicateImports/
│ │ ├── _config.js
│ │ └── source.js
│ ├── earlyExport/
│ │ ├── _config.js
│ │ └── source.js
│ ├── emptyImport/
│ │ ├── _config.js
│ │ └── source.js
│ ├── emptyImportWithDefaultExport/
│ │ ├── _config.js
│ │ └── source.js
│ ├── escapedSource/
│ │ ├── _config.js
│ │ └── source.js
│ ├── exportAnonFunction/
│ │ ├── _config.js
│ │ └── source.js
│ ├── exportClass/
│ │ ├── _config.js
│ │ └── source.js
│ ├── exportClassWithSuper/
│ │ ├── _config.js
│ │ └── source.js
│ ├── exportDefault/
│ │ ├── _config.js
│ │ └── source.js
│ ├── exportFunction/
│ │ ├── _config.js
│ │ └── source.js
│ ├── exportInlineFunction/
│ │ ├── _config.js
│ │ └── source.js
│ ├── exportLet/
│ │ ├── _config.js
│ │ └── source.js
│ ├── exportNamed/
│ │ ├── _config.js
│ │ └── source.js
│ ├── exportNamedCollidesWithFunctionExpression/
│ │ ├── _config.js
│ │ └── source.js
│ ├── exportNamedFromNamedImportES3/
│ │ ├── _config.js
│ │ └── source.js
│ ├── exportNamedFunction/
│ │ ├── _config.js
│ │ └── source.js
│ ├── exportVar/
│ │ ├── _config.js
│ │ └── source.js
│ ├── footer/
│ │ ├── _config.js
│ │ └── source.js
│ ├── hasExportsVariable/
│ │ ├── _config.js
│ │ └── source.js
│ ├── importAll/
│ │ ├── _config.js
│ │ └── source.js
│ ├── importDefault/
│ │ ├── _config.js
│ │ └── source.js
│ ├── importNamed/
│ │ ├── _config.js
│ │ └── source.js
│ ├── intermediateSourcemaps/
│ │ ├── _config.js
│ │ └── source.js
│ ├── mixedImports/
│ │ ├── _config.js
│ │ └── source.js
│ ├── multipleImports/
│ │ ├── _config.js
│ │ └── source.js
│ ├── namedAmdModule/
│ │ ├── _config.js
│ │ └── source.js
│ ├── preparsed/
│ │ ├── _config.js
│ │ └── source.js
│ ├── reExportES3/
│ │ ├── _config.js
│ │ └── source.js
│ ├── renamedExport/
│ │ ├── _config.js
│ │ └── source.js
│ ├── renamedImport/
│ │ ├── _config.js
│ │ └── source.js
│ ├── safeCommentRemoval/
│ │ ├── _config.js
│ │ └── source.js
│ ├── shadowedExport/
│ │ ├── _config.js
│ │ └── source.js
│ ├── shadowedImport/
│ │ ├── _config.js
│ │ └── source.js
│ ├── sparseArray/
│ │ ├── _config.js
│ │ └── source.js
│ ├── trailingEmptyImport/
│ │ ├── _config.js
│ │ └── source.js
│ ├── unscopedNameConflicts/
│ │ ├── _config.js
│ │ └── source.js
│ ├── updateExportInArgument/
│ │ ├── _config.js
│ │ └── source.js
│ ├── updateExpressionInFunction/
│ │ ├── _config.js
│ │ └── source.js
│ └── useStrictFalse/
│ ├── _config.js
│ └── source.js
├── sourcemaps/
│ ├── bundle/
│ │ ├── foo.js
│ │ └── main.js
│ └── index.js
├── strictMode/
│ ├── index.js
│ └── output/
│ ├── amd/
│ │ ├── absolutePaths.js
│ │ ├── banner.js
│ │ ├── bannerAndFooter.js
│ │ ├── clashingFunctionArguments.js
│ │ ├── clashingMixedImports.js
│ │ ├── clashingNames.js
│ │ ├── clashingObjectProperties.js
│ │ ├── conditionalExport.js
│ │ ├── constructor.js
│ │ ├── duplicateImportFalsePositive.js
│ │ ├── duplicateImports.js
│ │ ├── earlyExport.js
│ │ ├── emptyImport.js
│ │ ├── emptyImportWithDefaultExport.js
│ │ ├── escapedSource.js
│ │ ├── exportAnonFunction.js
│ │ ├── exportClass.js
│ │ ├── exportClassWithSuper.js
│ │ ├── exportDefault.js
│ │ ├── exportFunction.js
│ │ ├── exportInlineFunction.js
│ │ ├── exportLet.js
│ │ ├── exportNamed.js
│ │ ├── exportNamedCollidesWithFunctionExpression.js
│ │ ├── exportNamedFromNamedImportES3.js
│ │ ├── exportNamedFunction.js
│ │ ├── exportVar.js
│ │ ├── footer.js
│ │ ├── hasExportsVariable.js
│ │ ├── importAll.js
│ │ ├── importDefault.js
│ │ ├── importNamed.js
│ │ ├── intermediateSourcemaps.js
│ │ ├── mixedImports.js
│ │ ├── multipleImports.js
│ │ ├── namedAmdModule.js
│ │ ├── preparsed.js
│ │ ├── reExportES3.js
│ │ ├── renamedExport.js
│ │ ├── renamedImport.js
│ │ ├── safeCommentRemoval.js
│ │ ├── shadowedExport.js
│ │ ├── shadowedImport.js
│ │ ├── sparseArray.js
│ │ ├── trailingEmptyImport.js
│ │ ├── unscopedNameConflicts.js
│ │ ├── updateExportInArgument.js
│ │ ├── updateExpressionInFunction.js
│ │ └── useStrictFalse.js
│ ├── cjs/
│ │ ├── absolutePaths.js
│ │ ├── banner.js
│ │ ├── bannerAndFooter.js
│ │ ├── clashingFunctionArguments.js
│ │ ├── clashingMixedImports.js
│ │ ├── clashingNames.js
│ │ ├── clashingObjectProperties.js
│ │ ├── conditionalExport.js
│ │ ├── constructor.js
│ │ ├── duplicateImportFalsePositive.js
│ │ ├── duplicateImports.js
│ │ ├── earlyExport.js
│ │ ├── emptyImport.js
│ │ ├── emptyImportWithDefaultExport.js
│ │ ├── escapedSource.js
│ │ ├── exportAnonFunction.js
│ │ ├── exportClass.js
│ │ ├── exportClassWithSuper.js
│ │ ├── exportDefault.js
│ │ ├── exportFunction.js
│ │ ├── exportInlineFunction.js
│ │ ├── exportLet.js
│ │ ├── exportNamed.js
│ │ ├── exportNamedCollidesWithFunctionExpression.js
│ │ ├── exportNamedFromNamedImportES3.js
│ │ ├── exportNamedFunction.js
│ │ ├── exportVar.js
│ │ ├── footer.js
│ │ ├── hasExportsVariable.js
│ │ ├── importAll.js
│ │ ├── importDefault.js
│ │ ├── importNamed.js
│ │ ├── intermediateSourcemaps.js
│ │ ├── mixedImports.js
│ │ ├── multipleImports.js
│ │ ├── namedAmdModule.js
│ │ ├── preparsed.js
│ │ ├── reExportES3.js
│ │ ├── renamedExport.js
│ │ ├── renamedImport.js
│ │ ├── safeCommentRemoval.js
│ │ ├── shadowedExport.js
│ │ ├── shadowedImport.js
│ │ ├── sparseArray.js
│ │ ├── trailingEmptyImport.js
│ │ ├── unscopedNameConflicts.js
│ │ ├── updateExportInArgument.js
│ │ ├── updateExpressionInFunction.js
│ │ └── useStrictFalse.js
│ └── umd/
│ ├── absolutePaths.js
│ ├── banner.js
│ ├── bannerAndFooter.js
│ ├── clashingFunctionArguments.js
│ ├── clashingMixedImports.js
│ ├── clashingNames.js
│ ├── clashingObjectProperties.js
│ ├── conditionalExport.js
│ ├── constructor.js
│ ├── duplicateImportFalsePositive.js
│ ├── duplicateImports.js
│ ├── earlyExport.js
│ ├── emptyImport.js
│ ├── emptyImportWithDefaultExport.js
│ ├── escapedSource.js
│ ├── exportAnonFunction.js
│ ├── exportClass.js
│ ├── exportClassWithSuper.js
│ ├── exportDefault.js
│ ├── exportFunction.js
│ ├── exportInlineFunction.js
│ ├── exportLet.js
│ ├── exportNamed.js
│ ├── exportNamedCollidesWithFunctionExpression.js
│ ├── exportNamedFromNamedImportES3.js
│ ├── exportNamedFunction.js
│ ├── exportVar.js
│ ├── footer.js
│ ├── hasExportsVariable.js
│ ├── importAll.js
│ ├── importDefault.js
│ ├── importNamed.js
│ ├── intermediateSourcemaps.js
│ ├── mixedImports.js
│ ├── multipleImports.js
│ ├── namedAmdModule.js
│ ├── preparsed.js
│ ├── reExportES3.js
│ ├── renamedExport.js
│ ├── renamedImport.js
│ ├── safeCommentRemoval.js
│ ├── shadowedExport.js
│ ├── shadowedImport.js
│ ├── sparseArray.js
│ ├── trailingEmptyImport.js
│ ├── unscopedNameConflicts.js
│ ├── updateExportInArgument.js
│ ├── updateExpressionInFunction.js
│ └── useStrictFalse.js
├── test.js
└── utils/
├── generate.js
└── makeWhitespaceVisible.js
SYMBOL INDEX (661 symbols across 341 files)
FILE: bin/runEsperanto.js
function bundle (line 34) | function bundle ( options, method ) {
function convert (line 86) | function convert ( options, method ) {
function readFromStdin (line 150) | function readFromStdin () {
function assign (line 175) | function assign ( target ) {
function filterOutNonJs (line 191) | function filterOutNonJs ( files ) {
FILE: comparison/output/esperanto/groupedExports.js
function getJSON (line 6) | function getJSON() {
function postJSON (line 10) | function postJSON() {
function animate (line 14) | function animate() {
FILE: comparison/output/esperanto/inlineNamedExports.js
function requestAnimationFrame (line 10) | function requestAnimationFrame() {
FILE: comparison/output/traceur/groupedExports.js
function getJSON (line 15) | function getJSON() {}
function postJSON (line 16) | function postJSON() {}
function animate (line 17) | function animate() {}
FILE: comparison/output/traceur/inlineNamedExports.js
function requestAnimationFrame (line 11) | function requestAnimationFrame() {}
FILE: comparison/output/transpile/groupedExports.js
function getJSON (line 15) | function getJSON() {}
function postJSON (line 16) | function postJSON() {}
function animate (line 17) | function animate() {}
FILE: comparison/output/transpile/inlineNamedExports.js
function requestAnimationFrame (line 11) | function requestAnimationFrame() {}
FILE: comparison/samples/groupedExports.js
function getJSON (line 4) | function getJSON() {
function postJSON (line 8) | function postJSON() {
function animate (line 12) | function animate() {
FILE: comparison/samples/inlineNamedExports.js
function requestAnimationFrame (line 4) | function requestAnimationFrame() {
FILE: gobblefile.js
function today (line 66) | function today () {
function pad (line 76) | function pad ( num ) {
FILE: src/bundler/builders/concat.js
function concat (line 3) | function concat ( bundle, options ) {
FILE: src/bundler/builders/defaultsMode/amd.js
function amd (line 4) | function amd ( bundle, options ) {
FILE: src/bundler/builders/defaultsMode/cjs.js
function cjs (line 4) | function cjs ( bundle, options ) {
FILE: src/bundler/builders/defaultsMode/umd.js
function umd (line 5) | function umd ( bundle, options ) {
FILE: src/bundler/builders/strictMode/amd.js
function amd (line 5) | function amd ( bundle, options ) {
function needsDefault (line 39) | function needsDefault ( externalModule ) {
FILE: src/bundler/builders/strictMode/cjs.js
function cjs (line 5) | function cjs ( bundle, options ) {
FILE: src/bundler/builders/strictMode/umd.js
function umd (line 6) | function umd ( bundle, options ) {
function needsDefault (line 31) | function needsDefault ( externalModule ) {
FILE: src/bundler/builders/strictMode/utils/getExportBlock.js
function getExportBlock (line 1) | function getExportBlock ( entry ) {
FILE: src/bundler/combine/getRenamedImports.js
function getRenamedImports (line 1) | function getRenamedImports ( mod ) {
FILE: src/bundler/combine/index.js
function combine (line 8) | function combine ( bundle ) {
FILE: src/bundler/combine/populateExternalModuleImports.js
function populateExternalModuleImports (line 1) | function populateExternalModuleImports ( bundle ) {
FILE: src/bundler/combine/populateIdentifierReplacements.js
function populateIdentifierReplacements (line 10) | function populateIdentifierReplacements ( bundle ) {
FILE: src/bundler/combine/populateModuleNames.js
function getUniqueNames (line 5) | function getUniqueNames ( bundle ) {
FILE: src/bundler/combine/resolveExports.js
function resolveExports (line 1) | function resolveExports ( bundle ) {
FILE: src/bundler/combine/topLevelScopeConflicts.js
function topLevelScopeConflicts (line 7) | function topLevelScopeConflicts ( bundle ) {
FILE: src/bundler/combine/transformBody.js
function transformBody (line 5) | function transformBody ( bundle, mod, body ) {
FILE: src/bundler/getBundle.js
function getBundle (line 11) | function getBundle ( options ) {
function resolvePath (line 164) | function resolvePath ( base, userModules, moduleId, importerPath, resolv...
function tryPath (line 189) | function tryPath ( base, filename, userModules ) {
function isThenable (line 198) | function isThenable ( obj ) {
FILE: src/bundler/getModule.js
function getModule (line 7) | function getModule ( mod ) {
FILE: src/bundler/utils/resolveChains.js
function resolveChains (line 11) | function resolveChains ( modules, moduleLookup ) {
function setOrigin (line 69) | function setOrigin ( specifier, hash, chains, moduleLookup ) {
FILE: src/bundler/utils/sortModules.js
function sortModules (line 10) | function sortModules ( entry ) {
function referencesAtTopLevel (line 93) | function referencesAtTopLevel ( a, b ) {
FILE: src/esperanto.js
function transpileMethod (line 23) | function transpileMethod ( format ) {
function bundle (line 67) | function bundle ( options ) {
function flattenExports (line 118) | function flattenExports ( exports ) {
FILE: src/standalone/builders/defaultsMode/amd.js
function amd (line 5) | function amd ( mod, options ) {
FILE: src/standalone/builders/defaultsMode/cjs.js
function cjs (line 5) | function cjs ( mod, options ) {
FILE: src/standalone/builders/defaultsMode/umd.js
function umd (line 6) | function umd ( mod, options ) {
FILE: src/standalone/builders/defaultsMode/utils/transformExportDeclaration.js
function transformExportDeclaration (line 1) | function transformExportDeclaration ( declaration, body ) {
FILE: src/standalone/builders/strictMode/amd.js
function amd (line 5) | function amd ( mod, options ) {
FILE: src/standalone/builders/strictMode/cjs.js
function cjs (line 6) | function cjs ( mod, options ) {
FILE: src/standalone/builders/strictMode/umd.js
function umd (line 6) | function umd ( mod, options ) {
FILE: src/standalone/builders/strictMode/utils/gatherImports.js
function gatherImports (line 1) | function gatherImports ( imports ) {
FILE: src/standalone/builders/strictMode/utils/getExportNames.js
function getExportNames (line 1) | function getExportNames ( exports ) {
FILE: src/standalone/builders/strictMode/utils/getImportSummary.js
function getImportSummary (line 3) | function getImportSummary ( mod ) {
FILE: src/standalone/builders/strictMode/utils/transformBody.js
function transformBody (line 7) | function transformBody ( mod, body, options ) {
function deconflict (line 98) | function deconflict ( name, declared ) {
FILE: src/standalone/getModule.js
constant SOURCEMAPPINGURL_REGEX (line 10) | const SOURCEMAPPINGURL_REGEX = /^# sourceMappingURL=/;
function getStandaloneModule (line 12) | function getStandaloneModule ( options ) {
function determineImportNames (line 69) | function determineImportNames ( imports, userFn, usedNames ) {
FILE: src/utils/amd/amdIntro.js
function amdIntro (line 5) | function amdIntro ({ name, imports, hasExports, indentStr, absolutePaths...
FILE: src/utils/amd/getImportSummary.js
function getImportSummary (line 3) | function getImportSummary ({ imports, absolutePaths, name }) {
FILE: src/utils/amd/processIds.js
function processIds (line 3) | function processIds ( ids ) {
FILE: src/utils/amd/processName.js
function processName (line 3) | function processName ( name ) {
FILE: src/utils/ast/annotate.js
function Scope (line 10) | function Scope ( options ) {
function annotateAst (line 40) | function annotateAst ( ast, options ) {
FILE: src/utils/ast/disallowIllegalReassignment.js
function disallowIllegalReassignment (line 6) | function disallowIllegalReassignment ( node, importedBindings, importedN...
FILE: src/utils/ast/findImportsAndExports.js
function findImportsAndExports (line 8) | function findImportsAndExports ( ast, source, comments ) {
function processImport (line 100) | function processImport ( node, passthrough ) {
function processDefaultExport (line 153) | function processDefaultExport ( node, source ) {
function processExport (line 199) | function processExport ( node, source ) {
FILE: src/utils/ast/getUnscopedNames.js
function getUnscopedNames (line 4) | function getUnscopedNames ( mod ) {
FILE: src/utils/ast/replaceIdentifiers.js
function replaceIdentifiers (line 3) | function replaceIdentifiers ( body, node, identifierReplacements, scope ) {
FILE: src/utils/ast/rewriteExportAssignments.js
function rewriteExportAssignments (line 3) | function rewriteExportAssignments ( body, node, parent, exports, scope, ...
FILE: src/utils/ast/traverse.js
function traverseAst (line 6) | function traverseAst ( ast, body, identifierReplacements, importedBindin...
function exportCapturedUpdate (line 72) | function exportCapturedUpdate ( c ) {
FILE: src/utils/ast/walk.js
function walk (line 4) | function walk ( ast, { enter, leave }) {
function isArray (line 18) | function isArray ( thing ) {
function visit (line 22) | function visit ( node, parent, enter, leave ) {
FILE: src/utils/disallowConflictingImports.js
function disallowConflictingImports (line 3) | function disallowConflictingImports ( imports ) {
FILE: src/utils/getReadOnlyIdentifiers.js
function getReadOnlyIdentifiers (line 9) | function getReadOnlyIdentifiers ( imports ) {
FILE: src/utils/hasNamedExports.js
function hasNamedExports (line 1) | function hasNamedExports ( mod ) {
FILE: src/utils/hasNamedImports.js
function hasNamedImports (line 1) | function hasNamedImports ( mod ) {
FILE: src/utils/mappers.js
function getId (line 1) | function getId ( m ) {
function getName (line 5) | function getName ( m ) {
function quote (line 9) | function quote ( str ) {
function req (line 13) | function req ( path ) {
function globalify (line 17) | function globalify ( name ) {
FILE: src/utils/packageResult.js
constant ABSOLUTE_PATH (line 4) | const ABSOLUTE_PATH = /^(?:[A-Z]:)?[\/\\]/i;
function packageResult (line 8) | function packageResult ( bundleOrModule, body, options, methodName, isBu...
function getRelativePath (line 68) | function getRelativePath ( from, to ) {
function markBundleSourcemapLocations (line 96) | function markBundleSourcemapLocations ( bundle ) {
function markModuleSourcemapLocations (line 106) | function markModuleSourcemapLocations ( mod ) {
FILE: src/utils/promiseSequence.js
function promiseSequence (line 3) | function promiseSequence ( arr, callback ) {
FILE: src/utils/resolveId.js
function resolveId (line 9) | function resolveId ( importPath, importerPath ) {
function resolveAgainst (line 38) | function resolveAgainst ( importerPath ) {
FILE: src/utils/sanitize.js
constant RESERVED (line 1) | const RESERVED = 'break case class catch const continue debugger default...
constant INVALID_CHAR (line 2) | const INVALID_CHAR = /[^a-zA-Z0-9_$]/g;
constant INVALID_LEADING_CHAR (line 3) | const INVALID_LEADING_CHAR = /[^a-zA-Z_$]/;
function sanitize (line 10) | function sanitize ( name ) {
function splitPath (line 21) | function splitPath ( path ) {
FILE: src/utils/umd/requireName.js
function requireName (line 3) | function requireName ( options ) {
FILE: src/utils/umd/umdIntro.js
function umdIntro (line 6) | function umdIntro ({ amdName, name, hasExports, imports, absolutePaths, ...
FILE: test/bundle/input/07/main.js
function logFoo (line 4) | function logFoo () {
function logBar (line 8) | function logBar () {
FILE: test/bundle/input/10/main.js
class Foo (line 1) | class Foo {
method constructor (line 2) | constructor( str ) {
method toString (line 6) | toString() {
FILE: test/bundle/input/16/a.js
function a (line 1) | function a () {
FILE: test/bundle/input/16/c.js
function a (line 1) | function a () {
FILE: test/bundle/input/16/main.js
function foo (line 4) | function foo () {
FILE: test/bundle/input/17/foo.js
function a (line 1) | function a ( message ) {
FILE: test/bundle/input/22/foo.js
function foo (line 1) | function foo () {
FILE: test/bundle/input/23/foo.js
function bar (line 3) | function bar () {
function baz (line 7) | function baz () {
FILE: test/bundle/input/24/bar.js
function bar (line 1) | function bar () {
FILE: test/bundle/input/24/foo.js
function foo (line 1) | function foo () {
FILE: test/bundle/input/26/bar.js
function foo (line 1) | function foo () {
FILE: test/bundle/input/27/main.js
function logFoo (line 4) | function logFoo () {
function logBar (line 8) | function logBar () {
FILE: test/bundle/input/31/exportedX.js
function someOtherName (line 1) | function someOtherName () {}
FILE: test/bundle/input/31/notExportedX.js
function x (line 1) | function x () {}
FILE: test/bundle/input/33/Math.js
function add (line 1) | function add ( a, b ) {
function multiply (line 5) | function multiply ( a, b ) {
FILE: test/bundle/input/33/Promise.js
method keep (line 4) | keep () { this.state = 'kept'; }
method break (line 5) | break () { this.state = 'broken'; }
FILE: test/bundle/input/33/foo.js
function foo (line 4) | function foo () {
FILE: test/bundle/input/35/js_modules/a.js
function a (line 1) | function a () {
FILE: test/bundle/input/35/js_modules/c.js
function c (line 1) | function c () {
FILE: test/bundle/input/35/js_modules/external/js_modules/b.js
function b (line 3) | function b () {
FILE: test/bundle/input/35/js_modules/external/src/external.js
function external (line 4) | function external () {
FILE: test/bundle/input/36/js_modules/external/src/dependsOnExternal.js
function dependsOnExternal (line 3) | function dependsOnExternal () {
FILE: test/bundle/input/36/js_modules/external/src/external.js
function external (line 3) | function external () {
FILE: test/bundle/input/38/foo.js
function notActuallyFoo (line 3) | function notActuallyFoo () {
function foo (line 7) | function foo () {
FILE: test/bundle/input/40/foo.js
function foo (line 1) | function foo () {
FILE: test/bundle/input/42/foo.js
function foo (line 1) | function foo () {
FILE: test/bundle/input/43/main.js
class Foo (line 3) | class Foo extends Bar {
method constructor (line 4) | constructor() {
FILE: test/bundle/input/49/foo.js
function foo (line 1) | function foo () {
FILE: test/bundle/input/50/A.js
class A (line 3) | class A {
method constructor (line 4) | constructor () {
method b (line 8) | b () {
FILE: test/bundle/input/50/B.js
class B (line 3) | class B extends A {
method constructor (line 4) | constructor () {
FILE: test/bundle/input/50/C.js
class C (line 3) | class C extends D {
method constructor (line 4) | constructor () {
FILE: test/bundle/input/50/D.js
class D (line 3) | class D {
method constructor (line 4) | constructor () {
method c (line 8) | c () {
FILE: test/bundle/input/55/A.js
class A (line 4) | class A {
method b (line 5) | b () {
method c (line 9) | c () {
FILE: test/bundle/input/55/B.js
class B (line 3) | class B extends A {}
FILE: test/bundle/input/55/C.js
class C (line 3) | class C extends A {}
FILE: test/bundle/output/amd/07.js
function logFoo (line 7) | function logFoo () {
function logBar (line 11) | function logBar () {
FILE: test/bundle/output/amd/10.js
class Foo (line 5) | class Foo {
method constructor (line 6) | constructor( str ) {
method toString (line 10) | toString() {
FILE: test/bundle/output/amd/16.js
function _a__a (line 5) | function _a__a () {
function c__a (line 9) | function c__a () {
function foo (line 18) | function foo () {
FILE: test/bundle/output/amd/17.js
function foo__a (line 5) | function foo__a ( message ) {
FILE: test/bundle/output/amd/22.js
function foo (line 5) | function foo () {
FILE: test/bundle/output/amd/24.js
function foo (line 6) | function foo () {
function bar (line 10) | function bar () {
FILE: test/bundle/output/amd/26.js
function bar (line 5) | function bar () {
FILE: test/bundle/output/amd/27.js
function logFoo (line 9) | function logFoo () {
function logBar (line 13) | function logBar () {
FILE: test/bundle/output/amd/31.js
function someOtherName (line 5) | function someOtherName () {}
function x (line 7) | function x () {}
FILE: test/bundle/output/amd/33.js
method keep (line 8) | keep () { this.state = 'kept'; }
method break (line 9) | break () { this.state = 'broken'; }
method add (line 15) | get add () { return add; }
method multiply (line 16) | get multiply () { return multiply; }
function add (line 19) | function add ( a, b ) {
function multiply (line 23) | function multiply ( a, b ) {
function foo (line 30) | function foo () {
FILE: test/bundle/output/amd/35.js
function a (line 5) | function a () {
function c (line 9) | function c () {
function b (line 13) | function b () {
function external (line 18) | function external () {
FILE: test/bundle/output/amd/36.js
function dependsOnExternal (line 5) | function dependsOnExternal () {
function external (line 9) | function external () {
FILE: test/bundle/output/amd/38.js
function notActuallyFoo (line 7) | function notActuallyFoo () {
function foo (line 11) | function foo () {
FILE: test/bundle/output/amd/40.js
function foo (line 5) | function foo () {
FILE: test/bundle/output/amd/42.js
function foo (line 5) | function foo () {
FILE: test/bundle/output/amd/43.js
class Foo (line 7) | class Foo extends Bar {
method constructor (line 8) | constructor() {
FILE: test/bundle/output/amd/45.js
function foo (line 7) | function foo () {
FILE: test/bundle/output/amd/46.js
function foo (line 7) | function foo () {
FILE: test/bundle/output/amd/49.js
function foo (line 5) | function foo () {
FILE: test/bundle/output/amd/50.js
class A (line 5) | class A {
method constructor (line 6) | constructor () {
method b (line 10) | b () {
class B (line 15) | class B extends A {
method constructor (line 16) | constructor () {
class D (line 21) | class D {
method constructor (line 22) | constructor () {
method c (line 26) | c () {
class C (line 31) | class C extends D {
method constructor (line 32) | constructor () {
FILE: test/bundle/output/amd/55.js
class A (line 5) | class A {
method b (line 6) | b () {
method c (line 10) | c () {
class B (line 15) | class B extends A {}
class C (line 17) | class C extends A {}
FILE: test/bundle/output/amd/57.js
method y (line 6) | get y () { return x; }
FILE: test/bundle/output/amdDefaults/07.js
function logFoo (line 7) | function logFoo () {
function logBar (line 11) | function logBar () {
FILE: test/bundle/output/amdDefaults/10.js
class Foo (line 5) | class Foo {
method constructor (line 6) | constructor( str ) {
method toString (line 10) | toString() {
FILE: test/bundle/output/amdDefaults/16.js
function _a__a (line 5) | function _a__a () {
function c__a (line 9) | function c__a () {
function foo (line 18) | function foo () {
FILE: test/bundle/output/amdDefaults/17.js
function foo__a (line 5) | function foo__a ( message ) {
FILE: test/bundle/output/amdDefaults/24.js
function foo (line 6) | function foo () {
function bar (line 10) | function bar () {
FILE: test/bundle/output/amdDefaults/26.js
function bar (line 5) | function bar () {
FILE: test/bundle/output/amdDefaults/27.js
function logFoo (line 9) | function logFoo () {
function logBar (line 13) | function logBar () {
FILE: test/bundle/output/amdDefaults/31.js
function someOtherName (line 5) | function someOtherName () {}
function x (line 7) | function x () {}
FILE: test/bundle/output/amdDefaults/33.js
method keep (line 8) | keep () { this.state = 'kept'; }
method break (line 9) | break () { this.state = 'broken'; }
method add (line 15) | get add () { return add; }
method multiply (line 16) | get multiply () { return multiply; }
function add (line 19) | function add ( a, b ) {
function multiply (line 23) | function multiply ( a, b ) {
function foo (line 30) | function foo () {
FILE: test/bundle/output/amdDefaults/35.js
function a (line 5) | function a () {
function c (line 9) | function c () {
function b (line 13) | function b () {
function external (line 18) | function external () {
FILE: test/bundle/output/amdDefaults/36.js
function dependsOnExternal (line 5) | function dependsOnExternal () {
function external (line 9) | function external () {
FILE: test/bundle/output/amdDefaults/38.js
function notActuallyFoo (line 7) | function notActuallyFoo () {
function foo (line 11) | function foo () {
FILE: test/bundle/output/amdDefaults/40.js
function foo (line 5) | function foo () {
FILE: test/bundle/output/amdDefaults/42.js
function foo (line 5) | function foo () {
FILE: test/bundle/output/amdDefaults/43.js
class Foo (line 5) | class Foo extends Bar {
method constructor (line 6) | constructor() {
FILE: test/bundle/output/amdDefaults/45.js
function foo (line 7) | function foo () {
FILE: test/bundle/output/amdDefaults/46.js
function foo (line 7) | function foo () {
FILE: test/bundle/output/amdDefaults/49.js
function foo (line 5) | function foo () {
FILE: test/bundle/output/amdDefaults/50.js
class A (line 5) | class A {
method constructor (line 6) | constructor () {
method b (line 10) | b () {
class B (line 15) | class B extends A {
method constructor (line 16) | constructor () {
class D (line 21) | class D {
method constructor (line 22) | constructor () {
method c (line 26) | c () {
class C (line 31) | class C extends D {
method constructor (line 32) | constructor () {
FILE: test/bundle/output/amdDefaults/55.js
class A (line 5) | class A {
method b (line 6) | b () {
method c (line 10) | c () {
class B (line 15) | class B extends A {}
class C (line 17) | class C extends A {}
FILE: test/bundle/output/amdDefaults/57.js
method y (line 6) | get y () { return x; }
FILE: test/bundle/output/cjs/07.js
function logFoo (line 5) | function logFoo () {
function logBar (line 9) | function logBar () {
FILE: test/bundle/output/cjs/10.js
class Foo (line 3) | class Foo {
method constructor (line 4) | constructor( str ) {
method toString (line 8) | toString() {
FILE: test/bundle/output/cjs/16.js
function _a__a (line 3) | function _a__a () {
function c__a (line 7) | function c__a () {
function foo (line 16) | function foo () {
FILE: test/bundle/output/cjs/17.js
function foo__a (line 3) | function foo__a ( message ) {
FILE: test/bundle/output/cjs/22.js
function foo (line 3) | function foo () {
FILE: test/bundle/output/cjs/24.js
function foo (line 4) | function foo () {
function bar (line 8) | function bar () {
FILE: test/bundle/output/cjs/26.js
function bar (line 3) | function bar () {
FILE: test/bundle/output/cjs/27.js
function logFoo (line 7) | function logFoo () {
function logBar (line 11) | function logBar () {
FILE: test/bundle/output/cjs/31.js
function someOtherName (line 3) | function someOtherName () {}
function x (line 5) | function x () {}
FILE: test/bundle/output/cjs/33.js
method keep (line 6) | keep () { this.state = 'kept'; }
method break (line 7) | break () { this.state = 'broken'; }
method add (line 13) | get add () { return add; }
method multiply (line 14) | get multiply () { return multiply; }
function add (line 17) | function add ( a, b ) {
function multiply (line 21) | function multiply ( a, b ) {
function foo (line 28) | function foo () {
FILE: test/bundle/output/cjs/35.js
function a (line 3) | function a () {
function c (line 7) | function c () {
function b (line 11) | function b () {
function external (line 16) | function external () {
FILE: test/bundle/output/cjs/36.js
function dependsOnExternal (line 3) | function dependsOnExternal () {
function external (line 7) | function external () {
FILE: test/bundle/output/cjs/38.js
function notActuallyFoo (line 5) | function notActuallyFoo () {
function foo (line 9) | function foo () {
FILE: test/bundle/output/cjs/40.js
function foo (line 3) | function foo () {
FILE: test/bundle/output/cjs/42.js
function foo (line 3) | function foo () {
FILE: test/bundle/output/cjs/43.js
class Foo (line 6) | class Foo extends Bar {
method constructor (line 7) | constructor() {
FILE: test/bundle/output/cjs/45.js
function foo (line 5) | function foo () {
FILE: test/bundle/output/cjs/46.js
function foo (line 5) | function foo () {
FILE: test/bundle/output/cjs/49.js
function foo (line 3) | function foo () {
FILE: test/bundle/output/cjs/50.js
class A (line 3) | class A {
method constructor (line 4) | constructor () {
method b (line 8) | b () {
class B (line 13) | class B extends A {
method constructor (line 14) | constructor () {
class D (line 19) | class D {
method constructor (line 20) | constructor () {
method c (line 24) | c () {
class C (line 29) | class C extends D {
method constructor (line 30) | constructor () {
FILE: test/bundle/output/cjs/55.js
class A (line 3) | class A {
method b (line 4) | b () {
method c (line 8) | c () {
class B (line 13) | class B extends A {}
class C (line 15) | class C extends A {}
FILE: test/bundle/output/cjs/57.js
method y (line 4) | get y () { return x; }
FILE: test/bundle/output/cjsDefaults/07.js
function logFoo (line 5) | function logFoo () {
function logBar (line 9) | function logBar () {
FILE: test/bundle/output/cjsDefaults/10.js
class Foo (line 3) | class Foo {
method constructor (line 4) | constructor( str ) {
method toString (line 8) | toString() {
FILE: test/bundle/output/cjsDefaults/16.js
function _a__a (line 3) | function _a__a () {
function c__a (line 7) | function c__a () {
function foo (line 16) | function foo () {
FILE: test/bundle/output/cjsDefaults/17.js
function foo__a (line 3) | function foo__a ( message ) {
FILE: test/bundle/output/cjsDefaults/24.js
function foo (line 4) | function foo () {
function bar (line 8) | function bar () {
FILE: test/bundle/output/cjsDefaults/26.js
function bar (line 3) | function bar () {
FILE: test/bundle/output/cjsDefaults/27.js
function logFoo (line 7) | function logFoo () {
function logBar (line 11) | function logBar () {
FILE: test/bundle/output/cjsDefaults/31.js
function someOtherName (line 3) | function someOtherName () {}
function x (line 5) | function x () {}
FILE: test/bundle/output/cjsDefaults/33.js
method keep (line 6) | keep () { this.state = 'kept'; }
method break (line 7) | break () { this.state = 'broken'; }
method add (line 13) | get add () { return add; }
method multiply (line 14) | get multiply () { return multiply; }
function add (line 17) | function add ( a, b ) {
function multiply (line 21) | function multiply ( a, b ) {
function foo (line 28) | function foo () {
FILE: test/bundle/output/cjsDefaults/35.js
function a (line 3) | function a () {
function c (line 7) | function c () {
function b (line 11) | function b () {
function external (line 16) | function external () {
FILE: test/bundle/output/cjsDefaults/36.js
function dependsOnExternal (line 3) | function dependsOnExternal () {
function external (line 7) | function external () {
FILE: test/bundle/output/cjsDefaults/38.js
function notActuallyFoo (line 5) | function notActuallyFoo () {
function foo (line 9) | function foo () {
FILE: test/bundle/output/cjsDefaults/40.js
function foo (line 3) | function foo () {
FILE: test/bundle/output/cjsDefaults/42.js
function foo (line 3) | function foo () {
FILE: test/bundle/output/cjsDefaults/43.js
class Foo (line 5) | class Foo extends Bar {
method constructor (line 6) | constructor() {
FILE: test/bundle/output/cjsDefaults/45.js
function foo (line 5) | function foo () {
FILE: test/bundle/output/cjsDefaults/46.js
function foo (line 5) | function foo () {
FILE: test/bundle/output/cjsDefaults/49.js
function foo (line 3) | function foo () {
FILE: test/bundle/output/cjsDefaults/50.js
class A (line 3) | class A {
method constructor (line 4) | constructor () {
method b (line 8) | b () {
class B (line 13) | class B extends A {
method constructor (line 14) | constructor () {
class D (line 19) | class D {
method constructor (line 20) | constructor () {
method c (line 24) | c () {
class C (line 29) | class C extends D {
method constructor (line 30) | constructor () {
FILE: test/bundle/output/cjsDefaults/55.js
class A (line 3) | class A {
method b (line 4) | b () {
method c (line 8) | c () {
class B (line 13) | class B extends A {}
class C (line 15) | class C extends A {}
FILE: test/bundle/output/cjsDefaults/57.js
method y (line 4) | get y () { return x; }
FILE: test/bundle/output/concat/07.js
function logFoo (line 5) | function logFoo () {
function logBar (line 9) | function logBar () {
FILE: test/bundle/output/concat/16.js
function _a__a (line 3) | function _a__a () {
function c__a (line 7) | function c__a () {
function foo (line 16) | function foo () {
FILE: test/bundle/output/concat/17.js
function foo__a (line 3) | function foo__a ( message ) {
FILE: test/bundle/output/concat/24.js
function foo (line 4) | function foo () {
function bar (line 8) | function bar () {
FILE: test/bundle/output/concat/26.js
function bar (line 3) | function bar () {
FILE: test/bundle/output/concat/27.js
function logFoo (line 7) | function logFoo () {
function logBar (line 11) | function logBar () {
FILE: test/bundle/output/concat/31.js
function someOtherName (line 3) | function someOtherName () {}
function x (line 5) | function x () {}
FILE: test/bundle/output/concat/33.js
method keep (line 6) | keep () { this.state = 'kept'; }
method break (line 7) | break () { this.state = 'broken'; }
method add (line 13) | get add () { return add; }
method multiply (line 14) | get multiply () { return multiply; }
function add (line 17) | function add ( a, b ) {
function multiply (line 21) | function multiply ( a, b ) {
function foo (line 28) | function foo () {
FILE: test/bundle/output/concat/35.js
function a (line 3) | function a () {
function c (line 7) | function c () {
function b (line 11) | function b () {
function external (line 16) | function external () {
FILE: test/bundle/output/concat/36.js
function dependsOnExternal (line 3) | function dependsOnExternal () {
function external (line 7) | function external () {
FILE: test/bundle/output/concat/38.js
function notActuallyFoo (line 5) | function notActuallyFoo () {
function foo (line 9) | function foo () {
FILE: test/bundle/output/concat/40.js
function foo (line 3) | function foo () {
FILE: test/bundle/output/concat/42.js
function foo (line 3) | function foo () {
FILE: test/bundle/output/concat/45.js
function foo (line 5) | function foo () {
FILE: test/bundle/output/concat/46.js
function foo (line 5) | function foo () {
FILE: test/bundle/output/concat/49.js
function foo (line 3) | function foo () {
FILE: test/bundle/output/concat/50.js
class A (line 3) | class A {
method constructor (line 4) | constructor () {
method b (line 8) | b () {
class B (line 13) | class B extends A {
method constructor (line 14) | constructor () {
class D (line 19) | class D {
method constructor (line 20) | constructor () {
method c (line 24) | c () {
class C (line 29) | class C extends D {
method constructor (line 30) | constructor () {
FILE: test/bundle/output/concat/55.js
class A (line 3) | class A {
method b (line 4) | b () {
method c (line 8) | c () {
class B (line 13) | class B extends A {}
class C (line 15) | class C extends A {}
FILE: test/bundle/output/concat/57.js
method y (line 4) | get y () { return x; }
FILE: test/bundle/output/umd/07.js
function logFoo (line 9) | function logFoo () {
function logBar (line 13) | function logBar () {
FILE: test/bundle/output/umd/10.js
class Foo (line 7) | class Foo {
method constructor (line 8) | constructor( str ) {
method toString (line 12) | toString() {
FILE: test/bundle/output/umd/16.js
function _a__a (line 7) | function _a__a () {
function c__a (line 11) | function c__a () {
function foo (line 20) | function foo () {
FILE: test/bundle/output/umd/17.js
function foo__a (line 7) | function foo__a ( message ) {
FILE: test/bundle/output/umd/22.js
function foo (line 7) | function foo () {
FILE: test/bundle/output/umd/24.js
function foo (line 8) | function foo () {
function bar (line 12) | function bar () {
FILE: test/bundle/output/umd/26.js
function bar (line 7) | function bar () {
FILE: test/bundle/output/umd/27.js
function logFoo (line 11) | function logFoo () {
function logBar (line 15) | function logBar () {
FILE: test/bundle/output/umd/31.js
function someOtherName (line 7) | function someOtherName () {}
function x (line 9) | function x () {}
FILE: test/bundle/output/umd/33.js
method keep (line 10) | keep () { this.state = 'kept'; }
method break (line 11) | break () { this.state = 'broken'; }
method add (line 17) | get add () { return add; }
method multiply (line 18) | get multiply () { return multiply; }
function add (line 21) | function add ( a, b ) {
function multiply (line 25) | function multiply ( a, b ) {
function foo (line 32) | function foo () {
FILE: test/bundle/output/umd/35.js
function a (line 7) | function a () {
function c (line 11) | function c () {
function b (line 15) | function b () {
function external (line 20) | function external () {
FILE: test/bundle/output/umd/36.js
function dependsOnExternal (line 7) | function dependsOnExternal () {
function external (line 11) | function external () {
FILE: test/bundle/output/umd/38.js
function notActuallyFoo (line 9) | function notActuallyFoo () {
function foo (line 13) | function foo () {
FILE: test/bundle/output/umd/40.js
function foo (line 7) | function foo () {
FILE: test/bundle/output/umd/42.js
function foo (line 7) | function foo () {
FILE: test/bundle/output/umd/43.js
class Foo (line 9) | class Foo extends Bar {
method constructor (line 10) | constructor() {
FILE: test/bundle/output/umd/45.js
function foo (line 9) | function foo () {
FILE: test/bundle/output/umd/46.js
function foo (line 9) | function foo () {
FILE: test/bundle/output/umd/49.js
function foo (line 7) | function foo () {
FILE: test/bundle/output/umd/50.js
class A (line 7) | class A {
method constructor (line 8) | constructor () {
method b (line 12) | b () {
class B (line 17) | class B extends A {
method constructor (line 18) | constructor () {
class D (line 23) | class D {
method constructor (line 24) | constructor () {
method c (line 28) | c () {
class C (line 33) | class C extends D {
method constructor (line 34) | constructor () {
FILE: test/bundle/output/umd/55.js
class A (line 7) | class A {
method b (line 8) | b () {
method c (line 12) | c () {
class B (line 17) | class B extends A {}
class C (line 19) | class C extends A {}
FILE: test/bundle/output/umd/57.js
method y (line 8) | get y () { return x; }
FILE: test/bundle/output/umdDefaults/07.js
function logFoo (line 9) | function logFoo () {
function logBar (line 13) | function logBar () {
FILE: test/bundle/output/umdDefaults/10.js
class Foo (line 7) | class Foo {
method constructor (line 8) | constructor( str ) {
method toString (line 12) | toString() {
FILE: test/bundle/output/umdDefaults/16.js
function _a__a (line 7) | function _a__a () {
function c__a (line 11) | function c__a () {
function foo (line 20) | function foo () {
FILE: test/bundle/output/umdDefaults/17.js
function foo__a (line 7) | function foo__a ( message ) {
FILE: test/bundle/output/umdDefaults/24.js
function foo (line 8) | function foo () {
function bar (line 12) | function bar () {
FILE: test/bundle/output/umdDefaults/26.js
function bar (line 7) | function bar () {
FILE: test/bundle/output/umdDefaults/27.js
function logFoo (line 11) | function logFoo () {
function logBar (line 15) | function logBar () {
FILE: test/bundle/output/umdDefaults/31.js
function someOtherName (line 7) | function someOtherName () {}
function x (line 9) | function x () {}
FILE: test/bundle/output/umdDefaults/33.js
method keep (line 10) | keep () { this.state = 'kept'; }
method break (line 11) | break () { this.state = 'broken'; }
method add (line 17) | get add () { return add; }
method multiply (line 18) | get multiply () { return multiply; }
function add (line 21) | function add ( a, b ) {
function multiply (line 25) | function multiply ( a, b ) {
function foo (line 32) | function foo () {
FILE: test/bundle/output/umdDefaults/35.js
function a (line 7) | function a () {
function c (line 11) | function c () {
function b (line 15) | function b () {
function external (line 20) | function external () {
FILE: test/bundle/output/umdDefaults/36.js
function dependsOnExternal (line 7) | function dependsOnExternal () {
function external (line 11) | function external () {
FILE: test/bundle/output/umdDefaults/38.js
function notActuallyFoo (line 9) | function notActuallyFoo () {
function foo (line 13) | function foo () {
FILE: test/bundle/output/umdDefaults/40.js
function foo (line 7) | function foo () {
FILE: test/bundle/output/umdDefaults/42.js
function foo (line 7) | function foo () {
FILE: test/bundle/output/umdDefaults/43.js
class Foo (line 7) | class Foo extends Bar {
method constructor (line 8) | constructor() {
FILE: test/bundle/output/umdDefaults/45.js
function foo (line 9) | function foo () {
FILE: test/bundle/output/umdDefaults/46.js
function foo (line 9) | function foo () {
FILE: test/bundle/output/umdDefaults/49.js
function foo (line 7) | function foo () {
FILE: test/bundle/output/umdDefaults/50.js
class A (line 7) | class A {
method constructor (line 8) | constructor () {
method b (line 12) | b () {
class B (line 17) | class B extends A {
method constructor (line 18) | constructor () {
class D (line 23) | class D {
method constructor (line 24) | constructor () {
method c (line 28) | c () {
class C (line 33) | class C extends D {
method constructor (line 34) | constructor () {
FILE: test/bundle/output/umdDefaults/55.js
class A (line 7) | class A {
method b (line 8) | b () {
method c (line 12) | c () {
class B (line 17) | class B extends A {}
class C (line 19) | class C extends A {}
FILE: test/bundle/output/umdDefaults/57.js
method y (line 8) | get y () { return x; }
FILE: test/es6-module-transpiler-tests/bundled-output/bindings.js
function incr (line 5) | function incr() {
FILE: test/es6-module-transpiler-tests/bundled-output/cycles-defaults.js
method a (line 3) | get a() { return a.a; }
method b (line 5) | get b() { return b.b; }
FILE: test/es6-module-transpiler-tests/bundled-output/cycles-immediate.js
function nextOdd (line 3) | function nextOdd(n) {
function isEven (line 31) | function isEven(n) {
FILE: test/es6-module-transpiler-tests/bundled-output/cycles.js
function geta (line 3) | function geta() {
function getb (line 9) | function getb() {
FILE: test/es6-module-transpiler-tests/bundled-output/export-default-named-function.js
function foo (line 3) | function foo() {
function callsFoo (line 7) | function callsFoo() {
FILE: test/es6-module-transpiler-tests/bundled-output/export-default.js
function change (line 5) | function change() {
FILE: test/es6-module-transpiler-tests/bundled-output/export-function.js
function foo (line 3) | function foo() {
FILE: test/es6-module-transpiler-tests/bundled-output/export-list.js
function incr (line 6) | function incr() {
FILE: test/es6-module-transpiler-tests/bundled-output/module-level-declarations.js
function getA (line 8) | function getA() {
FILE: test/es6-module-transpiler-tests/bundled-output/namespaces.js
method a (line 4) | get a () { return a; }
method b (line 5) | get b () { return b; }
method default (line 6) | get default () { return exporter__default; }
FILE: test/es6-module-transpiler-tests/bundled-output/re-export-default-import.js
function hi (line 3) | function hi() {
FILE: test/es6-module-transpiler-tests/input/bindings/exporter.js
function incr (line 3) | function incr() {
FILE: test/es6-module-transpiler-tests/input/cycles-defaults/a.js
method b (line 3) | get b() { return b.b; }
FILE: test/es6-module-transpiler-tests/input/cycles-defaults/b.js
method a (line 3) | get a() { return a.a; }
FILE: test/es6-module-transpiler-tests/input/cycles-immediate/evens.js
function isEven (line 16) | function isEven(n) {
FILE: test/es6-module-transpiler-tests/input/cycles-immediate/odds.js
function nextOdd (line 3) | function nextOdd(n) {
FILE: test/es6-module-transpiler-tests/input/cycles/a.js
function getb (line 3) | function getb() {
FILE: test/es6-module-transpiler-tests/input/cycles/b.js
function geta (line 3) | function geta() {
FILE: test/es6-module-transpiler-tests/input/export-default-named-function/exporter.js
function foo (line 1) | function foo() {
function callsFoo (line 5) | function callsFoo() {
FILE: test/es6-module-transpiler-tests/input/export-default/exporter.js
function change (line 3) | function change() {
FILE: test/es6-module-transpiler-tests/input/export-function/exporter.js
function foo (line 1) | function foo() {
FILE: test/es6-module-transpiler-tests/input/export-list/exporter.js
function incr (line 4) | function incr() {
FILE: test/es6-module-transpiler-tests/input/export-not-at-top-level-fails/index.js
function foo (line 1) | function foo() {
FILE: test/es6-module-transpiler-tests/input/import-not-at-top-level-fails/index.js
function foo (line 1) | function foo() {
FILE: test/es6-module-transpiler-tests/input/module-level-declarations/mod.js
function getA (line 6) | function getA() {
FILE: test/es6-module-transpiler-tests/input/re-export-default-import/first.js
function hi (line 1) | function hi() {
FILE: test/es6-module-transpiler-tests/input/reassign-import-not-at-top-level-fails/importer.js
function foo (line 3) | function foo () {
function bar (line 6) | function bar () {
FILE: test/es6-module-transpiler-tests/output/bindings/exporter.js
function incr (line 7) | function incr() {
FILE: test/es6-module-transpiler-tests/output/cycles-defaults/a.js
method b (line 5) | get b() { return b['default'].b; }
FILE: test/es6-module-transpiler-tests/output/cycles-defaults/b.js
method a (line 5) | get a() { return a['default'].a; }
FILE: test/es6-module-transpiler-tests/output/cycles-immediate/evens.js
function isEven (line 20) | function isEven(n) {
FILE: test/es6-module-transpiler-tests/output/cycles-immediate/odds.js
function nextOdd (line 7) | function nextOdd(n) {
FILE: test/es6-module-transpiler-tests/output/cycles/a.js
function getb (line 7) | function getb() {
FILE: test/es6-module-transpiler-tests/output/cycles/b.js
function geta (line 7) | function geta() {
FILE: test/es6-module-transpiler-tests/output/export-default-named-function/exporter.js
function foo (line 5) | function foo() {
function callsFoo (line 10) | function callsFoo() {
FILE: test/es6-module-transpiler-tests/output/export-default/exporter.js
function change (line 7) | function change() {
FILE: test/es6-module-transpiler-tests/output/export-function/exporter.js
function foo (line 5) | function foo() {
FILE: test/es6-module-transpiler-tests/output/export-list/exporter.js
function incr (line 8) | function incr() {
FILE: test/es6-module-transpiler-tests/output/module-level-declarations/mod.js
function getA (line 8) | function getA() {
FILE: test/es6-module-transpiler-tests/output/re-export-default-import/first.js
function hi (line 3) | function hi() {
FILE: test/fastMode/index.js
function runTests (line 75) | function runTests ( dir, method ) {
FILE: test/fastMode/output/amd/earlyExport.js
function foo (line 5) | function foo () {
FILE: test/fastMode/output/amd/exportClassWithSuper.js
class Foo (line 5) | class Foo extends Bar {
method constructor (line 6) | constructor() {
FILE: test/fastMode/output/amd/exportFunction.js
function foo (line 5) | function foo ( str ) {
FILE: test/fastMode/output/cjs/earlyExport.js
function foo (line 5) | function foo () {
FILE: test/fastMode/output/cjs/exportClassWithSuper.js
class Foo (line 5) | class Foo extends Bar {
method constructor (line 6) | constructor() {
FILE: test/fastMode/output/cjs/exportFunction.js
function foo (line 3) | function foo ( str ) {
FILE: test/fastMode/output/umd/earlyExport.js
function foo (line 7) | function foo () {
FILE: test/fastMode/output/umd/exportClassWithSuper.js
class Foo (line 7) | class Foo extends Bar {
method constructor (line 8) | constructor() {
FILE: test/fastMode/output/umd/exportFunction.js
function foo (line 7) | function foo ( str ) {
FILE: test/samples/clashingFunctionArguments/source.js
function bar (line 3) | function bar ( z ) {
FILE: test/samples/earlyExport/source.js
function foo (line 3) | function foo () {
FILE: test/samples/exportClass/source.js
class Point (line 1) | class Point {}
FILE: test/samples/exportClassWithSuper/source.js
class Foo (line 3) | class Foo extends Bar {
method constructor (line 4) | constructor() {
FILE: test/samples/exportFunction/source.js
function foo (line 1) | function foo ( str ) {
FILE: test/samples/exportInlineFunction/source.js
function foo (line 1) | function foo ( str ) {
FILE: test/samples/exportNamedFunction/source.js
function foo (line 1) | function foo() {}
function bar (line 2) | function bar() {}
function baz (line 3) | function baz() {}
FILE: test/samples/shadowedExport/source.js
function foo (line 1) | function foo () { }
function bar (line 3) | function bar() {
FILE: test/samples/updateExportInArgument/source.js
function decr (line 3) | function decr () {
FILE: test/samples/updateExpressionInFunction/source.js
function incr (line 3) | function incr () {
FILE: test/strictMode/index.js
function runTests (line 60) | function runTests ( dir, method ) {
FILE: test/strictMode/output/amd/clashingFunctionArguments.js
function bar (line 7) | function bar ( z ) {
FILE: test/strictMode/output/amd/earlyExport.js
function foo (line 7) | function foo () {
FILE: test/strictMode/output/amd/exportClass.js
class Point (line 5) | class Point {}
FILE: test/strictMode/output/amd/exportClassWithSuper.js
class Foo (line 5) | class Foo extends Bar['default'] {
method constructor (line 6) | constructor() {
FILE: test/strictMode/output/amd/exportFunction.js
function foo (line 5) | function foo ( str ) {
FILE: test/strictMode/output/amd/exportInlineFunction.js
function foo (line 7) | function foo ( str ) {
FILE: test/strictMode/output/amd/exportNamedFunction.js
function foo (line 9) | function foo() {}
function bar (line 10) | function bar() {}
function baz (line 11) | function baz() {}
FILE: test/strictMode/output/amd/shadowedExport.js
function foo (line 7) | function foo () { }
function bar (line 9) | function bar() {
FILE: test/strictMode/output/amd/updateExportInArgument.js
function decr (line 9) | function decr () {
FILE: test/strictMode/output/amd/updateExpressionInFunction.js
function incr (line 9) | function incr () {
FILE: test/strictMode/output/cjs/clashingFunctionArguments.js
function bar (line 7) | function bar ( z ) {
FILE: test/strictMode/output/cjs/earlyExport.js
function foo (line 5) | function foo () {
FILE: test/strictMode/output/cjs/exportClass.js
class Point (line 3) | class Point {}
FILE: test/strictMode/output/cjs/exportClassWithSuper.js
class Foo (line 5) | class Foo extends Bar['default'] {
method constructor (line 6) | constructor() {
FILE: test/strictMode/output/cjs/exportFunction.js
function foo (line 3) | function foo ( str ) {
FILE: test/strictMode/output/cjs/exportInlineFunction.js
function foo (line 5) | function foo ( str ) {
FILE: test/strictMode/output/cjs/exportNamedFunction.js
function foo (line 7) | function foo() {}
function bar (line 8) | function bar() {}
function baz (line 9) | function baz() {}
FILE: test/strictMode/output/cjs/shadowedExport.js
function foo (line 5) | function foo () { }
function bar (line 7) | function bar() {
FILE: test/strictMode/output/cjs/updateExportInArgument.js
function decr (line 7) | function decr () {
FILE: test/strictMode/output/cjs/updateExpressionInFunction.js
function incr (line 7) | function incr () {
FILE: test/strictMode/output/umd/clashingFunctionArguments.js
function bar (line 9) | function bar ( z ) {
FILE: test/strictMode/output/umd/earlyExport.js
function foo (line 9) | function foo () {
FILE: test/strictMode/output/umd/exportClass.js
class Point (line 7) | class Point {}
FILE: test/strictMode/output/umd/exportClassWithSuper.js
class Foo (line 7) | class Foo extends Bar['default'] {
method constructor (line 8) | constructor() {
FILE: test/strictMode/output/umd/exportFunction.js
function foo (line 7) | function foo ( str ) {
FILE: test/strictMode/output/umd/exportInlineFunction.js
function foo (line 9) | function foo ( str ) {
FILE: test/strictMode/output/umd/exportNamedFunction.js
function foo (line 11) | function foo() {}
function bar (line 12) | function bar() {}
function baz (line 13) | function baz() {}
FILE: test/strictMode/output/umd/shadowedExport.js
function foo (line 9) | function foo () { }
function bar (line 11) | function bar() {
FILE: test/strictMode/output/umd/updateExportInArgument.js
function decr (line 11) | function decr () {
FILE: test/strictMode/output/umd/updateExpressionInFunction.js
function incr (line 11) | function incr () {
FILE: test/utils/generate.js
function generateFastModeOutput (line 14) | function generateFastModeOutput () {
function generateStrictModeOutput (line 67) | function generateStrictModeOutput () {
function generateBundleOutput (line 119) | function generateBundleOutput () {
Condensed preview — 1161 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (417K chars).
[
{
"path": ".babelrc",
"chars": 318,
"preview": "{\n\t\"whitelist\": [\n\t\t\"es3.memberExpressionLiterals\",\n\t\t\"es3.propertyLiterals\",\n\t\t\"es6.arrowFunctions\",\n\t\t\"es6.blockScopin"
},
{
"path": ".editorconfig",
"chars": 25,
"preview": "[*.js]\nindent_style = tab"
},
{
"path": ".gitignore",
"chars": 108,
"preview": ".DS_Store\nnode_modules\nsample/output\n.gobble\n.gobble-build\nout\ndemo/dist\ntest/lib\nlib\ncli-test\nsandbox\ndist\n"
},
{
"path": ".jshintrc",
"chars": 233,
"preview": "{\n\t\"esnext\": true,\n\t\"undef\": true,\n\t\"unused\": true,\n\t\"expr\": true,\n\t\"boss\": true,\n\t\"globals\": {\n\t\t\"process\": true,\n\t\t\"__"
},
{
"path": ".travis.yml",
"chars": 113,
"preview": "sudo: false\nlanguage: node_js\nnode_js:\n - \"0.10\"\n - \"0.11\"\n - \"0.12\"\nenv:\n global:\n - BUILD_TIMEOUT=10000\n"
},
{
"path": "CHANGELOG.md",
"chars": 13821,
"preview": "# changelog\n\n## 0.7.6\n\n* Update sander to prevent graceful-fs-opocalypse ([#193](https://github.com/esperantojs/esperant"
},
{
"path": "README.md",
"chars": 1599,
"preview": "# esperanto [](https://travis-ci.org/esper"
},
{
"path": "appveyor.yml",
"chars": 539,
"preview": "# Test against this version of Node.js\nenvironment:\n matrix:\n # node.js\n - nodejs_version: \"0.10\"\n - nodejs_version:"
},
{
"path": "bin/handleError.js",
"chars": 1036,
"preview": "var chalk = require( 'chalk' );\n\nvar handlers = {\n\tMISSING_INPUT_OPTION: function () {\n\t\tconsole.error( chalk.red( 'You "
},
{
"path": "bin/help.md",
"chars": 1260,
"preview": " Esperanto version <%= version %>\n =====================================\n\n Usage: esperanto [options]\n\n Basic option"
},
{
"path": "bin/index.js",
"chars": 578,
"preview": "#!/usr/bin/env node\n\nvar minimist = require( 'minimist' ),\n\tcommand;\n\ncommand = minimist( process.argv.slice( 2 ), {\n\tal"
},
{
"path": "bin/runEsperanto.js",
"chars": 4493,
"preview": "var path = require( 'path' ),\n\tsander = require( 'sander' ),\n\tPromise = sander.Promise,\n\thandleError = require( './handl"
},
{
"path": "bin/showHelp.js",
"chars": 337,
"preview": "var fs = require( 'fs' ),\n\tpath = require( 'path' );\n\nmodule.exports = function () {\n\tfs.readFile( path.join( __dirname,"
},
{
"path": "comparison/README.md",
"chars": 1444,
"preview": "# ES6 module transpilers comparison\n\n**Parental advisory: benchmarks are nonsense. Do not rely on benchmarks alone to ma"
},
{
"path": "comparison/index.js",
"chars": 2137,
"preview": "var fs = require( 'fs' ),\n\tpath = require( 'path' ),\n\tesperanto = require( '../lib/esperanto' ),\n\tsamples,\n\titerations ="
},
{
"path": "comparison/output/esperanto/batchImports.js",
"chars": 173,
"preview": "(function () {\n\n\t'use strict';\n\n\tvar fs = require('fs');\n\t\n\t// example from http://jsmodules.io\n\tfs.unlink(filename, fun"
},
{
"path": "comparison/output/esperanto/defaultExport.js",
"chars": 396,
"preview": "(function () {\n\n 'use strict';\n\n // example from http://jsmodules.io\n var asap;\n var isNode = typeof process !== \"un"
},
{
"path": "comparison/output/esperanto/defaultImport.js",
"chars": 194,
"preview": "(function () {\n\n 'use strict';\n\n var asap = require('asap');\n \n // example from http://jsmodules.io\n asap.default(f"
},
{
"path": "comparison/output/esperanto/groupedExports.js",
"chars": 334,
"preview": "(function () {\n\n 'use strict';\n\n // example from http://jsmodules.io\n function getJSON() {\n // implementation\n }\n"
},
{
"path": "comparison/output/esperanto/inlineNamedExports.js",
"chars": 407,
"preview": "(function () {\n\n 'use strict';\n\n exports.requestAnimationFrame = requestAnimationFrame;\n \n // example from http://js"
},
{
"path": "comparison/output/esperanto/mixedImports.js",
"chars": 117,
"preview": "(function () {\n\n\t'use strict';\n\n\tvar asap = require('asap');\n\t\n\t// example from http://jsmodules.io\n\n}).call(global);"
},
{
"path": "comparison/output/esperanto/namedExports.js",
"chars": 486,
"preview": "(function () {\n\n 'use strict';\n\n // example from http://jsmodules.io\n var asap;\n var isNode = typeof process !== \"un"
},
{
"path": "comparison/output/esperanto/namedImports.js",
"chars": 208,
"preview": "(function () {\n\n 'use strict';\n\n var asap = require('asap');\n \n // example from http://jsmodules.io\n asap.later(fun"
},
{
"path": "comparison/output/esperanto/renamingImports.js",
"chars": 173,
"preview": "(function () {\n\n\t'use strict';\n\n\tvar fs = require('fs');\n\t\n\t// example from http://jsmodules.io\n\tfs.unlink(filename, fun"
},
{
"path": "comparison/output/traceur/batchImports.js",
"chars": 166,
"preview": "\"use strict\";\nvar $__fs__;\nvar fs = ($__fs__ = require(\"fs\"), $__fs__ && $__fs__.__esModule && $__fs__ || {default: $__f"
},
{
"path": "comparison/output/traceur/defaultExport.js",
"chars": 420,
"preview": "\"use strict\";\nObject.defineProperties(exports, {\n default: {get: function() {\n return $__default;\n }},\n __esMo"
},
{
"path": "comparison/output/traceur/defaultImport.js",
"chars": 210,
"preview": "\"use strict\";\nvar $__asap__;\nvar asap = ($__asap__ = require(\"asap\"), $__asap__ && $__asap__.__esModule && $__asap__ || "
},
{
"path": "comparison/output/traceur/groupedExports.js",
"chars": 332,
"preview": "\"use strict\";\nObject.defineProperties(exports, {\n getJSON: {get: function() {\n return getJSON;\n }},\n postJSON:"
},
{
"path": "comparison/output/traceur/inlineNamedExports.js",
"chars": 301,
"preview": "\"use strict\";\nObject.defineProperties(exports, {\n requestAnimationFrame: {get: function() {\n return requestAnimati"
},
{
"path": "comparison/output/traceur/mixedImports.js",
"chars": 9,
"preview": "undefined"
},
{
"path": "comparison/output/traceur/namedExports.js",
"chars": 526,
"preview": "\"use strict\";\nObject.defineProperties(exports, {\n default: {get: function() {\n return $__default;\n }},\n later:"
},
{
"path": "comparison/output/traceur/namedImports.js",
"chars": 226,
"preview": "\"use strict\";\nvar $__asap__;\nvar later = ($__asap__ = require(\"asap\"), $__asap__ && $__asap__.__esModule && $__asap__ ||"
},
{
"path": "comparison/output/traceur/renamingImports.js",
"chars": 166,
"preview": "\"use strict\";\nvar $__fs__;\nvar rm = ($__fs__ = require(\"fs\"), $__fs__ && $__fs__.__esModule && $__fs__ || {default: $__f"
},
{
"path": "comparison/output/transpile/batchImports.js",
"chars": 9,
"preview": "undefined"
},
{
"path": "comparison/output/transpile/defaultExport.js",
"chars": 420,
"preview": "\"use strict\";\nObject.defineProperties(exports, {\n default: {get: function() {\n return $__default;\n }},\n __esMo"
},
{
"path": "comparison/output/transpile/defaultImport.js",
"chars": 139,
"preview": "\"use strict\";\nvar asap = $traceurRuntime.assertObject(require(\"asap\")).default;\nasap(function() {\n console.log(\"hello a"
},
{
"path": "comparison/output/transpile/groupedExports.js",
"chars": 332,
"preview": "\"use strict\";\nObject.defineProperties(exports, {\n getJSON: {get: function() {\n return getJSON;\n }},\n postJSON:"
},
{
"path": "comparison/output/transpile/inlineNamedExports.js",
"chars": 301,
"preview": "\"use strict\";\nObject.defineProperties(exports, {\n requestAnimationFrame: {get: function() {\n return requestAnimati"
},
{
"path": "comparison/output/transpile/mixedImports.js",
"chars": 9,
"preview": "undefined"
},
{
"path": "comparison/output/transpile/namedExports.js",
"chars": 526,
"preview": "\"use strict\";\nObject.defineProperties(exports, {\n default: {get: function() {\n return $__default;\n }},\n later:"
},
{
"path": "comparison/output/transpile/namedImports.js",
"chars": 155,
"preview": "\"use strict\";\nvar later = $traceurRuntime.assertObject(require(\"asap\")).later;\nlater(function() {\n console.log(\"Running"
},
{
"path": "comparison/output/transpile/renamingImports.js",
"chars": 107,
"preview": "\"use strict\";\nvar rm = $traceurRuntime.assertObject(require(\"fs\")).unlink;\nrm(filename, function(err) {});\n"
},
{
"path": "comparison/package.json",
"chars": 259,
"preview": "{\n \"name\": \"esperanto-benchmark\",\n \"description\": \"quick and dirty script to illustrate esperanto speed advantage\",\n "
},
{
"path": "comparison/samples/batchImports.js",
"chars": 122,
"preview": "// example from http://jsmodules.io\nimport * as fs from \"fs\";\n\nfs.unlink(filename, function(err) { /* check errors */ })"
},
{
"path": "comparison/samples/defaultExport.js",
"chars": 315,
"preview": "// example from http://jsmodules.io\nvar asap;\nvar isNode = typeof process !== \"undefined\" &&\n\t\t\t{}.toString.call(process"
},
{
"path": "comparison/samples/defaultImport.js",
"chars": 121,
"preview": "// example from http://jsmodules.io\nimport asap from \"asap\";\n\nasap(function() {\n console.log(\"hello async world!\");\n});"
},
{
"path": "comparison/samples/groupedExports.js",
"chars": 208,
"preview": "// example from http://jsmodules.io\nexport { getJSON, postJSON, animate };\n\nfunction getJSON() {\n // implementation\n}\n\n"
},
{
"path": "comparison/samples/inlineNamedExports.js",
"chars": 259,
"preview": "// example from http://jsmodules.io\n\n// exports this function as \"requestAnimationFrame\"\nexport function requestAnimatio"
},
{
"path": "comparison/samples/mixedImports.js",
"chars": 72,
"preview": "// example from http://jsmodules.io\nimport asap, { later } from \"asap\";\n"
},
{
"path": "comparison/samples/namedExports.js",
"chars": 382,
"preview": "// example from http://jsmodules.io\nvar asap;\nvar isNode = typeof process !== \"undefined\" &&\n {}.toString.ca"
},
{
"path": "comparison/samples/namedImports.js",
"chars": 143,
"preview": "// example from http://jsmodules.io\nimport { later } from \"asap\";\n\nlater(function() {\n console.log(\"Running after other"
},
{
"path": "comparison/samples/renamingImports.js",
"chars": 124,
"preview": "// example from http://jsmodules.io\nimport { unlink as rm } from \"fs\";\n\nrm(filename, function(err) { /* check errors */ "
},
{
"path": "gobblefile.js",
"chars": 1725,
"preview": "var gobble = require( 'gobble' );\nvar path = require( 'path' );\nvar resolve = require( 'resolve' );\nvar Promise = requir"
},
{
"path": "package.json",
"chars": 1054,
"preview": "{\n \"name\": \"esperanto\",\n \"description\": \"An easier way to convert ES6 modules to AMD and CommonJS\",\n \"version\": \"0.7."
},
{
"path": "src/banner.js",
"chars": 102,
"preview": "/*\n\tesperanto.js v${VERSION} - ${TODAY}\n\thttp://esperantojs.org\n\n\tReleased under the MIT License.\n*/\n\n"
},
{
"path": "src/bundler/builders/concat.js",
"chars": 956,
"preview": "import packageResult from 'utils/packageResult';\n\nexport default function concat ( bundle, options ) {\n\t// This bundle m"
},
{
"path": "src/bundler/builders/defaultsMode/amd.js",
"chars": 629,
"preview": "import packageResult from '../../../utils/packageResult';\nimport amdIntro from '../../../utils/amd/amdIntro';\n\nexport de"
},
{
"path": "src/bundler/builders/defaultsMode/cjs.js",
"chars": 655,
"preview": "import packageResult from 'utils/packageResult';\nimport { req } from 'utils/mappers';\n\nexport default function cjs ( bun"
},
{
"path": "src/bundler/builders/defaultsMode/index.js",
"chars": 128,
"preview": "import amd from './amd';\nimport cjs from './cjs';\nimport umd from './umd';\n\nexport default {\n\tamd: amd,\n\tcjs: cjs,\n\tumd:"
},
{
"path": "src/bundler/builders/defaultsMode/umd.js",
"chars": 749,
"preview": "import packageResult from 'utils/packageResult';\nimport umdIntro from 'utils/umd/umdIntro';\nimport requireName from 'uti"
},
{
"path": "src/bundler/builders/index.js",
"chars": 199,
"preview": "// TODO rewrite with named imports/exports\nimport defaultsMode from './defaultsMode';\nimport strictMode from './strictMo"
},
{
"path": "src/bundler/builders/strictMode/amd.js",
"chars": 1319,
"preview": "import packageResult from '../../../utils/packageResult';\nimport amdIntro from '../../../utils/amd/amdIntro';\nimport get"
},
{
"path": "src/bundler/builders/strictMode/cjs.js",
"chars": 888,
"preview": "import packageResult from 'utils/packageResult';\nimport getExportBlock from './utils/getExportBlock';\nimport { req } fro"
},
{
"path": "src/bundler/builders/strictMode/index.js",
"chars": 128,
"preview": "import amd from './amd';\nimport cjs from './cjs';\nimport umd from './umd';\n\nexport default {\n\tamd: amd,\n\tcjs: cjs,\n\tumd:"
},
{
"path": "src/bundler/builders/strictMode/umd.js",
"chars": 947,
"preview": "import umdIntro from 'utils/umd/umdIntro';\nimport requireName from 'utils/umd/requireName';\nimport packageResult from 'u"
},
{
"path": "src/bundler/builders/strictMode/utils/getExportBlock.js",
"chars": 144,
"preview": "export default function getExportBlock ( entry ) {\n\tlet name = entry.identifierReplacements.default;\n\treturn `exports['d"
},
{
"path": "src/bundler/combine/getRenamedImports.js",
"chars": 287,
"preview": "export default function getRenamedImports ( mod ) {\n\tlet renamed = [];\n\n\tmod.imports.forEach( x => {\n\t\tif ( x.specifiers"
},
{
"path": "src/bundler/combine/index.js",
"chars": 1437,
"preview": "import MagicString from 'magic-string';\nimport populateModuleNames from './populateModuleNames';\nimport populateExternal"
},
{
"path": "src/bundler/combine/populateExternalModuleImports.js",
"chars": 400,
"preview": "export default function populateExternalModuleImports ( bundle ) {\n\tbundle.modules.forEach( mod => {\n\t\tmod.imports.forEa"
},
{
"path": "src/bundler/combine/populateIdentifierReplacements.js",
"chars": 3130,
"preview": "import hasOwnProp from 'utils/hasOwnProp';\nimport topLevelScopeConflicts from './topLevelScopeConflicts';\n\n/**\n * Figure"
},
{
"path": "src/bundler/combine/populateModuleNames.js",
"chars": 2182,
"preview": "import hasOwnProp from 'utils/hasOwnProp';\nimport builtins from 'utils/builtins';\nimport { default as sanitize, splitPat"
},
{
"path": "src/bundler/combine/resolveExports.js",
"chars": 708,
"preview": "export default function resolveExports ( bundle ) {\n\tlet bundleExports = {};\n\n\tbundle.entryModule.exports.forEach( x => "
},
{
"path": "src/bundler/combine/topLevelScopeConflicts.js",
"chars": 1023,
"preview": "import hasOwnProp from 'utils/hasOwnProp';\nimport builtins from 'utils/builtins';\nimport getUnscopedNames from 'utils/as"
},
{
"path": "src/bundler/combine/transformBody.js",
"chars": 3589,
"preview": "import hasOwnProp from 'utils/hasOwnProp';\nimport getReadOnlyIdentifiers from 'utils/getReadOnlyIdentifiers';\nimport tra"
},
{
"path": "src/bundler/getBundle.js",
"chars": 5513,
"preview": "import { relative, resolve, sep } from 'path';\nimport hasOwnProp from 'utils/hasOwnProp';\nimport resolveId from 'utils/r"
},
{
"path": "src/bundler/getModule.js",
"chars": 3199,
"preview": "import { parse } from 'acorn';\nimport MagicString from 'magic-string';\nimport findImportsAndExports from 'utils/ast/find"
},
{
"path": "src/bundler/utils/resolveChains.js",
"chars": 2132,
"preview": "import hasOwnProp from 'utils/hasOwnProp';\n\n/**\n * Discovers 'chains' within a bundle - e.g. `import { foo } from 'foo'`"
},
{
"path": "src/bundler/utils/sortModules.js",
"chars": 3063,
"preview": "import hasOwnProp from 'utils/hasOwnProp';\nimport walk from 'utils/ast/walk';\n\n/**\n * Sorts an array of modules such tha"
},
{
"path": "src/esperanto.js",
"chars": 4270,
"preview": "import chalk from 'chalk';\nimport hasNamedImports from 'utils/hasNamedImports';\nimport hasNamedExports from 'utils/hasNa"
},
{
"path": "src/standalone/builders/defaultsMode/amd.js",
"chars": 702,
"preview": "import transformExportDeclaration from './utils/transformExportDeclaration';\nimport packageResult from 'utils/packageRes"
},
{
"path": "src/standalone/builders/defaultsMode/cjs.js",
"chars": 1144,
"preview": "import hasOwnProp from 'utils/hasOwnProp';\nimport packageResult from 'utils/packageResult';\nimport { req } from 'utils/m"
},
{
"path": "src/standalone/builders/defaultsMode/index.js",
"chars": 128,
"preview": "import amd from './amd';\nimport cjs from './cjs';\nimport umd from './umd';\n\nexport default {\n\tamd: amd,\n\tcjs: cjs,\n\tumd:"
},
{
"path": "src/standalone/builders/defaultsMode/umd.js",
"chars": 818,
"preview": "import transformExportDeclaration from './utils/transformExportDeclaration';\nimport packageResult from 'utils/packageRes"
},
{
"path": "src/standalone/builders/defaultsMode/utils/transformExportDeclaration.js",
"chars": 1167,
"preview": "export default function transformExportDeclaration ( declaration, body ) {\n\tif ( !declaration ) {\n\t\treturn;\n\t}\n\n\tlet exp"
},
{
"path": "src/standalone/builders/index.js",
"chars": 199,
"preview": "// TODO rewrite with named imports/exports\nimport defaultsMode from './defaultsMode';\nimport strictMode from './strictMo"
},
{
"path": "src/standalone/builders/strictMode/amd.js",
"chars": 627,
"preview": "import packageResult from '../../../utils/packageResult';\nimport transformBody from './utils/transformBody';\nimport amdI"
},
{
"path": "src/standalone/builders/strictMode/cjs.js",
"chars": 816,
"preview": "import packageResult from 'utils/packageResult';\nimport hasOwnProp from 'utils/hasOwnProp';\nimport transformBody from '."
},
{
"path": "src/standalone/builders/strictMode/index.js",
"chars": 128,
"preview": "import amd from './amd';\nimport cjs from './cjs';\nimport umd from './umd';\n\nexport default {\n\tamd: amd,\n\tcjs: cjs,\n\tumd:"
},
{
"path": "src/standalone/builders/strictMode/umd.js",
"chars": 737,
"preview": "import packageResult from 'utils/packageResult';\nimport umdIntro from 'utils/umd/umdIntro';\nimport requireName from 'uti"
},
{
"path": "src/standalone/builders/strictMode/utils/gatherImports.js",
"chars": 474,
"preview": "export default function gatherImports ( imports ) {\n\tlet chains = {};\n\tlet identifierReplacements = {};\n\n\timports.forEac"
},
{
"path": "src/standalone/builders/strictMode/utils/getExportNames.js",
"chars": 290,
"preview": "export default function getExportNames ( exports ) {\n\tvar result = {};\n\n\texports.forEach( x => {\n\t\tif ( x.isDefault ) re"
},
{
"path": "src/standalone/builders/strictMode/utils/getImportSummary.js",
"chars": 577,
"preview": "import hasOwnProp from 'utils/hasOwnProp';\n\nexport default function getImportSummary ( mod ) {\n\tlet importPaths = [];\n\tl"
},
{
"path": "src/standalone/builders/strictMode/utils/transformBody.js",
"chars": 3389,
"preview": "import gatherImports from './gatherImports';\nimport getExportNames from './getExportNames';\nimport getReadOnlyIdentifier"
},
{
"path": "src/standalone/getModule.js",
"chars": 3212,
"preview": "import { parse } from 'acorn';\nimport MagicString from 'magic-string';\nimport annotateAst from 'utils/ast/annotate';\nimp"
},
{
"path": "src/utils/EsperantoError.js",
"chars": 405,
"preview": "var EsperantoError = function ( message, data ) {\n\tvar prop;\n\n\tthis.message = message;\n\tthis.stack = (new Error()).stack"
},
{
"path": "src/utils/amd/amdIntro.js",
"chars": 579,
"preview": "import getImportSummary from './getImportSummary';\nimport processName from './processName';\nimport processIds from './pr"
},
{
"path": "src/utils/amd/getImportSummary.js",
"chars": 882,
"preview": "import resolveId from '../resolveId';\n\nexport default function getImportSummary ({ imports, absolutePaths, name }) {\n\tle"
},
{
"path": "src/utils/amd/processIds.js",
"chars": 154,
"preview": "import { quote } from '../mappers';\n\nexport default function processIds ( ids ) {\n\treturn ids.length ? '[' + ids.map( qu"
},
{
"path": "src/utils/amd/processName.js",
"chars": 127,
"preview": "import { quote } from '../mappers';\n\nexport default function processName ( name ) {\n\treturn name ? quote( name ) + ', ' "
},
{
"path": "src/utils/ast/annotate.js",
"chars": 4082,
"preview": "/*\n\tThis module traverse a module's AST, attaching scope information\n\tto nodes as it goes, which is later used to determ"
},
{
"path": "src/utils/ast/disallowIllegalReassignment.js",
"chars": 972,
"preview": "import hasOwnProp from 'utils/hasOwnProp';\n\nvar bindingMessage = 'Cannot reassign imported binding ',\n\tnamespaceMessage "
},
{
"path": "src/utils/ast/findImportsAndExports.js",
"chars": 6221,
"preview": "/**\n * Inspects a module and discovers/categorises import & export declarations\n * @param {object} ast - the result of p"
},
{
"path": "src/utils/ast/getUnscopedNames.js",
"chars": 983,
"preview": "import walk from './walk';\nimport hasOwnProp from 'utils/hasOwnProp';\n\nexport default function getUnscopedNames ( mod ) "
},
{
"path": "src/utils/ast/replaceIdentifiers.js",
"chars": 541,
"preview": "import hasOwnProp from 'utils/hasOwnProp';\n\nexport default function replaceIdentifiers ( body, node, identifierReplaceme"
},
{
"path": "src/utils/ast/rewriteExportAssignments.js",
"chars": 1222,
"preview": "import hasOwnProp from 'utils/hasOwnProp';\n\nexport default function rewriteExportAssignments ( body, node, parent, expor"
},
{
"path": "src/utils/ast/traverse.js",
"chars": 2506,
"preview": "import walk from './walk';\nimport disallowIllegalReassignment from './disallowIllegalReassignment';\nimport replaceIdenti"
},
{
"path": "src/utils/ast/walk.js",
"chars": 1100,
"preview": "let shouldSkip;\nlet shouldAbort;\n\nexport default function walk ( ast, { enter, leave }) {\n\tshouldAbort = false;\n\tvisit( "
},
{
"path": "src/utils/builtins.js",
"chars": 740,
"preview": "// from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects\n// we add `exports` to this lis"
},
{
"path": "src/utils/disallowConflictingImports.js",
"chars": 520,
"preview": "import hasOwnProp from './hasOwnProp';\n\nexport default function disallowConflictingImports ( imports ) {\n\tlet usedNames "
},
{
"path": "src/utils/getReadOnlyIdentifiers.js",
"chars": 752,
"preview": "/**\n * Scans an array of imports, and determines which identifiers\n are readonly, and which cannot be assigned to. For"
},
{
"path": "src/utils/hasNamedExports.js",
"chars": 159,
"preview": "export default function hasNamedExports ( mod ) {\n\tvar i = mod.exports.length;\n\n\twhile ( i-- ) {\n\t\tif ( !mod.exports[i]."
},
{
"path": "src/utils/hasNamedImports.js",
"chars": 156,
"preview": "export default function hasNamedImports ( mod ) {\n\tvar i = mod.imports.length;\n\n\twhile ( i-- ) {\n\t\tif ( mod.imports[i].i"
},
{
"path": "src/utils/hasOwnProp.js",
"chars": 76,
"preview": "var hasOwnProp = Object.prototype.hasOwnProperty;\nexport default hasOwnProp;"
},
{
"path": "src/utils/mappers.js",
"chars": 418,
"preview": "export function getId ( m ) {\n\treturn m.id;\n}\n\nexport function getName ( m ) {\n\treturn m.name;\n}\n\nexport function quote "
},
{
"path": "src/utils/packageResult.js",
"chars": 2648,
"preview": "import walk from './ast/walk';\nimport { splitPath } from 'utils/sanitize';\n\nconst ABSOLUTE_PATH = /^(?:[A-Z]:)?[\\/\\\\]/i;"
},
{
"path": "src/utils/promiseSequence.js",
"chars": 426,
"preview": "import { Promise } from 'sander';\n\nexport default function promiseSequence ( arr, callback ) {\n\tconst len = arr.length;\n"
},
{
"path": "src/utils/resolveId.js",
"chars": 1061,
"preview": "import { splitPath } from 'utils/sanitize';\n\n/**\n * Resolves an importPath relative to the module that is importing it\n "
},
{
"path": "src/utils/sanitize.js",
"chars": 784,
"preview": "const RESERVED = 'break case class catch const continue debugger default delete do else export extends finally for funct"
},
{
"path": "src/utils/umd/requireName.js",
"chars": 241,
"preview": "import EsperantoError from 'utils/EsperantoError';\n\nexport default function requireName ( options ) {\n\tif ( !options.nam"
},
{
"path": "src/utils/umd/umdIntro.js",
"chars": 2323,
"preview": "import { globalify, req } from 'utils/mappers';\nimport processName from '../amd/processName';\nimport processIds from '.."
},
{
"path": "test/.jshintrc",
"chars": 293,
"preview": "{\n\t\"boss\": true,\n\t\"unused\": true,\n\t\"undef\": true,\n\t\"esnext\": true,\n\t\"globals\": {\n\t\t\"process\": true,\n\t\t\"require\": true,\n\t"
},
{
"path": "test/bundle/index.js",
"chars": 6378,
"preview": "var path = require( 'path' );\nvar assert = require( 'assert' );\nvar sander = require( 'sander' );\nvar makeWhitespaceVisi"
},
{
"path": "test/bundle/input/01/_config.js",
"chars": 76,
"preview": "module.exports = {\n\tdescription: 'bundles a simple collection of modules'\n};"
},
{
"path": "test/bundle/input/01/foo.js",
"chars": 45,
"preview": "var message = 'yes';\nexport default message;\n"
},
{
"path": "test/bundle/input/01/main.js",
"chars": 45,
"preview": "import foo from './foo';\nconsole.log( foo );\n"
},
{
"path": "test/bundle/input/02/_config.js",
"chars": 71,
"preview": "module.exports = {\n\tdescription: 'bundles modules in index.js files'\n};"
},
{
"path": "test/bundle/input/02/foo/index.js",
"chars": 45,
"preview": "var message = 'yes';\nexport default message;\n"
},
{
"path": "test/bundle/input/02/main.js",
"chars": 44,
"preview": "import foo from './foo';\nconsole.log( foo );"
},
{
"path": "test/bundle/input/03/_config.js",
"chars": 87,
"preview": "module.exports = {\n\tdescription: 'allows external imports',\n\timports: [ 'external' ]\n};"
},
{
"path": "test/bundle/input/03/foo.js",
"chars": 37,
"preview": "var bar = 'yes';\nexport default bar;\n"
},
{
"path": "test/bundle/input/03/main.js",
"chars": 90,
"preview": "import foo from './foo';\nimport external from 'external';\n\nconsole.log( external( foo ) );"
},
{
"path": "test/bundle/input/04/_config.js",
"chars": 87,
"preview": "module.exports = {\n\tdescription: 'exports a default export',\n\texports: [ 'default' ]\n};"
},
{
"path": "test/bundle/input/04/foo.js",
"chars": 23,
"preview": "export var answer = 42;"
},
{
"path": "test/bundle/input/04/main.js",
"chars": 58,
"preview": "import { answer } from './foo';\nexport default answer * 2;"
},
{
"path": "test/bundle/input/05/_config.js",
"chars": 111,
"preview": "module.exports = {\n\tdescription: 'exports named exports',\n\tstrict: true,\n\texports: [ 'four', 'five', 'six' ]\n};"
},
{
"path": "test/bundle/input/05/main.js",
"chars": 139,
"preview": "import { one, two, three } from './numbers';\n\nexport var four = one + 3;\nexport var five = two + 3;\nexport var six = thr"
},
{
"path": "test/bundle/input/05/numbers.js",
"chars": 61,
"preview": "export var one = 1;\nexport var two = 2;\nexport var three = 3;"
},
{
"path": "test/bundle/input/06/_config.js",
"chars": 105,
"preview": "module.exports = {\n\tdescription: 'gives legal names to nested imports',\n\timports: [ 'utils/external' ]\n};"
},
{
"path": "test/bundle/input/06/main.js",
"chars": 96,
"preview": "import message from 'nested/foo';\nimport external from 'utils/external';\nconsole.log( message );"
},
{
"path": "test/bundle/input/06/nested/foo.js",
"chars": 35,
"preview": "export default 'this is a message';"
},
{
"path": "test/bundle/input/07/_config.js",
"chars": 79,
"preview": "module.exports = {\n\tdescription: 'modules can be skipped',\n\tskip: [ 'bar' ]\n};\n"
},
{
"path": "test/bundle/input/07/bar.js",
"chars": 30,
"preview": "export default 'this is bar';\n"
},
{
"path": "test/bundle/input/07/foo.js",
"chars": 30,
"preview": "export default 'this is foo';\n"
},
{
"path": "test/bundle/input/07/main.js",
"chars": 136,
"preview": "import foo from 'foo';\nimport bar from 'bar';\n\nfunction logFoo () {\n\tconsole.log( foo );\n}\n\nfunction logBar () {\n\tconsol"
},
{
"path": "test/bundle/input/08/_config.js",
"chars": 116,
"preview": "module.exports = {\n\tdescription: 'external module names are guessed (affects UMD only)',\n\timports: [ 'external' ]\n};"
},
{
"path": "test/bundle/input/08/main.js",
"chars": 40,
"preview": "import ImplicitlyNamed from 'external';\n"
},
{
"path": "test/bundle/input/09/_config.js",
"chars": 158,
"preview": "module.exports = {\n\tdescription: 'external module names can be specified (affects UMD only)',\n\timports: [ 'external' ],\n"
},
{
"path": "test/bundle/input/09/main.js",
"chars": 40,
"preview": "import ExplicitlyNamed from 'external';\n"
},
{
"path": "test/bundle/input/10/_config.js",
"chars": 90,
"preview": "module.exports = {\n\tdescription: 'does not affect ES6 classes',\n\texports: [ 'default' ]\n};"
},
{
"path": "test/bundle/input/10/main.js",
"chars": 109,
"preview": "export default class Foo {\n\tconstructor( str ) {\n\t\tthis.str = str;\n\t}\n\n\ttoString() {\n\t\treturn this.str;\n\t}\n}\n"
},
{
"path": "test/bundle/input/11/_config.js",
"chars": 134,
"preview": "module.exports = {\n\tdescription: 'exports chains correctly in strict mode',\n\tstrict: true,\n\texports: [ 'foo', 'bar', 'ba"
},
{
"path": "test/bundle/input/11/a.js",
"chars": 49,
"preview": "export var foo = 1;\nexport var bar = 2;\n\nfoo = 3;"
},
{
"path": "test/bundle/input/11/b.js",
"chars": 17,
"preview": "export default 4;"
},
{
"path": "test/bundle/input/11/main.js",
"chars": 110,
"preview": "import { foo, bar } from './a';\nimport baz from './b';\n\nvar qux = 5;\nqux = 6;\n\nexport { foo, bar, baz, qux };\n"
},
{
"path": "test/bundle/input/12/_config.js",
"chars": 121,
"preview": "module.exports = {\n\tdescription: 'throws an error if a non-exported identifier is imported',\n\terror: /does not export/\n}"
},
{
"path": "test/bundle/input/12/foo.js",
"chars": 25,
"preview": "var bar = 'not exported';"
},
{
"path": "test/bundle/input/12/main.js",
"chars": 28,
"preview": "import { bar } from './foo';"
},
{
"path": "test/bundle/input/13/_config.js",
"chars": 250,
"preview": "module.exports = {\n\tdescription: 'throw error with file and location error if acorn cannot parse',\n\terror: function ( er"
},
{
"path": "test/bundle/input/13/main.js",
"chars": 17,
"preview": "var 42 = answer;\n"
},
{
"path": "test/bundle/input/14/_config.js",
"chars": 119,
"preview": "module.exports = {\n\tdescription: 'handles default imports from external modules correctly',\n\timports: [ 'external' ]\n};"
},
{
"path": "test/bundle/input/14/main.js",
"chars": 36,
"preview": "import foo from './external';\nfoo();"
},
{
"path": "test/bundle/input/15/_config.js",
"chars": 132,
"preview": "module.exports = {\n\tdescription: 'handles named imports from external modules correctly',\n\timports: [ 'external' ],\n\tstr"
},
{
"path": "test/bundle/input/15/main.js",
"chars": 40,
"preview": "import { foo } from './external';\nfoo();"
},
{
"path": "test/bundle/input/16/_config.js",
"chars": 65,
"preview": "module.exports = {\n\tdescription: 'handles conflicting imports'\n};"
},
{
"path": "test/bundle/input/16/a.js",
"chars": 53,
"preview": "export default function a () {\n\tconsole.log( 'a' );\n}"
},
{
"path": "test/bundle/input/16/b.js",
"chars": 78,
"preview": "import a from './c';\nexport default function () {\n\t// a but actually c\n\ta();\n}"
},
{
"path": "test/bundle/input/16/c.js",
"chars": 68,
"preview": "export default function a () {\n\tconsole.log( 'a but actually c' );\n}"
},
{
"path": "test/bundle/input/16/main.js",
"chars": 68,
"preview": "import a from './a';\nimport b from './b';\n\nfunction foo () {\n\ta();\n}"
},
{
"path": "test/bundle/input/17/_config.js",
"chars": 70,
"preview": "module.exports = {\n\tdescription: 'handles shadowed renamed imports'\n};"
},
{
"path": "test/bundle/input/17/foo.js",
"chars": 58,
"preview": "export function a ( message ) {\n\tconsole.log( message );\n}"
},
{
"path": "test/bundle/input/17/main.js",
"chars": 81,
"preview": "import { a as b } from './foo';\n\nb();\n(function () {\n\tvar a = 'c';\n\tb( a );\n}());"
},
{
"path": "test/bundle/input/18/_config.js",
"chars": 96,
"preview": "module.exports = {\n\tdescription: 'renames imports that conflict with existing variable names'\n};"
},
{
"path": "test/bundle/input/18/bar.js",
"chars": 114,
"preview": "export default function () {\n\tdoThing();\n}\n\nvar doThing = function ( item ) {\n\tconsole.log( 'doing bar thing' );\n}"
},
{
"path": "test/bundle/input/18/doThing.js",
"chars": 66,
"preview": "export default function () {\n\tconsole.log( 'doing foo thing' );\n}\n"
},
{
"path": "test/bundle/input/18/foo.js",
"chars": 76,
"preview": "import doThing from './doThing';\n\nexport default function () {\n\tdoThing();\n}"
},
{
"path": "test/bundle/input/18/main.js",
"chars": 70,
"preview": "import foo from './foo';\nimport bar from './bar';\n\n// foo();\n// bar();"
},
{
"path": "test/bundle/input/19/_config.js",
"chars": 88,
"preview": "module.exports = {\n\tdescription: 'handles hasOwnProperty edge case (default imports)'\n};"
},
{
"path": "test/bundle/input/19/hasOwnProperty.js",
"chars": 84,
"preview": "var hasOwnProperty = Object.prototype.hasOwnProperty;\nexport default hasOwnProperty;"
},
{
"path": "test/bundle/input/19/main.js",
"chars": 107,
"preview": "import hasOwnProperty from './hasOwnProperty';\n\nconsole.log( hasOwnProperty.call({ foo: 'bar' }, 'foo' ) );"
},
{
"path": "test/bundle/input/20/_config.js",
"chars": 111,
"preview": "module.exports = {\n\tdescription: 'handles hasOwnProperty edge case (named imports)',\n\texports: [ 'default' ]\n};"
},
{
"path": "test/bundle/input/20/main.js",
"chars": 140,
"preview": "import { hasOwnProperty } from './objectUtils';\n\nexport default function () {\n\tconsole.log( hasOwnProperty.call({ foo: '"
},
{
"path": "test/bundle/input/20/objectUtils.js",
"chars": 60,
"preview": "export var hasOwnProperty = Object.prototype.hasOwnProperty;"
},
{
"path": "test/bundle/input/21/_config.js",
"chars": 81,
"preview": "module.exports = {\n\tdescription: 'handles member assignments of named imports'\n};"
},
{
"path": "test/bundle/input/21/config.js",
"chars": 26,
"preview": "export const config = {};\n"
},
{
"path": "test/bundle/input/21/main.js",
"chars": 56,
"preview": "import { config } from './config';\nconfig.async = true;\n"
},
{
"path": "test/bundle/input/22/_config.js",
"chars": 114,
"preview": "module.exports = {\n\tdescription: 'handles named exports of default imports',\n\tstrict: true,\n\texports: [ 'foo' ]\n};"
},
{
"path": "test/bundle/input/22/foo.js",
"chars": 60,
"preview": "export default function foo () {\n\tconsole.log( 'fooing' );\n}"
},
{
"path": "test/bundle/input/22/main.js",
"chars": 56,
"preview": "import foo from './foo';\n\n// foo\nfoo();\n\nexport { foo };"
},
{
"path": "test/bundle/input/23/_config.js",
"chars": 107,
"preview": "module.exports = {\n\tdescription: 'throws error if module imports itself',\n\terror: /cannot import itself/\n};"
},
{
"path": "test/bundle/input/23/foo.js",
"chars": 119,
"preview": "import { baz } from './foo';\n\nexport function bar () {\n\tbaz();\n}\n\nexport function baz () {\n\tconsole.log( 'bazzing' );\n}"
},
{
"path": "test/bundle/input/23/main.js",
"chars": 36,
"preview": "import { bar } from './foo';\n\nbar();"
},
{
"path": "test/bundle/input/24/_config.js",
"chars": 142,
"preview": "module.exports = {\n\tdescription: 'adds a banner/footer to bundle',\n\tbanner: '/* this is a banner */\\n',\n\tfooter: '\\n/* t"
},
{
"path": "test/bundle/input/24/bar.js",
"chars": 60,
"preview": "export default function bar () {\n\tconsole.log( 'baring' );\n}"
},
{
"path": "test/bundle/input/24/foo.js",
"chars": 60,
"preview": "export default function foo () {\n\tconsole.log( 'fooing' );\n}"
},
{
"path": "test/bundle/input/24/main.js",
"chars": 64,
"preview": "import foo from './foo';\nimport bar from './bar';\n\nfoo();\nbar();"
},
{
"path": "test/bundle/input/25/_config.js",
"chars": 86,
"preview": "module.exports = {\n\tdescription: 'creates a named AMD module',\n\tamdName: 'myModule'\n};"
},
{
"path": "test/bundle/input/25/foo.js",
"chars": 56,
"preview": "export default function () {\n\tconsole.log( 'fooing' );\n}"
},
{
"path": "test/bundle/input/25/main.js",
"chars": 29,
"preview": "import foo from 'foo';\nfoo();"
},
{
"path": "test/bundle/input/26/_config.js",
"chars": 142,
"preview": "module.exports = {\n\tdescription: 'transforms input sources',\n\ttransform: function ( source ) {\n\t\treturn source.replace( "
},
{
"path": "test/bundle/input/26/bar.js",
"chars": 60,
"preview": "export default function foo () {\n\tconsole.log( 'fooing' );\n}"
}
]
// ... and 961 more files (download for full content)
About this extraction
This page contains the full source code of the esperantojs/esperanto GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 1161 files (300.9 KB), approximately 118.6k tokens, and a symbol index with 661 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.