zhang-wei-jian's picture
:rocket:
7d73cf2
raw
history blame contribute delete
746 Bytes
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateLegacyCode = void 0;
const shared_1 = require("@intlify/shared");
function generateLegacyCode({ isGlobal }, generator) {
// prettier-ignore
const componentNamespace = `Component.options`;
const variableName = !isGlobal ? '__i18n' : '__i18nGlobal';
const exportSyntax = 'export default';
const code = `${exportSyntax} function (Component) {
${componentNamespace}.${variableName} = ${componentNamespace}.${variableName} || []
${componentNamespace}.${variableName}.push(${(0, shared_1.friendlyJSONstringify)(generator())})
delete ${componentNamespace}._Ctor
}`;
return code;
}
exports.generateLegacyCode = generateLegacyCode;