From 6a71878a98f77797aa869e137b4524b40a0c3c3c Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Fri, 20 Jan 2023 11:15:39 -0800 Subject: [PATCH] First attempt at adopting Parcel (#1186) * Upgrade sharp * First attempt at adopting Parcel * Get multiple targets working for Parcel * Use lts node for Netlify deploy * Update deploy script to reflect new demo site dir * Inline css into library bundles * More updates * Remove uri optimization * Upgrade parcel * Fix butterchurn logo import for Parcel * Add browser build * List browser build * Prefer jest-swc to babel * Preserve old build artifact location * Ignore dist * Minify library bundles * Switch to postcss to use uri optimization plugin * Serve from the correct location * Clarifying comments * Ignore bundle reports in git * Refine Parcel builds * Try to be more explicit with port * Use relative path to create build dir * Try to force supporting chrome 76 * Update the location of the test skin in integration test to work with Parcel --- .github/workflows/ci.yml | 1 + .gitignore | 5 +- .parcelrc | 3 + .prettierignore | 1 + babel.config.js | 6 - config/jest.unit.js | 3 + deploy.sh | 2 +- netlify.toml | 2 +- package.json | 12 +- packages/skin-museum-og/package-lock.json | 637 --- packages/webamp/.eslintignore | 1 + packages/webamp/config/jest.integration.js | 1 + packages/webamp/config/jest.unit.js | 2 +- packages/webamp/config/webpack.library.js | 77 - packages/webamp/demo/config/webpack.common.js | 86 - packages/webamp/demo/config/webpack.dev.js | 18 - packages/webamp/demo/config/webpack.prod.js | 30 - packages/webamp/demo/index.html | 33 +- packages/webamp/demo/js/avaliableSkins.ts | 14 +- packages/webamp/demo/js/config.ts | 2 +- packages/webamp/demo/js/index.tsx | 8 +- packages/webamp/demo/js/webampConfig.ts | 2 +- packages/webamp/jest-puppeteer.config.js | 8 +- .../js/__tests__/baseline.integration-test.js | 7 +- packages/webamp/js/components/App.tsx | 6 +- packages/webamp/js/webampBrowser.js | 3 + packages/webamp/js/webampLazyBrowser.js | 3 + packages/webamp/package.json | 105 +- packages/webamp/postcss.config.js | 3 + packages/webamp/scripts/moveLibrary.js | 41 + yarn.lock | 4152 ++++++++--------- 31 files changed, 2067 insertions(+), 3207 deletions(-) create mode 100644 .parcelrc delete mode 100644 babel.config.js delete mode 100644 packages/skin-museum-og/package-lock.json delete mode 100644 packages/webamp/config/webpack.library.js delete mode 100644 packages/webamp/demo/config/webpack.common.js delete mode 100644 packages/webamp/demo/config/webpack.dev.js delete mode 100644 packages/webamp/demo/config/webpack.prod.js create mode 100644 packages/webamp/js/webampBrowser.js create mode 100644 packages/webamp/js/webampLazyBrowser.js create mode 100644 packages/webamp/postcss.config.js create mode 100644 packages/webamp/scripts/moveLibrary.js diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df076639..7caeaa50 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,7 @@ jobs: yarn workspace ani-cursor build yarn workspace webamp build yarn workspace webamp build-library + yarn workspace webamp move-library - name: Lint run: | yarn lint diff --git a/.gitignore b/.gitignore index 55371e5c..a876d52e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ node_modules -.vscode \ No newline at end of file +.vscode +.parcel-cache +dist +parcel-bundle-reports \ No newline at end of file diff --git a/.parcelrc b/.parcelrc new file mode 100644 index 00000000..47d1b5e3 --- /dev/null +++ b/.parcelrc @@ -0,0 +1,3 @@ +{ + "extends": "@parcel/config-default" +} diff --git a/.prettierignore b/.prettierignore index 3b682f96..514a00e6 100644 --- a/.prettierignore +++ b/.prettierignore @@ -2,5 +2,6 @@ packages/webamp/demo/built/ packages/webamp/built/ +packages/webamp/dist/ packages/webamp-modern/build/ packages/webamp-modern/tools/eslint-rules/dist/ \ No newline at end of file diff --git a/babel.config.js b/babel.config.js deleted file mode 100644 index dd242dc9..00000000 --- a/babel.config.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - presets: [ - ["@babel/preset-env", { targets: { node: "current" } }], - "@babel/preset-typescript", - ], -}; diff --git a/config/jest.unit.js b/config/jest.unit.js index 33cd86ac..edb3b958 100644 --- a/config/jest.unit.js +++ b/config/jest.unit.js @@ -13,4 +13,7 @@ module.exports = { ], testEnvironment: "jsdom", setupFiles: ["/packages/skin-database/jest-setup.js"], + transform: { + "^.+\\.(t|j)sx?$": ["@swc/jest"], + }, }; diff --git a/deploy.sh b/deploy.sh index a1c2f5a4..d010ef32 100755 --- a/deploy.sh +++ b/deploy.sh @@ -3,4 +3,4 @@ yarn workspace ani-cursor build yarn workspace webamp build yarn workspace webamp build-library yarn workspace webamp-modern build -mv packages/webamp-modern/build packages/webamp/demo/built/modern \ No newline at end of file +mv packages/webamp-modern/build packages/webamp/dist/demo-site/modern \ No newline at end of file diff --git a/netlify.toml b/netlify.toml index 850f84e6..9cf50e73 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,6 +1,6 @@ [build] command = "yarn deploy" - publish = "packages/webamp/demo/built" + publish = "packages/webamp/dist/demo-site/" # A short URL for listeners of https://changelog.com/podcast/291 [[redirects]] diff --git a/package.json b/package.json index 13344b9c..bdddc24a 100644 --- a/package.json +++ b/package.json @@ -16,12 +16,19 @@ }, "devDependencies": { "@babel/preset-typescript": "^7.16.7", + "@parcel/optimizer-data-url": "2.7.0", + "@parcel/transformer-inline-string": "^2.8.2", + "@swc/core": "^1.3.24", + "@swc/jest": "^0.2.24", "@typescript-eslint/parser": "^5.13.0", + "assert": "^2.0.0", "eslint": "^8.14.0", "eslint-config-react-app": "^7.0.1", "eslint-plugin-prettier": "^4.0.0", + "events": "^3.3.0", "jest": "^27.5.1", - "prettier": "^2.3.2" + "prettier": "^2.3.2", + "stream-browserify": "^3.0.0" }, "prettier": { "trailingComma": "es5" @@ -30,5 +37,6 @@ "projects": [ "config/jest.*.js" ] - } + }, + "dependencies": {} } diff --git a/packages/skin-museum-og/package-lock.json b/packages/skin-museum-og/package-lock.json deleted file mode 100644 index 4d964ddf..00000000 --- a/packages/skin-museum-og/package-lock.json +++ /dev/null @@ -1,637 +0,0 @@ -{ - "name": "skin-museum-og", - "version": "0.1.0", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "name": "skin-museum-og", - "version": "0.1.0", - "dependencies": { - "next": "13.0.3", - "react": "18.2.0", - "react-dom": "18.2.0" - } - }, - "node_modules/@next/env": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/@next/env/-/env-13.0.3.tgz", - "integrity": "sha512-/4WzeG61Ot/PxsghXkSqQJ6UohFfwXoZ3dtsypmR9EBP+OIax9JRq0trq8Z/LCT9Aq4JbihVkaazRWguORjTAw==" - }, - "node_modules/@next/swc-android-arm-eabi": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-13.0.3.tgz", - "integrity": "sha512-uxfUoj65CdFc1gX2q7GtBX3DhKv9Kn343LMqGNvXyuTpYTGMmIiVY7b9yF8oLWRV0gVKqhZBZifUmoPE8SJU6Q==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-android-arm64": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/@next/swc-android-arm64/-/swc-android-arm64-13.0.3.tgz", - "integrity": "sha512-t2k+WDfg7Cq2z/EnalKGsd/9E5F4Hdo1xu+UzZXYDpKUI9zgE6Bz8ajQb8m8txv3qOaWdKuDa5j5ziq9Acd1Xw==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-darwin-arm64": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.0.3.tgz", - "integrity": "sha512-wV6j6SZ1bc/YHOLCLk9JVqaZTCCey6HBV7inl2DriHsHqIcO6F3+QiYf0KXwRP9BE0GSZZrYd5mZQm2JPTHdJA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-darwin-x64": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.0.3.tgz", - "integrity": "sha512-jaI2CMuYWvUtRixV3AIjUhnxUDU1FKOR+8hADMhYt3Yz+pCKuj4RZ0n0nY5qUf3qT1AtvnJXEgyatSFJhSp/wQ==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-freebsd-x64": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/@next/swc-freebsd-x64/-/swc-freebsd-x64-13.0.3.tgz", - "integrity": "sha512-nbyT0toBTJrcj5TCB9pVnQpGJ3utGyQj4CWegZs1ulaeUQ5Z7CS/qt8nRyYyOKYHtOdSCJ9Nw5F/RgKNkdpOdw==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-arm-gnueabihf": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-13.0.3.tgz", - "integrity": "sha512-1naLxYvRUQCoFCU1nMkcQueRc0Iux9xBv1L5pzH2ejtIWFg8BrSgyuluJG4nyAhFCx4WG863IEIkAaefOowVdA==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-arm64-gnu": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.0.3.tgz", - "integrity": "sha512-3Z4A8JkuGWpMVbUhUPQInK/SLY+kijTT78Q/NZCrhLlyvwrVxaQALJNlXzxDLraUgv4oVH0Wz/FIw1W9PUUhxA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-arm64-musl": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.0.3.tgz", - "integrity": "sha512-MoYe9SM40UaunTjC+01c9OILLH3uSoeri58kDMu3KF/EFEvn1LZ6ODeDj+SLGlAc95wn46hrRJS2BPmDDE+jFQ==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-x64-gnu": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.0.3.tgz", - "integrity": "sha512-z22T5WGnRanjLMXdF0NaNjSpBlEzzY43t5Ysp3nW1oI6gOkub6WdQNZeHIY7A2JwkgSWZmtjLtf+Fzzz38LHeQ==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-x64-musl": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.0.3.tgz", - "integrity": "sha512-ZOMT7zjBFmkusAtr47k8xs/oTLsNlTH6xvYb+iux7yly2hZGwhfBLzPGBsbeMZukZ96IphJTagT+C033s6LNVA==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-win32-arm64-msvc": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.0.3.tgz", - "integrity": "sha512-Q4BM16Djl+Oah9UdGrvjFYgoftYB2jNd+rtRGPX5Mmxo09Ry/KiLbOZnoUyoIxKc1xPyfqMXuaVsAFQLYs0KEQ==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-win32-ia32-msvc": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.0.3.tgz", - "integrity": "sha512-Sa8yGkNeRUsic8Qjf7MLIAfP0p0+einK/wIqJ8UO1y76j+8rRQu42AMs5H4Ax1fm9GEYq6I8njHtY59TVpTtGQ==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-win32-x64-msvc": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.0.3.tgz", - "integrity": "sha512-IAptmSqA7k4tQzaw2NAkoEjj3+Dz9ceuvlEHwYh770MMDL4V0ku2m+UHrmn5HUCEDHhgwwjg2nyf6728q2jr1w==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@swc/helpers": { - "version": "0.4.11", - "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.4.11.tgz", - "integrity": "sha512-rEUrBSGIoSFuYxwBYtlUFMlE2CwGhmW+w9355/5oduSw8e5h2+Tj4UrAGNNgP9915++wj5vkQo0UuOBqOAq4nw==", - "dependencies": { - "tslib": "^2.4.0" - } - }, - "node_modules/caniuse-lite": { - "version": "1.0.30001431", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001431.tgz", - "integrity": "sha512-zBUoFU0ZcxpvSt9IU66dXVT/3ctO1cy4y9cscs1szkPlcWb6pasYM144GqrUygUbT+k7cmUCW61cvskjcv0enQ==", - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/caniuse-lite" - } - ] - }, - "node_modules/client-only": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", - "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==" - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" - }, - "node_modules/loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "dependencies": { - "js-tokens": "^3.0.0 || ^4.0.0" - }, - "bin": { - "loose-envify": "cli.js" - } - }, - "node_modules/nanoid": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", - "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==", - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/next": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/next/-/next-13.0.3.tgz", - "integrity": "sha512-rFQeepcenRxKzeKlh1CsmEnxsJwhIERtbUjmYnKZyDInZsU06lvaGw5DT44rlNp1Rv2MT/e9vffZ8vK+ytwXHA==", - "dependencies": { - "@next/env": "13.0.3", - "@swc/helpers": "0.4.11", - "caniuse-lite": "^1.0.30001406", - "postcss": "8.4.14", - "styled-jsx": "5.1.0", - "use-sync-external-store": "1.2.0" - }, - "bin": { - "next": "dist/bin/next" - }, - "engines": { - "node": ">=14.6.0" - }, - "optionalDependencies": { - "@next/swc-android-arm-eabi": "13.0.3", - "@next/swc-android-arm64": "13.0.3", - "@next/swc-darwin-arm64": "13.0.3", - "@next/swc-darwin-x64": "13.0.3", - "@next/swc-freebsd-x64": "13.0.3", - "@next/swc-linux-arm-gnueabihf": "13.0.3", - "@next/swc-linux-arm64-gnu": "13.0.3", - "@next/swc-linux-arm64-musl": "13.0.3", - "@next/swc-linux-x64-gnu": "13.0.3", - "@next/swc-linux-x64-musl": "13.0.3", - "@next/swc-win32-arm64-msvc": "13.0.3", - "@next/swc-win32-ia32-msvc": "13.0.3", - "@next/swc-win32-x64-msvc": "13.0.3" - }, - "peerDependencies": { - "fibers": ">= 3.1.0", - "node-sass": "^6.0.0 || ^7.0.0", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "sass": "^1.3.0" - }, - "peerDependenciesMeta": { - "fibers": { - "optional": true - }, - "node-sass": { - "optional": true - }, - "sass": { - "optional": true - } - } - }, - "node_modules/picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" - }, - "node_modules/postcss": { - "version": "8.4.14", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.14.tgz", - "integrity": "sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig==", - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - } - ], - "dependencies": { - "nanoid": "^3.3.4", - "picocolors": "^1.0.0", - "source-map-js": "^1.0.2" - }, - "engines": { - "node": "^10 || ^12 || >=14" - } - }, - "node_modules/react": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", - "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", - "dependencies": { - "loose-envify": "^1.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/react-dom": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", - "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", - "dependencies": { - "loose-envify": "^1.1.0", - "scheduler": "^0.23.0" - }, - "peerDependencies": { - "react": "^18.2.0" - } - }, - "node_modules/scheduler": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", - "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", - "dependencies": { - "loose-envify": "^1.1.0" - } - }, - "node_modules/source-map-js": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", - "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/styled-jsx": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.0.tgz", - "integrity": "sha512-/iHaRJt9U7T+5tp6TRelLnqBqiaIT0HsO0+vgyj8hK2KUk7aejFqRrumqPUlAqDwAj8IbS/1hk3IhBAAK/FCUQ==", - "dependencies": { - "client-only": "0.0.1" - }, - "engines": { - "node": ">= 12.0.0" - }, - "peerDependencies": { - "react": ">= 16.8.0 || 17.x.x || ^18.0.0-0" - }, - "peerDependenciesMeta": { - "@babel/core": { - "optional": true - }, - "babel-plugin-macros": { - "optional": true - } - } - }, - "node_modules/tslib": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", - "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" - }, - "node_modules/use-sync-external-store": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz", - "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==", - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0" - } - } - }, - "dependencies": { - "@next/env": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/@next/env/-/env-13.0.3.tgz", - "integrity": "sha512-/4WzeG61Ot/PxsghXkSqQJ6UohFfwXoZ3dtsypmR9EBP+OIax9JRq0trq8Z/LCT9Aq4JbihVkaazRWguORjTAw==" - }, - "@next/swc-android-arm-eabi": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-13.0.3.tgz", - "integrity": "sha512-uxfUoj65CdFc1gX2q7GtBX3DhKv9Kn343LMqGNvXyuTpYTGMmIiVY7b9yF8oLWRV0gVKqhZBZifUmoPE8SJU6Q==", - "optional": true - }, - "@next/swc-android-arm64": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/@next/swc-android-arm64/-/swc-android-arm64-13.0.3.tgz", - "integrity": "sha512-t2k+WDfg7Cq2z/EnalKGsd/9E5F4Hdo1xu+UzZXYDpKUI9zgE6Bz8ajQb8m8txv3qOaWdKuDa5j5ziq9Acd1Xw==", - "optional": true - }, - "@next/swc-darwin-arm64": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.0.3.tgz", - "integrity": "sha512-wV6j6SZ1bc/YHOLCLk9JVqaZTCCey6HBV7inl2DriHsHqIcO6F3+QiYf0KXwRP9BE0GSZZrYd5mZQm2JPTHdJA==", - "optional": true - }, - "@next/swc-darwin-x64": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.0.3.tgz", - "integrity": "sha512-jaI2CMuYWvUtRixV3AIjUhnxUDU1FKOR+8hADMhYt3Yz+pCKuj4RZ0n0nY5qUf3qT1AtvnJXEgyatSFJhSp/wQ==", - "optional": true - }, - "@next/swc-freebsd-x64": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/@next/swc-freebsd-x64/-/swc-freebsd-x64-13.0.3.tgz", - "integrity": "sha512-nbyT0toBTJrcj5TCB9pVnQpGJ3utGyQj4CWegZs1ulaeUQ5Z7CS/qt8nRyYyOKYHtOdSCJ9Nw5F/RgKNkdpOdw==", - "optional": true - }, - "@next/swc-linux-arm-gnueabihf": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-13.0.3.tgz", - "integrity": "sha512-1naLxYvRUQCoFCU1nMkcQueRc0Iux9xBv1L5pzH2ejtIWFg8BrSgyuluJG4nyAhFCx4WG863IEIkAaefOowVdA==", - "optional": true - }, - "@next/swc-linux-arm64-gnu": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.0.3.tgz", - "integrity": "sha512-3Z4A8JkuGWpMVbUhUPQInK/SLY+kijTT78Q/NZCrhLlyvwrVxaQALJNlXzxDLraUgv4oVH0Wz/FIw1W9PUUhxA==", - "optional": true - }, - "@next/swc-linux-arm64-musl": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.0.3.tgz", - "integrity": "sha512-MoYe9SM40UaunTjC+01c9OILLH3uSoeri58kDMu3KF/EFEvn1LZ6ODeDj+SLGlAc95wn46hrRJS2BPmDDE+jFQ==", - "optional": true - }, - "@next/swc-linux-x64-gnu": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.0.3.tgz", - "integrity": "sha512-z22T5WGnRanjLMXdF0NaNjSpBlEzzY43t5Ysp3nW1oI6gOkub6WdQNZeHIY7A2JwkgSWZmtjLtf+Fzzz38LHeQ==", - "optional": true - }, - "@next/swc-linux-x64-musl": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.0.3.tgz", - "integrity": "sha512-ZOMT7zjBFmkusAtr47k8xs/oTLsNlTH6xvYb+iux7yly2hZGwhfBLzPGBsbeMZukZ96IphJTagT+C033s6LNVA==", - "optional": true - }, - "@next/swc-win32-arm64-msvc": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.0.3.tgz", - "integrity": "sha512-Q4BM16Djl+Oah9UdGrvjFYgoftYB2jNd+rtRGPX5Mmxo09Ry/KiLbOZnoUyoIxKc1xPyfqMXuaVsAFQLYs0KEQ==", - "optional": true - }, - "@next/swc-win32-ia32-msvc": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.0.3.tgz", - "integrity": "sha512-Sa8yGkNeRUsic8Qjf7MLIAfP0p0+einK/wIqJ8UO1y76j+8rRQu42AMs5H4Ax1fm9GEYq6I8njHtY59TVpTtGQ==", - "optional": true - }, - "@next/swc-win32-x64-msvc": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.0.3.tgz", - "integrity": "sha512-IAptmSqA7k4tQzaw2NAkoEjj3+Dz9ceuvlEHwYh770MMDL4V0ku2m+UHrmn5HUCEDHhgwwjg2nyf6728q2jr1w==", - "optional": true - }, - "@swc/helpers": { - "version": "0.4.11", - "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.4.11.tgz", - "integrity": "sha512-rEUrBSGIoSFuYxwBYtlUFMlE2CwGhmW+w9355/5oduSw8e5h2+Tj4UrAGNNgP9915++wj5vkQo0UuOBqOAq4nw==", - "requires": { - "tslib": "^2.4.0" - } - }, - "caniuse-lite": { - "version": "1.0.30001431", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001431.tgz", - "integrity": "sha512-zBUoFU0ZcxpvSt9IU66dXVT/3ctO1cy4y9cscs1szkPlcWb6pasYM144GqrUygUbT+k7cmUCW61cvskjcv0enQ==" - }, - "client-only": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", - "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==" - }, - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" - }, - "loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "requires": { - "js-tokens": "^3.0.0 || ^4.0.0" - } - }, - "nanoid": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", - "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==" - }, - "next": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/next/-/next-13.0.3.tgz", - "integrity": "sha512-rFQeepcenRxKzeKlh1CsmEnxsJwhIERtbUjmYnKZyDInZsU06lvaGw5DT44rlNp1Rv2MT/e9vffZ8vK+ytwXHA==", - "requires": { - "@next/env": "13.0.3", - "@next/swc-android-arm-eabi": "13.0.3", - "@next/swc-android-arm64": "13.0.3", - "@next/swc-darwin-arm64": "13.0.3", - "@next/swc-darwin-x64": "13.0.3", - "@next/swc-freebsd-x64": "13.0.3", - "@next/swc-linux-arm-gnueabihf": "13.0.3", - "@next/swc-linux-arm64-gnu": "13.0.3", - "@next/swc-linux-arm64-musl": "13.0.3", - "@next/swc-linux-x64-gnu": "13.0.3", - "@next/swc-linux-x64-musl": "13.0.3", - "@next/swc-win32-arm64-msvc": "13.0.3", - "@next/swc-win32-ia32-msvc": "13.0.3", - "@next/swc-win32-x64-msvc": "13.0.3", - "@swc/helpers": "0.4.11", - "caniuse-lite": "^1.0.30001406", - "postcss": "8.4.14", - "styled-jsx": "5.1.0", - "use-sync-external-store": "1.2.0" - } - }, - "picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" - }, - "postcss": { - "version": "8.4.14", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.14.tgz", - "integrity": "sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig==", - "requires": { - "nanoid": "^3.3.4", - "picocolors": "^1.0.0", - "source-map-js": "^1.0.2" - } - }, - "react": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", - "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", - "requires": { - "loose-envify": "^1.1.0" - } - }, - "react-dom": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", - "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", - "requires": { - "loose-envify": "^1.1.0", - "scheduler": "^0.23.0" - } - }, - "scheduler": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", - "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", - "requires": { - "loose-envify": "^1.1.0" - } - }, - "source-map-js": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", - "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==" - }, - "styled-jsx": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.0.tgz", - "integrity": "sha512-/iHaRJt9U7T+5tp6TRelLnqBqiaIT0HsO0+vgyj8hK2KUk7aejFqRrumqPUlAqDwAj8IbS/1hk3IhBAAK/FCUQ==", - "requires": { - "client-only": "0.0.1" - } - }, - "tslib": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", - "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" - }, - "use-sync-external-store": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz", - "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==", - "requires": {} - } - } -} diff --git a/packages/webamp/.eslintignore b/packages/webamp/.eslintignore index 6a659d86..7b8f38be 100644 --- a/packages/webamp/.eslintignore +++ b/packages/webamp/.eslintignore @@ -1,5 +1,6 @@ *.min.js built/ +dist/ coverage/ **/node_modules/ examples/webpack/bundle.js diff --git a/packages/webamp/config/jest.integration.js b/packages/webamp/config/jest.integration.js index 719f1d02..e9477375 100644 --- a/packages/webamp/config/jest.integration.js +++ b/packages/webamp/config/jest.integration.js @@ -1,3 +1,4 @@ +// See jest-puppeteer.config.js for the config that setups the web server. module.exports = { displayName: "integration-test", rootDir: "../", diff --git a/packages/webamp/config/jest.unit.js b/packages/webamp/config/jest.unit.js index 479702bf..315840b5 100644 --- a/packages/webamp/config/jest.unit.js +++ b/packages/webamp/config/jest.unit.js @@ -12,7 +12,7 @@ module.exports = { "\\.mp3$": "/js/__mocks__/fileMock.js", }, transform: { - "^.+\\.(js|ts|tsx)$": "babel-jest", + "^.+\\.(t|j)sx?$": ["@swc/jest"], }, testPathIgnorePatterns: ["/node_modules/"], testEnvironment: "jsdom", diff --git a/packages/webamp/config/webpack.library.js b/packages/webamp/config/webpack.library.js deleted file mode 100644 index 70f0bad1..00000000 --- a/packages/webamp/config/webpack.library.js +++ /dev/null @@ -1,77 +0,0 @@ -const path = require("path"); -const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer"); -const TerserPlugin = require("terser-webpack-plugin"); - -module.exports = { - devtool: "source-map", - mode: "production", - resolve: { - extensions: [".js", ".ts", ".tsx"], - }, - module: { - rules: [ - { - test: /\.css$/, - use: [ - "style-loader", - { loader: "css-loader", options: { importLoaders: 1 } }, - // We really only need this in prod. We could find a way to disable it in dev. - { - loader: "postcss-loader", - options: { - plugins: [ - require("cssnano"), - require("../scripts/postcss-optimize-data-uri-pngs"), - ], - }, - }, - ], - }, - { - test: /\.(js|ts|tsx)$/, - exclude: /(node_modules)/, - use: { - loader: "babel-loader", - options: { - envName: "library", - }, - }, - }, - ], - noParse: [/jszip\.js$/], - }, - plugins: [ - new BundleAnalyzerPlugin({ - analyzerMode: "static", - reportFilename: "library-report.html", - openAnalyzer: false, - }), - ], - performance: { - // We do some crazy shit okay! Don't judge! - maxEntrypointSize: 9000000, - maxAssetSize: 9000000, - }, - optimization: { - minimize: true, - minimizer: [ - new TerserPlugin({ - // This allows us to produce both minfied and unminified files. - test: /\.min\.js$/i, - }), - ], - }, - entry: { - bundle: "./js/webamp.js", - "bundle.min": "./js/webamp.js", - "lazy-bundle": "./js/webampLazy.tsx", - "lazy-bundle.min": "./js/webampLazy.tsx", - }, - output: { - path: path.resolve(__dirname, "../built"), - filename: "webamp.[name].js", - library: "Webamp", - libraryTarget: "umd", - libraryExport: "default", - }, -}; diff --git a/packages/webamp/demo/config/webpack.common.js b/packages/webamp/demo/config/webpack.common.js deleted file mode 100644 index 5596c066..00000000 --- a/packages/webamp/demo/config/webpack.common.js +++ /dev/null @@ -1,86 +0,0 @@ -const path = require("path"); -const HtmlWebpackPlugin = require("html-webpack-plugin"); -const CopyWebpackPlugin = require("copy-webpack-plugin"); - -module.exports = { - resolve: { - extensions: [".js", ".ts", ".tsx"], - }, - module: { - rules: [ - { - test: /\.css$/, - use: [ - "style-loader", - { loader: "css-loader", options: { importLoaders: 1 } }, - // We really only need this in prod. We could find a way to disable it in dev. - { - loader: "postcss-loader", - options: { - plugins: [ - require("cssnano"), - require("../../scripts/postcss-optimize-data-uri-pngs"), - ], - }, - }, - ], - }, - { - test: /\.(js|ts|tsx)?$/, - exclude: /(node_modules)/, - use: { - loader: "babel-loader", - options: { - envName: "production", - }, - }, - }, - { - test: /\.(wsz|wal|mp3|png|ico|jpg|svg)$/, - use: [ - { - loader: "file-loader", - options: { - emitFile: true, - name: "[path][name]-[hash].[ext]", - }, - }, - ], - }, - ], - noParse: [/jszip\.js$/], - }, - plugins: [ - new HtmlWebpackPlugin({ - template: "./index.html", - chunks: ["webamp"], - }), - new CopyWebpackPlugin([ - { - from: "./js/delete-service-worker.js", - to: "service-worker.js", - force: true, - }, - { - from: "../assets", - to: "assets", - }, - ]), - ], - - performance: { - // We do some crazy shit okay! Don't judge! - maxEntrypointSize: 7000000, - maxAssetSize: 7000000, - }, - entry: { - webamp: ["./js/index.tsx"], - }, - context: path.resolve(__dirname, "../"), - output: { - filename: "[name]-[hash].js", - chunkFilename: "[name]-[hash].js", - publicPath: "/", - path: path.resolve(__dirname, "../built"), - }, -}; diff --git a/packages/webamp/demo/config/webpack.dev.js b/packages/webamp/demo/config/webpack.dev.js deleted file mode 100644 index d824b5cf..00000000 --- a/packages/webamp/demo/config/webpack.dev.js +++ /dev/null @@ -1,18 +0,0 @@ -const webpack = require("webpack"); -const merge = require("webpack-merge"); -const common = require("./webpack.common.js"); - -module.exports = merge(common, { - devtool: "eval-cheap-module-source-map", - mode: "development", - devServer: { - overlay: true, - }, - plugins: [ - new webpack.DefinePlugin({ - SENTRY_DSN: JSON.stringify( - "https://c8c64ef822f54240901bc64f88c234d8@sentry.io/146022" - ), - }), - ], -}); diff --git a/packages/webamp/demo/config/webpack.prod.js b/packages/webamp/demo/config/webpack.prod.js deleted file mode 100644 index b66f08f9..00000000 --- a/packages/webamp/demo/config/webpack.prod.js +++ /dev/null @@ -1,30 +0,0 @@ -const webpack = require("webpack"); -const merge = require("webpack-merge"); -const GitRevisionPlugin = require("git-revision-webpack-plugin"); -const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer"); - -const common = require("./webpack.common.js"); - -const gitRevisionPlugin = new GitRevisionPlugin(); - -const config = merge(common, { - devtool: "source-map", - mode: "production", - plugins: [ - new BundleAnalyzerPlugin({ - analyzerMode: "static", - reportFilename: "prod-report.html", - openAnalyzer: false, - }), - new webpack.DefinePlugin({ - SENTRY_DSN: JSON.stringify( - "https://12b6be8ef7c44f28ac37ab5ed98fd294@sentry.io/146021" - ), - COMMITHASH: JSON.stringify(gitRevisionPlugin.commithash()), - }), - ], -}); - -config.entry.webamp.unshift("./js/googleAnalytics.min.js"); - -module.exports = config; diff --git a/packages/webamp/demo/index.html b/packages/webamp/demo/index.html index d97c42ee..7c2b3090 100755 --- a/packages/webamp/demo/index.html +++ b/packages/webamp/demo/index.html @@ -15,20 +15,10 @@ /> - - - + + + + @@ -37,17 +27,7 @@ name="google-site-verification" content="ycocEnfUpYf8u_UmzpqSe0gNooPs0PBjbD7HKw-qa5I" /> - - - -