diff --git a/.github/workflows/compressed-size.yml b/.github/workflows/compressed-size.yml deleted file mode 100644 index 0c35f0a..0000000 --- a/.github/workflows/compressed-size.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Compressed Size - -on: - pull_request_target: - branches: - - main - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Use Node.js LTS - uses: actions/setup-node@v3 - with: - node-version-file: '.nvmrc' - cache: 'yarn' - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn config get cacheFolder)" - - uses: actions/cache@v3 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - name: Install Dependencies - run: yarn install - - uses: preactjs/compressed-size-action@v2 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - pattern: 'dist/**/*.{js,css,html,json}' - compression: 'brotli' diff --git a/docs/next.config.js b/docs/next.config.js index a541b84..ee314a3 100644 --- a/docs/next.config.js +++ b/docs/next.config.js @@ -1,3 +1,5 @@ +const { PerfseePlugin } = require('@perfsee/webpack') + const withNextra = require('nextra')({ theme: 'nextra-theme-docs', themeConfig: './theme.config.js', @@ -16,6 +18,20 @@ const nextConfig = { ], experimental: { externalDir: true + }, + webpack: (config, { dev, isServer }) => { + if (!isServer && !dev) { + config.devtool = 'hidden-nosources-source-map' + const perfsee = new PerfseePlugin({ + project: 'affine-toeverything' + }) + if (Array.isArray(config.plugins)) { + config.plugins.push(perfsee) + } else { + config.plugins = [perfsee] + } + } + return config } } diff --git a/docs/package.json b/docs/package.json index 085fe0f..67e553e 100644 --- a/docs/package.json +++ b/docs/package.json @@ -19,6 +19,7 @@ "react-dom": "^18.2.0" }, "devDependencies": { + "@perfsee/webpack": "^1.5.0", "@types/node": "^18.14.6", "@types/react": "^18.0.28", "@types/react-dom": "^18.0.11", diff --git a/yarn.lock b/yarn.lock index 9009f58..db4a65c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2547,6 +2547,13 @@ __metadata: languageName: node linkType: hard +"@eyhn/msgpack-stream@npm:^2.8.4": + version: 2.8.4 + resolution: "@eyhn/msgpack-stream@npm:2.8.4" + checksum: d0e6a237cec21ffd90e768dcf51a43ef9085e44a1adb7d0986c3df1e4e796da99a0b647e6e6c0eb92823e0e8be55f37a04939fb1d98f129b65907b68e1d504a7 + languageName: node + linkType: hard + "@fal-works/esbuild-plugin-global-externals@npm:^2.1.2": version: 2.1.2 resolution: "@fal-works/esbuild-plugin-global-externals@npm:2.1.2" @@ -3063,6 +3070,22 @@ __metadata: languageName: node linkType: hard +"@kwsites/file-exists@npm:^1.1.1": + version: 1.1.1 + resolution: "@kwsites/file-exists@npm:1.1.1" + dependencies: + debug: ^4.1.1 + checksum: 4ff945de7293285133aeae759caddc71e73c4a44a12fac710fdd4f574cce2671a3f89d8165fdb03d383cfc97f3f96f677d8de3c95133da3d0e12a123a23109fe + languageName: node + linkType: hard + +"@kwsites/promise-deferred@npm:^1.1.1": + version: 1.1.1 + resolution: "@kwsites/promise-deferred@npm:1.1.1" + checksum: 07455477a0123d9a38afb503739eeff2c5424afa8d3dbdcc7f9502f13604488a4b1d9742fc7288832a52a6422cf1e1c0a1d51f69a39052f14d27c9a0420b6629 + languageName: node + linkType: hard + "@mdx-js/mdx@npm:^2.2.1": version: 2.2.1 resolution: "@mdx-js/mdx@npm:2.2.1" @@ -3568,6 +3591,70 @@ __metadata: languageName: node linkType: hard +"@perfsee/bundle-analyzer@npm:1.4.0": + version: 1.4.0 + resolution: "@perfsee/bundle-analyzer@npm:1.4.0" + dependencies: + "@eyhn/msgpack-stream": ^2.8.4 + "@perfsee/utils": 1.3.0 + acorn: ^8.7.1 + acorn-walk: ^8.2.0 + htmlparser2: ^8.0.1 + lodash: ^4.17.21 + query-string: ^7.1.1 + tar: ^6.1.11 + tslib: ^2.4.0 + checksum: c95b149a1c16fc1a338808eb294a41fcbcff5a0025d8dce25b2c20f934530278783a0b39f7dca279759c8da2f5eaead265fe03c775f24f3d4c8dfa314ea0d5e4 + languageName: node + linkType: hard + +"@perfsee/plugin-utils@npm:1.5.0": + version: 1.5.0 + resolution: "@perfsee/plugin-utils@npm:1.5.0" + dependencies: + "@eyhn/msgpack-stream": ^2.8.4 + "@perfsee/bundle-analyzer": 1.4.0 + "@perfsee/utils": 1.3.0 + chalk: ^4.1.2 + debug: 4.3.4 + env-ci: ^7.2.1 + find-cache-dir: ^3.3.2 + lodash: ^4.17.21 + node-fetch: ^2.6.2 + open: ^8.4.2 + query-string: ^7.1.1 + simple-git: ^3.15.0 + table: ^6.8.0 + tar: ^6.1.11 + tslib: ^2.4.0 + uuid: ^9.0.0 + checksum: 77a6944dba45f2d710f269ec10777fb6db8529a5975bdb9946defb8160056c114af0492e33ad7e54624de2d3e8a6de238d867edad21119c0dec9ff7525f1a757 + languageName: node + linkType: hard + +"@perfsee/utils@npm:1.3.0": + version: 1.3.0 + resolution: "@perfsee/utils@npm:1.3.0" + dependencies: + tslib: ^2.4.0 + checksum: 0434601b1d1f65d5419b8da73a363dd46037c0bd3678374d3c0b5ac73a287857d742ad7ebe315ad740368272907c37b3ede7805e660a9282af1346a2801fff72 + languageName: node + linkType: hard + +"@perfsee/webpack@npm:^1.5.0": + version: 1.5.0 + resolution: "@perfsee/webpack@npm:1.5.0" + dependencies: + "@perfsee/bundle-analyzer": 1.4.0 + "@perfsee/plugin-utils": 1.5.0 + chalk: ^4.1.2 + tslib: ^2.4.0 + peerDependencies: + webpack: ">= 4" + checksum: 34ca89fb54ae3cdc11264a80d235212cd79a1d5c515f4ba6948d48ee01a4cae23a420142f6b8be1eaac5509de1d62a7316af0f1f898d69b82fb904bdb0caadaa + languageName: node + linkType: hard + "@polka/url@npm:^1.0.0-next.20": version: 1.0.0-next.21 resolution: "@polka/url@npm:1.0.0-next.21" @@ -3586,6 +3673,7 @@ __metadata: version: 0.0.0-use.local resolution: "@rich-data/viewer-docs@workspace:docs" dependencies: + "@perfsee/webpack": ^1.5.0 "@rich-data/viewer": "workspace:^" "@types/node": ^18.14.6 "@types/react": ^18.0.28 @@ -6000,21 +6088,21 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^8.8.0, acorn@npm:^8.8.1": - version: 8.8.1 - resolution: "acorn@npm:8.8.1" +"acorn@npm:^8.7.1, acorn@npm:^8.8.2": + version: 8.8.2 + resolution: "acorn@npm:8.8.2" bin: acorn: bin/acorn - checksum: 4079b67283b94935157698831967642f24a075c52ce3feaaaafe095776dfbe15d86a1b33b1e53860fc0d062ed6c83f4284a5c87c85b9ad51853a01173da6097f + checksum: f790b99a1bf63ef160c967e23c46feea7787e531292bb827126334612c234ed489a0dc2c7ba33156416f0ffa8d25bf2b0fdb7f35c2ba60eb3e960572bece4001 languageName: node linkType: hard -"acorn@npm:^8.8.2": - version: 8.8.2 - resolution: "acorn@npm:8.8.2" +"acorn@npm:^8.8.0, acorn@npm:^8.8.1": + version: 8.8.1 + resolution: "acorn@npm:8.8.1" bin: acorn: bin/acorn - checksum: f790b99a1bf63ef160c967e23c46feea7787e531292bb827126334612c234ed489a0dc2c7ba33156416f0ffa8d25bf2b0fdb7f35c2ba60eb3e960572bece4001 + checksum: 4079b67283b94935157698831967642f24a075c52ce3feaaaafe095776dfbe15d86a1b33b1e53860fc0d062ed6c83f4284a5c87c85b9ad51853a01173da6097f languageName: node linkType: hard @@ -6074,6 +6162,18 @@ __metadata: languageName: node linkType: hard +"ajv@npm:^8.0.1": + version: 8.12.0 + resolution: "ajv@npm:8.12.0" + dependencies: + fast-deep-equal: ^3.1.1 + json-schema-traverse: ^1.0.0 + require-from-string: ^2.0.2 + uri-js: ^4.2.2 + checksum: 4dc13714e316e67537c8b31bc063f99a1d9d9a497eb4bbd55191ac0dcd5e4985bbb71570352ad6f1e76684fb6d790928f96ba3b2d4fd6e10024be9612fe3f001 + languageName: node + linkType: hard + "ajv@npm:^8.11.0": version: 8.11.0 resolution: "ajv@npm:8.11.0" @@ -7689,7 +7789,7 @@ __metadata: languageName: node linkType: hard -"debug@npm:4, debug@npm:^4.0.0, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4": +"debug@npm:4, debug@npm:4.3.4, debug@npm:^4.0.0, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4": version: 4.3.4 resolution: "debug@npm:4.3.4" dependencies: @@ -7743,6 +7843,13 @@ __metadata: languageName: node linkType: hard +"decode-uri-component@npm:^0.2.2": + version: 0.2.2 + resolution: "decode-uri-component@npm:0.2.2" + checksum: 95476a7d28f267292ce745eac3524a9079058bbb35767b76e3ee87d42e34cd0275d2eb19d9d08c3e167f97556e8a2872747f5e65cbebcac8b0c98d83e285f139 + languageName: node + linkType: hard + "dedent@npm:^0.7.0": version: 0.7.0 resolution: "dedent@npm:0.7.0" @@ -8008,6 +8115,17 @@ __metadata: languageName: node linkType: hard +"dom-serializer@npm:^2.0.0": + version: 2.0.0 + resolution: "dom-serializer@npm:2.0.0" + dependencies: + domelementtype: ^2.3.0 + domhandler: ^5.0.2 + entities: ^4.2.0 + checksum: cd1810544fd8cdfbd51fa2c0c1128ec3a13ba92f14e61b7650b5de421b88205fd2e3f0cc6ace82f13334114addb90ed1c2f23074a51770a8e9c1273acbc7f3e6 + languageName: node + linkType: hard + "domelementtype@npm:1, domelementtype@npm:^1.3.1": version: 1.3.1 resolution: "domelementtype@npm:1.3.1" @@ -8015,7 +8133,7 @@ __metadata: languageName: node linkType: hard -"domelementtype@npm:^2.0.1": +"domelementtype@npm:^2.0.1, domelementtype@npm:^2.3.0": version: 2.3.0 resolution: "domelementtype@npm:2.3.0" checksum: ee837a318ff702622f383409d1f5b25dd1024b692ef64d3096ff702e26339f8e345820f29a68bcdcea8cfee3531776b3382651232fbeae95612d6f0a75efb4f6 @@ -8040,6 +8158,15 @@ __metadata: languageName: node linkType: hard +"domhandler@npm:^5.0.1, domhandler@npm:^5.0.2": + version: 5.0.3 + resolution: "domhandler@npm:5.0.3" + dependencies: + domelementtype: ^2.3.0 + checksum: 0f58f4a6af63e6f3a4320aa446d28b5790a009018707bce2859dcb1d21144c7876482b5188395a188dfa974238c019e0a1e610d2fc269a12b2c192ea2b0b131c + languageName: node + linkType: hard + "domutils@npm:^1.5.1": version: 1.7.0 resolution: "domutils@npm:1.7.0" @@ -8050,6 +8177,17 @@ __metadata: languageName: node linkType: hard +"domutils@npm:^3.0.1": + version: 3.0.1 + resolution: "domutils@npm:3.0.1" + dependencies: + dom-serializer: ^2.0.0 + domelementtype: ^2.3.0 + domhandler: ^5.0.1 + checksum: 23aa7a840572d395220e173cb6263b0d028596e3950100520870a125af33ff819e6f609e1606d6f7d73bd9e7feb03bb404286e57a39063b5384c62b724d987b3 + languageName: node + linkType: hard + "dot-prop@npm:^5.1.0": version: 5.3.0 resolution: "dot-prop@npm:5.3.0" @@ -8191,13 +8329,24 @@ __metadata: languageName: node linkType: hard -"entities@npm:^4.4.0": +"entities@npm:^4.2.0, entities@npm:^4.3.0, entities@npm:^4.4.0": version: 4.4.0 resolution: "entities@npm:4.4.0" checksum: 84d250329f4b56b40fa93ed067b194db21e8815e4eb9b59f43a086f0ecd342814f6bc483de8a77da5d64e0f626033192b1b4f1792232a7ea6b970ebe0f3187c2 languageName: node linkType: hard +"env-ci@npm:^7.2.1": + version: 7.3.0 + resolution: "env-ci@npm:7.3.0" + dependencies: + execa: ^5.0.0 + fromentries: ^1.3.2 + java-properties: ^1.0.0 + checksum: 828d06154b9b61a4b090ceb03fc2e9582b2720a0c2d34cbc83f81fdf7890f2788b42e3d0e4772d1aebf24d817debce2d508471003ae6bc2ce47d4fa85f07f69b + languageName: node + linkType: hard + "env-paths@npm:^2.2.0": version: 2.2.1 resolution: "env-paths@npm:2.2.1" @@ -9360,6 +9509,13 @@ __metadata: languageName: node linkType: hard +"filter-obj@npm:^1.1.0": + version: 1.1.0 + resolution: "filter-obj@npm:1.1.0" + checksum: cf2104a7c45ff48e7f505b78a3991c8f7f30f28bd8106ef582721f321f1c6277f7751aacd5d83026cb079d9d5091082f588d14a72e7c5d720ece79118fa61e10 + languageName: node + linkType: hard + "finalhandler@npm:1.2.0": version: 1.2.0 resolution: "finalhandler@npm:1.2.0" @@ -9386,7 +9542,7 @@ __metadata: languageName: node linkType: hard -"find-cache-dir@npm:^3.0.0, find-cache-dir@npm:^3.2.0": +"find-cache-dir@npm:^3.0.0, find-cache-dir@npm:^3.2.0, find-cache-dir@npm:^3.3.2": version: 3.3.2 resolution: "find-cache-dir@npm:3.3.2" dependencies: @@ -9568,7 +9724,7 @@ __metadata: languageName: node linkType: hard -"fromentries@npm:^1.2.0": +"fromentries@npm:^1.2.0, fromentries@npm:^1.3.2": version: 1.3.2 resolution: "fromentries@npm:1.3.2" checksum: 33729c529ce19f5494f846f0dd4945078f4e37f4e8955f4ae8cc7385c218f600e9d93a7d225d17636c20d1889106fd87061f911550861b7072f53bf891e6b341 @@ -10340,6 +10496,18 @@ __metadata: languageName: node linkType: hard +"htmlparser2@npm:^8.0.1": + version: 8.0.1 + resolution: "htmlparser2@npm:8.0.1" + dependencies: + domelementtype: ^2.3.0 + domhandler: ^5.0.2 + domutils: ^3.0.1 + entities: ^4.3.0 + checksum: 06d5c71e8313597722bc429ae2a7a8333d77bd3ab07ccb916628384b37332027b047f8619448d8f4a3312b6609c6ea3302a4e77435d859e9e686999e6699ca39 + languageName: node + linkType: hard + "http-cache-semantics@npm:^4.1.0": version: 4.1.1 resolution: "http-cache-semantics@npm:4.1.1" @@ -11184,6 +11352,13 @@ __metadata: languageName: node linkType: hard +"java-properties@npm:^1.0.0": + version: 1.0.2 + resolution: "java-properties@npm:1.0.2" + checksum: 9a086778346e3adbe2395e370f5c779033ed60360055a15e2cead49e3d676d2c73786cf2f6563a1860277dea3dd0a859432e546ed89c03ee08c1f53e31a5d420 + languageName: node + linkType: hard + "jest-changed-files@npm:^28.1.3": version: 28.1.3 resolution: "jest-changed-files@npm:28.1.3" @@ -12313,6 +12488,13 @@ __metadata: languageName: node linkType: hard +"lodash.truncate@npm:^4.4.2": + version: 4.4.2 + resolution: "lodash.truncate@npm:4.4.2" + checksum: b463d8a382cfb5f0e71c504dcb6f807a7bd379ff1ea216669aa42c52fc28c54e404bfbd96791aa09e6df0de2c1d7b8f1b7f4b1a61f324d38fe98bc535aeee4f5 + languageName: node + linkType: hard + "lodash.uniq@npm:^4.5.0": version: 4.5.0 resolution: "lodash.uniq@npm:4.5.0" @@ -13815,7 +13997,7 @@ __metadata: languageName: node linkType: hard -"node-fetch@npm:^2, node-fetch@npm:^2.6.1, node-fetch@npm:^2.6.7": +"node-fetch@npm:^2, node-fetch@npm:^2.6.1, node-fetch@npm:^2.6.2, node-fetch@npm:^2.6.7": version: 2.6.9 resolution: "node-fetch@npm:2.6.9" dependencies: @@ -14162,7 +14344,7 @@ __metadata: languageName: node linkType: hard -"open@npm:^8.4.0": +"open@npm:^8.4.0, open@npm:^8.4.2": version: 8.4.2 resolution: "open@npm:8.4.2" dependencies: @@ -14928,6 +15110,18 @@ __metadata: languageName: node linkType: hard +"query-string@npm:^7.1.1": + version: 7.1.3 + resolution: "query-string@npm:7.1.3" + dependencies: + decode-uri-component: ^0.2.2 + filter-obj: ^1.1.0 + split-on-first: ^1.0.0 + strict-uri-encode: ^2.0.0 + checksum: 91af02dcd9cc9227a052841d5c2eecb80a0d6489d05625df506a097ef1c59037cfb5e907f39b84643cbfd535c955abec3e553d0130a7b510120c37d06e0f4346 + languageName: node + linkType: hard + "querystringify@npm:^2.1.1": version: 2.2.0 resolution: "querystringify@npm:2.2.0" @@ -16050,6 +16244,17 @@ __metadata: languageName: node linkType: hard +"simple-git@npm:^3.15.0": + version: 3.17.0 + resolution: "simple-git@npm:3.17.0" + dependencies: + "@kwsites/file-exists": ^1.1.1 + "@kwsites/promise-deferred": ^1.1.1 + debug: ^4.3.4 + checksum: 977a05cb0b5087296348b5afa682ce552f43234f5fd29b44c3d7f56b3682d10dcb03752a418e508aaffcbdb6ea2e304a3ef10095197d6743d2353adb85f32592 + languageName: node + linkType: hard + "simple-update-notifier@npm:^1.0.0": version: 1.1.0 resolution: "simple-update-notifier@npm:1.1.0" @@ -16289,6 +16494,13 @@ __metadata: languageName: node linkType: hard +"split-on-first@npm:^1.0.0": + version: 1.1.0 + resolution: "split-on-first@npm:1.1.0" + checksum: 16ff85b54ddcf17f9147210a4022529b343edbcbea4ce977c8f30e38408b8d6e0f25f92cd35b86a524d4797f455e29ab89eb8db787f3c10708e0b47ebf528d30 + languageName: node + linkType: hard + "split2@npm:^3.0.0": version: 3.2.2 resolution: "split2@npm:3.2.2" @@ -16370,6 +16582,13 @@ __metadata: languageName: node linkType: hard +"strict-uri-encode@npm:^2.0.0": + version: 2.0.0 + resolution: "strict-uri-encode@npm:2.0.0" + checksum: eaac4cf978b6fbd480f1092cab8b233c9b949bcabfc9b598dd79a758f7243c28765ef7639c876fa72940dac687181b35486ea01ff7df3e65ce3848c64822c581 + languageName: node + linkType: hard + "string-argv@npm:^0.3.1": version: 0.3.1 resolution: "string-argv@npm:0.3.1" @@ -16669,6 +16888,19 @@ __metadata: languageName: node linkType: hard +"table@npm:^6.8.0": + version: 6.8.1 + resolution: "table@npm:6.8.1" + dependencies: + ajv: ^8.0.1 + lodash.truncate: ^4.4.2 + slice-ansi: ^4.0.0 + string-width: ^4.2.3 + strip-ansi: ^6.0.1 + checksum: 08249c7046125d9d0a944a6e96cfe9ec66908d6b8a9db125531be6eb05fa0de047fd5542e9d43b4f987057f00a093b276b8d3e19af162a9c40db2681058fd306 + languageName: node + linkType: hard + "tar-fs@npm:^2.1.1": version: 2.1.1 resolution: "tar-fs@npm:2.1.1" @@ -17629,6 +17861,15 @@ __metadata: languageName: node linkType: hard +"uuid@npm:^9.0.0": + version: 9.0.0 + resolution: "uuid@npm:9.0.0" + bin: + uuid: dist/bin/uuid + checksum: 8dd2c83c43ddc7e1c71e36b60aea40030a6505139af6bee0f382ebcd1a56f6cd3028f7f06ffb07f8cf6ced320b76aea275284b224b002b289f89fe89c389b028 + languageName: node + linkType: hard + "uvu@npm:^0.5.0": version: 0.5.6 resolution: "uvu@npm:0.5.6"