Skip to content

Commit e94dfe5

Browse files
committed
feat(vue-socials): remove destructure for a smaller bundle size
1 parent 6acbd61 commit e94dfe5

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

build/rollup.config.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ if (!argv.format || argv.format === 'esm') {
110110
dir: 'dist/esm',
111111
format: 'esm',
112112
exports: 'named',
113-
sourcemap: true,
114113
preserveModules: true,
115114
},
116115
plugins: [
@@ -148,7 +147,6 @@ if (!argv.format || argv.format === 'es') {
148147
file: 'dist/vue-socials.es.js',
149148
format: 'esm',
150149
exports: 'named',
151-
sourcemap: true,
152150
},
153151
plugins: [
154152
resolve(BASE_CONFIG.plugins.resolve),

src/utils/getSerialisedParams.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ export interface IParamsObject {
1010
*/
1111
export default function getSerialisedParams(object: IParamsObject): string {
1212
const params = Object.entries(object)
13-
.filter(([, value]) => value !== undefined && value !== null && !Number.isNaN(value) && value !== '')
14-
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
13+
.filter((param) => param[1] !== undefined && param[1] !== null && !Number.isNaN(param[1]) && param[1] !== '')
14+
.map((param) => `${encodeURIComponent(param[0])}=${encodeURIComponent(String(param[1]))}`);
1515

1616
return params.length > 0 ? `?${params.join('&')}` : '';
1717
}

src/vue-socials-esm.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import * as components from '@/components';
99
* Install function executed by Vue.use()
1010
*/
1111
const install: PluginFunction<never> = function installVueSocials(Vue: typeof _Vue) {
12-
Object.entries(components).forEach(([componentName, component]) => {
13-
Vue.component(componentName, component);
12+
Object.entries(components).forEach((item) => {
13+
Vue.component(item[0], item[1]);
1414
});
1515
};
1616

src/vue-socials.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ import plugin, * as components from '@/vue-socials-esm';
1111
type NamedExports = Exclude<typeof components, 'default'>;
1212
type ExtendedPlugin = typeof plugin & NamedExports;
1313

14-
Object.entries(components).forEach(([componentName, component]) => {
15-
if (componentName !== 'default') {
16-
const key = componentName as Exclude<keyof NamedExports, 'default'>;
17-
const val = component as Exclude<ExtendedPlugin, typeof plugin>;
14+
Object.entries(components).forEach((item) => {
15+
if (item[0] !== 'default') {
16+
const key = item[0] as Exclude<keyof NamedExports, 'default'>;
17+
const val = item[1] as Exclude<ExtendedPlugin, typeof plugin>;
1818
(plugin as ExtendedPlugin)[key] = val;
1919
}
2020
});

0 commit comments

Comments
 (0)