From e71811acad53b2d9c50f23788c24218c077bf051 Mon Sep 17 00:00:00 2001 From: Natan Yellin Date: Sat, 18 Sep 2021 17:37:10 +0300 Subject: [PATCH 01/10] generate dev environment, add component, and add example dev tooling was automatically generated using https://www.npmjs.com/package/vue-sfc-rollup --- .browserslistrc | 3 + .gitignore | 21 + babel.config.js | 17 + build/rollup.config.js | 180 + dev/serve.ts | 10 + dev/serve.vue | 43 + package-lock.json | 14799 +++++++++++++++++++++ package.json | 78 + shims-vue.d.ts | 6 + src/components/index.ts | 2 + src/components/vue-vega.vue | 35 + src/{ => composition}/useVega.ts | 9 +- src/{ => composition}/useVegaEmbed.ts | 8 +- src/{ => composition}/useVegaUpdaters.ts | 0 src/{ => composition}/utils/index.ts | 0 src/{ => composition}/utils/signals.ts | 0 src/{ => composition}/utils/typings.ts | 1 + src/{ => composition}/utils/update.ts | 0 src/entry.esm.ts | 21 + src/entry.ts | 17 + src/index.ts | 3 - tsconfig.json | 44 + 22 files changed, 15288 insertions(+), 9 deletions(-) create mode 100644 .browserslistrc create mode 100644 .gitignore create mode 100644 babel.config.js create mode 100644 build/rollup.config.js create mode 100644 dev/serve.ts create mode 100644 dev/serve.vue create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 shims-vue.d.ts create mode 100644 src/components/index.ts create mode 100644 src/components/vue-vega.vue rename src/{ => composition}/useVega.ts (86%) rename src/{ => composition}/useVegaEmbed.ts (85%) rename src/{ => composition}/useVegaUpdaters.ts (100%) rename src/{ => composition}/utils/index.ts (100%) rename src/{ => composition}/utils/signals.ts (100%) rename src/{ => composition}/utils/typings.ts (93%) rename src/{ => composition}/utils/update.ts (100%) create mode 100644 src/entry.esm.ts create mode 100644 src/entry.ts delete mode 100644 src/index.ts create mode 100644 tsconfig.json 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/.gitignore b/.gitignore new file mode 100644 index 0000000..e36f407 --- /dev/null +++ b/.gitignore @@ -0,0 +1,21 @@ +.DS_Store +node_modules/ +/dist/ + +# local env files +.env.local +.env.*.local + +# Log files +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw* diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 0000000..92ae825 --- /dev/null +++ b/babel.config.js @@ -0,0 +1,17 @@ +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)/ + // ], + }, + ], + '@babel/preset-typescript', +]; +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..b7659de --- /dev/null +++ b/build/rollup.config.js @@ -0,0 +1,180 @@ +// 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 ttypescript from 'ttypescript'; +import typescript from 'rollup-plugin-typescript2'; +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.ts', + plugins: { + preVue: [ + alias({ + entries: [ + { + find: '@', + replacement: `${path.resolve(projectRoot, 'src')}`, + }, + ], + }), + ], + replace: { + 'process.env.NODE_ENV': JSON.stringify('production'), + }, + vue: { + }, + postVue: [ + resolve({ + extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue'], + }), + // Process only `