From 7803bdf7975529c07079766112230e18d3e191f1 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sun, 13 Sep 2020 13:37:54 -0700 Subject: [PATCH] fix: remove LEGACY mode (#1867) --- CONTRIBUTING.md | 6 - bin/build-inline-script.js | 6 - package.json | 11 - src/client.js | 1 - .../dialog/components/EmojiDialog.html | 37 - .../dialog/components/MediaAltEditor.html | 34 +- .../_thirdparty/regenerator-runtime/LICENSE | 21 - .../regenerator-runtime/runtime.js | 709 ------------- src/routes/_utils/asyncPolyfills.js | 23 - src/routes/_utils/loadPolyfills.js | 17 +- src/routes/_workers/blurhash.js | 1 - src/service-worker.js | 1 - webpack/client.config.js | 5 +- webpack/legacyBabel.config.js | 42 - webpack/server.config.js | 4 +- webpack/service-worker.config.js | 7 - webpack/shared.config.js | 27 +- yarn.lock | 957 +----------------- 18 files changed, 36 insertions(+), 1873 deletions(-) delete mode 100644 src/routes/_thirdparty/regenerator-runtime/LICENSE delete mode 100644 src/routes/_thirdparty/regenerator-runtime/runtime.js delete mode 100644 webpack/legacyBabel.config.js diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0473597a..86f1a980 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -138,12 +138,6 @@ updating the `fixtures/` should make that a no-op. There are also some unit tests that run in Node using Mocha. You can find them in `tests/unit` and run them using `yarn run test-unit`. -## Legacy build - -Pinafore also offers a "legacy" build designed for older browsers. To build this version, use: - - LEGACY=1 yarn build - ## Debug build To disable minification in a production build (for debugging purposes), you can run: diff --git a/bin/build-inline-script.js b/bin/build-inline-script.js index 2a18dd5e..ffb1ce9e 100644 --- a/bin/build-inline-script.js +++ b/bin/build-inline-script.js @@ -6,7 +6,6 @@ import { rollup } from 'rollup' import { terser } from 'rollup-plugin-terser' import replace from '@rollup/plugin-replace' import fromPairs from 'lodash-es/fromPairs' -import babel from 'rollup-plugin-babel' import { themes } from '../src/routes/_static/themes' import terserOptions from './terserOptions' @@ -22,13 +21,8 @@ export async function buildInlineScript () { plugins: [ replace({ 'process.browser': true, - 'process.env.LEGACY': JSON.stringify(process.env.LEGACY), 'process.env.THEME_COLORS': JSON.stringify(themeColors) }), - process.env.LEGACY && babel({ - runtimeHelpers: true, - presets: ['@babel/preset-env'] - }), !process.env.DEBUG && terser(terserOptions) ] }) diff --git a/package.json b/package.json index 6de3f5c4..ab3c995e 100644 --- a/package.json +++ b/package.json @@ -43,16 +43,8 @@ "build-vercel-json": "node -r esm bin/build-vercel-json.js" }, "dependencies": { - "@babel/core": "^7.10.5", - "@babel/plugin-transform-runtime": "^7.10.5", - "@babel/preset-env": "^7.10.4", - "@babel/runtime": "^7.10.5", "@rollup/plugin-replace": "^2.3.3", - "@webcomponents/custom-elements": "^1.4.1", - "@webcomponents/shadydom": "^1.7.3", - "array-flat-polyfill": "^1.0.1", "arrow-key-navigation": "^1.2.0", - "babel-loader": "^8.1.0", "blurhash": "^1.1.3", "cheerio": "^1.0.0-rc.3", "child-process-promise": "^2.2.1", @@ -75,9 +67,6 @@ "focus-visible": "^5.1.0", "form-data": "^3.0.0", "glob": "^7.1.6", - "indexeddb-getall-shim": "^1.3.6", - "intersection-observer": "^0.11.0", - "intl": "^1.2.5", "li": "^1.3.0", "localstorage-memory": "^1.0.3", "lodash-es": "^4.17.15", diff --git a/src/client.js b/src/client.js index 5681eae1..7bb5a668 100644 --- a/src/client.js +++ b/src/client.js @@ -1,4 +1,3 @@ -import './routes/_thirdparty/regenerator-runtime/runtime.js' import * as sapper from '../__sapper__/client.js' import './routes/_utils/serviceWorkerClient' import './routes/_utils/historyEvents' diff --git a/src/routes/_components/dialog/components/EmojiDialog.html b/src/routes/_components/dialog/components/EmojiDialog.html index 9235aee8..87edd5a1 100644 --- a/src/routes/_components/dialog/components/EmojiDialog.html +++ b/src/routes/_components/dialog/components/EmojiDialog.html @@ -68,40 +68,6 @@ import { doubleRAF } from '../../../_utils/doubleRAF' import { convertCustomEmojiToEmojiPickerFormat } from '../../../_utils/convertCustomEmojiToEmojiPickerFormat' - function applyShadowDomPolyfill (picker) { - // polyfill for :host, plus other fixes mostly targeted at KaiOS. - // We could use shadycss, but it doesn't really work for our use case (has to be injected - // into the web component's connectedCallback directly). - const style = picker.shadowRoot.querySelector('style') - style.remove() - if (!document.getElementById('emoji-picker-style')) { - let css = style.textContent - css = css.replace(/:host\(([.*?])\)/g, 'emoji-picker$1') - css = css.replace(/:host/g, 'emoji-picker') - css = css.replace(/\*/g, 'emoji-picker *') - css = css.replace(/\b(button|input|input\[type=search\])\s*\{/, 'emoji-picker $1{') - // fixes for KaiOS style bugs - css += ` - emoji-picker .emoji-menu { - grid-template-columns: repeat(8, 1fr); - } - - @media screen and (max-width: 320px) { - emoji-picker .emoji-menu { - grid-template-columns: repeat(6, 1fr); - } - .emoji-container { - width: calc(100% - 20px); - } - } - ` - const newStyle = document.createElement('style') - newStyle.id = 'emoji-picker-style' - newStyle.textContent = css - document.head.appendChild(newStyle) - } - } - export default { async oncreate () { onCreateDialog.call(this) @@ -117,9 +83,6 @@ } applyFocusVisiblePolyfill(picker.shadowRoot) registerShadowRoot(picker.shadowRoot) - if (process.env.LEGACY && !HTMLElement.prototype.attachShadow.toString().includes('[native code]')) { - applyShadowDomPolyfill(picker) - } this.on('destroy', () => unregisterShadowRoot(picker.shadowRoot)) if (!isUserTouching) { // auto focus the input on desktop doubleRAF(() => { // triple rAF because a11y tries to focus as well diff --git a/src/routes/_components/dialog/components/MediaAltEditor.html b/src/routes/_components/dialog/components/MediaAltEditor.html index ed35ebb7..e1d1d564 100644 --- a/src/routes/_components/dialog/components/MediaAltEditor.html +++ b/src/routes/_components/dialog/components/MediaAltEditor.html @@ -20,24 +20,21 @@ max={mediaAltCharLimit} style="width: 100%; text-align: right;" /> - - {#if !legacy} - - + - {/if} + {extractButtonText} + +