├── .babelrc ├── .github ├── release.yml └── workflows │ └── test.yml ├── .gitignore ├── .prettierignore ├── LICENSE ├── README.md ├── package.json ├── transforms ├── __testfixtures__ │ ├── module-exports-to-export-default │ │ ├── basic-case.input.js │ │ ├── basic-case.output.js │ │ ├── multiple-exports.input.js │ │ └── multiple-exports.output.js │ ├── module-exports-to-named-export │ │ ├── basic-case-exports.input.js │ │ ├── basic-case-exports.output.js │ │ ├── basic-case-module-exports.input.js │ │ ├── basic-case-module-exports.output.js │ │ ├── exports-variable.input.js │ │ └── exports-variable.output.js │ ├── require-to-import-default │ │ ├── bad-argument.input.js │ │ ├── bad-argument.output.js │ │ ├── basic-case-with-comment.input.js │ │ ├── basic-case-with-comment.output.js │ │ ├── basic-case.input.js │ │ ├── basic-case.output.js │ │ ├── chained-requires-with-rest.input.js │ │ ├── chained-requires-with-rest.output.js │ │ ├── chained-requires.input.js │ │ ├── chained-requires.output.js │ │ ├── destructure-multiple-require.input.js │ │ ├── destructure-multiple-require.output.js │ │ ├── destructure-require-alias.input.js │ │ ├── destructure-require-alias.output.js │ │ ├── destructure-require.input.js │ │ ├── destructure-require.output.js │ │ ├── too-many-arguments.input.js │ │ └── too-many-arguments.output.js │ ├── require-with-props-to-named-import │ │ ├── alias.input.js │ │ ├── alias.output.js │ │ ├── basic-case-with-comment.input.js │ │ ├── basic-case-with-comment.output.js │ │ ├── basic-case.input.js │ │ └── basic-case.output.js │ ├── single-require.input.js │ └── single-require.output.js ├── __tests__ │ ├── .eslintrc.yml │ ├── module-exports-to-export-default-test.js │ ├── module-exports-to-named-export-test.js │ ├── require-to-import-default-test.js │ ├── require-with-props-to-named-import-test.js │ └── single-require-test.js ├── __testutils__ │ └── defineTests.js ├── index.js ├── module-exports-to-export-default.js ├── module-exports-to-named-export.js ├── require-to-import-default.js ├── require-with-props-to-named-import.js ├── single-require.js └── utils │ ├── filters.js │ └── logger.js └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/.babelrc -------------------------------------------------------------------------------- /.github/release.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/.github/release.yml -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/.github/workflows/test.yml -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | coverage 3 | lib 4 | dist -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | transforms/__testfixtures__ 2 | 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/LICENSE -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/README.md -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/package.json -------------------------------------------------------------------------------- /transforms/__testfixtures__/module-exports-to-export-default/basic-case.input.js: -------------------------------------------------------------------------------- 1 | // comment 2 | module.exports = function () { 3 | return 42; 4 | }; -------------------------------------------------------------------------------- /transforms/__testfixtures__/module-exports-to-export-default/basic-case.output.js: -------------------------------------------------------------------------------- 1 | // comment 2 | export default function () { 3 | return 42; 4 | }; -------------------------------------------------------------------------------- /transforms/__testfixtures__/module-exports-to-export-default/multiple-exports.input.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/__testfixtures__/module-exports-to-export-default/multiple-exports.input.js -------------------------------------------------------------------------------- /transforms/__testfixtures__/module-exports-to-export-default/multiple-exports.output.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/__testfixtures__/module-exports-to-export-default/multiple-exports.output.js -------------------------------------------------------------------------------- /transforms/__testfixtures__/module-exports-to-named-export/basic-case-exports.input.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/__testfixtures__/module-exports-to-named-export/basic-case-exports.input.js -------------------------------------------------------------------------------- /transforms/__testfixtures__/module-exports-to-named-export/basic-case-exports.output.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/__testfixtures__/module-exports-to-named-export/basic-case-exports.output.js -------------------------------------------------------------------------------- /transforms/__testfixtures__/module-exports-to-named-export/basic-case-module-exports.input.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/__testfixtures__/module-exports-to-named-export/basic-case-module-exports.input.js -------------------------------------------------------------------------------- /transforms/__testfixtures__/module-exports-to-named-export/basic-case-module-exports.output.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/__testfixtures__/module-exports-to-named-export/basic-case-module-exports.output.js -------------------------------------------------------------------------------- /transforms/__testfixtures__/module-exports-to-named-export/exports-variable.input.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/__testfixtures__/module-exports-to-named-export/exports-variable.input.js -------------------------------------------------------------------------------- /transforms/__testfixtures__/module-exports-to-named-export/exports-variable.output.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/__testfixtures__/module-exports-to-named-export/exports-variable.output.js -------------------------------------------------------------------------------- /transforms/__testfixtures__/require-to-import-default/bad-argument.input.js: -------------------------------------------------------------------------------- 1 | const Lib = require('li' + 'b'); 2 | -------------------------------------------------------------------------------- /transforms/__testfixtures__/require-to-import-default/bad-argument.output.js: -------------------------------------------------------------------------------- 1 | const Lib = require('li' + 'b'); 2 | -------------------------------------------------------------------------------- /transforms/__testfixtures__/require-to-import-default/basic-case-with-comment.input.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/__testfixtures__/require-to-import-default/basic-case-with-comment.input.js -------------------------------------------------------------------------------- /transforms/__testfixtures__/require-to-import-default/basic-case-with-comment.output.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/__testfixtures__/require-to-import-default/basic-case-with-comment.output.js -------------------------------------------------------------------------------- /transforms/__testfixtures__/require-to-import-default/basic-case.input.js: -------------------------------------------------------------------------------- 1 | const Lib = require('lib'); 2 | -------------------------------------------------------------------------------- /transforms/__testfixtures__/require-to-import-default/basic-case.output.js: -------------------------------------------------------------------------------- 1 | import Lib from 'lib'; 2 | -------------------------------------------------------------------------------- /transforms/__testfixtures__/require-to-import-default/chained-requires-with-rest.input.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/__testfixtures__/require-to-import-default/chained-requires-with-rest.input.js -------------------------------------------------------------------------------- /transforms/__testfixtures__/require-to-import-default/chained-requires-with-rest.output.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/__testfixtures__/require-to-import-default/chained-requires-with-rest.output.js -------------------------------------------------------------------------------- /transforms/__testfixtures__/require-to-import-default/chained-requires.input.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/__testfixtures__/require-to-import-default/chained-requires.input.js -------------------------------------------------------------------------------- /transforms/__testfixtures__/require-to-import-default/chained-requires.output.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/__testfixtures__/require-to-import-default/chained-requires.output.js -------------------------------------------------------------------------------- /transforms/__testfixtures__/require-to-import-default/destructure-multiple-require.input.js: -------------------------------------------------------------------------------- 1 | const { a, b, c } = require("lib"); 2 | -------------------------------------------------------------------------------- /transforms/__testfixtures__/require-to-import-default/destructure-multiple-require.output.js: -------------------------------------------------------------------------------- 1 | import { a, b, c } from "lib"; 2 | -------------------------------------------------------------------------------- /transforms/__testfixtures__/require-to-import-default/destructure-require-alias.input.js: -------------------------------------------------------------------------------- 1 | const { k: v } = require("lib"); 2 | -------------------------------------------------------------------------------- /transforms/__testfixtures__/require-to-import-default/destructure-require-alias.output.js: -------------------------------------------------------------------------------- 1 | import { k as v } from "lib"; 2 | -------------------------------------------------------------------------------- /transforms/__testfixtures__/require-to-import-default/destructure-require.input.js: -------------------------------------------------------------------------------- 1 | const { method } = require("lib"); 2 | -------------------------------------------------------------------------------- /transforms/__testfixtures__/require-to-import-default/destructure-require.output.js: -------------------------------------------------------------------------------- 1 | import { method } from "lib"; 2 | -------------------------------------------------------------------------------- /transforms/__testfixtures__/require-to-import-default/too-many-arguments.input.js: -------------------------------------------------------------------------------- 1 | const Lib = require('lib', 'nop'); 2 | -------------------------------------------------------------------------------- /transforms/__testfixtures__/require-to-import-default/too-many-arguments.output.js: -------------------------------------------------------------------------------- 1 | const Lib = require('lib', 'nop'); 2 | -------------------------------------------------------------------------------- /transforms/__testfixtures__/require-with-props-to-named-import/alias.input.js: -------------------------------------------------------------------------------- 1 | const b = require('lib').a; 2 | -------------------------------------------------------------------------------- /transforms/__testfixtures__/require-with-props-to-named-import/alias.output.js: -------------------------------------------------------------------------------- 1 | import { a as b } from 'lib'; 2 | -------------------------------------------------------------------------------- /transforms/__testfixtures__/require-with-props-to-named-import/basic-case-with-comment.input.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/__testfixtures__/require-with-props-to-named-import/basic-case-with-comment.input.js -------------------------------------------------------------------------------- /transforms/__testfixtures__/require-with-props-to-named-import/basic-case-with-comment.output.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/__testfixtures__/require-with-props-to-named-import/basic-case-with-comment.output.js -------------------------------------------------------------------------------- /transforms/__testfixtures__/require-with-props-to-named-import/basic-case.input.js: -------------------------------------------------------------------------------- 1 | const a = require('lib').a; 2 | -------------------------------------------------------------------------------- /transforms/__testfixtures__/require-with-props-to-named-import/basic-case.output.js: -------------------------------------------------------------------------------- 1 | import { a } from 'lib'; 2 | -------------------------------------------------------------------------------- /transforms/__testfixtures__/single-require.input.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/__testfixtures__/single-require.input.js -------------------------------------------------------------------------------- /transforms/__testfixtures__/single-require.output.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/__testfixtures__/single-require.output.js -------------------------------------------------------------------------------- /transforms/__tests__/.eslintrc.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/__tests__/.eslintrc.yml -------------------------------------------------------------------------------- /transforms/__tests__/module-exports-to-export-default-test.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/__tests__/module-exports-to-export-default-test.js -------------------------------------------------------------------------------- /transforms/__tests__/module-exports-to-named-export-test.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/__tests__/module-exports-to-named-export-test.js -------------------------------------------------------------------------------- /transforms/__tests__/require-to-import-default-test.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/__tests__/require-to-import-default-test.js -------------------------------------------------------------------------------- /transforms/__tests__/require-with-props-to-named-import-test.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/__tests__/require-with-props-to-named-import-test.js -------------------------------------------------------------------------------- /transforms/__tests__/single-require-test.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/__tests__/single-require-test.js -------------------------------------------------------------------------------- /transforms/__testutils__/defineTests.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/__testutils__/defineTests.js -------------------------------------------------------------------------------- /transforms/index.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/index.js -------------------------------------------------------------------------------- /transforms/module-exports-to-export-default.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/module-exports-to-export-default.js -------------------------------------------------------------------------------- /transforms/module-exports-to-named-export.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/module-exports-to-named-export.js -------------------------------------------------------------------------------- /transforms/require-to-import-default.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/require-to-import-default.js -------------------------------------------------------------------------------- /transforms/require-with-props-to-named-import.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/require-with-props-to-named-import.js -------------------------------------------------------------------------------- /transforms/single-require.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/single-require.js -------------------------------------------------------------------------------- /transforms/utils/filters.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/utils/filters.js -------------------------------------------------------------------------------- /transforms/utils/logger.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/transforms/utils/logger.js -------------------------------------------------------------------------------- /yarn.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azu/commonjs-to-es-module-codemod/HEAD/yarn.lock --------------------------------------------------------------------------------