Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: 59naga/babel-plugin-add-module-exports
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: atom-community/babel-plugin-add-module-exports
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 9 commits
  • 6 files changed
  • 5 contributors

Commits on Oct 22, 2018

  1. Copy the full SHA
    df47a0a View commit details

Commits on Apr 16, 2019

  1. v1.0.1

    lijunle committed Apr 16, 2019

    Unverified

    This user has not yet uploaded their public signing key.
    Copy the full SHA
    38e2e68 View commit details

Commits on Apr 17, 2019

  1. v1.0.2

    lijunle committed Apr 17, 2019

    Unverified

    This user has not yet uploaded their public signing key.
    Copy the full SHA
    e8330b2 View commit details

Commits on Oct 18, 2019

  1. Copy the full SHA
    f4ce058 View commit details

Commits on Jul 20, 2020

  1. chore: Remove chokidar.

    jaywcjlove committed Jul 20, 2020
    Copy the full SHA
    ebbbb2a View commit details

Commits on Sep 7, 2020

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ea4d2f2 View commit details
  2. Copy the full SHA
    b856b07 View commit details
  3. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    3a2a966 View commit details

Commits on Jul 21, 2021

  1. Copy the full SHA
    ea9dab1 View commit details
Showing with 74 additions and 559 deletions.
  1. +20 −0 .github/renovate.json
  2. +2 −4 package.json
  3. +2 −0 pnpm-workspace.yaml
  4. +5 −1 src/index.js
  5. +36 −0 test/spec.js
  6. +9 −554 yarn.lock
20 changes: 20 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"schedule": ["every weekend"],
"labels": ["dependencies"],
"separateMajorMinor": "false",
"packageRules": [
{
"matchDepTypes": ["devDependencies"],
"matchUpdateTypes": ["major", "minor", "patch", "pin", "digest", "lockFileMaintenance", "rollback", "bump"],
"groupName": "devDependencies",
"semanticCommitType": "chore",
"automerge": true
},
{
"matchDepTypes": ["dependencies"],
"matchUpdateTypes": ["major", "minor", "patch", "pin", "digest", "lockFileMaintenance", "rollback", "bump"],
"groupName": "dependencies",
"semanticCommitType": "fix"
}
]
}
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "babel-plugin-add-module-exports",
"version": "1.0.0",
"version": "1.0.2",
"description": "Fix babel/babel#2212",
"main": "lib",
"files": [
@@ -40,9 +40,7 @@
"power-assert": "^1.6.0",
"prettier": "^1.13.7"
},
"optionalDependencies": {
"chokidar": "^2.0.4"
},
"optionalDependencies": {},
"keywords": [
"babel-plugin",
"module.exports"
2 changes: 2 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
packages:
- "."
6 changes: 5 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -103,10 +103,14 @@ class ExportsFinder {
}

const objectName = path.get(`${property}.left.object.name`).node
const propertyName = path.get(`${property}.left.property.name`).node
// Check name of MemberExpressions and values of StringLiterals
const propertyName =
path.get(`${property}.left.property.name`).node ||
path.get(`${property}.left.property.value`).node
if (objectName === 'exports' || objectName === '_exports') {
if (propertyName === 'default') {
this.hasExportsDefault = true
this.findExports(path.get(property), 'right')
} else if (propertyName !== '__esModule') {
this.hasExportsNamed = true
}
36 changes: 36 additions & 0 deletions test/spec.js
Original file line number Diff line number Diff line change
@@ -208,5 +208,41 @@ module.exports = [
module: 'default-entry',
exports: 'default-entry'
}
},
{
name: 'handle a single quote string literal export',
code: `
Object.defineProperty(exports, '__esModule', {value: true});
exports['default'] = 'foo';
`,
expected: {
module: 'foo',
exports: 'foo'
}
},
{
name: 'handle a double quote string literal export',
code: `
Object.defineProperty(exports, '__esModule', {value: true});
exports["default"] = 'foo';
`,
expected: {
module: 'foo',
exports: 'foo'
}
},
{
name: 'export same var as default and named declarations',
code: 'const foo="bar";export { foo, foo as default };',
expected: {
exports: {
default: 'bar',
foo: 'bar'
},
module: {
default: 'bar',
foo: 'bar'
}
}
}
]
563 changes: 9 additions & 554 deletions yarn.lock

Large diffs are not rendered by default.