Skip to content

Commit 63b41be

Browse files
refactor: emoji deprecate
BREAKING CHANGE: `emoji` was deprecated
1 parent 9f974be commit 63b41be

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

src/utils.js

+6
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,12 @@ function getModulesOptions(rawOptions, loaderContext) {
210210
}
211211
}
212212

213+
if (/\[emoji(?::(\d+))?\]/i.test(modulesOptions.localIdentName)) {
214+
loaderContext.emitWarning(
215+
'Emoji is deprecated and will be removed in next major release.'
216+
);
217+
}
218+
213219
return modulesOptions;
214220
}
215221

test/__snapshots__/modules-option.test.js.snap

+9
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,15 @@ Array [
699699

700700
exports[`"modules" option should dedupe same modules in one module (issue #1037): warnings 1`] = `Array []`;
701701

702+
exports[`"modules" option should emit warning when localIdentName is emoji: errors 1`] = `Array []`;
703+
704+
exports[`"modules" option should emit warning when localIdentName is emoji: warnings 1`] = `
705+
Array [
706+
"ModuleWarning: Module Warning (from \`replaced original path\`):
707+
(Emitted value instead of an instance of Error) Emoji is deprecated and will be removed in next major release.",
708+
]
709+
`;
710+
702711
exports[`"modules" option should keep order: errors 1`] = `Array []`;
703712

704713
exports[`"modules" option should keep order: module 1`] = `

test/modules-option.test.js

+12
Original file line numberDiff line numberDiff line change
@@ -1389,4 +1389,16 @@ describe('"modules" option', () => {
13891389
expect(getWarnings(stats)).toMatchSnapshot('warnings');
13901390
expect(getErrors(stats)).toMatchSnapshot('errors');
13911391
});
1392+
1393+
it('should emit warning when localIdentName is emoji', async () => {
1394+
const compiler = getCompiler('./modules/pure/pure.js', {
1395+
modules: {
1396+
localIdentName: '[emoji:0]',
1397+
},
1398+
});
1399+
const stats = await compile(compiler);
1400+
1401+
expect(getWarnings(stats)).toMatchSnapshot('warnings');
1402+
expect(getErrors(stats)).toMatchSnapshot('errors');
1403+
});
13921404
});

0 commit comments

Comments
 (0)