diff --git a/.eslintrc.js b/.eslintrc.js index ea557f8..0e5666d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -24,5 +24,5 @@ module.exports = { 'import/no-extraneous-dependencies': 'off', 'prefer-object-spread': 'off', }, - ignorePatterns: ['!.*', 'src/vue-socials.d.ts'], + ignorePatterns: ['!.*', 'src/vuetube.d.ts'], }; diff --git a/.size-limit.js b/.size-limit.js index 5b93f96..35fe69a 100644 --- a/.size-limit.js +++ b/.size-limit.js @@ -1,349 +1,7 @@ module.exports = [ { - path: 'dist/esm/vue-socials-esm.js', - name: 'Total', - limit: '10 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SBlogger', - import: '{ SBlogger }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SDevTo', - import: '{ SDevTo }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SDiaspora', - import: '{ SDiaspora }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SDouban', - import: '{ SDouban }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SEmail', - import: '{ SEmail }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SEvernote', - import: '{ SEvernote }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SFacebook', - import: '{ SFacebook }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SFacebookCount', - import: '{ SFacebookCount }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SFacebookMessenger', - import: '{ SFacebookMessenger }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SFacebookWorkplace', - import: '{ SFacebookWorkplace }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SFlipBoard', - import: '{ SFlipBoard }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SGithub', - import: '{ SGithub }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SGithubCount', - import: '{ SGithubCount }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SGithubGist', - import: '{ SGithubGist }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SGithubGistCount', - import: '{ SGithubGistCount }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SGithubRepo', - import: '{ SGithubRepo }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SGithubRepoCount', - import: '{ SGithubRepoCount }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SGmail', - import: '{ SGmail }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SGoogleBookmarks', - import: '{ SGoogleBookmarks }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SHackerNews', - import: '{ SHackerNews }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SHatena', - import: '{ SHatena }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SHatenaCount', - import: '{ SHatenaCount }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SHouzz', - import: '{ SHouzz }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SInstaPaper', - import: '{ SInstaPaper }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SKakaoStory', - import: '{ SKakaoStory }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SLine', - import: '{ SLine }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SLineCount', - import: '{ SLineCount }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SLinkedIn', - import: '{ SLinkedIn }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SLiveJournal', - import: '{ SLiveJournal }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SMailRu', - import: '{ SMailRu }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SMicrosoftTeams', - import: '{ SMicrosoftTeams }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SOdnoklassniki', - import: '{ SOdnoklassniki }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SOdnoklassnikiCount', - import: '{ SOdnoklassnikiCount }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SPinterest', - import: '{ SPinterest }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SPinterestCount', - import: '{ SPinterestCount }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SPocket', - import: '{ SPocket }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SQZone', - import: '{ SQZone }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SReddit', - import: '{ SReddit }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SRedditCount', - import: '{ SRedditCount }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SRenRen', - import: '{ SRenRen }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SSkype', - import: '{ SSkype }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SSms', - import: '{ SSms }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'STelegram', - import: '{ STelegram }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SThreema', - import: '{ SThreema }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'STrello', - import: '{ STrello }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'STumblr', - import: '{ STumblr }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'STumblrCount', - import: '{ STumblrCount }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'STwitter', - import: '{ STwitter }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SViber', - import: '{ SViber }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SVkontakte', - import: '{ SVkontakte }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SVkontakteCount', - import: '{ SVkontakteCount }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SWeibo', - import: '{ SWeibo }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SWhatsApp', - import: '{ SWhatsApp }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SWordPress', - import: '{ SWordPress }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SXing', - import: '{ SXing }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SYahoo', - import: '{ SYahoo }', - limit: '3 KB', - }, - { - path: 'dist/esm/vue-socials-esm.js', - name: 'SYammer', - import: '{ SYammer }', - limit: '3 KB', + path: 'dist/esm/vuetube.js', + name: 'VueTube', + limit: '2 KB', }, ]; diff --git a/.storybook/preview.js b/.storybook/preview.js index d554ce7..b285aac 100644 --- a/.storybook/preview.js +++ b/.storybook/preview.js @@ -1,3 +1,3 @@ export const parameters = { - actions: { argTypesRegex: "^on[A-Z].*" }, -} + actions: { argTypesRegex: '^on[A-Z].*' }, +}; diff --git a/build/rollup.config.js b/build/rollup.config.js index f648249..9deacb3 100644 --- a/build/rollup.config.js +++ b/build/rollup.config.js @@ -20,7 +20,7 @@ const argv = minimist(process.argv.slice(2)); const projectRoot = path.resolve(__dirname, '..'); const BASE_CONFIG = { - input: 'src/vue-socials.ts', + input: 'src/vuetube.ts', plugins: { resolve: { extensions: ['.js', '.ts', '.vue'], @@ -104,13 +104,12 @@ const BUILD_FORMATS = []; if (!argv.format || argv.format === 'esm') { const ESM_CONFIG = { ...BASE_CONFIG, - input: 'src/vue-socials-esm.ts', + input: 'src/vuetube.ts', external, output: { dir: 'dist/esm', format: 'esm', exports: 'named', - sourcemap: true, preserveModules: true, }, plugins: [ @@ -123,7 +122,7 @@ if (!argv.format || argv.format === 'esm') { commonjs(), copy({ targets: [ - { src: 'src/vue-socials.d.ts', dest: 'dist/types' }, + { src: 'src/vuetube.d.ts', dest: 'dist/types' }, ], }), ], @@ -138,13 +137,12 @@ if (!argv.format || argv.format === 'esm') { if (!argv.format || argv.format === 'es') { const ES_CONFIG = { ...BASE_CONFIG, - input: 'src/vue-socials-esm.ts', + input: 'src/vuetube.ts', external, output: { - file: 'dist/vue-socials.es.js', + file: 'dist/vuetube.es.js', format: 'esm', exports: 'named', - sourcemap: true, }, plugins: [ resolve(BASE_CONFIG.plugins.resolve), @@ -169,10 +167,10 @@ if (!argv.format || argv.format === 'cjs') { external, output: { compact: true, - file: 'dist/vue-socials.cjs.js', + file: 'dist/vuetube.cjs.js', format: 'cjs', - name: 'VueSocials', - exports: 'auto', + name: 'VueTube', + exports: 'named', globals, }, plugins: [ @@ -204,10 +202,10 @@ if (!argv.format || argv.format === 'iife') { external, output: { compact: true, - file: 'dist/vue-socials.iife.js', + file: 'dist/vuetube.iife.js', format: 'iife', - name: 'VueSocials', - exports: 'auto', + name: 'VueTube', + exports: 'named', globals, }, plugins: [ diff --git a/package-lock.json b/package-lock.json index eff78eb..dbf46f3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2039,6 +2039,26 @@ } } }, + "@jfonx/console-utils": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@jfonx/console-utils/-/console-utils-1.0.3.tgz", + "integrity": "sha512-/XbnqjWc7yNZVLAJJO9rimfIz9DYte+cj3EF9hwhIv7vw6ok2t3cjl0huYsmD89srKH03vWjeqAcIH86CuYj3g==", + "dev": true, + "requires": { + "colors": "^1.3.3" + } + }, + "@jfonx/file-utils": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@jfonx/file-utils/-/file-utils-3.0.1.tgz", + "integrity": "sha512-qwH0CuzWmghtTHGMyuPHj6SJPQgWeiXFJBfrxCWMbzxVCa3aLZPEfzSdlSnC/UABsk6feRkNdHXw59rVshNPqw==", + "dev": true, + "requires": { + "@jfonx/console-utils": "^1.0.3", + "comment-json": "^4.1.0", + "find-up": "^4.1.0" + } + }, "@ls-lint/ls-lint": { "version": "1.9.2", "resolved": "https://registry.npmjs.org/@ls-lint/ls-lint/-/ls-lint-1.9.2.tgz", @@ -5045,6 +5065,12 @@ "is-string": "^1.0.5" } }, + "array-timsort": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-timsort/-/array-timsort-1.0.3.tgz", + "integrity": "sha512-/+3GRL7dDAGEfM6TseQk/U+mi18TU2Ms9I3UlLdUMhz2hbvGNTKdj9xniwXfUqgYhHxRx0+8UnKkvlNwVU+cWQ==", + "dev": true + }, "array-union": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", @@ -6968,6 +6994,19 @@ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true }, + "comment-json": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/comment-json/-/comment-json-4.1.0.tgz", + "integrity": "sha512-WEghmVYaNq9NlWbrkzQTSsya9ycLyxJxpTQfZEan6a5Jomnjw18zS3Podf8q1Zf9BvonvQd/+Z7Z39L7KKzzdQ==", + "dev": true, + "requires": { + "array-timsort": "^1.0.3", + "core-util-is": "^1.0.2", + "esprima": "^4.0.1", + "has-own-prop": "^2.0.0", + "repeat-string": "^1.6.1" + } + }, "commondir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", @@ -8029,6 +8068,12 @@ "repeat-string": "^1.5.4" } }, + "detect-file": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", + "integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=", + "dev": true + }, "detect-port": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/detect-port/-/detect-port-1.3.0.tgz", @@ -9431,6 +9476,15 @@ } } }, + "expand-tilde": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz", + "integrity": "sha1-l+gBqgUt8CRU3kawK/YhZCzchQI=", + "dev": true, + "requires": { + "homedir-polyfill": "^1.0.1" + } + }, "express": { "version": "4.17.1", "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", @@ -10029,6 +10083,16 @@ } } }, + "find-node-modules": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/find-node-modules/-/find-node-modules-2.1.2.tgz", + "integrity": "sha512-x+3P4mbtRPlSiVE1Qco0Z4YLU8WFiFcuWTf3m75OV9Uzcfs2Bg+O9N+r/K0AnmINBW06KpfqKwYJbFlFq4qNug==", + "dev": true, + "requires": { + "findup-sync": "^4.0.0", + "merge": "^2.1.0" + } + }, "find-root": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz", @@ -10054,6 +10118,18 @@ "semver-regex": "^3.1.2" } }, + "findup-sync": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-4.0.0.tgz", + "integrity": "sha512-6jvvn/12IC4quLBL1KNokxC7wWTvYncaVUYSoxWw7YykPLuRrnv4qdHcSOywOI5RpkOVGeQRtWM8/q+G6W6qfQ==", + "dev": true, + "requires": { + "detect-file": "^1.0.0", + "is-glob": "^4.0.0", + "micromatch": "^4.0.2", + "resolve-dir": "^1.0.1" + } + }, "flat": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", @@ -10806,6 +10882,12 @@ } } }, + "has-own-prop": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-own-prop/-/has-own-prop-2.0.0.tgz", + "integrity": "sha512-Pq0h+hvsVm6dDEa8x82GnLSYHOzNDt7f0ddFa3FqcQlgzEiptPqL+XrOJNavjOzSYiYWIrgeVYYgGlLmnxwilQ==", + "dev": true + }, "has-symbols": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", @@ -11047,6 +11129,15 @@ "react-is": "^16.7.0" } }, + "homedir-polyfill": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", + "integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==", + "dev": true, + "requires": { + "parse-passwd": "^1.0.0" + } + }, "hosted-git-info": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.0.0.tgz", @@ -13569,6 +13660,12 @@ } } }, + "merge": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/merge/-/merge-2.1.1.tgz", + "integrity": "sha512-jz+Cfrg9GWOZbQAnDQ4hlVnQky+341Yk5ru8bZSe6sIDTCIg8n9i/u7hSQGSVOF3C7lH6mGtqjkiT9G4wFLL0w==", + "dev": true + }, "merge-descriptors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", @@ -14936,6 +15033,12 @@ "lines-and-columns": "^1.1.6" } }, + "parse-passwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", + "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=", + "dev": true + }, "parse-path": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/parse-path/-/parse-path-4.0.3.tgz", @@ -17726,6 +17829,51 @@ "integrity": "sha512-rTuiIEqFmGxne4IovivKSDzld2lWW9QCjqv80SYjPgf+gS35eaCAjaP54CCwGAwBtnCsvNLYtqxe1Nw+i6JEmA==", "dev": true }, + "resolve-dir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz", + "integrity": "sha1-eaQGRMNivoLybv/nOcm7U4IEb0M=", + "dev": true, + "requires": { + "expand-tilde": "^2.0.0", + "global-modules": "^1.0.0" + }, + "dependencies": { + "global-modules": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", + "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", + "dev": true, + "requires": { + "global-prefix": "^1.0.1", + "is-windows": "^1.0.1", + "resolve-dir": "^1.0.0" + } + }, + "global-prefix": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-1.0.2.tgz", + "integrity": "sha1-2/dDxsFJklk8ZVVoy2btMsASLr4=", + "dev": true, + "requires": { + "expand-tilde": "^2.0.2", + "homedir-polyfill": "^1.0.1", + "ini": "^1.3.4", + "is-windows": "^1.0.1", + "which": "^1.2.14" + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, "resolve-from": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", @@ -19812,6 +19960,84 @@ "integrity": "sha512-csd+vJOb/gkzvcCHgTGSChYpy5f1/XKNsmvBGO4JXS+z1v2HobugDz4s1IeFXM3wZB44uczs+eazB5Q/ccdhQw==", "dev": true }, + "tsc-alias": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/tsc-alias/-/tsc-alias-1.2.7.tgz", + "integrity": "sha512-b3DkA1agjntwfPLuR0PEJ2Q5/U+PQBc3UHyqJveW3CRmpKmSat8WqZbRld+lMqO2P+Vh+HRnACHHGrGelEq56A==", + "dev": true, + "requires": { + "@jfonx/console-utils": "^1.0.3", + "@jfonx/file-utils": "^3.0.1", + "chokidar": "^3.5.0", + "commander": "^6.2.1", + "find-node-modules": "^2.1.0", + "globby": "^11.0.2", + "normalize-path": "^3.0.0" + }, + "dependencies": { + "@nodelib/fs.stat": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz", + "integrity": "sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q==", + "dev": true + }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, + "commander": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", + "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", + "dev": true + }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + } + }, + "fast-glob": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", + "integrity": "sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.0", + "merge2": "^1.3.0", + "micromatch": "^4.0.2", + "picomatch": "^2.2.1" + } + }, + "globby": { + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.2.tgz", + "integrity": "sha512-2ZThXDvvV8fYFRVIxnrMQBipZQDr7MxKAmQK1vujaj9/7eF0efG7BPUKJ7jP7G5SLF37xKDXvO4S/KKLj/Z0og==", + "dev": true, + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.1.1", + "ignore": "^5.1.4", + "merge2": "^1.3.0", + "slash": "^3.0.0" + } + }, + "ignore": { + "version": "5.1.8", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", + "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", + "dev": true + } + } + }, "tsconfig-paths": { "version": "3.9.0", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz", diff --git a/package.json b/package.json index 0e66e9d..12d6d4e 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "email": "webistomin@gmail.com", "url": "https://github.com/webistomin" }, - "description": "A fast, lightweight, lazy load vue component acting as a thin layer over the YouTube IFrame Player API which render fast 🚀", + "description": "A fast, lightweight, lazyload vue component acting as a thin layer over the YouTube IFrame Player API which renders fast 🚀", "keywords": [ "youtube", "youtube-iframe", @@ -17,15 +17,26 @@ "vue-youtube" ], "license": "MIT", - "main": "dist/vuetube.ssr.js", + "main": "dist/vuetube.cjs.js", "browser": "dist/vuetube.esm.js", - "module": "dist/vuetube.esm.js", - "unpkg": "dist/vuetube.min.js", - "types": "vuetube.d.ts", + "module": "dist/esm/vuetube.js", + "exports": { + ".": { + "browser": "./dist/vuetube.js", + "require": "./dist/vuetube.cjs.js", + "import": "./dist/esm/vuetube.js", + "default": "./dist/esm/vuetube.js" + }, + "./": "./", + "./package.json": "./package.json" + }, + "unpkg": "dist/vuetube.iife.js", + "jsdelivr": "dist/vuetube.iife.js", + "types": "dist/types/vuetube.d.ts", "files": [ - "dist/*", - "vuetube.d.ts", - "../src/**/*.vue" + "dist", + "src", + "types" ], "reveal": true, "sideEffects": false, @@ -49,6 +60,9 @@ "check-size": "size-limit", "release": "dotenv release-it --verbose" }, + "peerDependencies": { + "vue": "^2.6.12" + }, "dependencies": {}, "devDependencies": { "@babel/core": "^7.13.8", @@ -76,6 +90,7 @@ "@vue/eslint-config-typescript": "^7.0.0", "agadoo": "^2.0.0", "babel-loader": "^8.2.2", + "cross-env": "^7.0.3", "dotenv-cli": "^4.0.0", "eslint": "^7.20.0", "eslint-config-airbnb-typescript": "^12.3.1", @@ -86,7 +101,6 @@ "lint-staged": "^10.5.4", "lodash.findindex": "^4.6.0", "minimist": "^1.2.5", - "cross-env": "^7.0.3", "npm-run-all": "^4.1.5", "release-it": "^14.4.1", "rimraf": "^3.0.2", @@ -95,14 +109,12 @@ "rollup-plugin-terser": "^7.0.2", "rollup-plugin-vue": "^5.1.9", "size-limit": "^4.9.2", + "tsc-alias": "^1.2.7", "typescript": "^4.2.2", "vue": "^2.6.12", "vue-loader": "^15.9.6", "vue-template-compiler": "^2.6.12" }, - "peerDependencies": { - "vue": "^2.6.12" - }, "engines": { "node": ">= 14.15.4", "npm": ">= 6.14.7" diff --git a/src/components/VueTube/VueTube.ts b/src/components/VueTube/VueTube.ts index b1c6ea4..0abb601 100644 --- a/src/components/VueTube/VueTube.ts +++ b/src/components/VueTube/VueTube.ts @@ -1 +1,3 @@ -export default {} +export default { + name: 'VueTube', +}; diff --git a/src/components/VueTube/index.ts b/src/components/VueTube/index.ts new file mode 100644 index 0000000..3652af5 --- /dev/null +++ b/src/components/VueTube/index.ts @@ -0,0 +1,3 @@ +import VueTube from './VueTube'; + +export default VueTube; diff --git a/src/components/index.ts b/src/components/index.ts new file mode 100644 index 0000000..9359cce --- /dev/null +++ b/src/components/index.ts @@ -0,0 +1 @@ +export { default as VueTube } from './VueTube'; diff --git a/src/entry.esm.ts b/src/entry.esm.ts deleted file mode 100644 index 1b818c5..0000000 --- a/src/entry.esm.ts +++ /dev/null @@ -1,25 +0,0 @@ -import _Vue, { PluginObject, VueConstructor } from 'vue'; - -// Import vue component -import component from '@/vuetube.vue'; - -// Define typescript interfaces for installable component -type InstallableComponent = VueConstructor<_Vue> & PluginObject; - -// Default export is installable instance of component. -// IIFE injects install function into component, allowing component -// to be registered via Vue.use() as well as Vue.component(), -export default /*#__PURE__*/((): InstallableComponent => { - // Assign InstallableComponent type - const installable = component as unknown as InstallableComponent; - - // Attach install function executed by Vue.use() - installable.install = (Vue: typeof _Vue) => { - Vue.component('Vuetube', installable); - }; - return installable; -})(); - -// It's possible to expose named exports when writing components that can -// also be used as directives, etc. - eg. import { RollupDemoDirective } from 'rollup-demo'; -// export const RollupDemoDirective = directive; diff --git a/src/entry.ts b/src/entry.ts deleted file mode 100644 index 58aed9a..0000000 --- a/src/entry.ts +++ /dev/null @@ -1,11 +0,0 @@ -// iife/cjs usage extends esm default export - so import it all -import component, * as namedExports from '@/entry.esm'; - -// Attach named exports directly to component. IIFE/CJS will -// only expose one global var, with named exports exposed as properties of -// that global var (eg. plugin.namedExport) -Object.entries(namedExports).forEach(([exportName, exported]) => { - if (exportName !== 'default') component[exportName] = exported; -}); - -export default component as typeof component & Exclude; diff --git a/src/vuetube.d.ts b/src/vuetube.d.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/vuetube.ts b/src/vuetube.ts new file mode 100644 index 0000000..337b524 --- /dev/null +++ b/src/vuetube.ts @@ -0,0 +1,24 @@ +import _Vue, { PluginFunction } from 'vue'; + +/** + * Import vue components + */ +import { VueTube } from '@/components'; + +/** + * Install function executed by Vue.use() + */ +const install: PluginFunction = function installVueTube(Vue: typeof _Vue) { + Vue.component(VueTube.name, VueTube); +}; + +/** + * Create module definition for Vue.use() + */ +export default install; + +/** + * To allow individual component use, export components + * each can be registered via Vue.component() + */ +export { VueTube }; diff --git a/tsconfig.alias.json b/tsconfig.alias.json new file mode 100644 index 0000000..5bd81c5 --- /dev/null +++ b/tsconfig.alias.json @@ -0,0 +1,44 @@ +{ + "compilerOptions": { + "target": "ES2019", + "module": "ESNext", + "strict": true, + "declaration": true, + "declarationDir": "dist/types", + "emitDeclarationOnly": true, + "outDir": "dist", + "noUnusedLocals": true, + "noUnusedParameters": true, + "importHelpers": true, + "moduleResolution": "node", + "experimentalDecorators": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "sourceMap": true, + "baseUrl": ".", + "types": [ + "node", + "vue" + ], + "paths": { + "@/*": [ + "dist/types" + ] + }, + "lib": [ + "esnext", + "dom", + "dom.iterable", + "scripthost" + ] +}, + "include": [ + "src/**/*.ts", +], + "exclude": [ + "node_modules", + "src/**/tests/**", + "src/**/docs/**", + "src/vuetube.ts", +] +} diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json index 56ea08c..76a580a 100644 --- a/tsconfig.eslint.json +++ b/tsconfig.eslint.json @@ -14,7 +14,6 @@ ".storybook/**/*.ts", ".storybook/**/*.js", ".storybook/**/*.vue", - "scripts/**/*.ts", ".eslintrc.js", "lint-staged.config.js", "husky.config.js", diff --git a/tsconfig.package.json b/tsconfig.package.json index 87eaad3..98f6e93 100644 --- a/tsconfig.package.json +++ b/tsconfig.package.json @@ -39,7 +39,6 @@ "node_modules", "src/**/tests/**", "src/**/docs/**", - "src/vue-socials.ts", - "src/vue-socials-esm.ts", + "src/vuetube.ts", ] }