"@vue/compiler-sfc": "^3.0.0-rc.9",
"@vue/server-renderer": "^3.0.0-rc.5",
"axios": "^0.20.0",
+ "brotli": "^1.3.2",
"browserstack-local": "^1.4.5",
"chalk": "^4.1.0",
"chromedriver": "^85.0.0",
__TEST__: isBundlerESMBuild ? `(process.env.NODE_ENV === 'test')` : false,
// If the build is expected to run directly in the browser (global / esm builds)
__BROWSER__: isBrowserBuild,
+ __FEATURE_PROD_DEVTOOLS__: isBundlerESMBuild
+ ? `__VUE_PROD_DEVTOOLS__`
+ : false,
// is targeting bundlers?
__BUNDLER__: isBundlerESMBuild,
__GLOBAL__: isGlobalBuild,
--- /dev/null
+const fs = require('fs')
+const path = require('path')
+const chalk = require('chalk')
+const { gzipSync } = require('zlib')
+const { compress } = require('brotli')
+
+function checkFileSize(filePath) {
+ if (!fs.existsSync(filePath)) {
+ return
+ }
+ const file = fs.readFileSync(filePath)
+ const minSize = (file.length / 1024).toFixed(2) + 'kb'
+ const gzipped = gzipSync(file)
+ const gzippedSize = (gzipped.length / 1024).toFixed(2) + 'kb'
+ const compressed = compress(file)
+ const compressedSize = (compressed.length / 1024).toFixed(2) + 'kb'
+ console.log(
+ `${chalk.gray(
+ chalk.bold(path.basename(filePath))
+ )} min:${minSize} / gzip:${gzippedSize} / brotli:${compressedSize}`
+ )
+}
+
+checkFileSize(path.resolve(__dirname, '../size-checks/dist/webRouter.js'))
--- /dev/null
+import path from 'path'
+import ts from 'rollup-plugin-typescript2'
+import replace from '@rollup/plugin-replace'
+import resolve from '@rollup/plugin-node-resolve'
+import commonjs from '@rollup/plugin-commonjs'
+import { terser } from 'rollup-plugin-terser'
+
+/** @type {import('rollup').RollupOptions} */
+const config = {
+ external: ['vue'],
+ output: {
+ file: path.resolve(__dirname, './dist/webRouter.js'),
+ format: 'es',
+ },
+ input: path.resolve(__dirname, './webRouter.js'),
+ plugins: [
+ replace({
+ __DEV__: false,
+ // this is only used during tests
+ __TEST__: false,
+ // If the build is expected to run directly in the browser (global / esm builds)
+ __BROWSER__: true,
+ // is targeting bundlers?
+ __BUNDLER__: false,
+ __GLOBAL__: false,
+ // is targeting Node (SSR)?
+ __NODE_JS__: false,
+ __VUE_PROD_DEVTOOLS__: false,
+ }),
+ ts({
+ check: false,
+ tsconfig: path.resolve(__dirname, '../tsconfig.json'),
+ cacheRoot: path.resolve(__dirname, '../node_modules/.rts2_cache'),
+ tsconfigOverride: {
+ compilerOptions: {
+ sourceMap: false,
+ declaration: false,
+ declarationMap: false,
+ },
+ exclude: ['__tests__', 'test-dts'],
+ },
+ }),
+ resolve(),
+ commonjs(),
+ terser({
+ format: {
+ comments: false,
+ },
+ module: true,
+ compress: {
+ ecma: 2015,
+ pure_getters: true,
+ },
+ }),
+ ],
+}
+
+export default config
// Global compile-time constants
declare var __DEV__: boolean
+declare var __FEATURE_PROD_DEVTOOLS__: boolean
declare var __BROWSER__: boolean
declare var __CI__: boolean
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c=
-base64-js@^1.0.2:
+base64-js@^1.0.2, base64-js@^1.1.2:
version "1.3.1"
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.1.tgz#58ece8cb75dd07e71ed08c736abc5fac4dbf8df1"
integrity sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==
dependencies:
duplexer "0.1.1"
+brotli@^1.3.2:
+ version "1.3.2"
+ resolved "https://registry.yarnpkg.com/brotli/-/brotli-1.3.2.tgz#525a9cad4fcba96475d7d388f6aecb13eed52f46"
+ integrity sha1-UlqcrU/LqWR119OI9q7LE+7VL0Y=
+ dependencies:
+ base64-js "^1.1.2"
+
browser-process-hrtime@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz#3c9b4b7d782c8121e56f10106d84c0d0ffc94626"