mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-11 21:07:47 +00:00
Compare commits
260 Commits
@vercel/py
...
@vercel/py
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
621b53bc49 | ||
|
|
728b620355 | ||
|
|
7d16395038 | ||
|
|
59e1259688 | ||
|
|
169242157e | ||
|
|
db10ffd679 | ||
|
|
c0d0744c4e | ||
|
|
9da67423a5 | ||
|
|
51fe09d5e9 | ||
|
|
695bfbdd60 | ||
|
|
547e88228e | ||
|
|
9bfb5dd535 | ||
|
|
81ea84fae8 | ||
|
|
fa8bf07be4 | ||
|
|
cc9dce73ad | ||
|
|
bba7cbd411 | ||
|
|
9a3739bebd | ||
|
|
8c62de16ce | ||
|
|
e9333988d7 | ||
|
|
fb001ce7eb | ||
|
|
b399fe7037 | ||
|
|
88385b3c84 | ||
|
|
eed39913e1 | ||
|
|
03e9047bc9 | ||
|
|
0e35205bf1 | ||
|
|
e42fe34c4a | ||
|
|
3ece7ac969 | ||
|
|
4f832acf90 | ||
|
|
918726e01d | ||
|
|
dc2ddf867b | ||
|
|
ee1211416f | ||
|
|
570fd24e29 | ||
|
|
40681ad0f4 | ||
|
|
f20703b15d | ||
|
|
68eb197112 | ||
|
|
b8b87b96da | ||
|
|
967c24f1bb | ||
|
|
609f781234 | ||
|
|
998f6bf6e6 | ||
|
|
7511c2ef85 | ||
|
|
71425fac1f | ||
|
|
6973cd5989 | ||
|
|
24785ff50a | ||
|
|
aa3ad4478c | ||
|
|
f0d73049ca | ||
|
|
6cef07354a | ||
|
|
50af9f5b75 | ||
|
|
af76b134d8 | ||
|
|
c7640005fd | ||
|
|
3deed977ba | ||
|
|
b38c360e36 | ||
|
|
1595e48414 | ||
|
|
e6b0ee3e3c | ||
|
|
a247e31688 | ||
|
|
dc02e763a4 | ||
|
|
8567fc0de6 | ||
|
|
4f8f3d373f | ||
|
|
debb85b690 | ||
|
|
bfef989ada | ||
|
|
4e0b6c5eaf | ||
|
|
0ace69ef75 | ||
|
|
b7b7923f92 | ||
|
|
8167233c56 | ||
|
|
32ee6aba92 | ||
|
|
b48f7a7e6e | ||
|
|
a961c9b992 | ||
|
|
cf7c50d691 | ||
|
|
f4be388a1f | ||
|
|
c1bc53dea8 | ||
|
|
6855e3df54 | ||
|
|
0d39dbd1d9 | ||
|
|
509c85182a | ||
|
|
ae801e563d | ||
|
|
0e8278f490 | ||
|
|
0d302a6f48 | ||
|
|
4e4f5f28a2 | ||
|
|
5205a4ec4b | ||
|
|
2c15e496ed | ||
|
|
1f0ca46626 | ||
|
|
17cb5f1bc6 | ||
|
|
b095031292 | ||
|
|
f50bcbc0ba | ||
|
|
4bf6295d7a | ||
|
|
a4001ce10b | ||
|
|
2df3432d88 | ||
|
|
bcfc19de12 | ||
|
|
04381c669b | ||
|
|
0c7b54edad | ||
|
|
6d42816395 | ||
|
|
6fe6d05a42 | ||
|
|
50a201f145 | ||
|
|
701a02ae9d | ||
|
|
39f7586621 | ||
|
|
c4a39c8d29 | ||
|
|
3ac238cf08 | ||
|
|
8384813a0d | ||
|
|
c4587de439 | ||
|
|
d997dc4fbc | ||
|
|
d15b90bd4d | ||
|
|
5b31297f0c | ||
|
|
e232566cbe | ||
|
|
592689cad1 | ||
|
|
9b08e72f76 | ||
|
|
bd0e10cfe7 | ||
|
|
28436ade60 | ||
|
|
de0d2fba0b | ||
|
|
e0900128d6 | ||
|
|
8d15f30579 | ||
|
|
960c66584c | ||
|
|
1c8f91031a | ||
|
|
68cb23c3cc | ||
|
|
94f6ae2595 | ||
|
|
b92aeac84d | ||
|
|
00420b7a01 | ||
|
|
a5128790d0 | ||
|
|
ae9aa91f4f | ||
|
|
d4cef69cc9 | ||
|
|
323f67c31a | ||
|
|
63c499a826 | ||
|
|
ad436313e1 | ||
|
|
c414288b2f | ||
|
|
b07ff7431f | ||
|
|
79fde4475c | ||
|
|
855197c699 | ||
|
|
fbd9080859 | ||
|
|
b5c5b7b82c | ||
|
|
0a072ee850 | ||
|
|
0b56caba45 | ||
|
|
ab3db60824 | ||
|
|
f2f2ff2c67 | ||
|
|
ba7dafff71 | ||
|
|
987fb4d4f7 | ||
|
|
be74f79fa0 | ||
|
|
86886e6b60 | ||
|
|
e8a9000137 | ||
|
|
75ea68d445 | ||
|
|
a5a990995c | ||
|
|
cd7dcc6731 | ||
|
|
c4bd462b85 | ||
|
|
5fc266bd8a | ||
|
|
08b04d0bda | ||
|
|
92ae51c6a6 | ||
|
|
909c493d1e | ||
|
|
98b54ff61f | ||
|
|
3defd0b2fd | ||
|
|
5a7851a7f7 | ||
|
|
7f0caa7dec | ||
|
|
89b5aad367 | ||
|
|
c13775ba07 | ||
|
|
cc3c1d1eeb | ||
|
|
3aa2fbbb53 | ||
|
|
3a8b8aa03a | ||
|
|
d008617c0b | ||
|
|
8aecb99447 | ||
|
|
1793fa643f | ||
|
|
913683a8e6 | ||
|
|
0d1dc23d0d | ||
|
|
e829ce47c3 | ||
|
|
474770e9b0 | ||
|
|
e762d8d4e8 | ||
|
|
6e8935883b | ||
|
|
1c3497dc74 | ||
|
|
9836fdb5ca | ||
|
|
d6f88f019f | ||
|
|
0f720472c4 | ||
|
|
8d0c5114e4 | ||
|
|
e3c4435606 | ||
|
|
234c4dfa84 | ||
|
|
acd756436c | ||
|
|
f26858b735 | ||
|
|
623e43f865 | ||
|
|
3e696513a2 | ||
|
|
285f62c9d0 | ||
|
|
c43db1788c | ||
|
|
fc2eb1a30d | ||
|
|
ecf194b7c1 | ||
|
|
c14e5689f1 | ||
|
|
54dfe747e2 | ||
|
|
2afc8db8e7 | ||
|
|
cc628dd9fb | ||
|
|
dfb6ef949b | ||
|
|
cd4799b5d5 | ||
|
|
5e66d4b2cc | ||
|
|
44d7473e7c | ||
|
|
fddec1286c | ||
|
|
6e5e700e8d | ||
|
|
b6e8609b83 | ||
|
|
78b7bd5ec8 | ||
|
|
4104a45c2d | ||
|
|
4c20218e05 | ||
|
|
02a0004719 | ||
|
|
123bffb776 | ||
|
|
074535f27c | ||
|
|
05243fb6e9 | ||
|
|
097725580c | ||
|
|
4b09c89e7d | ||
|
|
3a1eede63b | ||
|
|
9cee0dd5d7 | ||
|
|
b801c6e593 | ||
|
|
505050b923 | ||
|
|
15c7ad241a | ||
|
|
ec57654b5b | ||
|
|
3b9a9878bc | ||
|
|
70b7db1a15 | ||
|
|
41d6666139 | ||
|
|
2857219f89 | ||
|
|
246c2a0f5d | ||
|
|
d91bca7d6b | ||
|
|
be54fce67b | ||
|
|
7753bb8d89 | ||
|
|
ce17ac5c35 | ||
|
|
8006fc32b8 | ||
|
|
8038a90db1 | ||
|
|
f88c862e9d | ||
|
|
9170820371 | ||
|
|
c881546e0e | ||
|
|
fa21db98e4 | ||
|
|
8eabbfc666 | ||
|
|
6783f7afc9 | ||
|
|
a400b9b29d | ||
|
|
b549c37149 | ||
|
|
30d5e64291 | ||
|
|
47c2c361d2 | ||
|
|
438576fc7c | ||
|
|
b30343ef7b | ||
|
|
2dc0dfa572 | ||
|
|
9ee54b3dd6 | ||
|
|
9d67e0bc06 | ||
|
|
466135cf84 | ||
|
|
eab2e229dc | ||
|
|
698b89a2ba | ||
|
|
bae2a2e4df | ||
|
|
57916bb712 | ||
|
|
12bbd4e8eb | ||
|
|
4e4c7023dc | ||
|
|
41805790e7 | ||
|
|
6ad77ae8e1 | ||
|
|
e8daf36cd7 | ||
|
|
c319a2c499 | ||
|
|
a410baa797 | ||
|
|
625568e659 | ||
|
|
41868c1fe0 | ||
|
|
1b644f1218 | ||
|
|
29ea0fb06b | ||
|
|
b61f049f11 | ||
|
|
16e28f326b | ||
|
|
276397c940 | ||
|
|
85d7311199 | ||
|
|
b8114b8b39 | ||
|
|
d63e8d3187 | ||
|
|
11d3dd04aa | ||
|
|
46bf95ee36 | ||
|
|
92252468c2 | ||
|
|
71b83d5587 | ||
|
|
d9e5fdc5e4 | ||
|
|
58f479c603 | ||
|
|
d62461d952 | ||
|
|
e7f524defb | ||
|
|
bdefd0d05d | ||
|
|
ca522fc9f1 |
@@ -19,6 +19,10 @@ packages/cli/src/util/dev/templates/*.ts
|
|||||||
packages/client/tests/fixtures
|
packages/client/tests/fixtures
|
||||||
packages/client/lib
|
packages/client/lib
|
||||||
|
|
||||||
|
# next
|
||||||
|
packages/next/test/integration/middleware
|
||||||
|
packages/next/test/integration/middleware-eval
|
||||||
|
|
||||||
# node-bridge
|
# node-bridge
|
||||||
packages/node-bridge/bridge.js
|
packages/node-bridge/bridge.js
|
||||||
packages/node-bridge/launcher.js
|
packages/node-bridge/launcher.js
|
||||||
|
|||||||
4
.gitattributes
vendored
4
.gitattributes
vendored
@@ -8,3 +8,7 @@ packages/*/test/* linguist-vendored
|
|||||||
# Go build fails with Windows line endings.
|
# Go build fails with Windows line endings.
|
||||||
*.go text eol=lf
|
*.go text eol=lf
|
||||||
go.mod text eol=lf
|
go.mod text eol=lf
|
||||||
|
|
||||||
|
# Mark certain files as "binary" -- hide diffs
|
||||||
|
**/test/fixtures/**/git/**/* binary
|
||||||
|
**/test/fixtures/**/git/**/* linguist-generated
|
||||||
|
|||||||
39
.github/CODEOWNERS
vendored
39
.github/CODEOWNERS
vendored
@@ -1,29 +1,26 @@
|
|||||||
# Documentation
|
# Documentation
|
||||||
# https://help.github.com/en/articles/about-code-owners
|
# https://help.github.com/en/articles/about-code-owners
|
||||||
|
|
||||||
* @TooTallNate
|
* @TooTallNate @EndangeredMassa @styfle
|
||||||
/.github/workflows @AndyBitz @styfle
|
/.github/workflows @TooTallNate @EndangeredMassa @styfle @ijjk
|
||||||
/packages/frameworks @AndyBitz
|
/packages/frameworks @TooTallNate @EndangeredMassa @styfle @AndyBitz
|
||||||
/packages/cli/src/commands/build @TooTallNate @styfle @AndyBitz @gdborton @jaredpalmer
|
|
||||||
/packages/cli/src/commands/dev @TooTallNate @styfle @AndyBitz
|
|
||||||
/packages/cli/src/util/dev @TooTallNate @styfle @AndyBitz
|
|
||||||
/packages/cli/src/commands/domains @javivelasco @mglagola @anatrajkovska
|
/packages/cli/src/commands/domains @javivelasco @mglagola @anatrajkovska
|
||||||
/packages/cli/src/commands/certs @javivelasco @mglagola @anatrajkovska
|
/packages/cli/src/commands/certs @javivelasco @mglagola @anatrajkovska
|
||||||
/packages/cli/src/commands/env @styfle @lucleray
|
/packages/cli/src/commands/env @styfle @lucleray
|
||||||
/packages/client @styfle @TooTallNate
|
/packages/client @TooTallNate @EndangeredMassa @styfle
|
||||||
/packages/build-utils @styfle @AndyBitz @TooTallNate
|
/packages/build-utils @TooTallNate @EndangeredMassa @styfle @AndyBitz
|
||||||
/packages/middleware @gdborton @javivelasco
|
/packages/middleware @gdborton @javivelasco
|
||||||
/packages/node @styfle @TooTallNate @lucleray
|
/packages/node @TooTallNate @EndangeredMassa @styfle
|
||||||
/packages/node-bridge @styfle @TooTallNate @lucleray
|
/packages/node-bridge @TooTallNate @EndangeredMassa @styfle @ijjk
|
||||||
/packages/next @Timer @ijjk
|
/packages/next @TooTallNate @ijjk
|
||||||
/packages/go @styfle @TooTallNate
|
/packages/go @TooTallNate @EndangeredMassa @styfle
|
||||||
/packages/python @styfle @TooTallNate
|
/packages/python @TooTallNate @EndangeredMassa @styfle
|
||||||
/packages/ruby @styfle @TooTallNate
|
/packages/ruby @TooTallNate @EndangeredMassa @styfle
|
||||||
/packages/static-build @styfle @AndyBitz
|
/packages/static-build @TooTallNate @EndangeredMassa @styfle @AndyBitz
|
||||||
/packages/routing-utils @styfle @dav-is @ijjk
|
/packages/routing-utils @TooTallNate @EndangeredMassa @styfle @ijjk
|
||||||
/examples @mcsdevv
|
/examples @leerob
|
||||||
/examples/create-react-app @Timer
|
/examples/create-react-app @Timer
|
||||||
/examples/nextjs @timneutkens @Timer
|
/examples/nextjs @timneutkens @ijjk @styfle
|
||||||
/examples/hugo @mcsdevv @styfle
|
/examples/hugo @styfle
|
||||||
/examples/jekyll @mcsdevv @styfle
|
/examples/jekyll @styfle
|
||||||
/examples/zola @mcsdevv @styfle
|
/examples/zola @styfle
|
||||||
|
|||||||
8
.github/CONTRIBUTING.md
vendored
8
.github/CONTRIBUTING.md
vendored
@@ -23,7 +23,7 @@ Make sure all the tests pass before making changes.
|
|||||||
|
|
||||||
## Verifying your change
|
## Verifying your change
|
||||||
|
|
||||||
Once you are done with your changes (we even suggest doing it along the way), make sure all the test still pass by running:
|
Once you are done with your changes (we even suggest doing it along the way), make sure all the tests still pass by running:
|
||||||
|
|
||||||
```
|
```
|
||||||
yarn test-unit
|
yarn test-unit
|
||||||
@@ -64,7 +64,7 @@ Integration tests create deployments to your Vercel account using the `test` pro
|
|||||||
x-now-trace=iad1]
|
x-now-trace=iad1]
|
||||||
```
|
```
|
||||||
|
|
||||||
In such cases you can visit the URL of the failed deployment and append `/_logs` so see the build error. In the case above, that would be https://test-8ashcdlew.vercel.app/_logs
|
In such cases, you can visit the URL of the failed deployment and append `/_logs` to see the build error. In the case above, that would be https://test-8ashcdlew.vercel.app/_logs
|
||||||
|
|
||||||
The logs of this deployment will contain the actual error which may help you to understand what went wrong.
|
The logs of this deployment will contain the actual error which may help you to understand what went wrong.
|
||||||
|
|
||||||
@@ -82,11 +82,11 @@ nodeFileTrace(['path/to/entrypoint.js'], {
|
|||||||
.then(e => console.error(e));
|
.then(e => console.error(e));
|
||||||
```
|
```
|
||||||
|
|
||||||
When you run this script, you'll see all imported files. If anything file is missing, the bug is in [@vercel/nft](https://github.com/vercel/nft) and not the Builder.
|
When you run this script, you'll see all the imported files. If anything file is missing, the bug is in [@vercel/nft](https://github.com/vercel/nft) and not the Builder.
|
||||||
|
|
||||||
## Deploy a Builder with existing project
|
## Deploy a Builder with existing project
|
||||||
|
|
||||||
Sometimes you want to test changes to a Builder against an existing project, maybe with `vercel dev` or an actual deployment. You can avoid publishing every Builder change to npm by uploading the Builder as a tarball.
|
Sometimes you want to test changes to a Builder against an existing project, maybe with `vercel dev` or actual deployment. You can avoid publishing every Builder change to npm by uploading the Builder as a tarball.
|
||||||
|
|
||||||
1. Change directory to the desired Builder `cd ./packages/node`
|
1. Change directory to the desired Builder `cd ./packages/node`
|
||||||
2. Run `yarn build` to compile typescript and other build steps
|
2. Run `yarn build` to compile typescript and other build steps
|
||||||
|
|||||||
3
.github/workflows/cancel.yml
vendored
3
.github/workflows/cancel.yml
vendored
@@ -13,6 +13,5 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: styfle/cancel-workflow-action@0.9.1
|
- uses: styfle/cancel-workflow-action@0.9.1
|
||||||
with:
|
with:
|
||||||
workflow_id: 849295, 849296, 849297, 849298
|
workflow_id: test.yml, test-integration-cli.yml, test-unit.yml
|
||||||
access_token: ${{ github.token }}
|
access_token: ${{ github.token }}
|
||||||
|
|
||||||
|
|||||||
8
.github/workflows/test-integration-cli.yml
vendored
8
.github/workflows/test-integration-cli.yml
vendored
@@ -16,9 +16,15 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest]
|
os: [ubuntu-latest]
|
||||||
node: [12]
|
node: [14]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
|
- name: Conditionally set remote env
|
||||||
|
if: github.event.pull_request.head.repo.full_name == github.repository
|
||||||
|
run: |
|
||||||
|
echo "TURBO_REMOTE_ONLY=true" >> $GITHUB_ENV
|
||||||
|
echo "TURBO_TEAM=vercel" >> $GITHUB_ENV
|
||||||
|
echo "TURBO_TOKEN=${{ secrets.TURBO_TOKEN }}" >> $GITHUB_ENV
|
||||||
- uses: actions/setup-go@v2
|
- uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: '1.13.15'
|
go-version: '1.13.15'
|
||||||
|
|||||||
43
.github/workflows/test-integration-dev.yml
vendored
43
.github/workflows/test-integration-dev.yml
vendored
@@ -1,43 +0,0 @@
|
|||||||
name: Dev
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
tags:
|
|
||||||
- '!*'
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
name: Dev
|
|
||||||
timeout-minutes: 75
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, macos-latest]
|
|
||||||
node: [12]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/setup-go@v2
|
|
||||||
with:
|
|
||||||
go-version: '1.13.15'
|
|
||||||
- uses: actions/setup-node@v2
|
|
||||||
with:
|
|
||||||
node-version: ${{ matrix.node }}
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
fetch-depth: 100
|
|
||||||
- run: git --version
|
|
||||||
- run: git fetch origin main --depth=100
|
|
||||||
- run: git fetch origin ${{ github.ref }} --depth=100
|
|
||||||
- run: git diff origin/main...HEAD --name-only
|
|
||||||
- name: Install Hugo
|
|
||||||
if: matrix.os == 'macos-latest'
|
|
||||||
run: curl -L -O https://github.com/gohugoio/hugo/releases/download/v0.56.0/hugo_0.56.0_macOS-64bit.tar.gz && tar -xzf hugo_0.56.0_macOS-64bit.tar.gz && mv ./hugo packages/cli/test/dev/fixtures/08-hugo/
|
|
||||||
- run: yarn install --network-timeout 1000000
|
|
||||||
- run: yarn run build
|
|
||||||
- run: yarn test-integration-dev
|
|
||||||
env:
|
|
||||||
VERCEL_TEAM_TOKEN: ${{ secrets.VERCEL_TEAM_TOKEN }}
|
|
||||||
VERCEL_REGISTRATION_URL: ${{ secrets.VERCEL_REGISTRATION_URL }}
|
|
||||||
35
.github/workflows/test-integration-once.yml
vendored
35
.github/workflows/test-integration-once.yml
vendored
@@ -1,35 +0,0 @@
|
|||||||
name: E2E
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
tags:
|
|
||||||
- '!*'
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
name: E2E
|
|
||||||
timeout-minutes: 120
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/setup-go@v2
|
|
||||||
with:
|
|
||||||
go-version: '1.13.15'
|
|
||||||
- uses: actions/setup-node@v2
|
|
||||||
with:
|
|
||||||
node-version: 12
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
fetch-depth: 100
|
|
||||||
- run: git --version
|
|
||||||
- run: git fetch origin main --depth=100
|
|
||||||
- run: git fetch origin ${{ github.ref }} --depth=100
|
|
||||||
- run: git diff origin/main...HEAD --name-only
|
|
||||||
- run: yarn install --network-timeout 1000000
|
|
||||||
- run: yarn run build
|
|
||||||
- run: yarn test-integration-once
|
|
||||||
env:
|
|
||||||
VERCEL_TEAM_TOKEN: ${{ secrets.VERCEL_TEAM_TOKEN }}
|
|
||||||
VERCEL_REGISTRATION_URL: ${{ secrets.VERCEL_REGISTRATION_URL }}
|
|
||||||
12
.github/workflows/test-unit.yml
vendored
12
.github/workflows/test-unit.yml
vendored
@@ -16,9 +16,15 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
node: [12]
|
node: [14]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
|
- name: Conditionally set remote env
|
||||||
|
if: github.event.pull_request.head.repo.full_name == github.repository
|
||||||
|
run: |
|
||||||
|
echo "TURBO_REMOTE_ONLY=true" >> $GITHUB_ENV
|
||||||
|
echo "TURBO_TEAM=vercel" >> $GITHUB_ENV
|
||||||
|
echo "TURBO_TOKEN=${{ secrets.TURBO_TOKEN }}" >> $GITHUB_ENV
|
||||||
- uses: actions/setup-go@v2
|
- uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: '1.13.15'
|
go-version: '1.13.15'
|
||||||
@@ -35,9 +41,9 @@ jobs:
|
|||||||
- run: yarn install --network-timeout 1000000
|
- run: yarn install --network-timeout 1000000
|
||||||
- run: yarn run build
|
- run: yarn run build
|
||||||
- run: yarn run lint
|
- run: yarn run lint
|
||||||
if: matrix.os == 'ubuntu-latest' && matrix.node == 12 # only run lint once
|
if: matrix.os == 'ubuntu-latest' && matrix.node == 14 # only run lint once
|
||||||
- run: yarn run test-unit
|
- run: yarn run test-unit
|
||||||
- run: yarn workspace vercel run coverage
|
- run: yarn workspace vercel run coverage
|
||||||
if: matrix.os == 'ubuntu-latest' && matrix.node == 12 # only run coverage once
|
if: matrix.os == 'ubuntu-latest' && matrix.node == 14 # only run coverage once
|
||||||
env:
|
env:
|
||||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|||||||
90
.github/workflows/test.yml
vendored
Normal file
90
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
name: Tests
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
tags:
|
||||||
|
- '!*'
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
env:
|
||||||
|
NODE_VERSION: '14'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
setup:
|
||||||
|
name: Find Changes
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
tests: ${{ steps['set-tests'].outputs['tests'] }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- run: git --version
|
||||||
|
- run: git fetch origin main
|
||||||
|
- uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: ${{ env.NODE_VERSION }}
|
||||||
|
cache: 'yarn'
|
||||||
|
- run: yarn install --network-timeout 1000000
|
||||||
|
- id: set-tests
|
||||||
|
run: |
|
||||||
|
TESTS_ARRAY=$(node utils/chunk-tests.js $SCRIPT_NAME)
|
||||||
|
echo "Files to test:"
|
||||||
|
echo "$TESTS_ARRAY"
|
||||||
|
echo "::set-output name=tests::$TESTS_ARRAY"
|
||||||
|
|
||||||
|
test:
|
||||||
|
timeout-minutes: 120
|
||||||
|
runs-on: ${{ matrix.runner }}
|
||||||
|
name: ${{matrix.scriptName}} (${{matrix.packageName}}, ${{matrix.chunkNumber}}, ${{ matrix.runner }})
|
||||||
|
if: ${{ needs.setup.outputs['tests'] != '[]' }}
|
||||||
|
needs:
|
||||||
|
- setup
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include: ${{ fromJson(needs.setup.outputs['tests']) }}
|
||||||
|
steps:
|
||||||
|
- name: Conditionally set remote env
|
||||||
|
if: github.event.pull_request.head.repo.full_name == github.repository
|
||||||
|
run: |
|
||||||
|
echo "TURBO_REMOTE_ONLY=true" >> $GITHUB_ENV
|
||||||
|
echo "TURBO_TEAM=vercel" >> $GITHUB_ENV
|
||||||
|
echo "TURBO_TOKEN=${{ secrets.TURBO_TOKEN }}" >> $GITHUB_ENV
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 2
|
||||||
|
- uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: '1.13.15'
|
||||||
|
- uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: ${{ env.NODE_VERSION }}
|
||||||
|
cache: 'yarn'
|
||||||
|
|
||||||
|
- name: Install Hugo
|
||||||
|
if: matrix.runner == 'macos-latest'
|
||||||
|
run: curl -L -O https://github.com/gohugoio/hugo/releases/download/v0.56.0/hugo_0.56.0_macOS-64bit.tar.gz && tar -xzf hugo_0.56.0_macOS-64bit.tar.gz && mv ./hugo packages/cli/test/dev/fixtures/08-hugo/
|
||||||
|
|
||||||
|
- run: yarn install --network-timeout 1000000
|
||||||
|
|
||||||
|
- name: Build ${{matrix.packageName}} and all its dependencies
|
||||||
|
run: yarn turbo run build --cache-dir=".turbo" --scope=${{matrix.packageName}} --include-dependencies --no-deps
|
||||||
|
env:
|
||||||
|
FORCE_COLOR: '1'
|
||||||
|
- name: Test ${{matrix.packageName}}
|
||||||
|
run: node_modules/.bin/turbo run test --cache-dir=".turbo" --scope=${{matrix.packageName}} --no-deps -- ${{ join(matrix.testPaths, ' ') }}
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
VERCEL_TEAM_TOKEN: ${{ secrets.VERCEL_TEAM_TOKEN }}
|
||||||
|
VERCEL_REGISTRATION_URL: ${{ secrets.VERCEL_REGISTRATION_URL }}
|
||||||
|
FORCE_COLOR: '1'
|
||||||
|
|
||||||
|
conclusion:
|
||||||
|
needs:
|
||||||
|
- test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: E2E
|
||||||
|
steps:
|
||||||
|
- name: Done
|
||||||
|
run: echo "Done."
|
||||||
4
.prettierignore
Normal file
4
.prettierignore
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# https://prettier.io/docs/en/ignore.html
|
||||||
|
|
||||||
|
# ignore this file with an intentional syntax error
|
||||||
|
packages/cli/test/dev/fixtures/edge-function-error/api/edge-error-syntax.js
|
||||||
@@ -1,17 +1 @@
|
|||||||
*
|
packages/*/test/**
|
||||||
|
|
||||||
# general
|
|
||||||
!utils/
|
|
||||||
!utils/run.js
|
|
||||||
!.yarnrc
|
|
||||||
!yarn.lock
|
|
||||||
!package.json
|
|
||||||
|
|
||||||
# api
|
|
||||||
!api/
|
|
||||||
!api/**
|
|
||||||
|
|
||||||
# packages
|
|
||||||
!packages/
|
|
||||||
!packages/frameworks
|
|
||||||
!packages/frameworks/**
|
|
||||||
|
|||||||
@@ -307,15 +307,15 @@ This is a [class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refere
|
|||||||
|
|
||||||
This is an abstract enumeration type that is implemented by one of the following possible `String` values:
|
This is an abstract enumeration type that is implemented by one of the following possible `String` values:
|
||||||
|
|
||||||
|
- `nodejs14.x`
|
||||||
- `nodejs12.x`
|
- `nodejs12.x`
|
||||||
- `nodejs10.x`
|
|
||||||
- `go1.x`
|
- `go1.x`
|
||||||
- `java11`
|
- `java11`
|
||||||
- `python3.9`
|
- `python3.9`
|
||||||
- `python3.6`
|
- `dotnet6`
|
||||||
- `dotnetcore2.1`
|
- `dotnetcore3.1`
|
||||||
- `ruby2.5`
|
- `ruby2.7`
|
||||||
- `provided`
|
- `provided.al2`
|
||||||
|
|
||||||
## `@vercel/build-utils` Helper Functions
|
## `@vercel/build-utils` Helper Functions
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import fs from 'fs/promises';
|
import fs from 'fs/promises';
|
||||||
import { join } from 'path';
|
import { join, dirname } from 'path';
|
||||||
|
import execa from 'execa';
|
||||||
import { getExampleList } from '../examples/example-list';
|
import { getExampleList } from '../examples/example-list';
|
||||||
import { mapOldToNew } from '../examples/map-old-to-new';
|
import { mapOldToNew } from '../examples/map-old-to-new';
|
||||||
|
|
||||||
@@ -40,7 +41,32 @@ async function main() {
|
|||||||
JSON.stringify([...existingExamples, ...oldExamples])
|
JSON.stringify([...existingExamples, ...oldExamples])
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const { stdout: sha } = await execa('git', ['rev-parse', '--short', 'HEAD'], {
|
||||||
|
cwd: repoRoot,
|
||||||
|
});
|
||||||
|
|
||||||
|
const tarballsDir = join(pubDir, 'tarballs');
|
||||||
|
const packagesDir = join(repoRoot, 'packages');
|
||||||
|
const packages = await fs.readdir(packagesDir);
|
||||||
|
for (const pkg of packages) {
|
||||||
|
const fullDir = join(packagesDir, pkg);
|
||||||
|
const packageJsonRaw = await fs.readFile(
|
||||||
|
join(fullDir, 'package.json'),
|
||||||
|
'utf-8'
|
||||||
|
);
|
||||||
|
const packageJson = JSON.parse(packageJsonRaw);
|
||||||
|
const tarballName = `${packageJson.name
|
||||||
|
.replace('@', '')
|
||||||
|
.replace('/', '-')}-v${packageJson.version}-${sha.trim()}.tgz`;
|
||||||
|
const destTarballPath = join(tarballsDir, `${packageJson.name}.tgz`);
|
||||||
|
await fs.mkdir(dirname(destTarballPath), { recursive: true });
|
||||||
|
await fs.copyFile(join(fullDir, tarballName), destTarballPath);
|
||||||
|
}
|
||||||
|
|
||||||
console.log('Completed building static frontend.');
|
console.log('Completed building static frontend.');
|
||||||
}
|
}
|
||||||
|
|
||||||
main().catch(console.error);
|
main().catch(err => {
|
||||||
|
console.log('error running build:', err);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "esnext",
|
"target": "ES2020",
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
|||||||
@@ -16,4 +16,4 @@ If you would not like to verify your domain, you can remove it from your account
|
|||||||
|
|
||||||
#### Resources
|
#### Resources
|
||||||
|
|
||||||
- [Vercel Custom Domains Documentation](https://vercel.com/docs/v2/custom-domains)
|
- [Vercel Custom Domains Documentation](https://vercel.com/docs/concepts/projects/custom-domains)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#### Why This Error Occurred
|
#### Why This Error Occurred
|
||||||
|
|
||||||
You ran `vercel dev` inside a project that contains a `vercel.json` file with `env` or `build.env` properties that use [Vercel Secrets](https://vercel.com/docs/v2/build-step#environment-variables).
|
You ran `vercel dev` inside a project that contains a `vercel.json` file with `env` or `build.env` properties that use [Vercel Secrets](https://vercel.com/docs/concepts/projects/environment-variables).
|
||||||
|
|
||||||
In order to use environment variables in your project locally that have values defined using the Vercel Secrets format (e.g. `@my-secret-value`), you will need to provide the value as an environment variable using a `.env`.
|
In order to use environment variables in your project locally that have values defined using the Vercel Secrets format (e.g. `@my-secret-value`), you will need to provide the value as an environment variable using a `.env`.
|
||||||
|
|
||||||
@@ -24,4 +24,4 @@ TEST=value
|
|||||||
|
|
||||||
In the above example, `TEST` represents the name of the environment variable and `value` its value.
|
In the above example, `TEST` represents the name of the environment variable and `value` its value.
|
||||||
|
|
||||||
For more information on Environment Variables in development, [see the documentation](https://vercel.com/docs/v2/build-step#environment-variables).
|
For more information on Environment Variables in development, [see the documentation](https://vercel.com/docs/concepts/projects/environment-variables).
|
||||||
|
|||||||
1
examples/amp/.gitignore
vendored
1
examples/amp/.gitignore
vendored
@@ -1 +0,0 @@
|
|||||||
.env
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
# AMP Example
|
|
||||||
|
|
||||||
This directory is a brief example of an [AMP](https://amp.dev/) site that can be deployed to Vercel with zero configuration.
|
|
||||||
|
|
||||||
## Deploy Your Own
|
|
||||||
|
|
||||||
Deploy your own AMP project with Vercel.
|
|
||||||
|
|
||||||
[](https://vercel.com/new/clone?repository-url=https://github.com/vercel/vercel/tree/main/examples/amp)
|
|
||||||
|
|
||||||
_Live Example: https://amp-template.vercel.app_
|
|
||||||
|
|
||||||
### How We Created This Example
|
|
||||||
|
|
||||||
To get started deploying AMP with Vercel, you can use the [Vercel CLI](https://vercel.com/download) to initialize the project:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ vercel init amp
|
|
||||||
```
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.0 KiB |
@@ -1,72 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html ⚡>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta name="viewport" content="width=device-width,minimum-scale=1" />
|
|
||||||
<link rel="shortcut icon" href="favicon.png">
|
|
||||||
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
|
|
||||||
<link rel="canonical" href="index.html" />
|
|
||||||
<title>AMP Website</title>
|
|
||||||
<script async src="https://cdn.ampproject.org/v0.js"></script>
|
|
||||||
<style amp-custom>
|
|
||||||
body > * {
|
|
||||||
margin: 3rem 1rem;
|
|
||||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
|
||||||
color: #525252;
|
|
||||||
}
|
|
||||||
|
|
||||||
h3 {
|
|
||||||
font-size: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
h4 {
|
|
||||||
margin-top: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
|
||||||
font-size: 1.2rem;
|
|
||||||
line-height: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.links {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
margin-bottom: 3rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.links a {
|
|
||||||
margin: 0 10px;
|
|
||||||
font-size: 1rem;
|
|
||||||
color: #005af0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<center>
|
|
||||||
<amp-img width=150 height=150 layout="fixed" class="logo" src="logo.png"></amp-img>
|
|
||||||
<h3>Welcome to your AMP page</h3>
|
|
||||||
<p>AMP is a web component framework to <br> easily create user-first websites, stories, ads and emails.</p>
|
|
||||||
|
|
||||||
<h4>Links</h4>
|
|
||||||
<div class="links">
|
|
||||||
<a href="https://amp.dev/">Homepage</a>
|
|
||||||
<a href="https://amp.dev/documentation/guides-and-tutorials/?format=websites">Tutorials</a>
|
|
||||||
<a href="https://amp.dev/documentation/examples/">Examples</a>
|
|
||||||
<a href="https://blog.amp.dev">Blog</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h4>Ready to get started?</h4>
|
|
||||||
<div class="links">
|
|
||||||
<a href="https://amp.dev/documentation/guides-and-tutorials/start/create/?format=websites">Create your first AMP page</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h4>Get involved</h4>
|
|
||||||
<div class="links">
|
|
||||||
<a href="https://twitter.com/amphtml">Twitter</a>
|
|
||||||
<a href="https://amphtml.slack.com">Slack</a>
|
|
||||||
<a href="https://amp.dev/events/amp-conf-2019">AMP Conf</a>
|
|
||||||
<a href="https://amp.dev/events/amp-roadshow">AMP Roadshow</a>
|
|
||||||
</div>
|
|
||||||
</center>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 43 KiB |
20
examples/astro/.gitignore
vendored
Normal file
20
examples/astro/.gitignore
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# build output
|
||||||
|
dist/
|
||||||
|
.output/
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# logs
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
|
||||||
|
|
||||||
|
# environment variables
|
||||||
|
.env
|
||||||
|
.env.production
|
||||||
|
|
||||||
|
# macOS-specific files
|
||||||
|
.DS_Store
|
||||||
2
examples/astro/.npmrc
Normal file
2
examples/astro/.npmrc
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# Expose Astro dependencies for `pnpm` users
|
||||||
|
shamefully-hoist=true
|
||||||
1
examples/astro/.vercelignore
Normal file
1
examples/astro/.vercelignore
Normal file
@@ -0,0 +1 @@
|
|||||||
|
README.md
|
||||||
42
examples/astro/README.md
Normal file
42
examples/astro/README.md
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# Welcome to [Astro](https://astro.build)
|
||||||
|
|
||||||
|
[](https://stackblitz.com/github/withastro/astro/tree/latest/examples/starter)
|
||||||
|
|
||||||
|
> 🧑🚀 **Seasoned astronaut?** Delete this file. Have fun!
|
||||||
|
|
||||||
|
## 🚀 Project Structure
|
||||||
|
|
||||||
|
Inside of your Astro project, you'll see the following folders and files:
|
||||||
|
|
||||||
|
```
|
||||||
|
/
|
||||||
|
├── public/
|
||||||
|
│ └── favicon.ico
|
||||||
|
├── src/
|
||||||
|
│ ├── components/
|
||||||
|
│ │ └── Layout.astro
|
||||||
|
│ └── pages/
|
||||||
|
│ └── index.astro
|
||||||
|
└── package.json
|
||||||
|
```
|
||||||
|
|
||||||
|
Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name.
|
||||||
|
|
||||||
|
There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components or layouts.
|
||||||
|
|
||||||
|
Any static assets, like images, can be placed in the `public/` directory.
|
||||||
|
|
||||||
|
## 🧞 Commands
|
||||||
|
|
||||||
|
All commands are run from the root of the project, from a terminal:
|
||||||
|
|
||||||
|
| Command | Action |
|
||||||
|
| :---------------- | :------------------------------------------- |
|
||||||
|
| `npm install` | Installs dependencies |
|
||||||
|
| `npm run dev` | Starts local dev server at `localhost:3000` |
|
||||||
|
| `npm run build` | Build your production site to `./dist/` |
|
||||||
|
| `npm run preview` | Preview your build locally, before deploying |
|
||||||
|
|
||||||
|
## 👀 Want to learn more?
|
||||||
|
|
||||||
|
Feel free to check [our documentation](https://github.com/withastro/astro) or jump into our [Discord server](https://astro.build/chat).
|
||||||
4
examples/astro/astro.config.mjs
Normal file
4
examples/astro/astro.config.mjs
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
import { defineConfig } from 'astro/config';
|
||||||
|
|
||||||
|
// https://astro.build/config
|
||||||
|
export default defineConfig({});
|
||||||
14
examples/astro/package.json
Normal file
14
examples/astro/package.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"name": "@example/basics",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"dev": "astro dev",
|
||||||
|
"start": "astro dev",
|
||||||
|
"build": "astro build",
|
||||||
|
"preview": "astro preview"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"astro": "^1.0.0-beta.20"
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
examples/astro/public/favicon.ico
Normal file
BIN
examples/astro/public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
55
examples/astro/src/components/Layout.astro
Normal file
55
examples/astro/src/components/Layout.astro
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
---
|
||||||
|
export interface Props {
|
||||||
|
title: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { title } = Astro.props as Props;
|
||||||
|
---
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width">
|
||||||
|
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
||||||
|
<title>{title}</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<slot />
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
--font-size-base: clamp(1rem, 0.34vw + 0.91rem, 1.19rem);
|
||||||
|
--font-size-lg: clamp(1.2rem, 0.7vw + 1.2rem, 1.5rem);
|
||||||
|
--font-size-xl: clamp(2.44rem, 2.38vw + 1.85rem, 3.75rem);
|
||||||
|
|
||||||
|
--color-text: hsl(12, 5%, 4%);
|
||||||
|
--color-bg: hsl(10, 21%, 95%);
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
font-family: system-ui, sans-serif;
|
||||||
|
font-size: var(--font-size-base);
|
||||||
|
color: var(--color-text);
|
||||||
|
background-color: var(--color-bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(h1) {
|
||||||
|
font-size: var(--font-size-xl);
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(h2) {
|
||||||
|
font-size: var(--font-size-lg);
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(code) {
|
||||||
|
font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,
|
||||||
|
Bitstream Vera Sans Mono, Courier New, monospace;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
174
examples/astro/src/pages/index.astro
Normal file
174
examples/astro/src/pages/index.astro
Normal file
@@ -0,0 +1,174 @@
|
|||||||
|
---
|
||||||
|
import Layout from '../components/Layout.astro';
|
||||||
|
---
|
||||||
|
|
||||||
|
<Layout title="Welcome to Astro.">
|
||||||
|
<main>
|
||||||
|
<h1>Welcome to <span class="text-gradient">Astro</span></h1>
|
||||||
|
<p class="instructions"><strong>Your first mission:</strong> tweak this message to try our hot module reloading. Check the <code>src/pages</code> directory!</p>
|
||||||
|
<ul role="list" class="link-card-grid">
|
||||||
|
<li class="link-card">
|
||||||
|
<a href="https://astro.build/integrations/">
|
||||||
|
<h2>Integrations <span>→</span></h2>
|
||||||
|
<p>Add component frameworks, Tailwind, Partytown, and more!</p>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="link-card">
|
||||||
|
<a href="https://astro.build/themes/">
|
||||||
|
<h2>Themes <span>→</span></h2>
|
||||||
|
<p>Explore a galaxy of community-built starters.</p>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="link-card">
|
||||||
|
<a href="https://docs.astro.build/">
|
||||||
|
<h2>Docs <span>→</span></h2>
|
||||||
|
<p>Learn our complete feature set and explore the API.</p>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="link-card">
|
||||||
|
<a href="https://astro.build/chat/">
|
||||||
|
<h2>Chat <span>→</span></h2>
|
||||||
|
<p>
|
||||||
|
Ask, contribute, and have fun on our community Discord
|
||||||
|
<svg
|
||||||
|
class="heart"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 512 512"
|
||||||
|
width="16"
|
||||||
|
height="16"
|
||||||
|
fill="currentColor"
|
||||||
|
>
|
||||||
|
<title>heart</title>
|
||||||
|
<path d="M256 448l-30.164-27.211C118.718 322.442 48 258.61 48 179.095 48 114.221 97.918 64 162.4 64c36.399 0 70.717 16.742 93.6 43.947C278.882 80.742 313.199 64 349.6 64 414.082 64 464 114.221 464 179.095c0 79.516-70.719 143.348-177.836 241.694L256 448z" />
|
||||||
|
</svg>
|
||||||
|
</p>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</main>
|
||||||
|
</Layout>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
--color-border: hsl(17, 24%, 90%);
|
||||||
|
--astro-gradient: linear-gradient(0deg,#4F39FA, #DA62C4);
|
||||||
|
--link-gradient: linear-gradient(45deg, #4F39FA, #DA62C4 30%, var(--color-border) 60%);
|
||||||
|
--night-sky-gradient: linear-gradient(0deg, #392362 -33%, #431f69 10%, #30216b 50%, #1f1638 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
margin: 0;
|
||||||
|
transition: color 0.6s cubic-bezier(0.22, 1, 0.36, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 span {
|
||||||
|
display: inline-block;
|
||||||
|
transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
font-size: 0.875em;
|
||||||
|
border: 0.1em solid var(--color-border);
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 0.15em 0.25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
margin: auto;
|
||||||
|
padding: 1em;
|
||||||
|
max-width: 60ch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-gradient {
|
||||||
|
font-weight: 900;
|
||||||
|
background-image: var(--astro-gradient);
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
-webkit-text-fill-color: transparent;
|
||||||
|
background-size: 100% 200%;
|
||||||
|
background-position-y: 100%;
|
||||||
|
border-radius: 0.4rem;
|
||||||
|
animation: pulse 4s ease-in-out infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes pulse {
|
||||||
|
0%, 100% {
|
||||||
|
background-position-y: 0%;
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
background-position-y: 80%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.instructions {
|
||||||
|
line-height: 1.8;
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
background-image: var(--night-sky-gradient);
|
||||||
|
padding: 1.5rem;
|
||||||
|
border-radius: 0.4rem;
|
||||||
|
color: var(--color-bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.link-card-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(24ch, 1fr));
|
||||||
|
gap: 1rem;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.link-card {
|
||||||
|
list-style: none;
|
||||||
|
display: flex;
|
||||||
|
padding: 0.15rem;
|
||||||
|
background-image: var(--link-gradient);
|
||||||
|
background-size: 400%;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
background-position: 100%;
|
||||||
|
transition: background-position 0.6s cubic-bezier(0.22, 1, 0.36, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.link-card > a {
|
||||||
|
width: 100%;
|
||||||
|
text-decoration: none;
|
||||||
|
line-height: 1.4;
|
||||||
|
padding: 1em 1.3em;
|
||||||
|
border-radius: 0.35rem;
|
||||||
|
color: var(--text-color);
|
||||||
|
background-color: white;
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.link-card:is(:hover, :focus-within) {
|
||||||
|
background-position: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.link-card:is(:hover, :focus-within) h2 {
|
||||||
|
color: #4F39FA;
|
||||||
|
}
|
||||||
|
|
||||||
|
.link-card:is(:hover, :focus-within) h2 span {
|
||||||
|
transform: translateX(2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.heart {
|
||||||
|
display: inline-block;
|
||||||
|
color: #DA62C4;
|
||||||
|
animation: heartbeat 3s ease-in-out infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes heartbeat {
|
||||||
|
0%,
|
||||||
|
50%,
|
||||||
|
100% {
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
5% {
|
||||||
|
transform: scale(1.125);
|
||||||
|
}
|
||||||
|
10% {
|
||||||
|
transform: scale(1.05);
|
||||||
|
}
|
||||||
|
15% {
|
||||||
|
transform: scale(1.25);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
15
examples/astro/tsconfig.json
Normal file
15
examples/astro/tsconfig.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
// Enable top-level await, and other modern ESM features.
|
||||||
|
"target": "ESNext",
|
||||||
|
"module": "ESNext",
|
||||||
|
// Enable node-style module resolution, for things like npm package imports.
|
||||||
|
"moduleResolution": "node",
|
||||||
|
// Enable JSON imports.
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
// Enable stricter transpilation for better output.
|
||||||
|
"isolatedModules": true,
|
||||||
|
// Add type definitions for our Vite runtime.
|
||||||
|
"types": ["vite/client"]
|
||||||
|
}
|
||||||
|
}
|
||||||
3457
examples/astro/yarn.lock
Normal file
3457
examples/astro/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
2
examples/create-react-app/.env.production
Normal file
2
examples/create-react-app/.env.production
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# `REACT_APP` prefix is required to expose to client-side
|
||||||
|
REACT_APP_VERCEL_ANALYTICS_ID=$VERCEL_ANALYTICS_ID
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@testing-library/jest-dom": "^5.16.1",
|
"@testing-library/jest-dom": "^5.16.4",
|
||||||
"@testing-library/react": "^12.1.2",
|
"@testing-library/react": "^13.3.0",
|
||||||
"@testing-library/user-event": "^13.5.0",
|
"@testing-library/user-event": "^14.2.0",
|
||||||
"react": "^17.0.2",
|
"react": "^18.1.0",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^18.1.0",
|
||||||
"react-scripts": "5.0.0",
|
"react-scripts": "5.0.1",
|
||||||
"web-vitals": "^2.1.3"
|
"web-vitals": "^2.1.4"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "react-scripts start",
|
"start": "react-scripts start",
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import ReactDOM from 'react-dom';
|
|||||||
import './index.css';
|
import './index.css';
|
||||||
import App from './App';
|
import App from './App';
|
||||||
import reportWebVitals from './reportWebVitals';
|
import reportWebVitals from './reportWebVitals';
|
||||||
|
import { sendToVercelAnalytics } from './vitals';
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<React.StrictMode>
|
<React.StrictMode>
|
||||||
@@ -11,7 +12,4 @@ ReactDOM.render(
|
|||||||
document.getElementById('root')
|
document.getElementById('root')
|
||||||
);
|
);
|
||||||
|
|
||||||
// If you want to start measuring performance in your app, pass a function
|
reportWebVitals(sendToVercelAnalytics);
|
||||||
// to log results (for example: reportWebVitals(console.log))
|
|
||||||
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
|
||||||
reportWebVitals();
|
|
||||||
|
|||||||
40
examples/create-react-app/src/vitals.js
Normal file
40
examples/create-react-app/src/vitals.js
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
const vitalsUrl = 'https://vitals.vercel-analytics.com/v1/vitals';
|
||||||
|
|
||||||
|
function getConnectionSpeed() {
|
||||||
|
return 'connection' in navigator &&
|
||||||
|
navigator['connection'] &&
|
||||||
|
'effectiveType' in navigator['connection']
|
||||||
|
? navigator['connection']['effectiveType']
|
||||||
|
: '';
|
||||||
|
}
|
||||||
|
|
||||||
|
export function sendToVercelAnalytics(metric) {
|
||||||
|
const analyticsId = process.env.REACT_APP_VERCEL_ANALYTICS_ID;
|
||||||
|
if (!analyticsId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const body = {
|
||||||
|
dsn: analyticsId,
|
||||||
|
id: metric.id,
|
||||||
|
page: window.location.pathname,
|
||||||
|
href: window.location.href,
|
||||||
|
event_name: metric.name,
|
||||||
|
value: metric.value.toString(),
|
||||||
|
speed: getConnectionSpeed(),
|
||||||
|
};
|
||||||
|
|
||||||
|
const blob = new Blob([new URLSearchParams(body).toString()], {
|
||||||
|
// This content type is necessary for `sendBeacon`
|
||||||
|
type: 'application/x-www-form-urlencoded',
|
||||||
|
});
|
||||||
|
if (navigator.sendBeacon) {
|
||||||
|
navigator.sendBeacon(vitalsUrl, blob);
|
||||||
|
} else
|
||||||
|
fetch(vitalsUrl, {
|
||||||
|
body: blob,
|
||||||
|
method: 'POST',
|
||||||
|
credentials: 'omit',
|
||||||
|
keepalive: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -1484,10 +1484,10 @@
|
|||||||
"@svgr/plugin-svgo" "^5.5.0"
|
"@svgr/plugin-svgo" "^5.5.0"
|
||||||
loader-utils "^2.0.0"
|
loader-utils "^2.0.0"
|
||||||
|
|
||||||
"@testing-library/dom@^8.0.0":
|
"@testing-library/dom@^8.5.0":
|
||||||
version "8.11.2"
|
version "8.13.0"
|
||||||
resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-8.11.2.tgz#fc110c665a066c2287be765e4a35ba8dad737015"
|
resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-8.13.0.tgz#bc00bdd64c7d8b40841e27a70211399ad3af46f5"
|
||||||
integrity sha512-idsS/cqbYudXcVWngc1PuWNmXs416oBy2g/7Q8QAUREt5Z3MUkAL2XJD7xazLJ6esDfqRDi/ZBxk+OPPXitHRw==
|
integrity sha512-9VHgfIatKNXQNaZTtLnalIy0jNZzY35a4S3oi08YAt9Hv1VsfZ/DfA45lM8D/UhtHBGJ4/lGwp0PZkVndRkoOQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/code-frame" "^7.10.4"
|
"@babel/code-frame" "^7.10.4"
|
||||||
"@babel/runtime" "^7.12.5"
|
"@babel/runtime" "^7.12.5"
|
||||||
@@ -1498,10 +1498,10 @@
|
|||||||
lz-string "^1.4.4"
|
lz-string "^1.4.4"
|
||||||
pretty-format "^27.0.2"
|
pretty-format "^27.0.2"
|
||||||
|
|
||||||
"@testing-library/jest-dom@^5.16.1":
|
"@testing-library/jest-dom@^5.16.4":
|
||||||
version "5.16.1"
|
version "5.16.4"
|
||||||
resolved "https://registry.yarnpkg.com/@testing-library/jest-dom/-/jest-dom-5.16.1.tgz#3db7df5ae97596264a7da9696fe14695ba02e51f"
|
resolved "https://registry.yarnpkg.com/@testing-library/jest-dom/-/jest-dom-5.16.4.tgz#938302d7b8b483963a3ae821f1c0808f872245cd"
|
||||||
integrity sha512-ajUJdfDIuTCadB79ukO+0l8O+QwN0LiSxDaYUTI4LndbbUsGi6rWU1SCexXzBA2NSjlVB9/vbkasQIL3tmPBjw==
|
integrity sha512-Gy+IoFutbMQcky0k+bqqumXZ1cTGswLsFqmNLzNdSKkU9KGV2u9oXhukCbbJ9/LRPKiqwxEE8VpV/+YZlfkPUA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.9.2"
|
"@babel/runtime" "^7.9.2"
|
||||||
"@types/testing-library__jest-dom" "^5.9.1"
|
"@types/testing-library__jest-dom" "^5.9.1"
|
||||||
@@ -1513,20 +1513,19 @@
|
|||||||
lodash "^4.17.15"
|
lodash "^4.17.15"
|
||||||
redent "^3.0.0"
|
redent "^3.0.0"
|
||||||
|
|
||||||
"@testing-library/react@^12.1.2":
|
"@testing-library/react@^13.3.0":
|
||||||
version "12.1.2"
|
version "13.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-12.1.2.tgz#f1bc9a45943461fa2a598bb4597df1ae044cfc76"
|
resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-13.3.0.tgz#bf298bfbc5589326bbcc8052b211f3bb097a97c5"
|
||||||
integrity sha512-ihQiEOklNyHIpo2Y8FREkyD1QAea054U0MVbwH1m8N9TxeFz+KoJ9LkqoKqJlzx2JDm56DVwaJ1r36JYxZM05g==
|
integrity sha512-DB79aA426+deFgGSjnf5grczDPiL4taK3hFaa+M5q7q20Kcve9eQottOG5kZ74KEr55v0tU2CQormSSDK87zYQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.12.5"
|
"@babel/runtime" "^7.12.5"
|
||||||
"@testing-library/dom" "^8.0.0"
|
"@testing-library/dom" "^8.5.0"
|
||||||
|
"@types/react-dom" "^18.0.0"
|
||||||
|
|
||||||
"@testing-library/user-event@^13.5.0":
|
"@testing-library/user-event@^14.2.0":
|
||||||
version "13.5.0"
|
version "14.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/@testing-library/user-event/-/user-event-13.5.0.tgz#69d77007f1e124d55314a2b73fd204b333b13295"
|
resolved "https://registry.yarnpkg.com/@testing-library/user-event/-/user-event-14.2.0.tgz#8293560f8f80a00383d6c755ec3e0b918acb1683"
|
||||||
integrity sha512-5Kwtbo3Y/NowpkbRuSepbyMFkZmHgD+vPzYB/RJ4oxt5Gj/avFFBYjhw27cqSVPVw/3a67NK1PbiIr9k4Gwmdg==
|
integrity sha512-+hIlG4nJS6ivZrKnOP7OGsDu9Fxmryj9vCl8x0ZINtTJcCHs2zLsYif5GzuRiBF2ck5GZG2aQr7Msg+EHlnYVQ==
|
||||||
dependencies:
|
|
||||||
"@babel/runtime" "^7.12.5"
|
|
||||||
|
|
||||||
"@tootallnate/once@1":
|
"@tootallnate/once@1":
|
||||||
version "1.1.2"
|
version "1.1.2"
|
||||||
@@ -1735,6 +1734,11 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.4.3.tgz#a3c65525b91fca7da00ab1a3ac2b5a2a4afbffbf"
|
resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.4.3.tgz#a3c65525b91fca7da00ab1a3ac2b5a2a4afbffbf"
|
||||||
integrity sha512-QzSuZMBuG5u8HqYz01qtMdg/Jfctlnvj1z/lYnIDXs/golxw0fxtRAHd9KrzjR7Yxz1qVeI00o0kiO3PmVdJ9w==
|
integrity sha512-QzSuZMBuG5u8HqYz01qtMdg/Jfctlnvj1z/lYnIDXs/golxw0fxtRAHd9KrzjR7Yxz1qVeI00o0kiO3PmVdJ9w==
|
||||||
|
|
||||||
|
"@types/prop-types@*":
|
||||||
|
version "15.7.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.5.tgz#5f19d2b85a98e9558036f6a3cacc8819420f05cf"
|
||||||
|
integrity sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==
|
||||||
|
|
||||||
"@types/q@^1.5.1":
|
"@types/q@^1.5.1":
|
||||||
version "1.5.5"
|
version "1.5.5"
|
||||||
resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.5.tgz#75a2a8e7d8ab4b230414505d92335d1dcb53a6df"
|
resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.5.tgz#75a2a8e7d8ab4b230414505d92335d1dcb53a6df"
|
||||||
@@ -1750,6 +1754,22 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.4.tgz#cd667bcfdd025213aafb7ca5915a932590acdcdc"
|
resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.4.tgz#cd667bcfdd025213aafb7ca5915a932590acdcdc"
|
||||||
integrity sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==
|
integrity sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==
|
||||||
|
|
||||||
|
"@types/react-dom@^18.0.0":
|
||||||
|
version "18.0.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.0.5.tgz#330b2d472c22f796e5531446939eacef8378444a"
|
||||||
|
integrity sha512-OWPWTUrY/NIrjsAPkAk1wW9LZeIjSvkXRhclsFO8CZcZGCOg2G0YZy4ft+rOyYxy8B7ui5iZzi9OkDebZ7/QSA==
|
||||||
|
dependencies:
|
||||||
|
"@types/react" "*"
|
||||||
|
|
||||||
|
"@types/react@*":
|
||||||
|
version "18.0.9"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.9.tgz#d6712a38bd6cd83469603e7359511126f122e878"
|
||||||
|
integrity sha512-9bjbg1hJHUm4De19L1cHiW0Jvx3geel6Qczhjd0qY5VKVE2X5+x77YxAepuCwVh4vrgZJdgEJw48zrhRIeF4Nw==
|
||||||
|
dependencies:
|
||||||
|
"@types/prop-types" "*"
|
||||||
|
"@types/scheduler" "*"
|
||||||
|
csstype "^3.0.2"
|
||||||
|
|
||||||
"@types/resolve@1.17.1":
|
"@types/resolve@1.17.1":
|
||||||
version "1.17.1"
|
version "1.17.1"
|
||||||
resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-1.17.1.tgz#3afd6ad8967c77e4376c598a82ddd58f46ec45d6"
|
resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-1.17.1.tgz#3afd6ad8967c77e4376c598a82ddd58f46ec45d6"
|
||||||
@@ -1762,6 +1782,11 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.12.1.tgz#d8f1c0d0dc23afad6dc16a9e993a0865774b4065"
|
resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.12.1.tgz#d8f1c0d0dc23afad6dc16a9e993a0865774b4065"
|
||||||
integrity sha512-xoDlM2S4ortawSWORYqsdU+2rxdh4LRW9ytc3zmT37RIKQh6IHyKwwtKhKis9ah8ol07DCkZxPt8BBvPjC6v4g==
|
integrity sha512-xoDlM2S4ortawSWORYqsdU+2rxdh4LRW9ytc3zmT37RIKQh6IHyKwwtKhKis9ah8ol07DCkZxPt8BBvPjC6v4g==
|
||||||
|
|
||||||
|
"@types/scheduler@*":
|
||||||
|
version "0.16.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.2.tgz#1a62f89525723dde24ba1b01b092bf5df8ad4d39"
|
||||||
|
integrity sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==
|
||||||
|
|
||||||
"@types/serve-index@^1.9.1":
|
"@types/serve-index@^1.9.1":
|
||||||
version "1.9.1"
|
version "1.9.1"
|
||||||
resolved "https://registry.yarnpkg.com/@types/serve-index/-/serve-index-1.9.1.tgz#1b5e85370a192c01ec6cec4735cf2917337a6278"
|
resolved "https://registry.yarnpkg.com/@types/serve-index/-/serve-index-1.9.1.tgz#1b5e85370a192c01ec6cec4735cf2917337a6278"
|
||||||
@@ -3175,6 +3200,11 @@ cssstyle@^2.3.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
cssom "~0.3.6"
|
cssom "~0.3.6"
|
||||||
|
|
||||||
|
csstype@^3.0.2:
|
||||||
|
version "3.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.0.tgz#4ddcac3718d787cf9df0d1b7d15033925c8f29f2"
|
||||||
|
integrity sha512-uX1KG+x9h5hIJsaKR9xHUeUraxf8IODOwq9JLNPq6BwB04a/xgpq3rcx47l5BZu5zBPlgD342tdke3Hom/nJRA==
|
||||||
|
|
||||||
damerau-levenshtein@^1.0.7:
|
damerau-levenshtein@^1.0.7:
|
||||||
version "1.0.8"
|
version "1.0.8"
|
||||||
resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz#b43d286ccbd36bc5b2f7ed41caf2d0aba1f8a6e7"
|
resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz#b43d286ccbd36bc5b2f7ed41caf2d0aba1f8a6e7"
|
||||||
@@ -3622,10 +3652,10 @@ escodegen@^2.0.0:
|
|||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
source-map "~0.6.1"
|
source-map "~0.6.1"
|
||||||
|
|
||||||
eslint-config-react-app@^7.0.0:
|
eslint-config-react-app@^7.0.1:
|
||||||
version "7.0.0"
|
version "7.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/eslint-config-react-app/-/eslint-config-react-app-7.0.0.tgz#0fa96d5ec1dfb99c029b1554362ab3fa1c3757df"
|
resolved "https://registry.yarnpkg.com/eslint-config-react-app/-/eslint-config-react-app-7.0.1.tgz#73ba3929978001c5c86274c017ea57eb5fa644b4"
|
||||||
integrity sha512-xyymoxtIt1EOsSaGag+/jmcywRuieQoA2JbPCjnw9HukFj9/97aGPoZVFioaotzk1K5Qt9sHO5EutZbkrAXS0g==
|
integrity sha512-K6rNzvkIeHaTd8m/QEh1Zko0KI7BACWkkneSs6s9cKZC/J27X3eZR6Upt1jkmZ/4FK+XUOPPxMEN7+lbUXfSlA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/core" "^7.16.0"
|
"@babel/core" "^7.16.0"
|
||||||
"@babel/eslint-parser" "^7.16.3"
|
"@babel/eslint-parser" "^7.16.3"
|
||||||
@@ -6841,10 +6871,10 @@ react-app-polyfill@^3.0.0:
|
|||||||
regenerator-runtime "^0.13.9"
|
regenerator-runtime "^0.13.9"
|
||||||
whatwg-fetch "^3.6.2"
|
whatwg-fetch "^3.6.2"
|
||||||
|
|
||||||
react-dev-utils@^12.0.0:
|
react-dev-utils@^12.0.1:
|
||||||
version "12.0.0"
|
version "12.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/react-dev-utils/-/react-dev-utils-12.0.0.tgz#4eab12cdb95692a077616770b5988f0adf806526"
|
resolved "https://registry.yarnpkg.com/react-dev-utils/-/react-dev-utils-12.0.1.tgz#ba92edb4a1f379bd46ccd6bcd4e7bc398df33e73"
|
||||||
integrity sha512-xBQkitdxozPxt1YZ9O1097EJiVpwHr9FoAuEVURCKV0Av8NBERovJauzP7bo1ThvuhZ4shsQ1AJiu4vQpoT1AQ==
|
integrity sha512-84Ivxmr17KjUupyqzFode6xKhjwuEJDROWKJy/BthkL7Wn6NJ8h4WE6k/exAv6ImS+0oZLRRW5j/aINMHyeGeQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/code-frame" "^7.16.0"
|
"@babel/code-frame" "^7.16.0"
|
||||||
address "^1.1.2"
|
address "^1.1.2"
|
||||||
@@ -6865,25 +6895,24 @@ react-dev-utils@^12.0.0:
|
|||||||
open "^8.4.0"
|
open "^8.4.0"
|
||||||
pkg-up "^3.1.0"
|
pkg-up "^3.1.0"
|
||||||
prompts "^2.4.2"
|
prompts "^2.4.2"
|
||||||
react-error-overlay "^6.0.10"
|
react-error-overlay "^6.0.11"
|
||||||
recursive-readdir "^2.2.2"
|
recursive-readdir "^2.2.2"
|
||||||
shell-quote "^1.7.3"
|
shell-quote "^1.7.3"
|
||||||
strip-ansi "^6.0.1"
|
strip-ansi "^6.0.1"
|
||||||
text-table "^0.2.0"
|
text-table "^0.2.0"
|
||||||
|
|
||||||
react-dom@^17.0.2:
|
react-dom@^18.1.0:
|
||||||
version "17.0.2"
|
version "18.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-17.0.2.tgz#ecffb6845e3ad8dbfcdc498f0d0a939736502c23"
|
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.1.0.tgz#7f6dd84b706408adde05e1df575b3a024d7e8a2f"
|
||||||
integrity sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==
|
integrity sha512-fU1Txz7Budmvamp7bshe4Zi32d0ll7ect+ccxNu9FlObT605GOEB8BfO4tmRJ39R5Zj831VCpvQ05QPBW5yb+w==
|
||||||
dependencies:
|
dependencies:
|
||||||
loose-envify "^1.1.0"
|
loose-envify "^1.1.0"
|
||||||
object-assign "^4.1.1"
|
scheduler "^0.22.0"
|
||||||
scheduler "^0.20.2"
|
|
||||||
|
|
||||||
react-error-overlay@^6.0.10:
|
react-error-overlay@^6.0.11:
|
||||||
version "6.0.10"
|
version "6.0.11"
|
||||||
resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-6.0.10.tgz#0fe26db4fa85d9dbb8624729580e90e7159a59a6"
|
resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-6.0.11.tgz#92835de5841c5cf08ba00ddd2d677b6d17ff9adb"
|
||||||
integrity sha512-mKR90fX7Pm5seCOfz8q9F+66VCc1PGsWSBxKbITjfKVQHMNF2zudxHnMdJiB1fRCb+XsbQV9sO9DCkgsMQgBIA==
|
integrity sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==
|
||||||
|
|
||||||
react-is@^16.13.1:
|
react-is@^16.13.1:
|
||||||
version "16.13.1"
|
version "16.13.1"
|
||||||
@@ -6900,10 +6929,10 @@ react-refresh@^0.11.0:
|
|||||||
resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.11.0.tgz#77198b944733f0f1f1a90e791de4541f9f074046"
|
resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.11.0.tgz#77198b944733f0f1f1a90e791de4541f9f074046"
|
||||||
integrity sha512-F27qZr8uUqwhWZboondsPx8tnC3Ct3SxZA3V5WyEvujRyyNv0VYPhoBg1gZ8/MV5tubQp76Trw8lTv9hzRBa+A==
|
integrity sha512-F27qZr8uUqwhWZboondsPx8tnC3Ct3SxZA3V5WyEvujRyyNv0VYPhoBg1gZ8/MV5tubQp76Trw8lTv9hzRBa+A==
|
||||||
|
|
||||||
react-scripts@5.0.0:
|
react-scripts@5.0.1:
|
||||||
version "5.0.0"
|
version "5.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/react-scripts/-/react-scripts-5.0.0.tgz#6547a6d7f8b64364ef95273767466cc577cb4b60"
|
resolved "https://registry.yarnpkg.com/react-scripts/-/react-scripts-5.0.1.tgz#6285dbd65a8ba6e49ca8d651ce30645a6d980003"
|
||||||
integrity sha512-3i0L2CyIlROz7mxETEdfif6Sfhh9Lfpzi10CtcGs1emDQStmZfWjJbAIMtRD0opVUjQuFWqHZyRZ9PPzKCFxWg==
|
integrity sha512-8VAmEm/ZAwQzJ+GOMLbBsTdDKOpuZh7RPs0UymvBR2vRk4iZWCskjbFnxqjrzoIvlNNRZ3QJFx6/qDSi6zSnaQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/core" "^7.16.0"
|
"@babel/core" "^7.16.0"
|
||||||
"@pmmmwh/react-refresh-webpack-plugin" "^0.5.3"
|
"@pmmmwh/react-refresh-webpack-plugin" "^0.5.3"
|
||||||
@@ -6921,7 +6950,7 @@ react-scripts@5.0.0:
|
|||||||
dotenv "^10.0.0"
|
dotenv "^10.0.0"
|
||||||
dotenv-expand "^5.1.0"
|
dotenv-expand "^5.1.0"
|
||||||
eslint "^8.3.0"
|
eslint "^8.3.0"
|
||||||
eslint-config-react-app "^7.0.0"
|
eslint-config-react-app "^7.0.1"
|
||||||
eslint-webpack-plugin "^3.1.1"
|
eslint-webpack-plugin "^3.1.1"
|
||||||
file-loader "^6.2.0"
|
file-loader "^6.2.0"
|
||||||
fs-extra "^10.0.0"
|
fs-extra "^10.0.0"
|
||||||
@@ -6938,7 +6967,7 @@ react-scripts@5.0.0:
|
|||||||
postcss-preset-env "^7.0.1"
|
postcss-preset-env "^7.0.1"
|
||||||
prompts "^2.4.2"
|
prompts "^2.4.2"
|
||||||
react-app-polyfill "^3.0.0"
|
react-app-polyfill "^3.0.0"
|
||||||
react-dev-utils "^12.0.0"
|
react-dev-utils "^12.0.1"
|
||||||
react-refresh "^0.11.0"
|
react-refresh "^0.11.0"
|
||||||
resolve "^1.20.0"
|
resolve "^1.20.0"
|
||||||
resolve-url-loader "^4.0.0"
|
resolve-url-loader "^4.0.0"
|
||||||
@@ -6955,13 +6984,12 @@ react-scripts@5.0.0:
|
|||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
fsevents "^2.3.2"
|
fsevents "^2.3.2"
|
||||||
|
|
||||||
react@^17.0.2:
|
react@^18.1.0:
|
||||||
version "17.0.2"
|
version "18.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/react/-/react-17.0.2.tgz#d0b5cc516d29eb3eee383f75b62864cfb6800037"
|
resolved "https://registry.yarnpkg.com/react/-/react-18.1.0.tgz#6f8620382decb17fdc5cc223a115e2adbf104890"
|
||||||
integrity sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==
|
integrity sha512-4oL8ivCz5ZEPyclFQXaNksK3adutVS8l2xzZU0cqEFrE9Sb7fC0EFK5uEk74wIreL1DERyjvsU915j1pcT2uEQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
loose-envify "^1.1.0"
|
loose-envify "^1.1.0"
|
||||||
object-assign "^4.1.1"
|
|
||||||
|
|
||||||
readable-stream@^2.0.1:
|
readable-stream@^2.0.1:
|
||||||
version "2.3.7"
|
version "2.3.7"
|
||||||
@@ -7235,13 +7263,12 @@ saxes@^5.0.1:
|
|||||||
dependencies:
|
dependencies:
|
||||||
xmlchars "^2.2.0"
|
xmlchars "^2.2.0"
|
||||||
|
|
||||||
scheduler@^0.20.2:
|
scheduler@^0.22.0:
|
||||||
version "0.20.2"
|
version "0.22.0"
|
||||||
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.20.2.tgz#4baee39436e34aa93b4874bddcbf0fe8b8b50e91"
|
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.22.0.tgz#83a5d63594edf074add9a7198b1bae76c3db01b8"
|
||||||
integrity sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==
|
integrity sha512-6QAm1BgQI88NPYymgGQLCZgvep4FyePDWFpXVK+zNSUgHwlqpJy8VEh8Et0KxTACS4VWwMousBElAZOH9nkkoQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
loose-envify "^1.1.0"
|
loose-envify "^1.1.0"
|
||||||
object-assign "^4.1.1"
|
|
||||||
|
|
||||||
schema-utils@2.7.0:
|
schema-utils@2.7.0:
|
||||||
version "2.7.0"
|
version "2.7.0"
|
||||||
@@ -8156,10 +8183,10 @@ wbuf@^1.1.0, wbuf@^1.7.3:
|
|||||||
dependencies:
|
dependencies:
|
||||||
minimalistic-assert "^1.0.0"
|
minimalistic-assert "^1.0.0"
|
||||||
|
|
||||||
web-vitals@^2.1.3:
|
web-vitals@^2.1.4:
|
||||||
version "2.1.3"
|
version "2.1.4"
|
||||||
resolved "https://registry.yarnpkg.com/web-vitals/-/web-vitals-2.1.3.tgz#6dca59f41dbc3fcccdb889da06191b437b18f534"
|
resolved "https://registry.yarnpkg.com/web-vitals/-/web-vitals-2.1.4.tgz#76563175a475a5e835264d373704f9dde718290c"
|
||||||
integrity sha512-+ijpniAzcnQicXaXIN0/eHQAiV/jMt1oHGHTmz7VdAJPPkzzDhmoYPSpLgJTuFtUh+jCjxCoeTZPg7Ic+g8o7w==
|
integrity sha512-sVWcwhU5mX6crfI5Vd2dC4qchyTqxV8URinzt25XqVh+bHEPGH4C3NPrNionCP7Obx59wrYEbNlw4Z8sjALzZg==
|
||||||
|
|
||||||
webidl-conversions@^4.0.2:
|
webidl-conversions@^4.0.2:
|
||||||
version "4.0.2"
|
version "4.0.2"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ This directory is a brief example of a [Dojo](https://dojo.io) site that can be
|
|||||||
|
|
||||||
Deploy your own Dojo project with Vercel.
|
Deploy your own Dojo project with Vercel.
|
||||||
|
|
||||||
[](https://vercel.com/new/clone?repository-url=https://github.com/vercel/vercel/tree/main/dojo&template=dojo)
|
[](https://vercel.com/new/clone?repository-url=https://github.com/vercel/vercel/tree/main/examples/dojo&template=dojo)
|
||||||
|
|
||||||
### How We Created This Example
|
### How We Created This Example
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ cache:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
# See https://git.io/vdao3 for details.
|
# See https://github.com/ember-cli/ember-cli/blob/master/docs/build-concurrency.md
|
||||||
- JOBS=1
|
- JOBS=1
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
|||||||
@@ -48,6 +48,6 @@
|
|||||||
"qunit-dom": "^0.8.4"
|
"qunit-dom": "^0.8.4"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "8.* || >= 10.*"
|
"node": "14.x"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,3 +2,4 @@ README.md
|
|||||||
.nuxt
|
.nuxt
|
||||||
node_modules
|
node_modules
|
||||||
*.log
|
*.log
|
||||||
|
.output
|
||||||
|
|||||||
3
examples/remix/.eslintrc.js
Normal file
3
examples/remix/.eslintrc.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
module.exports = {
|
||||||
|
extends: ["@remix-run/eslint-config", "@remix-run/eslint-config/node"],
|
||||||
|
};
|
||||||
8
examples/remix/.gitignore
vendored
8
examples/remix/.gitignore
vendored
@@ -1,7 +1,11 @@
|
|||||||
node_modules
|
node_modules
|
||||||
|
|
||||||
.cache
|
.cache
|
||||||
|
.env
|
||||||
.vercel
|
.vercel
|
||||||
|
.output
|
||||||
|
|
||||||
public/build
|
/build/
|
||||||
api/_build
|
/public/build
|
||||||
|
/api/index.js
|
||||||
|
/api/index.js.map
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
const { createRequestHandler } = require("@remix-run/vercel");
|
|
||||||
|
|
||||||
module.exports = createRequestHandler({
|
|
||||||
build: require("./_build")
|
|
||||||
});
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
|
import { RemixBrowser } from "@remix-run/react";
|
||||||
import { hydrate } from "react-dom";
|
import { hydrate } from "react-dom";
|
||||||
import { RemixBrowser } from "remix";
|
|
||||||
|
|
||||||
hydrate(<RemixBrowser />, document);
|
hydrate(<RemixBrowser />, document);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
import type { EntryContext } from "@remix-run/node";
|
||||||
|
import { RemixServer } from "@remix-run/react";
|
||||||
import { renderToString } from "react-dom/server";
|
import { renderToString } from "react-dom/server";
|
||||||
import { RemixServer } from "remix";
|
|
||||||
import type { EntryContext } from "remix";
|
|
||||||
|
|
||||||
export default function handleRequest(
|
export default function handleRequest(
|
||||||
request: Request,
|
request: Request,
|
||||||
@@ -16,6 +16,6 @@ export default function handleRequest(
|
|||||||
|
|
||||||
return new Response("<!DOCTYPE html>" + markup, {
|
return new Response("<!DOCTYPE html>" + markup, {
|
||||||
status: responseStatusCode,
|
status: responseStatusCode,
|
||||||
headers: responseHeaders
|
headers: responseHeaders,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import type { LinksFunction, MetaFunction } from "@remix-run/node";
|
||||||
import {
|
import {
|
||||||
Link,
|
Link,
|
||||||
Links,
|
Links,
|
||||||
@@ -6,14 +7,13 @@ import {
|
|||||||
Outlet,
|
Outlet,
|
||||||
Scripts,
|
Scripts,
|
||||||
ScrollRestoration,
|
ScrollRestoration,
|
||||||
useCatch
|
useCatch,
|
||||||
} from "remix";
|
} from "@remix-run/react";
|
||||||
import type { LinksFunction } from "remix";
|
|
||||||
|
|
||||||
import globalStylesUrl from "~/styles/global.css";
|
|
||||||
import darkStylesUrl from "~/styles/dark.css";
|
import darkStylesUrl from "~/styles/dark.css";
|
||||||
|
import globalStylesUrl from "~/styles/global.css";
|
||||||
|
|
||||||
// https://remix.run/api/app#links
|
// https://remix.run/api/conventions#links
|
||||||
export let links: LinksFunction = () => {
|
export let links: LinksFunction = () => {
|
||||||
return [
|
return [
|
||||||
{ rel: "stylesheet", href: globalStylesUrl },
|
{ rel: "stylesheet", href: globalStylesUrl },
|
||||||
@@ -25,6 +25,12 @@ export let links: LinksFunction = () => {
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// https://remix.run/api/conventions#meta
|
||||||
|
export let meta: MetaFunction = () => ({
|
||||||
|
charset: "utf-8",
|
||||||
|
viewport: "width=device-width,initial-scale=1",
|
||||||
|
});
|
||||||
|
|
||||||
// https://remix.run/api/conventions#default-export
|
// https://remix.run/api/conventions#default-export
|
||||||
// https://remix.run/api/conventions#route-filenames
|
// https://remix.run/api/conventions#route-filenames
|
||||||
export default function App() {
|
export default function App() {
|
||||||
@@ -37,7 +43,7 @@ export default function App() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://remix.run/docs/en/v1/api/conventions#errorboundary
|
// https://remix.run/api/conventions#errorboundary
|
||||||
export function ErrorBoundary({ error }: { error: Error }) {
|
export function ErrorBoundary({ error }: { error: Error }) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return (
|
return (
|
||||||
@@ -57,7 +63,7 @@ export function ErrorBoundary({ error }: { error: Error }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://remix.run/docs/en/v1/api/conventions#catchboundary
|
// https://remix.run/api/conventions#catchboundary
|
||||||
export function CatchBoundary() {
|
export function CatchBoundary() {
|
||||||
let caught = useCatch();
|
let caught = useCatch();
|
||||||
|
|
||||||
@@ -103,8 +109,6 @@ function Document({
|
|||||||
return (
|
return (
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charSet="utf-8" />
|
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
||||||
{title ? <title>{title}</title> : null}
|
{title ? <title>{title}</title> : null}
|
||||||
<Meta />
|
<Meta />
|
||||||
<Links />
|
<Links />
|
||||||
@@ -113,7 +117,7 @@ function Document({
|
|||||||
{children}
|
{children}
|
||||||
<ScrollRestoration />
|
<ScrollRestoration />
|
||||||
<Scripts />
|
<Scripts />
|
||||||
{process.env.NODE_ENV === "development" && <LiveReload />}
|
<LiveReload />
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Outlet } from "remix";
|
import type { MetaFunction, LinksFunction } from "@remix-run/node";
|
||||||
import type { MetaFunction, LinksFunction } from "remix";
|
import { Outlet } from "@remix-run/react";
|
||||||
|
|
||||||
import stylesUrl from "~/styles/demos/about.css";
|
import stylesUrl from "~/styles/demos/about.css";
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Link } from "remix";
|
import { Link } from "@remix-run/react";
|
||||||
|
|
||||||
export default function AboutIndex() {
|
export default function AboutIndex() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Link } from "remix";
|
import { Link } from "@remix-run/react";
|
||||||
|
|
||||||
export default function AboutIndex() {
|
export default function AboutIndex() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
|
import type { ActionFunction } from "@remix-run/node";
|
||||||
|
import { json, redirect } from "@remix-run/node";
|
||||||
|
import { Form, useActionData } from "@remix-run/react";
|
||||||
import { useEffect, useRef } from "react";
|
import { useEffect, useRef } from "react";
|
||||||
import type { ActionFunction } from "remix";
|
|
||||||
import { Form, json, useActionData, redirect } from "remix";
|
|
||||||
|
|
||||||
export function meta() {
|
export function meta() {
|
||||||
return { title: "Actions Demo" };
|
return { title: "Actions Demo" };
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { useCatch, Link, json, useLoaderData, Outlet } from "remix";
|
import type { MetaFunction } from "@remix-run/node";
|
||||||
|
import { json } from "@remix-run/node";
|
||||||
|
import { Link, Outlet, useCatch, useLoaderData } from "@remix-run/react";
|
||||||
|
|
||||||
export function meta() {
|
export let meta: MetaFunction = () => ({ title: "Boundaries Demo" });
|
||||||
return { title: "Boundaries Demo" };
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function Boundaries() {
|
export default function Boundaries() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useCatch, Link, json, useLoaderData } from "remix";
|
import type { LoaderFunction, MetaFunction } from "@remix-run/node";
|
||||||
import type { LoaderFunction, MetaFunction } from "remix";
|
import { json } from "@remix-run/node";
|
||||||
|
import { Link, useCatch, useLoaderData } from "@remix-run/react";
|
||||||
|
|
||||||
// The `$` in route filenames becomes a pattern that's parsed from the URL and
|
// The `$` in route filenames becomes a pattern that's parsed from the URL and
|
||||||
// passed to your loaders so you can look up data.
|
// passed to your loaders so you can look up data.
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useCatch, Link, json, useLoaderData, Outlet } from "remix";
|
import type { LoaderFunction } from "@remix-run/node";
|
||||||
import type { LoaderFunction } from "remix";
|
import { json } from "@remix-run/node";
|
||||||
|
import { Link, Outlet, useCatch, useLoaderData } from "@remix-run/react";
|
||||||
|
|
||||||
export default function Boundaries() {
|
export default function Boundaries() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import type { MetaFunction, LoaderFunction } from "remix";
|
import type { MetaFunction, LoaderFunction } from "@remix-run/node";
|
||||||
import { useLoaderData, json, Link } from "remix";
|
import { json } from "@remix-run/node";
|
||||||
|
import { Link, useLoaderData } from "@remix-run/react";
|
||||||
|
|
||||||
type IndexData = {
|
type IndexData = {
|
||||||
resources: Array<{ name: string; url: string }>;
|
resources: Array<{ name: string; url: string }>;
|
||||||
|
|||||||
8345
examples/remix/package-lock.json
generated
8345
examples/remix/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,29 +1,28 @@
|
|||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"name": "remix-app-template",
|
"sideEffects": false,
|
||||||
"description": "",
|
|
||||||
"license": "",
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "remix build",
|
"build": "remix build",
|
||||||
"dev": "remix dev",
|
"dev": "remix dev"
|
||||||
"postinstall": "remix setup node"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@remix-run/react": "^1.0.6",
|
"@remix-run/node": "^1.5.1",
|
||||||
|
"@remix-run/react": "^1.5.1",
|
||||||
|
"@remix-run/vercel": "^1.5.1",
|
||||||
|
"@vercel/node": "^2.0.0",
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2"
|
||||||
"remix": "^1.0.6",
|
|
||||||
"@remix-run/serve": "^1.0.6",
|
|
||||||
"@remix-run/vercel": "^1.0.6"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@remix-run/dev": "^1.0.6",
|
"@remix-run/dev": "^1.5.1",
|
||||||
"@types/react": "^17.0.24",
|
"@remix-run/eslint-config": "^1.5.1",
|
||||||
"@types/react-dom": "^17.0.9",
|
"@remix-run/serve": "^1.5.1",
|
||||||
"typescript": "^4.1.2"
|
"@types/react": "^17.0.45",
|
||||||
|
"@types/react-dom": "^17.0.17",
|
||||||
|
"eslint": "^8.15.0",
|
||||||
|
"typescript": "^4.6.4"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14"
|
"node": ">=14"
|
||||||
},
|
}
|
||||||
"sideEffects": false
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
/**
|
/**
|
||||||
* @type {import('@remix-run/dev/config').AppConfig}
|
* @type {import('@remix-run/dev').AppConfig}
|
||||||
*/
|
*/
|
||||||
module.exports = {
|
module.exports = {
|
||||||
appDirectory: "app",
|
serverBuildTarget: "vercel",
|
||||||
browserBuildDirectory: "public/build",
|
// When running locally in development mode, we use the built in remix
|
||||||
publicPath: "/build/",
|
// server. This does not understand the vercel lambda module format,
|
||||||
serverBuildDirectory: "api/_build"
|
// so we default back to the standard build output.
|
||||||
|
server: process.env.NODE_ENV === "development" ? undefined : "./server.js",
|
||||||
|
ignoredRouteFiles: ["**/.*"],
|
||||||
|
// appDirectory: "app",
|
||||||
|
// assetsBuildDirectory: "public/build",
|
||||||
|
// serverBuildPath: "api/index.js",
|
||||||
|
// publicPath: "/build/",
|
||||||
};
|
};
|
||||||
|
|||||||
4
examples/remix/server.js
Normal file
4
examples/remix/server.js
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
import * as build from "@remix-run/dev/server-build";
|
||||||
|
import { createRequestHandler } from "@remix-run/vercel";
|
||||||
|
|
||||||
|
export default createRequestHandler({ build, mode: process.env.NODE_ENV });
|
||||||
1
examples/solidstart/.gitignore
vendored
1
examples/solidstart/.gitignore
vendored
@@ -2,6 +2,7 @@ dist
|
|||||||
worker
|
worker
|
||||||
.solid
|
.solid
|
||||||
.vercel
|
.vercel
|
||||||
|
.output
|
||||||
|
|
||||||
# dependencies
|
# dependencies
|
||||||
/node_modules
|
/node_modules
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# SolidStart
|
# SolidStart
|
||||||
|
|
||||||
This directory is a brief example of a [SolidStart](https://github.com/ryansolid/solid-startp) site that can be deployed to Vercel with zero configuration.
|
This directory is a brief example of a [SolidStart](https://github.com/ryansolid/solid-start) site that can be deployed to Vercel with zero configuration.
|
||||||
|
|
||||||
## Deploy Your Own
|
## Deploy Your Own
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"jsx": "preserve",
|
|
||||||
"jsxImportSource": "solid-js",
|
|
||||||
"paths": {
|
|
||||||
"~/*": ["./src/*"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -7,14 +7,14 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"private": true,
|
"private": true,
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"solid-app-router": "^0.1.14",
|
"solid-app-router": "^0.3.2",
|
||||||
"solid-js": "^1.2.6",
|
"solid-js": "^1.3.15",
|
||||||
"solid-meta": "^0.27.2",
|
"solid-meta": "^0.27.3",
|
||||||
"solid-start": "next",
|
"solid-start": "next",
|
||||||
"solid-start-vercel": "next",
|
"solid-start-vercel": "next",
|
||||||
"vite": "^2.7.1"
|
"vite": "^2.9.9"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14"
|
"node": "16.x"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
4
examples/solidstart/src/entry-client.tsx
Normal file
4
examples/solidstart/src/entry-client.tsx
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
import { hydrate } from "solid-js/web";
|
||||||
|
import { StartClient } from "solid-start/entry-client";
|
||||||
|
|
||||||
|
hydrate(() => <StartClient />, document);
|
||||||
7
examples/solidstart/src/entry-server.tsx
Normal file
7
examples/solidstart/src/entry-server.tsx
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import { StartServer, createHandler, renderAsync } from "solid-start/entry-server";
|
||||||
|
import { inlineServerModules } from "solid-start/server";
|
||||||
|
|
||||||
|
export default createHandler(
|
||||||
|
inlineServerModules,
|
||||||
|
renderAsync((context) => <StartServer context={context} />)
|
||||||
|
);
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
// @refresh reload
|
|
||||||
import { Links, Meta, Outlet, Scripts } from "solid-start/components";
|
|
||||||
|
|
||||||
export default function Root({ Start }) {
|
|
||||||
return (
|
|
||||||
<Start>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<Meta />
|
|
||||||
<Links />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<Outlet />
|
|
||||||
<Scripts />
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
</Start>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
25
examples/solidstart/src/root.tsx
Normal file
25
examples/solidstart/src/root.tsx
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
// @refresh reload
|
||||||
|
import { Links, Meta, Routes, Scripts } from "solid-start/root";
|
||||||
|
import { ErrorBoundary } from "solid-start/error-boundary";
|
||||||
|
import { Suspense } from "solid-js";
|
||||||
|
|
||||||
|
export default function Root() {
|
||||||
|
return (
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<Meta />
|
||||||
|
<Links />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<ErrorBoundary>
|
||||||
|
<Suspense>
|
||||||
|
<Routes />
|
||||||
|
</Suspense>
|
||||||
|
</ErrorBoundary>
|
||||||
|
<Scripts />
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
);
|
||||||
|
}
|
||||||
16
examples/solidstart/tsconfig.json
Normal file
16
examples/solidstart/tsconfig.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"target": "ESNext",
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"jsxImportSource": "solid-js",
|
||||||
|
"jsx": "preserve",
|
||||||
|
"types": ["vite/client"],
|
||||||
|
"baseUrl": "./",
|
||||||
|
"paths": {
|
||||||
|
"~/*": ["./src/*"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"build": {
|
"build": {
|
||||||
"env": {
|
"env": {
|
||||||
"ENABLE_FILE_SYSTEM_API": "1"
|
"ENABLE_VC_BUILD": "1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
import solid from "solid-start";
|
import solid from "solid-start";
|
||||||
import vercel from "solid-start-vercel"
|
import vercel from "solid-start-vercel";
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [solid({ adapter: vercel() })]
|
plugins: [solid({ adapter: vercel() })],
|
||||||
});
|
});
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
1
examples/sveltekit/.gitignore
vendored
1
examples/sveltekit/.gitignore
vendored
@@ -7,3 +7,4 @@ node_modules
|
|||||||
.env.*
|
.env.*
|
||||||
!.env.example
|
!.env.example
|
||||||
.vercel
|
.vercel
|
||||||
|
.output
|
||||||
|
|||||||
13
examples/sveltekit/.prettierignore
Normal file
13
examples/sveltekit/.prettierignore
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
.DS_Store
|
||||||
|
node_modules
|
||||||
|
/build
|
||||||
|
/.svelte-kit
|
||||||
|
/package
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
!.env.example
|
||||||
|
|
||||||
|
# Ignore files for PNPM, NPM and YARN
|
||||||
|
pnpm-lock.yaml
|
||||||
|
package-lock.json
|
||||||
|
yarn.lock
|
||||||
6
examples/sveltekit/.prettierrc
Normal file
6
examples/sveltekit/.prettierrc
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"useTabs": false,
|
||||||
|
"singleQuote": true,
|
||||||
|
"trailingComma": "none",
|
||||||
|
"printWidth": 100
|
||||||
|
}
|
||||||
@@ -14,31 +14,29 @@ If you're seeing this, you've probably already done this step. Congrats!
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# create a new project in the current directory
|
# create a new project in the current directory
|
||||||
npm init svelte@next
|
npm init svelte
|
||||||
|
|
||||||
# create a new project in my-app
|
# create a new project in my-app
|
||||||
npm init svelte@next my-app
|
npm init svelte my-app
|
||||||
```
|
```
|
||||||
|
|
||||||
> Note: the `@next` is temporary
|
|
||||||
|
|
||||||
## Developing
|
## Developing
|
||||||
|
|
||||||
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
Once you've created a project and installed dependencies with `pnpm install`, start a development server:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run dev
|
pnpm run dev
|
||||||
|
|
||||||
# or start the server and open the app in a new browser tab
|
# or start the server and open the app in a new browser tab
|
||||||
npm run dev -- --open
|
pnpm run dev -- --open
|
||||||
```
|
```
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
This uses the adapter-auto for SvelteKit, which detects Vercel and runs adapter-vercel on your behalf.
|
To create a production version of your app:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run build
|
pnpm run build
|
||||||
```
|
```
|
||||||
|
|
||||||
> You can preview the built app with `npm run preview`, regardless of whether you installed an adapter. This should _not_ be used to serve your app in production.
|
You can preview the production build with `npm run preview`.
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
{
|
{
|
||||||
|
"extends": "./.svelte-kit/tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": ".",
|
"allowJs": true,
|
||||||
"paths": {
|
"checkJs": true,
|
||||||
"$lib": ["src/lib"],
|
"esModuleInterop": true,
|
||||||
"$lib/*": ["src/lib/*"]
|
"forceConsistentCasingInFileNames": true,
|
||||||
}
|
"resolveJsonModule": true,
|
||||||
},
|
"skipLibCheck": true,
|
||||||
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"]
|
"sourceMap": true,
|
||||||
|
"strict": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1267
examples/sveltekit/package-lock.json
generated
1267
examples/sveltekit/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,22 +1,30 @@
|
|||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"name": "sveltekit",
|
|
||||||
"version": "0.0.1",
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "svelte-kit dev",
|
"dev": "svelte-kit dev",
|
||||||
"build": "svelte-kit build",
|
"build": "svelte-kit build",
|
||||||
"package": "svelte-kit package",
|
"package": "svelte-kit package",
|
||||||
"preview": "svelte-kit preview"
|
"preview": "svelte-kit preview",
|
||||||
|
"prepare": "svelte-kit sync",
|
||||||
|
"check": "svelte-check --tsconfig ./jsconfig.json",
|
||||||
|
"check:watch": "svelte-check --tsconfig ./jsconfig.json --watch",
|
||||||
|
"lint": "prettier --check --plugin-search-dir=. .",
|
||||||
|
"format": "prettier --write --plugin-search-dir=. ."
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sveltejs/adapter-auto": "next",
|
"@sveltejs/adapter-auto": "1.0.0-next.50",
|
||||||
"@sveltejs/kit": "next",
|
"@sveltejs/kit": "1.0.0-next.347",
|
||||||
"svelte": "^3.46.0"
|
"@types/cookie": "^0.4.1",
|
||||||
|
"prettier": "^2.5.1",
|
||||||
|
"prettier-plugin-svelte": "^2.5.0",
|
||||||
|
"svelte": "^3.46.0",
|
||||||
|
"svelte-check": "^2.2.6",
|
||||||
|
"typescript": "~4.6.2"
|
||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fontsource/fira-mono": "^4.5.0",
|
"@fontsource/fira-mono": "^4.5.0",
|
||||||
"@lukeed/uuid": "^2.0.0",
|
"cookie": "^0.4.1",
|
||||||
"cookie": "^0.4.1"
|
"web-vitals": "^2.1.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,107 +1,107 @@
|
|||||||
@import '@fontsource/fira-mono';
|
@import '@fontsource/fira-mono';
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
font-family: Arial, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
|
font-family: Arial, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
|
||||||
Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
||||||
--font-mono: 'Fira Mono', monospace;
|
--font-mono: 'Fira Mono', monospace;
|
||||||
--pure-white: #ffffff;
|
--pure-white: #ffffff;
|
||||||
--primary-color: #b9c6d2;
|
--primary-color: #b9c6d2;
|
||||||
--secondary-color: #d0dde9;
|
--secondary-color: #d0dde9;
|
||||||
--tertiary-color: #edf0f8;
|
--tertiary-color: #edf0f8;
|
||||||
--accent-color: #ff3e00;
|
--accent-color: #ff3e00;
|
||||||
--heading-color: rgba(0, 0, 0, 0.7);
|
--heading-color: rgba(0, 0, 0, 0.7);
|
||||||
--text-color: #444444;
|
--text-color: #444444;
|
||||||
--background-without-opacity: rgba(255, 255, 255, 0.7);
|
--background-without-opacity: rgba(255, 255, 255, 0.7);
|
||||||
--column-width: 42rem;
|
--column-width: 42rem;
|
||||||
--column-margin-top: 4rem;
|
--column-margin-top: 4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
background-color: var(--primary-color);
|
background-color: var(--primary-color);
|
||||||
background: linear-gradient(
|
background: linear-gradient(
|
||||||
180deg,
|
180deg,
|
||||||
var(--primary-color) 0%,
|
var(--primary-color) 0%,
|
||||||
var(--secondary-color) 10.45%,
|
var(--secondary-color) 10.45%,
|
||||||
var(--tertiary-color) 41.35%
|
var(--tertiary-color) 41.35%
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
body::before {
|
body::before {
|
||||||
content: '';
|
content: '';
|
||||||
width: 80vw;
|
width: 80vw;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 10vw;
|
left: 10vw;
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
background: radial-gradient(
|
background: radial-gradient(
|
||||||
50% 50% at 50% 50%,
|
50% 50% at 50% 50%,
|
||||||
var(--pure-white) 0%,
|
var(--pure-white) 0%,
|
||||||
rgba(255, 255, 255, 0) 100%
|
rgba(255, 255, 255, 0) 100%
|
||||||
);
|
);
|
||||||
opacity: 0.05;
|
opacity: 0.05;
|
||||||
}
|
}
|
||||||
|
|
||||||
#svelte {
|
#svelte {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1,
|
h1,
|
||||||
h2,
|
h2,
|
||||||
p {
|
p {
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: var(--heading-color);
|
color: var(--heading-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: var(--accent-color);
|
color: var(--accent-color);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
a:hover {
|
a:hover {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
font-size: 2rem;
|
font-size: 2rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
pre {
|
pre {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-family: var(--font-mono);
|
font-family: var(--font-mono);
|
||||||
background-color: rgba(255, 255, 255, 0.45);
|
background-color: rgba(255, 255, 255, 0.45);
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
box-shadow: 2px 2px 6px rgb(255 255 255 / 25%);
|
box-shadow: 2px 2px 6px rgb(255 255 255 / 25%);
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
color: var(--text-color);
|
color: var(--text-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
input,
|
input,
|
||||||
button {
|
button {
|
||||||
font-size: inherit;
|
font-size: inherit;
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
button:focus:not(:focus-visible) {
|
button:focus:not(:focus-visible) {
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 720px) {
|
@media (min-width: 720px) {
|
||||||
h1 {
|
h1 {
|
||||||
font-size: 2.4rem;
|
font-size: 2.4rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
15
examples/sveltekit/src/app.d.ts
vendored
Normal file
15
examples/sveltekit/src/app.d.ts
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
/// <reference types="@sveltejs/kit" />
|
||||||
|
|
||||||
|
// See https://kit.svelte.dev/docs/types#app
|
||||||
|
// for information about these interfaces
|
||||||
|
declare namespace App {
|
||||||
|
interface Locals {
|
||||||
|
userid: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// interface Platform {}
|
||||||
|
|
||||||
|
// interface Session {}
|
||||||
|
|
||||||
|
// interface Stuff {}
|
||||||
|
}
|
||||||
@@ -1,13 +1,12 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="description" content="Svelte demo app" />
|
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
||||||
<link rel="icon" href="%svelte.assets%/favicon.png" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
%sveltekit.head%
|
||||||
%svelte.head%
|
</head>
|
||||||
</head>
|
<body>
|
||||||
<body>
|
<div>%sveltekit.body%</div>
|
||||||
<div>%svelte.body%</div>
|
</body>
|
||||||
</body>
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
import cookie from 'cookie';
|
import * as cookie from 'cookie';
|
||||||
import { v4 as uuid } from '@lukeed/uuid';
|
|
||||||
|
|
||||||
|
/** @type {import('@sveltejs/kit').Handle} */
|
||||||
export const handle = async ({ event, resolve }) => {
|
export const handle = async ({ event, resolve }) => {
|
||||||
const cookies = cookie.parse(event.request.headers.get('cookie') || '');
|
const cookies = cookie.parse(event.request.headers.get('cookie') || '');
|
||||||
event.locals.userid = cookies.userid || uuid();
|
event.locals.userid = cookies['userid'] || crypto.randomUUID();
|
||||||
|
|
||||||
const response = await resolve(event);
|
const response = await resolve(event);
|
||||||
|
|
||||||
if (!cookies.userid) {
|
if (!cookies['userid']) {
|
||||||
// if this is the first time the user has visited this app,
|
// if this is the first time the user has visited this app,
|
||||||
// set a cookie so that we recognise them when they return
|
// set a cookie so that we recognise them when they return
|
||||||
response.headers.set(
|
response.headers.set(
|
||||||
'set-cookie',
|
'set-cookie',
|
||||||
cookie.serialize('userid', event.locals.userid, {
|
cookie.serialize('userid', event.locals.userid, {
|
||||||
path: '/',
|
path: '/',
|
||||||
httpOnly: true
|
httpOnly: true
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,102 +1,107 @@
|
|||||||
<script>
|
<script>
|
||||||
import { spring } from 'svelte/motion';
|
import { spring } from 'svelte/motion';
|
||||||
|
|
||||||
let count = 0;
|
let count = 0;
|
||||||
|
|
||||||
const displayed_count = spring();
|
const displayed_count = spring();
|
||||||
$: displayed_count.set(count);
|
$: displayed_count.set(count);
|
||||||
$: offset = modulo($displayed_count, 1);
|
$: offset = modulo($displayed_count, 1);
|
||||||
|
|
||||||
function modulo(n, m) {
|
/**
|
||||||
// handle negative numbers
|
* @param {number} n
|
||||||
return ((n % m) + m) % m;
|
* @param {number} m
|
||||||
}
|
*/
|
||||||
|
function modulo(n, m) {
|
||||||
|
// handle negative numbers
|
||||||
|
return ((n % m) + m) % m;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="counter">
|
<div class="counter">
|
||||||
<button on:click={() => (count -= 1)} aria-label="Decrease the counter by one">
|
<button on:click={() => (count -= 1)} aria-label="Decrease the counter by one">
|
||||||
<svg aria-hidden="true" viewBox="0 0 1 1">
|
<svg aria-hidden="true" viewBox="0 0 1 1">
|
||||||
<path d="M0,0.5 L1,0.5" />
|
<path d="M0,0.5 L1,0.5" />
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div class="counter-viewport">
|
<div class="counter-viewport">
|
||||||
<div class="counter-digits" style="transform: translate(0, {100 * offset}%)">
|
<div class="counter-digits" style="transform: translate(0, {100 * offset}%)">
|
||||||
<strong class="hidden" aria-hidden="true">{Math.floor($displayed_count + 1)}</strong>
|
<strong class="hidden" aria-hidden="true">{Math.floor($displayed_count + 1)}</strong>
|
||||||
<strong>{Math.floor($displayed_count)}</strong>
|
<strong>{Math.floor($displayed_count)}</strong>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button on:click={() => (count += 1)} aria-label="Increase the counter by one">
|
<button on:click={() => (count += 1)} aria-label="Increase the counter by one">
|
||||||
<svg aria-hidden="true" viewBox="0 0 1 1">
|
<svg aria-hidden="true" viewBox="0 0 1 1">
|
||||||
<path d="M0,0.5 L1,0.5 M0.5,0 L0.5,1" />
|
<path d="M0,0.5 L1,0.5 M0.5,0 L0.5,1" />
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.counter {
|
.counter {
|
||||||
display: flex;
|
display: flex;
|
||||||
border-top: 1px solid rgba(0, 0, 0, 0.1);
|
border-top: 1px solid rgba(0, 0, 0, 0.1);
|
||||||
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
||||||
margin: 1rem 0;
|
margin: 1rem 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.counter button {
|
.counter button {
|
||||||
width: 2em;
|
width: 2em;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
border: 0;
|
border: 0;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
color: var(--text-color);
|
touch-action: manipulation;
|
||||||
font-size: 2rem;
|
color: var(--text-color);
|
||||||
}
|
font-size: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
.counter button:hover {
|
.counter button:hover {
|
||||||
background-color: var(--secondary-color);
|
background-color: var(--secondary-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
svg {
|
svg {
|
||||||
width: 25%;
|
width: 25%;
|
||||||
height: 25%;
|
height: 25%;
|
||||||
}
|
}
|
||||||
|
|
||||||
path {
|
path {
|
||||||
vector-effect: non-scaling-stroke;
|
vector-effect: non-scaling-stroke;
|
||||||
stroke-width: 2px;
|
stroke-width: 2px;
|
||||||
stroke: var(--text-color);
|
stroke: var(--text-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.counter-viewport {
|
.counter-viewport {
|
||||||
width: 8em;
|
width: 8em;
|
||||||
height: 4em;
|
height: 4em;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.counter-viewport strong {
|
.counter-viewport strong {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: var(--accent-color);
|
color: var(--accent-color);
|
||||||
font-size: 4rem;
|
font-size: 4rem;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.counter-digits {
|
.counter-digits {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hidden {
|
.hidden {
|
||||||
top: -100%;
|
top: -100%;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -2,54 +2,81 @@ import { invalidate } from '$app/navigation';
|
|||||||
|
|
||||||
// this action (https://svelte.dev/tutorial/actions) allows us to
|
// this action (https://svelte.dev/tutorial/actions) allows us to
|
||||||
// progressively enhance a <form> that already works without JS
|
// progressively enhance a <form> that already works without JS
|
||||||
|
/**
|
||||||
|
* @param {HTMLFormElement} form
|
||||||
|
* @param {{
|
||||||
|
* pending?: ({ data, form }: { data: FormData; form: HTMLFormElement }) => void;
|
||||||
|
* error?: ({
|
||||||
|
* data,
|
||||||
|
* form,
|
||||||
|
* response,
|
||||||
|
* error
|
||||||
|
* }: {
|
||||||
|
* data: FormData;
|
||||||
|
* form: HTMLFormElement;
|
||||||
|
* response: Response | null;
|
||||||
|
* error: Error | null;
|
||||||
|
* }) => void;
|
||||||
|
* result?: ({
|
||||||
|
* data,
|
||||||
|
* form,
|
||||||
|
* response
|
||||||
|
* }: {
|
||||||
|
* data: FormData;
|
||||||
|
* response: Response;
|
||||||
|
* form: HTMLFormElement;
|
||||||
|
* }) => void;
|
||||||
|
* }} [opts]
|
||||||
|
*/
|
||||||
export function enhance(form, { pending, error, result } = {}) {
|
export function enhance(form, { pending, error, result } = {}) {
|
||||||
let current_token;
|
let current_token;
|
||||||
|
|
||||||
async function handle_submit(e) {
|
/** @param {SubmitEvent} e */
|
||||||
const token = (current_token = {});
|
async function handle_submit(e) {
|
||||||
|
const token = (current_token = {});
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
const data = new FormData(form);
|
const data = new FormData(form);
|
||||||
|
|
||||||
if (pending) pending({ data, form });
|
if (pending) pending({ data, form });
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(form.action, {
|
const response = await fetch(form.action, {
|
||||||
method: form.method,
|
method: form.method,
|
||||||
headers: {
|
headers: {
|
||||||
accept: 'application/json'
|
accept: 'application/json'
|
||||||
},
|
},
|
||||||
body: data
|
body: data
|
||||||
});
|
});
|
||||||
|
|
||||||
if (token !== current_token) return;
|
if (token !== current_token) return;
|
||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
if (result) result({ data, form, response });
|
if (result) result({ data, form, response });
|
||||||
|
|
||||||
const url = new URL(form.action);
|
const url = new URL(form.action);
|
||||||
url.search = url.hash = '';
|
url.search = url.hash = '';
|
||||||
invalidate(url.href);
|
invalidate(url.href);
|
||||||
} else if (error) {
|
} else if (error) {
|
||||||
error({ data, form, error: null, response });
|
error({ data, form, error: null, response });
|
||||||
} else {
|
} else {
|
||||||
console.error(await response.text());
|
console.error(await response.text());
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (error) {
|
if (error && e instanceof Error) {
|
||||||
error({ data, form, error: e, response: null });
|
error({ data, form, error: e, response: null });
|
||||||
} else {
|
} else {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
form.addEventListener('submit', handle_submit);
|
form.addEventListener('submit', handle_submit);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
destroy() {
|
destroy() {
|
||||||
form.removeEventListener('submit', handle_submit);
|
form.removeEventListener('submit', handle_submit);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,124 +1,124 @@
|
|||||||
<script>
|
<script>
|
||||||
import { page } from '$app/stores';
|
import { page } from '$app/stores';
|
||||||
import logo from './svelte-logo.svg';
|
import logo from './svelte-logo.svg';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<header>
|
<header>
|
||||||
<div class="corner">
|
<div class="corner">
|
||||||
<a href="https://kit.svelte.dev">
|
<a href="https://kit.svelte.dev">
|
||||||
<img src={logo} alt="SvelteKit" />
|
<img src={logo} alt="SvelteKit" />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
<svg viewBox="0 0 2 3" aria-hidden="true">
|
<svg viewBox="0 0 2 3" aria-hidden="true">
|
||||||
<path d="M0,0 L1,2 C1.5,3 1.5,3 2,3 L2,0 Z" />
|
<path d="M0,0 L1,2 C1.5,3 1.5,3 2,3 L2,0 Z" />
|
||||||
</svg>
|
</svg>
|
||||||
<ul>
|
<ul>
|
||||||
<li class:active={$page.url.pathname === '/'}><a sveltekit:prefetch href="/">Home</a></li>
|
<li class:active={$page.url.pathname === '/'}><a sveltekit:prefetch href="/">Home</a></li>
|
||||||
<li class:active={$page.url.pathname === '/about'}>
|
<li class:active={$page.url.pathname === '/about'}>
|
||||||
<a sveltekit:prefetch href="/about">About</a>
|
<a sveltekit:prefetch href="/about">About</a>
|
||||||
</li>
|
</li>
|
||||||
<li class:active={$page.url.pathname === '/todos'}>
|
<li class:active={$page.url.pathname === '/todos'}>
|
||||||
<a sveltekit:prefetch href="/todos">Todos</a>
|
<a sveltekit:prefetch href="/todos">Todos</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<svg viewBox="0 0 2 3" aria-hidden="true">
|
<svg viewBox="0 0 2 3" aria-hidden="true">
|
||||||
<path d="M0,0 L0,3 C0.5,3 0.5,3 1,2 L2,0 Z" />
|
<path d="M0,0 L0,3 C0.5,3 0.5,3 1,2 L2,0 Z" />
|
||||||
</svg>
|
</svg>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="corner">
|
<div class="corner">
|
||||||
<!-- TODO put something else here? github link? -->
|
<!-- TODO put something else here? github link? -->
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
header {
|
header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
|
||||||
.corner {
|
.corner {
|
||||||
width: 3em;
|
width: 3em;
|
||||||
height: 3em;
|
height: 3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.corner a {
|
.corner a {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.corner img {
|
.corner img {
|
||||||
width: 2em;
|
width: 2em;
|
||||||
height: 2em;
|
height: 2em;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
}
|
}
|
||||||
|
|
||||||
nav {
|
nav {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
--background: rgba(255, 255, 255, 0.7);
|
--background: rgba(255, 255, 255, 0.7);
|
||||||
}
|
}
|
||||||
|
|
||||||
svg {
|
svg {
|
||||||
width: 2em;
|
width: 2em;
|
||||||
height: 3em;
|
height: 3em;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
path {
|
path {
|
||||||
fill: var(--background);
|
fill: var(--background);
|
||||||
}
|
}
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
position: relative;
|
position: relative;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
height: 3em;
|
height: 3em;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
background: var(--background);
|
background: var(--background);
|
||||||
background-size: contain;
|
background-size: contain;
|
||||||
}
|
}
|
||||||
|
|
||||||
li {
|
li {
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
li.active::before {
|
li.active::before {
|
||||||
--size: 6px;
|
--size: 6px;
|
||||||
content: '';
|
content: '';
|
||||||
width: 0;
|
width: 0;
|
||||||
height: 0;
|
height: 0;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: calc(50% - var(--size));
|
left: calc(50% - var(--size));
|
||||||
border: var(--size) solid transparent;
|
border: var(--size) solid transparent;
|
||||||
border-top: var(--size) solid var(--accent-color);
|
border-top: var(--size) solid var(--accent-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
nav a {
|
nav a {
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 0 1em;
|
padding: 0 1em;
|
||||||
color: var(--heading-color);
|
color: var(--heading-color);
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
font-size: 0.8rem;
|
font-size: 0.8rem;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
letter-spacing: 0.1em;
|
letter-spacing: 0.1em;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
transition: color 0.2s linear;
|
transition: color 0.2s linear;
|
||||||
}
|
}
|
||||||
|
|
||||||
a:hover {
|
a:hover {
|
||||||
color: var(--accent-color);
|
color: var(--accent-color);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
66
examples/sveltekit/src/lib/vitals.js
Normal file
66
examples/sveltekit/src/lib/vitals.js
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
import { getCLS, getFCP, getFID, getLCP, getTTFB } from 'web-vitals';
|
||||||
|
|
||||||
|
const vitalsUrl = 'https://vitals.vercel-analytics.com/v1/vitals';
|
||||||
|
|
||||||
|
function getConnectionSpeed() {
|
||||||
|
return 'connection' in navigator &&
|
||||||
|
navigator['connection'] &&
|
||||||
|
'effectiveType' in navigator['connection']
|
||||||
|
? // @ts-ignore
|
||||||
|
navigator['connection']['effectiveType']
|
||||||
|
: '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {import("web-vitals").Metric} metric
|
||||||
|
* @param {{ params: { [s: string]: any; } | ArrayLike<any>; path: string; analyticsId: string; debug: boolean; }} options
|
||||||
|
*/
|
||||||
|
function sendToAnalytics(metric, options) {
|
||||||
|
const page = Object.entries(options.params).reduce(
|
||||||
|
(acc, [key, value]) => acc.replace(value, `[${key}]`),
|
||||||
|
options.path
|
||||||
|
);
|
||||||
|
|
||||||
|
const body = {
|
||||||
|
dsn: options.analyticsId,
|
||||||
|
id: metric.id,
|
||||||
|
page,
|
||||||
|
href: location.href,
|
||||||
|
event_name: metric.name,
|
||||||
|
value: metric.value.toString(),
|
||||||
|
speed: getConnectionSpeed()
|
||||||
|
};
|
||||||
|
|
||||||
|
if (options.debug) {
|
||||||
|
console.log('[Analytics]', metric.name, JSON.stringify(body, null, 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
const blob = new Blob([new URLSearchParams(body).toString()], {
|
||||||
|
// This content type is necessary for `sendBeacon`
|
||||||
|
type: 'application/x-www-form-urlencoded'
|
||||||
|
});
|
||||||
|
if (navigator.sendBeacon) {
|
||||||
|
navigator.sendBeacon(vitalsUrl, blob);
|
||||||
|
} else
|
||||||
|
fetch(vitalsUrl, {
|
||||||
|
body: blob,
|
||||||
|
method: 'POST',
|
||||||
|
credentials: 'omit',
|
||||||
|
keepalive: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {any} options
|
||||||
|
*/
|
||||||
|
export function webVitals(options) {
|
||||||
|
try {
|
||||||
|
getFID((metric) => sendToAnalytics(metric, options));
|
||||||
|
getTTFB((metric) => sendToAnalytics(metric, options));
|
||||||
|
getLCP((metric) => sendToAnalytics(metric, options));
|
||||||
|
getCLS((metric) => sendToAnalytics(metric, options));
|
||||||
|
getFCP((metric) => sendToAnalytics(metric, options));
|
||||||
|
} catch (err) {
|
||||||
|
console.error('[Analytics]', err);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,45 +1,58 @@
|
|||||||
<script>
|
<script>
|
||||||
import Header from '$lib/header/Header.svelte';
|
import Header from '$lib/header/Header.svelte';
|
||||||
import '../app.css';
|
import { webVitals } from '$lib/vitals';
|
||||||
|
import { browser } from '$app/env';
|
||||||
|
import { page } from '$app/stores';
|
||||||
|
import '../app.css';
|
||||||
|
|
||||||
|
let analyticsId = import.meta.env.VERCEL_ANALYTICS_ID;
|
||||||
|
|
||||||
|
$: if (browser && analyticsId) {
|
||||||
|
webVitals({
|
||||||
|
path: $page.url.pathname,
|
||||||
|
params: $page.params,
|
||||||
|
analyticsId
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header />
|
<Header />
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<slot />
|
<slot />
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
<p>visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to learn SvelteKit</p>
|
<p>visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to learn SvelteKit</p>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
main {
|
main {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 1024px;
|
max-width: 1024px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 40px;
|
padding: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
footer a {
|
footer a {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 480px) {
|
@media (min-width: 480px) {
|
||||||
footer {
|
footer {
|
||||||
padding: 40px 0;
|
padding: 40px 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,50 +1,50 @@
|
|||||||
<script context="module">
|
<script context="module">
|
||||||
import { browser, dev } from '$app/env';
|
import { browser, dev } from '$app/env';
|
||||||
|
|
||||||
// we don't need any JS on this page, though we'll load
|
// we don't need any JS on this page, though we'll load
|
||||||
// it in dev so that we get hot module replacement...
|
// it in dev so that we get hot module replacement...
|
||||||
export const hydrate = dev;
|
export const hydrate = dev;
|
||||||
|
|
||||||
// ...but if the client-side router is already loaded
|
// ...but if the client-side router is already loaded
|
||||||
// (i.e. we came here from elsewhere in the app), use it
|
// (i.e. we came here from elsewhere in the app), use it
|
||||||
export const router = browser;
|
export const router = browser;
|
||||||
|
|
||||||
// since there's no dynamic data here, we can prerender
|
// since there's no dynamic data here, we can prerender
|
||||||
// it so that it gets served as a static asset in prod
|
// it so that it gets served as a static asset in prod
|
||||||
export const prerender = true;
|
export const prerender = true;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
<title>About</title>
|
<title>About</title>
|
||||||
|
<meta name="description" content="About this app" />
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<h1>About this app</h1>
|
<h1>About this app</h1>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
This is a <a href="https://kit.svelte.dev">SvelteKit</a> app. You can make your own by typing the
|
This is a <a href="https://kit.svelte.dev">SvelteKit</a> app. You can make your own by typing the
|
||||||
following into your command line and following the prompts:
|
following into your command line and following the prompts:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<!-- TODO lose the @next! -->
|
<pre>npm init svelte</pre>
|
||||||
<pre>npm init svelte@next</pre>
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The page you're looking at is purely static HTML, with no client-side interactivity needed.
|
The page you're looking at is purely static HTML, with no client-side interactivity needed.
|
||||||
Because of that, we don't need to load any JavaScript. Try viewing the page's source, or opening
|
Because of that, we don't need to load any JavaScript. Try viewing the page's source, or opening
|
||||||
the devtools network panel and reloading.
|
the devtools network panel and reloading.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The <a href="/todos">TODOs</a> page illustrates SvelteKit's data loading and form handling. Try using
|
The <a href="/todos">TODOs</a> page illustrates SvelteKit's data loading and form handling. Try using
|
||||||
it with JavaScript disabled!
|
it with JavaScript disabled!
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.content {
|
.content {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: var(--column-width);
|
max-width: var(--column-width);
|
||||||
margin: var(--column-margin-top) auto 0 auto;
|
margin: var(--column-margin-top) auto 0 auto;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,59 +1,60 @@
|
|||||||
<script context="module">
|
<script context="module">
|
||||||
export const prerender = true;
|
export const prerender = true;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Counter from '$lib/Counter.svelte';
|
import Counter from '$lib/Counter.svelte';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
<title>Home</title>
|
<title>Home</title>
|
||||||
|
<meta name="description" content="Svelte demo app" />
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<h1>
|
<h1>
|
||||||
<div class="welcome">
|
<div class="welcome">
|
||||||
<picture>
|
<picture>
|
||||||
<source srcset="svelte-welcome.webp" type="image/webp" />
|
<source srcset="svelte-welcome.webp" type="image/webp" />
|
||||||
<img src="svelte-welcome.png" alt="Welcome" />
|
<img src="svelte-welcome.png" alt="Welcome" />
|
||||||
</picture>
|
</picture>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
to your new<br />SvelteKit app
|
to your new<br />SvelteKit app
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<h2>
|
<h2>
|
||||||
try editing <strong>src/routes/index.svelte</strong>
|
try editing <strong>src/routes/index.svelte</strong>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<Counter />
|
<Counter />
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
section {
|
section {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.welcome {
|
.welcome {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 0;
|
height: 0;
|
||||||
padding: 0 0 calc(100% * 495 / 2048) 0;
|
padding: 0 0 calc(100% * 495 / 2048) 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.welcome img {
|
.welcome img {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
top: 0;
|
top: 0;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -11,12 +11,17 @@
|
|||||||
|
|
||||||
const base = 'https://api.svelte.dev';
|
const base = 'https://api.svelte.dev';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} method
|
||||||
|
* @param {string} resource
|
||||||
|
* @param {Record<string, unknown>} [data]
|
||||||
|
*/
|
||||||
export function api(method, resource, data) {
|
export function api(method, resource, data) {
|
||||||
return fetch(`${base}/${resource}`, {
|
return fetch(`${base}/${resource}`, {
|
||||||
method,
|
method,
|
||||||
headers: {
|
headers: {
|
||||||
'content-type': 'application/json'
|
'content-type': 'application/json'
|
||||||
},
|
},
|
||||||
body: data && JSON.stringify(data)
|
body: data && JSON.stringify(data)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,66 +1,70 @@
|
|||||||
import { api } from './_api';
|
import { api } from './_api';
|
||||||
|
|
||||||
|
/** @type {import('./__types').RequestHandler} */
|
||||||
export const get = async ({ locals }) => {
|
export const get = async ({ locals }) => {
|
||||||
// locals.userid comes from src/hooks.js
|
// locals.userid comes from src/hooks.js
|
||||||
const response = await api('get', `todos/${locals.userid}`);
|
const response = await api('get', `todos/${locals.userid}`);
|
||||||
|
|
||||||
if (response.status === 404) {
|
if (response.status === 404) {
|
||||||
// user hasn't created a todo list.
|
// user hasn't created a todo list.
|
||||||
// start with an empty array
|
// start with an empty array
|
||||||
return {
|
return {
|
||||||
body: {
|
body: {
|
||||||
todos: []
|
todos: []
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
return {
|
return {
|
||||||
body: {
|
body: {
|
||||||
todos: await response.json()
|
todos: await response.json()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
status: response.status
|
status: response.status
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** @type {import('./index').RequestHandler} */
|
||||||
export const post = async ({ request, locals }) => {
|
export const post = async ({ request, locals }) => {
|
||||||
const form = await request.formData();
|
const form = await request.formData();
|
||||||
|
|
||||||
await api('post', `todos/${locals.userid}`, {
|
await api('post', `todos/${locals.userid}`, {
|
||||||
text: form.get('text')
|
text: form.get('text')
|
||||||
});
|
});
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
};
|
};
|
||||||
|
|
||||||
// If the user has JavaScript disabled, the URL will change to
|
// If the user has JavaScript disabled, the URL will change to
|
||||||
// include the method override unless we redirect back to /todos
|
// include the method override unless we redirect back to /todos
|
||||||
const redirect = {
|
const redirect = {
|
||||||
status: 303,
|
status: 303,
|
||||||
headers: {
|
headers: {
|
||||||
location: '/todos'
|
location: '/todos'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** @type {import('./index').RequestHandler} */
|
||||||
export const patch = async ({ request, locals }) => {
|
export const patch = async ({ request, locals }) => {
|
||||||
const form = await request.formData();
|
const form = await request.formData();
|
||||||
|
|
||||||
await api('patch', `todos/${locals.userid}/${form.get('uid')}`, {
|
await api('patch', `todos/${locals.userid}/${form.get('uid')}`, {
|
||||||
text: form.has('text') ? form.get('text') : undefined,
|
text: form.has('text') ? form.get('text') : undefined,
|
||||||
done: form.has('done') ? !!form.get('done') : undefined
|
done: form.has('done') ? !!form.get('done') : undefined
|
||||||
});
|
});
|
||||||
|
|
||||||
return redirect;
|
return redirect;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** @type {import('./index').RequestHandler} */
|
||||||
export const del = async ({ request, locals }) => {
|
export const del = async ({ request, locals }) => {
|
||||||
const form = await request.formData();
|
const form = await request.formData();
|
||||||
|
|
||||||
await api('delete', `todos/${locals.userid}/${form.get('uid')}`);
|
await api('delete', `todos/${locals.userid}/${form.get('uid')}`);
|
||||||
|
|
||||||
return redirect;
|
return redirect;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,178 +1,190 @@
|
|||||||
<script>
|
<script>
|
||||||
import { enhance } from '$lib/form';
|
import { enhance } from '$lib/form';
|
||||||
import { scale } from 'svelte/transition';
|
import { scale } from 'svelte/transition';
|
||||||
import { flip } from 'svelte/animate';
|
import { flip } from 'svelte/animate';
|
||||||
|
|
||||||
export let todos;
|
/**
|
||||||
|
* @typedef {{
|
||||||
|
* uid: string;
|
||||||
|
* created_at: Date;
|
||||||
|
* text: string;
|
||||||
|
* done: boolean;
|
||||||
|
* pending_delete: boolean;
|
||||||
|
* }} Todo
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {Todo[]} */
|
||||||
|
export let todos;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
<title>Todos</title>
|
<title>Todos</title>
|
||||||
|
<meta name="description" content="A todo list app" />
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<div class="todos">
|
<div class="todos">
|
||||||
<h1>Todos</h1>
|
<h1>Todos</h1>
|
||||||
|
|
||||||
<form
|
<form
|
||||||
class="new"
|
class="new"
|
||||||
action="/todos"
|
action="/todos"
|
||||||
method="post"
|
method="post"
|
||||||
use:enhance={{
|
use:enhance={{
|
||||||
result: async ({ form }) => {
|
result: async ({ form }) => {
|
||||||
form.reset();
|
form.reset();
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<input name="text" aria-label="Add todo" placeholder="+ tap to add a todo" />
|
<input name="text" aria-label="Add todo" placeholder="+ tap to add a todo" />
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{#each todos as todo (todo.uid)}
|
{#each todos as todo (todo.uid)}
|
||||||
<div
|
<div
|
||||||
class="todo"
|
class="todo"
|
||||||
class:done={todo.done}
|
class:done={todo.done}
|
||||||
transition:scale|local={{ start: 0.7 }}
|
transition:scale|local={{ start: 0.7 }}
|
||||||
animate:flip={{ duration: 200 }}
|
animate:flip={{ duration: 200 }}
|
||||||
>
|
>
|
||||||
<form
|
<form
|
||||||
action="/todos?_method=PATCH"
|
action="/todos?_method=PATCH"
|
||||||
method="post"
|
method="post"
|
||||||
use:enhance={{
|
use:enhance={{
|
||||||
pending: ({ data }) => {
|
pending: ({ data }) => {
|
||||||
todo.done = !!data.get('done');
|
todo.done = !!data.get('done');
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<input type="hidden" name="uid" value={todo.uid} />
|
<input type="hidden" name="uid" value={todo.uid} />
|
||||||
<input type="hidden" name="done" value={todo.done ? '' : 'true'} />
|
<input type="hidden" name="done" value={todo.done ? '' : 'true'} />
|
||||||
<button class="toggle" aria-label="Mark todo as {todo.done ? 'not done' : 'done'}" />
|
<button class="toggle" aria-label="Mark todo as {todo.done ? 'not done' : 'done'}" />
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form class="text" action="/todos?_method=PATCH" method="post" use:enhance>
|
<form class="text" action="/todos?_method=PATCH" method="post" use:enhance>
|
||||||
<input type="hidden" name="uid" value={todo.uid} />
|
<input type="hidden" name="uid" value={todo.uid} />
|
||||||
<input aria-label="Edit todo" type="text" name="text" value={todo.text} />
|
<input aria-label="Edit todo" type="text" name="text" value={todo.text} />
|
||||||
<button class="save" aria-label="Save todo" />
|
<button class="save" aria-label="Save todo" />
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form
|
<form
|
||||||
action="/todos?_method=DELETE"
|
action="/todos?_method=DELETE"
|
||||||
method="post"
|
method="post"
|
||||||
use:enhance={{
|
use:enhance={{
|
||||||
pending: () => (todo.pending_delete = true)
|
pending: () => (todo.pending_delete = true)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<input type="hidden" name="uid" value={todo.uid} />
|
<input type="hidden" name="uid" value={todo.uid} />
|
||||||
<button class="delete" aria-label="Delete todo" disabled={todo.pending_delete} />
|
<button class="delete" aria-label="Delete todo" disabled={todo.pending_delete} />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.todos {
|
.todos {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: var(--column-width);
|
max-width: var(--column-width);
|
||||||
margin: var(--column-margin-top) auto 0 auto;
|
margin: var(--column-margin-top) auto 0 auto;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.new {
|
.new {
|
||||||
margin: 0 0 0.5rem 0;
|
margin: 0 0 0.5rem 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
input {
|
input {
|
||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
input:focus-visible {
|
input:focus-visible {
|
||||||
box-shadow: inset 1px 1px 6px rgba(0, 0, 0, 0.1);
|
box-shadow: inset 1px 1px 6px rgba(0, 0, 0, 0.1);
|
||||||
border: 1px solid #ff3e00 !important;
|
border: 1px solid #ff3e00 !important;
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.new input {
|
.new input {
|
||||||
font-size: 28px;
|
font-size: 28px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 0.5em 1em 0.3em 1em;
|
padding: 0.5em 1em 0.3em 1em;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background: rgba(255, 255, 255, 0.05);
|
background: rgba(255, 255, 255, 0.05);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.todo {
|
.todo {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 2rem 1fr 2rem;
|
grid-template-columns: 2rem 1fr 2rem;
|
||||||
grid-gap: 0.5rem;
|
grid-gap: 0.5rem;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin: 0 0 0.5rem 0;
|
margin: 0 0 0.5rem 0;
|
||||||
padding: 0.5rem;
|
padding: 0.5rem;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.1));
|
filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.1));
|
||||||
transform: translate(-1px, -1px);
|
transform: translate(-1px, -1px);
|
||||||
transition: filter 0.2s, transform 0.2s;
|
transition: filter 0.2s, transform 0.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.done {
|
.done {
|
||||||
transform: none;
|
transform: none;
|
||||||
opacity: 0.4;
|
opacity: 0.4;
|
||||||
filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.1));
|
filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.1));
|
||||||
}
|
}
|
||||||
|
|
||||||
form.text {
|
form.text {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.todo input {
|
.todo input {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
padding: 0.5em 2em 0.5em 0.8em;
|
padding: 0.5em 2em 0.5em 0.8em;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.todo button {
|
.todo button {
|
||||||
width: 2em;
|
width: 2em;
|
||||||
height: 2em;
|
height: 2em;
|
||||||
border: none;
|
border: none;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
background-position: 50% 50%;
|
background-position: 50% 50%;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
button.toggle {
|
button.toggle {
|
||||||
border: 1px solid rgba(0, 0, 0, 0.2);
|
border: 1px solid rgba(0, 0, 0, 0.2);
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background-size: 1em auto;
|
background-size: 1em auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.done .toggle {
|
.done .toggle {
|
||||||
background-image: url("data:image/svg+xml,%3Csvg width='22' height='16' viewBox='0 0 22 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20.5 1.5L7.4375 14.5L1.5 8.5909' stroke='%23676778' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
|
background-image: url("data:image/svg+xml,%3Csvg width='22' height='16' viewBox='0 0 22 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20.5 1.5L7.4375 14.5L1.5 8.5909' stroke='%23676778' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
|
||||||
}
|
}
|
||||||
|
|
||||||
.delete {
|
.delete {
|
||||||
background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.5 5V22H19.5V5H4.5Z' fill='%23676778' stroke='%23676778' stroke-width='1.5' stroke-linejoin='round'/%3E%3Cpath d='M10 10V16.5' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M14 10V16.5' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M2 5H22' stroke='%23676778' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M8 5L9.6445 2H14.3885L16 5H8Z' fill='%23676778' stroke='%23676778' stroke-width='1.5' stroke-linejoin='round'/%3E%3C/svg%3E%0A");
|
background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.5 5V22H19.5V5H4.5Z' fill='%23676778' stroke='%23676778' stroke-width='1.5' stroke-linejoin='round'/%3E%3Cpath d='M10 10V16.5' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M14 10V16.5' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M2 5H22' stroke='%23676778' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M8 5L9.6445 2H14.3885L16 5H8Z' fill='%23676778' stroke='%23676778' stroke-width='1.5' stroke-linejoin='round'/%3E%3C/svg%3E%0A");
|
||||||
opacity: 0.2;
|
opacity: 0.2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.delete:hover,
|
.delete:hover,
|
||||||
.delete:focus {
|
.delete:focus {
|
||||||
transition: opacity 0.2s;
|
transition: opacity 0.2s;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.save {
|
.save {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 0;
|
right: 0;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20.5 2H3.5C2.67158 2 2 2.67157 2 3.5V20.5C2 21.3284 2.67158 22 3.5 22H20.5C21.3284 22 22 21.3284 22 20.5V3.5C22 2.67157 21.3284 2 20.5 2Z' fill='%23676778' stroke='%23676778' stroke-width='1.5' stroke-linejoin='round'/%3E%3Cpath d='M17 2V11H7.5V2H17Z' fill='white' stroke='white' stroke-width='1.5' stroke-linejoin='round'/%3E%3Cpath d='M13.5 5.5V7.5' stroke='%23676778' stroke-width='1.5' stroke-linecap='round'/%3E%3Cpath d='M5.99844 2H18.4992' stroke='%23676778' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E%0A");
|
background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20.5 2H3.5C2.67158 2 2 2.67157 2 3.5V20.5C2 21.3284 2.67158 22 3.5 22H20.5C21.3284 22 22 21.3284 22 20.5V3.5C22 2.67157 21.3284 2 20.5 2Z' fill='%23676778' stroke='%23676778' stroke-width='1.5' stroke-linejoin='round'/%3E%3Cpath d='M17 2V11H7.5V2H17Z' fill='white' stroke='white' stroke-width='1.5' stroke-linejoin='round'/%3E%3Cpath d='M13.5 5.5V7.5' stroke='%23676778' stroke-width='1.5' stroke-linecap='round'/%3E%3Cpath d='M5.99844 2H18.4992' stroke='%23676778' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E%0A");
|
||||||
}
|
}
|
||||||
|
|
||||||
.todo input:focus + .save,
|
.todo input:focus + .save,
|
||||||
.save:focus {
|
.save:focus {
|
||||||
transition: opacity 0.2s;
|
transition: opacity 0.2s;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -2,14 +2,19 @@ import adapter from '@sveltejs/adapter-auto';
|
|||||||
|
|
||||||
/** @type {import('@sveltejs/kit').Config} */
|
/** @type {import('@sveltejs/kit').Config} */
|
||||||
const config = {
|
const config = {
|
||||||
kit: {
|
kit: {
|
||||||
adapter: adapter(),
|
adapter: adapter(),
|
||||||
|
|
||||||
// Override http methods in the Todo forms
|
// Override http methods in the Todo forms
|
||||||
methodOverride: {
|
methodOverride: {
|
||||||
allowed: ['PATCH', 'DELETE']
|
allowed: ['PATCH', 'DELETE']
|
||||||
}
|
},
|
||||||
}
|
vite: {
|
||||||
|
define: {
|
||||||
|
'import.meta.env.VERCEL_ANALYTICS_ID': JSON.stringify(process.env.VERCEL_ANALYTICS_ID)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
|||||||
1479
examples/sveltekit/yarn.lock
Normal file
1479
examples/sveltekit/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
46
package.json
46
package.json
@@ -14,37 +14,24 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lerna": "3.16.4"
|
"lerna": "3.16.4"
|
||||||
},
|
},
|
||||||
"turbo": {
|
|
||||||
"baseBranch": "origin/main",
|
|
||||||
"pipeline": {
|
|
||||||
"build": {
|
|
||||||
"dependsOn": [
|
|
||||||
"^build"
|
|
||||||
],
|
|
||||||
"outputs": [
|
|
||||||
"dist/**"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@typescript-eslint/eslint-plugin": "4.28.0",
|
"@typescript-eslint/eslint-plugin": "5.21.0",
|
||||||
"@typescript-eslint/parser": "4.28.0",
|
"@typescript-eslint/parser": "5.21.0",
|
||||||
"async-retry": "1.2.3",
|
"async-retry": "1.2.3",
|
||||||
"buffer-replace": "1.0.0",
|
"buffer-replace": "1.0.0",
|
||||||
"eslint": "7.29.0",
|
"eslint": "8.14.0",
|
||||||
"eslint-config-prettier": "8.3.0",
|
"eslint-config-prettier": "8.5.0",
|
||||||
"eslint-plugin-jest": "24.3.6",
|
"eslint-plugin-jest": "26.1.5",
|
||||||
"husky": "6.0.0",
|
"husky": "7.0.4",
|
||||||
"jest": "27.3.1",
|
"jest": "28.0.2",
|
||||||
"json5": "2.1.1",
|
"json5": "2.1.1",
|
||||||
"lint-staged": "9.2.5",
|
"lint-staged": "9.2.5",
|
||||||
"node-fetch": "2.6.1",
|
"node-fetch": "2.6.1",
|
||||||
"npm-package-arg": "6.1.0",
|
"npm-package-arg": "6.1.0",
|
||||||
"prettier": "2.3.1",
|
"prettier": "2.6.2",
|
||||||
"ts-eager": "2.0.2",
|
"ts-eager": "2.0.2",
|
||||||
"ts-jest": "27.0.4",
|
"ts-jest": "28.0.5",
|
||||||
"turbo": "1.1.9"
|
"turbo": "1.3.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lerna": "lerna",
|
"lerna": "lerna",
|
||||||
@@ -54,15 +41,16 @@
|
|||||||
"publish-from-github": "./utils/publish.sh",
|
"publish-from-github": "./utils/publish.sh",
|
||||||
"changelog": "node utils/changelog.js",
|
"changelog": "node utils/changelog.js",
|
||||||
"build": "turbo run build",
|
"build": "turbo run build",
|
||||||
"vercel-build": "yarn build && cd api && node -r ts-eager/register ./_lib/script/build.ts",
|
"vercel-build": "yarn build && yarn run pack && cd api && node -r ts-eager/register ./_lib/script/build.ts",
|
||||||
"pre-commit": "lint-staged",
|
"pre-commit": "lint-staged",
|
||||||
"test": "jest --rootDir=\"test\" --testPathPattern=\"\\.test.js\"",
|
"test": "jest --rootDir=\"test\" --testPathPattern=\"\\.test.js\"",
|
||||||
"test-unit": "yarn test && node utils/run.js test-unit",
|
"test-unit": "yarn test && turbo run test-unit",
|
||||||
"test-integration-cli": "node utils/run.js test-integration-cli",
|
"test-integration-cli": "turbo run test-integration-cli",
|
||||||
"test-integration-once": "node utils/run.js test-integration-once",
|
"test-integration-once": "turbo run test-integration-once",
|
||||||
"test-integration-dev": "node utils/run.js test-integration-dev",
|
"test-integration-dev": "turbo run test-integration-dev",
|
||||||
"lint": "eslint . --ext .ts,.js",
|
"lint": "eslint . --ext .ts,.js",
|
||||||
"prepare": "husky install"
|
"prepare": "husky install",
|
||||||
|
"pack": "cd utils && node -r ts-eager/register ./pack.ts"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"./{*,{api,packages,test,utils}/**/*}.{js,ts}": [
|
"./{*,{api,packages,test,utils}/**/*}.{js,ts}": [
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vercel/build-utils",
|
"name": "@vercel/build-utils",
|
||||||
"version": "2.15.1",
|
"version": "5.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"types": "./dist/index.d.js",
|
"types": "./dist/index.d.js",
|
||||||
@@ -12,8 +12,9 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "node build",
|
"build": "node build",
|
||||||
"test-unit": "jest --env node --verbose --runInBand --bail test/unit.*test.*",
|
"test": "jest --env node --verbose --runInBand --bail",
|
||||||
"test-integration-once": "jest --env node --verbose --runInBand --bail test/integration.test.ts",
|
"test-unit": "yarn test test/unit.*test.*",
|
||||||
|
"test-integration-once": "yarn test test/integration.test.ts",
|
||||||
"prepublishOnly": "node build"
|
"prepublishOnly": "node build"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -22,15 +23,14 @@
|
|||||||
"@types/cross-spawn": "6.0.0",
|
"@types/cross-spawn": "6.0.0",
|
||||||
"@types/end-of-stream": "^1.4.0",
|
"@types/end-of-stream": "^1.4.0",
|
||||||
"@types/fs-extra": "9.0.13",
|
"@types/fs-extra": "9.0.13",
|
||||||
"@types/glob": "^7.1.1",
|
"@types/glob": "7.2.0",
|
||||||
"@types/jest": "27.0.1",
|
"@types/jest": "27.4.1",
|
||||||
"@types/js-yaml": "3.12.1",
|
"@types/js-yaml": "3.12.1",
|
||||||
"@types/ms": "0.7.31",
|
"@types/ms": "0.7.31",
|
||||||
"@types/multistream": "2.1.1",
|
"@types/multistream": "2.1.1",
|
||||||
"@types/node-fetch": "^2.1.6",
|
"@types/node-fetch": "^2.1.6",
|
||||||
"@types/semver": "6.0.0",
|
"@types/semver": "6.0.0",
|
||||||
"@types/yazl": "^2.4.1",
|
"@types/yazl": "2.4.2",
|
||||||
"@vercel/frameworks": "0.7.1",
|
|
||||||
"@vercel/ncc": "0.24.0",
|
"@vercel/ncc": "0.24.0",
|
||||||
"aggregate-error": "3.0.1",
|
"aggregate-error": "3.0.1",
|
||||||
"async-retry": "1.2.3",
|
"async-retry": "1.2.3",
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
"cross-spawn": "6.0.5",
|
"cross-spawn": "6.0.5",
|
||||||
"end-of-stream": "1.4.1",
|
"end-of-stream": "1.4.1",
|
||||||
"fs-extra": "10.0.0",
|
"fs-extra": "10.0.0",
|
||||||
"glob": "7.1.3",
|
"glob": "8.0.3",
|
||||||
"into-stream": "5.0.0",
|
"into-stream": "5.0.0",
|
||||||
"js-yaml": "3.13.1",
|
"js-yaml": "3.13.1",
|
||||||
"minimatch": "3.0.4",
|
"minimatch": "3.0.4",
|
||||||
@@ -47,6 +47,6 @@
|
|||||||
"node-fetch": "2.6.1",
|
"node-fetch": "2.6.1",
|
||||||
"semver": "6.1.1",
|
"semver": "6.1.1",
|
||||||
"typescript": "4.3.4",
|
"typescript": "4.3.4",
|
||||||
"yazl": "2.4.3"
|
"yazl": "2.5.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user