chore(builder): Upgrade to Parcel 2

This commit is contained in:
Tixie 2021-10-14 02:18:34 +02:00
parent c2c4dfb4a7
commit 37e4fbe2d4
31 changed files with 3677 additions and 18423 deletions

View file

@ -1,5 +0,0 @@
{
"plugins": [
["@babel/plugin-transform-runtime"]
]
}

View file

@ -1,23 +1,20 @@
module.exports = {
'env': {
'es6': true,
'node': true
env: {
es6: true,
node: true
},
'extends': [
extends: [
'standard',
'plugin:vue/essential'
],
'globals': {
'Atomics': 'readonly',
'SharedArrayBuffer': 'readonly'
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly'
},
'parserOptions': {
'ecmaVersion': 2018,
},
'plugins': [
plugins: [
'vue'
],
'rules': {
rules: {
'no-console': 'off',
'no-debugger': 'off',
'vue/html-end-tags': 'error',

2
.gitignore vendored
View file

@ -1,6 +1,6 @@
.DS_Store
node_modules
.cache
.parcel-cache
/dist
# local env files

View file

@ -1,4 +0,0 @@
{
"recognizeSelfClosing": true,
"lowerCaseAttributeNames": false
}

21788
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -11,39 +11,35 @@
"lint-fix": "eslint --ext .js,vue . --fix"
},
"dependencies": {
"@babel/runtime": "^7.6.3",
"@vue/compat": "^3.2.20",
"folktale": "^2.3.2",
"generic-pool": "^3.7.1",
"gif-writer": "^0.9.3",
"objectFitPolyfill": "^2.3.0",
"parcel": "^2.0.0",
"postcss-modules": "^1.4.1",
"vue": "^2.6.10",
"vue-router": "^3.1.3",
"vuex": "^3.1.1"
"vue": "^3.2.20",
"vue-router": "^4.0.11",
"vuex": "^4.0.2"
},
"devDependencies": {
"@babel/core": "^7.6.4",
"@babel/plugin-transform-runtime": "^7.6.2",
"@vue/component-compiler-utils": "^3.0.0",
"@parcel/packager-raw-url": "^2.0.0",
"@parcel/transformer-vue": "^2.0.0",
"@parcel/transformer-webmanifest": "^2.0.0",
"@vue/compiler-sfc": "^3.2.20",
"autoprefixer": "^9.7.0",
"eslint": "^6.5.1",
"eslint-config-standard": "^14.1.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"eslint-plugin-vue": "^5.2.3",
"parcel-bundler": "^1.12.4",
"eslint": "^8.0.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-vue": "^7.19.1",
"parcel-plugin-static-files-copy": "^2.4.3",
"parcel-plugin-sw-precache": "^1.1.1",
"vue-hot-reload-api": "^2.3.4",
"vue-template-compiler": "^2.6.10"
},
"staticFiles": {
"staticPath": "public",
"watcherGlob": "**"
},
"sw-precache": {
"maximumFileSizeToCacheInBytes": 10485760
}
}

View file

@ -6,7 +6,7 @@
</template>
<script>
import RefreshBanner from '/views/components/refresh'
import RefreshBanner from '~/src/views/components/refresh'
export default {
name: 'souvenir',
@ -30,5 +30,5 @@ export default {
</script>
<style lang="css">
@import '/assets/css/style.css';
@import '~/src/assets/css/style.css';
</style>

View file

@ -7,7 +7,7 @@
font-weight: normal;
font-style: normal;
font-family: "Roboto";
src: url("/fonts/Roboto.woff") format("woff"), local("Roboto");
src: url("~/src/fonts/Roboto.woff") format("woff"), local("Roboto");
}
@font-face {
@ -15,5 +15,5 @@
font-weight: bold;
font-style: normal;
font-family: "Roboto";
src: url("/fonts/Roboto-bold.woff") format("woff"), local("Roboto");
src: url("~/src/fonts/Roboto-bold.woff") format("woff"), local("Roboto");
}

View file

@ -11,7 +11,7 @@ body {
flex-direction: column;
justify-content: center;
min-height: 100%;
background: var(--color-tertiary) url("/assets/img/dotgrid.png");
background: var(--color-tertiary) url("~/src/assets/img/dotgrid.png");
color: var(--color-light-text);
font-family: var(--fontstack);

View file

@ -38,7 +38,7 @@
.options__select {
padding-right: 4.4rem;
background: url("/assets/img/ico-arrow.svg") no-repeat;
background: url("~/src/assets/img/ico-arrow.svg") no-repeat;
background-position: calc(100% - 2rem) center;
}
@ -57,7 +57,7 @@
bottom: 1.5rem;
width: 1.8rem;
height: 1.5rem;
background: url("/assets/img/boomerang-check.svg");
background: url("~/src/assets/img/boomerang-check.svg");
content: "";
animation: btnOptionArrive .5s cubic-bezier(.18,.89,.32,1.28);
animation-delay: 100ms;

View file

@ -2,63 +2,63 @@
/* == config */
/* ----------------------------------------------------------- */
@import "/assets/css/colors.css";
@import "/assets/css/config.css";
@import "./colors.css";
@import "./config.css";
/* ----------------------------------------------------------- */
/* == core */
/* ----------------------------------------------------------- */
@import "/assets/css/1-core/_00-reset.css";
@import "/assets/css/1-core/_01-typography.css";
@import "./1-core/_00-reset.css";
@import "./1-core/_01-typography.css";
/* ----------------------------------------------------------- */
/* == components */
/* ----------------------------------------------------------- */
@import "/assets/css/2-components/_buttons.css";
@import "./2-components/_buttons.css";
/* ----------------------------------------------------------- */
/* == base */
/* ----------------------------------------------------------- */
@import "/assets/css/3-base/_01-fonts.css";
@import "/assets/css/3-base/_02-main.css";
@import "/assets/css/3-base/_03-layout.css";
@import "./3-base/_01-fonts.css";
@import "./3-base/_02-main.css";
@import "./3-base/_03-layout.css";
/* ----------------------------------------------------------- */
/* == modules */
/* ----------------------------------------------------------- */
@import "/assets/css/4-modules/options.css";
@import "/assets/css/4-modules/preview.css";
@import "/assets/css/4-modules/progress-bar.css";
@import "/assets/css/4-modules/encoding.css";
@import "/assets/css/4-modules/refresh-banner.css";
@import "./4-modules/options.css";
@import "./4-modules/preview.css";
@import "./4-modules/progress-bar.css";
@import "./4-modules/encoding.css";
@import "./4-modules/refresh-banner.css";
/* ----------------------------------------------------------- */
/* == screens */
/* ----------------------------------------------------------- */
@import "/assets/css/5-screens/welcome.css";
@import "/assets/css/5-screens/capture.css";
@import "/assets/css/5-screens/preview.css";
@import "/assets/css/5-screens/download.css";
@import "./5-screens/welcome.css";
@import "./5-screens/capture.css";
@import "./5-screens/preview.css";
@import "./5-screens/download.css";
/* ----------------------------------------------------------- */
/* == helpers */
/* ----------------------------------------------------------- */
@import "/assets/css/6-helpers/_alignment.css";
@import "/assets/css/6-helpers/_spacing.css";
@import "/assets/css/6-helpers/_width.css";
@import "./6-helpers/_alignment.css";
@import "./6-helpers/_spacing.css";
@import "./6-helpers/_width.css";
/* ----------------------------------------------------------- */
/* == rwd */
/* ----------------------------------------------------------- */
@import "/assets/css/7-rwd/_rwd-xsmall.css";
@import "/assets/css/7-rwd/_rwd-small.css";
@import "/assets/css/7-rwd/_rwd-medium.css";
@import "/assets/css/7-rwd/_rwd-large.css";
@import "/assets/css/7-rwd/_rwd-landscape.css";
@import "./7-rwd/_rwd-xsmall.css";
@import "./7-rwd/_rwd-small.css";
@import "./7-rwd/_rwd-medium.css";
@import "./7-rwd/_rwd-large.css";
@import "./7-rwd/_rwd-landscape.css";

View file

@ -6,15 +6,15 @@
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta name="msapplication-TileColor" content="#8420a7">
<meta name="theme-color" content="#212045">
<link rel="apple-touch-icon" sizes="180x180" href="/assets/img/icons/apple-touch-icon.png">
<link rel="icon" href="/favicon.ico">
<link rel="icon" type="image/png" sizes="32x32" href="/assets/img/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/assets/img/icons/favicon-16x16.png">
<link rel="manifest" href="/manifest.webmanifest">
<link rel="apple-touch-icon" sizes="180x180" href="./assets/img/icons/apple-touch-icon.png">
<link rel="icon" href="./favicon.ico">
<link rel="icon" type="image/png" sizes="32x32" href="./assets/img/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="./assets/img/icons/favicon-16x16.png">
<link rel="manifest" href="./manifest.webmanifest">
<title>Souvenir ∴ Capture few seconds as a gif for souvenir</title>
<!-- Open Graph -->
<meta property="og:image" content="/assets/img/icons/android-chrome-512x512.png">
<meta property="og:image" content="./assets/img/icons/android-chrome-512x512.png">
<meta property="og:image:width" content="512">
<meta property="og:image:height" content="512">
<meta property="og:title" content="Souvenir">
@ -24,7 +24,7 @@
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Souvenir">
<meta name="twitter:description" content="Capture few seconds as a gif, for souvenir ~">
<meta name="twitter:image" content="/assets/img/icons/android-chrome-192x192.png">
<meta name="twitter:image" content="./assets/img/icons/android-chrome-192x192.png">
</head>
<body>
@ -32,6 +32,6 @@
<strong>We're sorry but souvenir doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<script src="/main.js"></script>
<script type="module" src="./main.js"></script>
</body>
</html>

View file

@ -1,22 +1,19 @@
import Vue from 'vue'
import App from '/App.vue'
import router from '/router'
import store from '/store'
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import registerServiceWorker from '/register-service-worker.js'
import registerServiceWorker from './register-service-worker.js'
import LayoutDefault from '/views/layout/default'
import LayoutOverlay from '/views/layout/overlay'
Vue.component('layout-default', LayoutDefault)
Vue.component('layout-overlay', LayoutOverlay)
import LayoutDefault from '~/src/views/layout/default.vue'
import LayoutOverlay from '~/src/views/layout/overlay.vue'
Vue.config.productionTip = false
new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')
createApp(App)
.use(store)
.use(router)
.component('layout-default', LayoutDefault)
.component('layout-overlay', LayoutOverlay)
.mount('#app')
registerServiceWorker()

View file

@ -3,12 +3,12 @@
"short_name": "Souvenir",
"icons": [
{
"src": "/assets/img/icons/android-chrome-192x192.png",
"src": "~/src/assets/img/icons/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/assets/img/icons/android-chrome-512x512.png",
"src": "~/src/assets/img/icons/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}

View file

@ -1,4 +1,4 @@
import store from '/store'
import store from '~/src/store'
const isLocalhost = Boolean(
window.location.hostname === 'localhost' ||

View file

@ -1,20 +1,17 @@
import Vue from 'vue'
import VueRouter from 'vue-router'
import { createRouter, createWebHistory } from 'vue-router'
import Welcome from '/views/screens/welcome'
import Capture from '/views/screens/capture'
import Preview from '/views/screens/preview'
import Download from '/views/screens/download'
Vue.use(VueRouter)
export default new VueRouter({
mode: 'history',
import Welcome from '~/src/views/screens/welcome.vue'
import Capture from '~/src/views/screens/capture.vue'
import Preview from '~/src/views/screens/preview.vue'
import Download from '~/src/views/screens/download.vue'
const Router = createRouter({
history: createWebHistory(),
routes: [
{ name: 'home', path: '/', component: Welcome },
{ name: 'capture', path: '/capture', component: Capture },
{ name: 'preview', path: '/preview', component: Preview },
{ name: 'download', path: '/download', component: Download },
{ path: '*', redirect: { name: 'home' } }
{ path: '/:catchAll(.*)', redirect: { name: 'home' } }
]
})
export default Router

View file

@ -1,11 +1,11 @@
import { task, of as taskOf } from 'folktale/concurrency/task'
import { makeRectangle, crop } from '/services/rectangle.js'
import { makeRectangle, crop } from '~/src/services/rectangle.js'
import {
GIF_WIDTH,
GIF_HEIGHT,
GIF_FRAME_RATE
} from '/constants.js'
} from '~/src/constants.js'
export function capture ({ mediaStream, facingMode }, duration, progressCallback) {
const delayTime = 1000 / GIF_FRAME_RATE

View file

@ -1,5 +1,5 @@
import genericPool from 'generic-pool'
import { calcProgress } from '/services/util.js'
import { calcProgress } from '~/src/services/util.js'
import {
task,
do as taskDo,
@ -8,7 +8,7 @@ import {
waitAll
} from 'folktale/concurrency/task'
import { GIF_PALETTE_SIZE } from '/constants.js'
import { GIF_PALETTE_SIZE } from '~/src/constants.js'
export function encode ({ imageDataList, imageWidth, imageHeight, delayTime }, { boomerangEffect }, progressCallback) {
return taskDo(function * () {
@ -32,7 +32,7 @@ export function encode ({ imageDataList, imageWidth, imageHeight, delayTime }, {
function quantizeColorImageDataList (imageDataList, paletteSize, progressCallback) {
return task((resolver) => {
const workerPool = genericPool.createPool({
create: () => new Worker('/services/quantize-color.worker.js'),
create: () => new Worker(new URL('~/src/services/quantize-color.worker.js', import.meta.url), { type: 'module' }),
destroy: worker => worker.terminate()
}, {
min: 0,
@ -105,7 +105,7 @@ function writeBlob (
onProgress
) {
return task((resolver) => {
const worker = new Worker('/services/write-gif.worker.js')
const worker = new Worker(new URL('~/src/services/write-gif.worker.js', import.meta.url), { type: 'module' })
resolver.cleanup(() => {
worker.terminate()

View file

@ -1,4 +1,4 @@
import { convertImageDataToIndexedColorImage } from '/services/quantize-color.js'
import { convertImageDataToIndexedColorImage } from '~/src/services/quantize-color.js'
onmessage = event => {
const { imageData, paletteSize } = event.data

View file

@ -1,6 +1,6 @@
import { GifWriter } from 'gif-writer'
import { boomerang } from '/services/effects.js'
import { pipe, calcProgress } from '/services/util.js'
import { boomerang } from '~/src/services/effects.js'
import { pipe, calcProgress } from '~/src/services/util.js'
class OutputStream {
constructor () {

View file

@ -1,4 +1,4 @@
import { write } from '/services/write-gif.js'
import { write } from '~/src/services/write-gif.js'
const postProgressMessage = value => postMessage({ type: 'progress', payload: { value } })
const postDoneMessage = buffer => postMessage({ type: 'done', payload: { buffer } })

View file

@ -1,24 +1,22 @@
import Vue from 'vue'
import Vuex from 'vuex'
import { createStore } from 'vuex'
import { getCamera } from '~/src/services/camera.js'
import { getCamera } from '/services/camera.js'
Vue.use(Vuex)
export default new Vuex.Store({
export default createStore({
strict: process.env.NODE_ENV !== 'production',
state: {
cameraShouldFaceUser: true,
duration: {
selected: 2,
list: [2, 3, 5]
},
boomerang: false,
timer: 0,
camera: null,
capture: null,
gif: null,
needRefresh: false
state () {
return {
cameraShouldFaceUser: true,
duration: {
selected: 2,
list: [2, 3, 5]
},
boomerang: false,
timer: 0,
camera: null,
capture: null,
gif: null,
needRefresh: false
}
},
mutations: {
updateCameraShouldFaceUser (state, cameraShouldFaceUser) {

View file

@ -27,9 +27,9 @@
<script>
import { mapState } from 'vuex'
import iconBoomerang from '/views/icons/ico-boomerang'
import iconTimer from '/views/icons/ico-timer'
import iconDisabled from '/views/icons/ico-disabled'
import iconBoomerang from '~/src/views/icons/ico-boomerang.vue'
import iconTimer from '~/src/views/icons/ico-timer.vue'
import iconDisabled from '~/src/views/icons/ico-disabled.vue'
export default {
name: 'captureOptions',

View file

@ -4,8 +4,8 @@
<script>
import { mapState } from 'vuex'
import { boomerang } from '/services/effects.js'
import { pipe, cycle } from '/services/util.js'
import { boomerang } from '~/src/services/effects.js'
import { pipe, cycle } from '~/src/services/util.js'
export default {
name: 'previewCanvas',

View file

@ -9,7 +9,7 @@
</template>
<script>
import IconClose from '/views/icons/ico-close'
import IconClose from '~/src/views/icons/ico-close.vue'
import { mapState } from 'vuex'

View file

@ -8,7 +8,7 @@
</template>
<script>
import iconClose from '/views/icons/ico-close-overlay'
import iconClose from '~/src/views/icons/ico-close-overlay.vue'
export default {
components: {

View file

@ -25,17 +25,17 @@
</template>
<script>
import captureOptions from '/views/components/capture-options'
import captureProgress from '/views/components/capture-progress'
import captureTimer from '/views/components/capture-timer'
import { capture } from '/services/capture.js'
import { countdown } from '/services/countdown.js'
import captureOptions from '~/src/views/components/capture-options.vue'
import captureProgress from '~/src/views/components/capture-progress.vue'
import captureTimer from '~/src/views/components/capture-timer.vue'
import { capture } from '~/src/services/capture.js'
import { countdown } from '~/src/services/countdown.js'
import 'objectFitPolyfill'
import { mapState } from 'vuex'
import iconSwitch from '/views/icons/ico-switch'
import iconSwitch from '~/src/views/icons/ico-switch.vue'
export default {
name: 'capture',
@ -62,15 +62,15 @@ export default {
shouldFlip () {
if (this.camera) {
switch (this.camera.facingMode) {
default:
throw new Error('Unhandled case')
case 'user':
case 'unknow':
return true
case 'environment':
return false
default:
throw new Error('Unhandled case')
}
} else {
return false

View file

@ -20,11 +20,11 @@
<script>
import { mapState } from 'vuex'
import { encode } from '/services/encode.js'
import encodingScreen from '/views/screens/encoding'
import iconDl from '/views/icons/ico-download'
import illuFlower from '/views/icons/flower'
import appLogo from '/assets/img/icons/android-chrome-512x512.png'
import { encode } from '~/src/services/encode.js'
import encodingScreen from '~/src/views/screens/encoding.vue'
import iconDl from '~/src/views/icons/ico-download.vue'
import illuFlower from '~/src/views/icons/flower.vue'
import appLogo from '~/src/assets/img/icons/android-chrome-512x512.png'
export default {
name: 'download',

View file

@ -20,9 +20,9 @@
</template>
<script>
import encodingLoader from '/views/components/encoding-loader'
import previewCanvas from '/views/components/preview-canvas'
import iconNotif from '/views/icons/ico-notif'
import encodingLoader from '~/src/views/components/encoding-loader.vue'
import previewCanvas from '~/src/views/components/preview-canvas.vue'
import iconNotif from '~/src/views/icons/ico-notif.vue'
export default {
name: 'encoding',

View file

@ -13,8 +13,8 @@
</template>
<script>
import captureOptions from '/views/components/capture-options'
import previewCanvas from '/views/components/preview-canvas'
import captureOptions from '~/src/views/components/capture-options.vue'
import previewCanvas from '~/src/views/components/preview-canvas.vue'
import { mapState } from 'vuex'

View file

@ -16,7 +16,7 @@
</template>
<script>
import illuWelcome from '/views/components/illu-welcome'
import illuWelcome from '~/src/views/components/illu-welcome.vue'
export default {
name: 'welcome',