rename getModuleName option to getModuleId
This commit is contained in:
parent
7e6e5d4746
commit
c1a6ff7f44
@ -25,7 +25,7 @@
|
|||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
|
||||||
"getModuleName": {
|
"getModuleId": {
|
||||||
"hidden": true
|
"hidden": true
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -185,8 +185,8 @@ export default class DefaultFormatter {
|
|||||||
|
|
||||||
getModuleName() {
|
getModuleName() {
|
||||||
var opts = this.file.opts;
|
var opts = this.file.opts;
|
||||||
// moduleId is n/a if a `getModuleName()` is provided
|
// moduleId is n/a if a `getModuleId()` is provided
|
||||||
if (opts.moduleId && !opts.getModuleName) {
|
if (opts.moduleId && !opts.getModuleId) {
|
||||||
return opts.moduleId;
|
return opts.moduleId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,10 +217,9 @@ export default class DefaultFormatter {
|
|||||||
// normalize path separators
|
// normalize path separators
|
||||||
moduleName = moduleName.replace(/\\/g, "/");
|
moduleName = moduleName.replace(/\\/g, "/");
|
||||||
|
|
||||||
if (opts.getModuleName) {
|
if (opts.getModuleId) {
|
||||||
// If return is falsy, assume they want us to use
|
// If return is falsy, assume they want us to use our generated default name
|
||||||
// our generated default name
|
return opts.getModuleId(moduleName) || moduleName;
|
||||||
return opts.getModuleName(moduleName) || moduleName;
|
|
||||||
} else {
|
} else {
|
||||||
return moduleName;
|
return moduleName;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,8 +18,8 @@ suite("api", function () {
|
|||||||
assert.ok(!result.ast);
|
assert.ok(!result.ast);
|
||||||
});
|
});
|
||||||
|
|
||||||
suite("getModuleName() {} option", function () {
|
suite("getModuleId() {} option", function () {
|
||||||
// As of this commit, `getModuleName` is the only option that isn't JSON
|
// 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
|
// compatible which is why it's not inside /test/core/fixtures/transformation
|
||||||
|
|
||||||
function getModuleNameTest(moduleFormat, expected) {
|
function getModuleNameTest(moduleFormat, expected) {
|
||||||
@ -27,7 +27,7 @@ suite("api", function () {
|
|||||||
filename: "foo/bar/index",
|
filename: "foo/bar/index",
|
||||||
modules: moduleFormat,
|
modules: moduleFormat,
|
||||||
moduleIds: true,
|
moduleIds: true,
|
||||||
getModuleName: function (name) {
|
getModuleId: function (name) {
|
||||||
return name.replace(/\/index$/, "");
|
return name.replace(/\/index$/, "");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user