diff --git a/src/babel/transformation/file/options.json b/src/babel/transformation/file/options.json index 2b13bb102b..9365c94d4a 100644 --- a/src/babel/transformation/file/options.json +++ b/src/babel/transformation/file/options.json @@ -25,7 +25,7 @@ "type": "string" }, - "getModuleName": { + "getModuleId": { "hidden": true }, diff --git a/src/babel/transformation/modules/_default.js b/src/babel/transformation/modules/_default.js index b038f43ea7..f4d8f016a1 100644 --- a/src/babel/transformation/modules/_default.js +++ b/src/babel/transformation/modules/_default.js @@ -185,8 +185,8 @@ export default class DefaultFormatter { getModuleName() { var opts = this.file.opts; - // moduleId is n/a if a `getModuleName()` is provided - if (opts.moduleId && !opts.getModuleName) { + // moduleId is n/a if a `getModuleId()` is provided + if (opts.moduleId && !opts.getModuleId) { return opts.moduleId; } @@ -217,10 +217,9 @@ export default class DefaultFormatter { // normalize path separators moduleName = moduleName.replace(/\\/g, "/"); - if (opts.getModuleName) { - // If return is falsy, assume they want us to use - // our generated default name - return opts.getModuleName(moduleName) || moduleName; + if (opts.getModuleId) { + // If return is falsy, assume they want us to use our generated default name + return opts.getModuleId(moduleName) || moduleName; } else { return moduleName; } diff --git a/test/core/api.js b/test/core/api.js index c7dfa2a6d7..2fb0330ff3 100644 --- a/test/core/api.js +++ b/test/core/api.js @@ -18,8 +18,8 @@ suite("api", function () { assert.ok(!result.ast); }); - suite("getModuleName() {} option", function () { - // As of this commit, `getModuleName` is the only option that isn't JSON + suite("getModuleId() {} option", function () { + // As of this commit, `getModuleId` is the only option that isn't JSON // compatible which is why it's not inside /test/core/fixtures/transformation function getModuleNameTest(moduleFormat, expected) { @@ -27,7 +27,7 @@ suite("api", function () { filename: "foo/bar/index", modules: moduleFormat, moduleIds: true, - getModuleName: function (name) { + getModuleId: function (name) { return name.replace(/\/index$/, ""); } });