From b5248edce21b184e061ed64f4bbb8d6f4c93c996 Mon Sep 17 00:00:00 2001 From: Mauricio Walters Date: Tue, 2 Mar 2021 11:53:36 -0800 Subject: [PATCH 01/10] Bump peer dependecy on vue --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 53c3c83..c60f425 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "webpack-dev-server": "^3.1.8" }, "peerDependencies": { - "vue": "^2.6.10" + "vue": "^3.0.0" }, "license": "MIT", "browserslist": [ From 618e20376c3f5adb852e22630a377e605040f44a Mon Sep 17 00:00:00 2001 From: nvitius Date: Fri, 30 Apr 2021 23:15:49 -0600 Subject: [PATCH 02/10] Vue 3 compatibility --- .browserslistrc | 3 + babel.config.js | 16 + build/rollup.config.js | 172 +++++ dev/serve.js | 5 + dev/serve.vue | 17 + dist/vue-infinite-loading.esm.js | 788 +++++++++++++++++++++++ dist/vue-infinite-loading.js | 6 - dist/vue-infinite-loading.min.js | 1 + dist/vue-infinite-loading.ssr.js | 811 ++++++++++++++++++++++++ package.json | 69 +- src/components/InfiniteLoading.vue | 214 ++++--- src/components/Spinner.vue | 110 +--- src/entry.esm.js | 21 + src/entry.js | 11 + src/eventHub.js | 8 + src/index.js | 35 - test/unit/index.js | 2 +- test/unit/specs/InfiniteLoading.spec.js | 2 +- test/unit/specs/index.spec.js | 2 + 19 files changed, 2034 insertions(+), 259 deletions(-) create mode 100644 .browserslistrc create mode 100644 babel.config.js create mode 100644 build/rollup.config.js create mode 100644 dev/serve.js create mode 100644 dev/serve.vue create mode 100644 dist/vue-infinite-loading.esm.js delete mode 100644 dist/vue-infinite-loading.js create mode 100644 dist/vue-infinite-loading.min.js create mode 100644 dist/vue-infinite-loading.ssr.js create mode 100644 src/entry.esm.js create mode 100644 src/entry.js create mode 100644 src/eventHub.js delete mode 100644 src/index.js diff --git a/.browserslistrc b/.browserslistrc new file mode 100644 index 0000000..b29aeba --- /dev/null +++ b/.browserslistrc @@ -0,0 +1,3 @@ +current node +last 2 versions and > 2% +ie > 10 diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 0000000..de59089 --- /dev/null +++ b/babel.config.js @@ -0,0 +1,16 @@ +const devPresets = ['@vue/babel-preset-app']; +const buildPresets = [ + [ + '@babel/preset-env', + // Config for @babel/preset-env + { + // Example: Always transpile optional chaining/nullish coalescing + // include: [ + // /(optional-chaining|nullish-coalescing)/ + // ], + }, + ], +]; +module.exports = { + presets: (process.env.NODE_ENV === 'development' ? devPresets : buildPresets), +}; diff --git a/build/rollup.config.js b/build/rollup.config.js new file mode 100644 index 0000000..dd41f12 --- /dev/null +++ b/build/rollup.config.js @@ -0,0 +1,172 @@ +// rollup.config.js +import fs from 'fs'; +import path from 'path'; +import vue from 'rollup-plugin-vue'; +import alias from '@rollup/plugin-alias'; +import commonjs from '@rollup/plugin-commonjs'; +import resolve from '@rollup/plugin-node-resolve'; +import replace from '@rollup/plugin-replace'; +import babel from '@rollup/plugin-babel'; +import PostCSS from 'rollup-plugin-postcss'; +import { terser } from 'rollup-plugin-terser'; +import minimist from 'minimist'; + +// Get browserslist config and remove ie from es build targets +const esbrowserslist = fs.readFileSync('./.browserslistrc') + .toString() + .split('\n') + .filter((entry) => entry && entry.substring(0, 2) !== 'ie'); + +// Extract babel preset-env config, to combine with esbrowserslist +const babelPresetEnvConfig = require('../babel.config') + .presets.filter((entry) => entry[0] === '@babel/preset-env')[0][1]; + +const argv = minimist(process.argv.slice(2)); + +const projectRoot = path.resolve(__dirname, '..'); + +const baseConfig = { + input: 'src/entry.js', + plugins: { + preVue: [ + alias({ + entries: [ + { + find: '@', + replacement: `${path.resolve(projectRoot, 'src')}`, + }, + ], + }), + ], + replace: { + 'process.env.NODE_ENV': JSON.stringify('production'), + }, + vue: { + preprocessStyles: true + }, + postVue: [ + resolve({ + extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue'], + }), + // Process only ` diff --git a/src/components/Spinner.vue b/src/components/Spinner.vue index 25a8674..e39e740 100644 --- a/src/components/Spinner.vue +++ b/src/components/Spinner.vue @@ -1,102 +1,40 @@