Compare commits

...

8 Commits

Author SHA1 Message Date
Nathan Rajlich
0351f02dff Publish Canary
- @vercel/build-utils@2.14.1-canary.1
 - vercel@24.0.1-canary.1
 - @vercel/client@10.3.1-canary.1
 - @vercel/frameworks@0.6.1-canary.1
 - @vercel/go@1.3.1-canary.1
 - @vercel/node@1.13.1-canary.1
 - @vercel/python@2.2.1-canary.1
 - @vercel/ruby@1.3.1-canary.1
2022-02-22 12:13:21 -08:00
Yuanlin Lin
0d7fa2f912 [frameworks] Updated Umi.js logo (#7470)
Co-authored-by: Andy <AndyBitz@users.noreply.github.com>
2022-02-22 19:59:32 +01:00
Nathan Rajlich
3b646880e7 [node] Use NodejsLambda class (#7436)
Updates `@vercel/node` to utilize the `NodejsLambda` class so that it doesn't need to explicitly bundle in the launcher/bridge files into the build result. This reduces the complexity of the Builder and is a cleaner separation of concerns. The `helpers.test.ts` file has been moved to `@vercel/node-bridge` so it's being removed in this PR as well.
2022-02-22 16:57:11 +00:00
Steven
350a0e5f36 [examples] Bump Next.js to 12.1.0 (#7458) 2022-02-18 18:53:26 -05:00
Steven
5c21d400bd Update dev test for image optimization with next@latest and python flask (#7454)
Related to https://github.com/vercel/next.js/pull/34431
2022-02-18 16:37:59 +00:00
Nathan Rajlich
04029013a6 Publish Canary
- @vercel/build-utils@2.14.1-canary.0
 - vercel@24.0.1-canary.0
 - @vercel/client@10.3.1-canary.0
 - @vercel/frameworks@0.6.1-canary.0
 - @vercel/go@1.3.1-canary.0
 - @vercel/node-bridge@2.1.2-canary.0
 - @vercel/node@1.13.1-canary.0
 - @vercel/python@2.2.1-canary.0
 - @vercel/ruby@1.3.1-canary.0
2022-02-17 20:40:07 -08:00
Nathan Rajlich
c65e7fa883 [node-bridge] Move helpers to node-bridge (#7451) 2022-02-17 20:36:37 -08:00
Knut Melvær
27b68be93f [frameworks] Add Sanity Studio (#7350)
Adds the default config and detector for a Sanity Studio project.
2022-02-16 14:26:39 -08:00
48 changed files with 12142 additions and 6649 deletions

View File

@@ -14,4 +14,6 @@ packages/client/lib
packages/node/src/bridge.ts packages/node/src/bridge.ts
packages/node-bridge/bridge.js packages/node-bridge/bridge.js
packages/node-bridge/launcher.js packages/node-bridge/launcher.js
packages/node-bridge/helpers.js
packages/node-bridge/source-map-support.js
packages/middleware/src/entries.js packages/middleware/src/entries.js

View File

@@ -23,6 +23,7 @@
npm-debug.log* npm-debug.log*
yarn-debug.log* yarn-debug.log*
yarn-error.log* yarn-error.log*
.pnpm-debug.log*
# local env files # local env files
.env.local .env.local

View File

@@ -1,3 +1,6 @@
module.exports = { /** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true, reactStrictMode: true,
} }
module.exports = nextConfig

File diff suppressed because it is too large Load Diff

View File

@@ -7,12 +7,12 @@
"lint": "next lint" "lint": "next lint"
}, },
"dependencies": { "dependencies": {
"next": "^12.0.8", "next": "12.1.0",
"react": "17.0.2", "react": "17.0.2",
"react-dom": "17.0.2" "react-dom": "17.0.2"
}, },
"devDependencies": { "devDependencies": {
"eslint": "8.7.0", "eslint": "8.9.0",
"eslint-config-next": "^12.0.8" "eslint-config-next": "12.1.0"
} }
} }

1633
examples/nextjs/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
# Run `vercel env pull` to generate a .env file from your Vercel project
SANITY_STUDIO_API_PROJECT_ID=
SANITY_STUDIO_API_DATASET=

View File

@@ -0,0 +1,12 @@
# Logs
/logs
*.log
# Coverage directory used by tools like istanbul
/coverage
# Dependency directories
node_modules
# Compiled sanity studio
/dist

29
examples/sanity/README.md Normal file
View File

@@ -0,0 +1,29 @@
# Sanity Blogging Content Studio
Congratulations, you have now installed Sanity Studio, an open source real-time content editing environment connected to the Sanity backend.
Now you can do the following things:
- [Read “getting started” in the docs](https://www.sanity.io/docs/introduction/getting-started?utm_source=readme)
- Check out the example frontend: [React/Next.js](https://github.com/sanity-io/tutorial-sanity-blog-react-next)
- [Read the blog post about this template](https://www.sanity.io/blog/build-your-own-blog-with-sanity-and-next-js?utm_source=readme)
- [Join the community Slack](https://slack.sanity.io/?utm_source=readme)
- [Extend and build plugins](https://www.sanity.io/docs/content-studio/extending?utm_source=readme)
## Develop locally
Install dependencies:
```sh
npx @sanity/cli install
```
Pull down environment variables from your Vercel project (requires the [Vercel CLI](https://vercel.com/cli)):
```sh
vercel env pull
```
You can also run `npx @sanity/init` in this repo and agree to reconfigure it. You'll then be able to select from existing projects. The CLI will update `sanity.json` with the project ID and dataset name.

View File

@@ -0,0 +1,7 @@
{
"#": "Used by Sanity to keep track of configuration file checksums, do not delete or modify!",
"@sanity/default-layout": "bb034f391ba508a6ca8cd971967cbedeb131c4d19b17b28a0895f32db5d568ea",
"@sanity/default-login": "6fb6d3800aa71346e1b84d95bbcaa287879456f2922372bb0294e30b968cd37f",
"@sanity/form-builder": "b38478227ba5e22c91981da4b53436df22e48ff25238a55a973ed620be5068aa",
"@sanity/data-aspects": "d199e2c199b3e26cd28b68dc84d7fc01c9186bf5089580f2e2446994d36b3cb6"
}

View File

@@ -0,0 +1,3 @@
{
"listOptions": {}
}

View File

@@ -0,0 +1,6 @@
{
"toolSwitcher": {
"order": [],
"hidden": []
}
}

View File

@@ -0,0 +1,7 @@
{
"providers": {
"mode": "append",
"redirectOnSingle": false,
"entries": []
}
}

View File

@@ -0,0 +1,5 @@
{
"images": {
"directUploads": true
}
}

View File

@@ -0,0 +1,30 @@
{
"name": "verceltemplateblogstudio",
"private": true,
"version": "1.0.0",
"description": "This is the public list of examples for **Vercel**",
"main": "package.json",
"author": "Knut Melvær <knut@sanity.io>",
"license": "UNLICENSED",
"scripts": {
"start": "sanity start",
"build": "sanity build"
},
"keywords": [
"sanity"
],
"dependencies": {
"@sanity/core": "^2.26",
"@sanity/default-layout": "^2.26",
"@sanity/default-login": "^2.26",
"@sanity/desk-tool": "^2.26",
"@sanity/vision": "^2.26",
"prop-types": "^15.7",
"react": "^17.0",
"react-dom": "^17.0",
"styled-components": "^5.2"
},
"devDependencies": {
"@sanity/cli": "^2.26"
}
}

View File

@@ -0,0 +1 @@
User-specific packages can be placed here

View File

@@ -0,0 +1,29 @@
{
"root": true,
"project": {
"name": "vercel-template-blog-studio"
},
"api": {
"projectId": "YOUR_PROJECT_ID",
"dataset": "YOUR_DATASET_NAME"
},
"plugins": [
"@sanity/base",
"@sanity/default-layout",
"@sanity/default-login",
"@sanity/desk-tool"
],
"env": {
"development": {
"plugins": [
"@sanity/vision"
]
}
},
"parts": [
{
"name": "part:@sanity/base/schema",
"path": "./schemas/schema"
}
]
}

View File

@@ -0,0 +1,48 @@
export default {
name: 'author',
title: 'Author',
type: 'document',
fields: [
{
name: 'name',
title: 'Name',
type: 'string',
},
{
name: 'slug',
title: 'Slug',
type: 'slug',
options: {
source: 'name',
maxLength: 96,
},
},
{
name: 'image',
title: 'Image',
type: 'image',
options: {
hotspot: true,
},
},
{
name: 'bio',
title: 'Bio',
type: 'array',
of: [
{
title: 'Block',
type: 'block',
styles: [{title: 'Normal', value: 'normal'}],
lists: [],
},
],
},
],
preview: {
select: {
title: 'name',
media: 'image',
},
},
}

View File

@@ -0,0 +1,65 @@
/**
* This is the schema definition for the rich text fields used for
* for this blog studio. When you import it in schemas.js it can be
* reused in other parts of the studio with:
* {
* name: 'someName',
* title: 'Some title',
* type: 'blockContent'
* }
*/
export default {
title: 'Block Content',
name: 'blockContent',
type: 'array',
of: [
{
title: 'Block',
type: 'block',
// Styles let you set what your user can mark up blocks with. These
// correspond with HTML tags, but you can set any title or value
// you want and decide how you want to deal with it where you want to
// use your content.
styles: [
{title: 'Normal', value: 'normal'},
{title: 'H1', value: 'h1'},
{title: 'H2', value: 'h2'},
{title: 'H3', value: 'h3'},
{title: 'H4', value: 'h4'},
{title: 'Quote', value: 'blockquote'},
],
lists: [{title: 'Bullet', value: 'bullet'}],
// Marks let you mark up inline text in the block editor.
marks: {
// Decorators usually describe a single property e.g. a typographic
// preference or highlighting by editors.
decorators: [
{title: 'Strong', value: 'strong'},
{title: 'Emphasis', value: 'em'},
],
// Annotations can be any object structure e.g. a link or a footnote.
annotations: [
{
title: 'URL',
name: 'link',
type: 'object',
fields: [
{
title: 'URL',
name: 'href',
type: 'url',
},
],
},
],
},
},
// You can add additional types here. Note that you can't use
// primitive types such as 'string' and 'number' in the same array
// as a block type.
{
type: 'image',
options: {hotspot: true},
},
],
}

View File

@@ -0,0 +1,17 @@
export default {
name: 'category',
title: 'Category',
type: 'document',
fields: [
{
name: 'title',
title: 'Title',
type: 'string',
},
{
name: 'description',
title: 'Description',
type: 'text',
},
],
}

View File

@@ -0,0 +1,65 @@
export default {
name: 'post',
title: 'Post',
type: 'document',
fields: [
{
name: 'title',
title: 'Title',
type: 'string',
},
{
name: 'slug',
title: 'Slug',
type: 'slug',
options: {
source: 'title',
maxLength: 96,
},
},
{
name: 'author',
title: 'Author',
type: 'reference',
to: {type: 'author'},
},
{
name: 'mainImage',
title: 'Main image',
type: 'image',
options: {
hotspot: true,
},
},
{
name: 'categories',
title: 'Categories',
type: 'array',
of: [{type: 'reference', to: {type: 'category'}}],
},
{
name: 'publishedAt',
title: 'Published at',
type: 'datetime',
},
{
name: 'body',
title: 'Body',
type: 'blockContent',
},
],
preview: {
select: {
title: 'title',
author: 'author.name',
media: 'mainImage',
},
prepare(selection) {
const {author} = selection
return Object.assign({}, selection, {
subtitle: author && `by ${author}`,
})
},
},
}

View File

@@ -0,0 +1,29 @@
// First, we must import the schema creator
import createSchema from 'part:@sanity/base/schema-creator'
// Then import schema types from any plugins that might expose them
import schemaTypes from 'all:part:@sanity/base/schema-type'
// We import object and document schemas
import blockContent from './blockContent'
import category from './category'
import post from './post'
import author from './author'
// Then we give our schema to the builder and provide the result to Sanity
export default createSchema({
// We name our schema
name: 'default',
// Then proceed to concatenate our document type
// to the ones provided by any plugins that are installed
types: schemaTypes.concat([
// The following are document types which will appear
// in the studio.
post,
author,
category,
// When added to this list, object types can be used as
// { type: 'typename' } in other document schemas
blockContent,
]),
})

View File

@@ -0,0 +1 @@
Files placed here will be served by the Sanity server under the `/static`-prefix

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,6 @@
{
// Note: This config is only used to help editors like VS Code understand/resolve
// parts, the actual transpilation is done by babel. Any compiler configuration in
// here will be ignored.
"include": ["./node_modules/@sanity/base/types/**/*.ts", "./**/*.ts", "./**/*.tsx"]
}

9911
examples/sanity/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"name": "@vercel/build-utils", "name": "@vercel/build-utils",
"version": "2.14.0", "version": "2.14.1-canary.1",
"license": "MIT", "license": "MIT",
"main": "./dist/index.js", "main": "./dist/index.js",
"types": "./dist/index.d.js", "types": "./dist/index.d.js",
@@ -30,7 +30,7 @@
"@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.1",
"@vercel/frameworks": "0.6.0", "@vercel/frameworks": "0.6.1-canary.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",

View File

@@ -1,6 +1,6 @@
{ {
"name": "vercel", "name": "vercel",
"version": "24.0.0", "version": "24.0.1-canary.1",
"preferGlobal": true, "preferGlobal": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"description": "The command-line interface for Vercel", "description": "The command-line interface for Vercel",
@@ -43,11 +43,11 @@
"node": ">= 12" "node": ">= 12"
}, },
"dependencies": { "dependencies": {
"@vercel/build-utils": "2.14.0", "@vercel/build-utils": "2.14.1-canary.1",
"@vercel/go": "1.3.0", "@vercel/go": "1.3.1-canary.1",
"@vercel/node": "1.13.0", "@vercel/node": "1.13.1-canary.1",
"@vercel/python": "2.2.0", "@vercel/python": "2.2.1-canary.1",
"@vercel/ruby": "1.3.0", "@vercel/ruby": "1.3.1-canary.1",
"update-notifier": "4.1.0" "update-notifier": "4.1.0"
}, },
"devDependencies": { "devDependencies": {
@@ -88,9 +88,9 @@
"@types/update-notifier": "5.1.0", "@types/update-notifier": "5.1.0",
"@types/which": "1.3.2", "@types/which": "1.3.2",
"@types/write-json-file": "2.2.1", "@types/write-json-file": "2.2.1",
"@vercel/client": "10.3.0", "@vercel/client": "10.3.1-canary.1",
"@vercel/fetch-retry": "5.0.3", "@vercel/fetch-retry": "5.0.3",
"@vercel/frameworks": "0.6.0", "@vercel/frameworks": "0.6.1-canary.1",
"@vercel/ncc": "0.24.0", "@vercel/ncc": "0.24.0",
"@vercel/nft": "0.17.5", "@vercel/nft": "0.17.5",
"@zeit/fun": "0.11.2", "@zeit/fun": "0.11.2",

View File

@@ -1 +1,3 @@
Flask==1.0.3 Flask==2.0.1
werkzeug==2.0.1

View File

@@ -1703,13 +1703,11 @@ test(
fetchOpts('image/webp') fetchOpts('image/webp')
); );
*/ */
await testPath( /*
200, * Disabled svg in https://github.com/vercel/next.js/pull/34431
toUrl('/test.svg', 64, 70), * We can test for 400 status since config option is not enabled.
null, */
expectHeader('image/svg+xml'), await testPath(400, toUrl('/test.svg', 64, 70));
fetchOpts('image/webp')
);
/* Disabled bmp because `next dev` bypasses /* Disabled bmp because `next dev` bypasses
* and production will convert. Eventually * and production will convert. Eventually
* we can enable once `next dev` supports it. * we can enable once `next dev` supports it.

View File

@@ -1,6 +1,6 @@
{ {
"name": "@vercel/client", "name": "@vercel/client",
"version": "10.3.0", "version": "10.3.1-canary.1",
"main": "dist/index.js", "main": "dist/index.js",
"typings": "dist/index.d.ts", "typings": "dist/index.d.ts",
"homepage": "https://vercel.com", "homepage": "https://vercel.com",
@@ -40,7 +40,7 @@
] ]
}, },
"dependencies": { "dependencies": {
"@vercel/build-utils": "2.14.0", "@vercel/build-utils": "2.14.1-canary.1",
"@zeit/fetch": "5.2.0", "@zeit/fetch": "5.2.0",
"async-retry": "1.2.3", "async-retry": "1.2.3",
"async-sema": "3.0.0", "async-sema": "3.0.0",

View File

@@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 128 128" height="128" width="128">
<rect fill="#F03E2F" height="128" width="128"></rect>
<path fill="white" d="M39.4229 33.1629C39.4229 44.1614 46.3362 50.7055 60.1767 54.1563L74.8429 57.4971C87.9417 60.453 95.9185 67.7945 95.9185 79.7554C96.0204 84.9662 94.296 90.053 91.0345 94.1634C91.0345 82.23 84.751 75.7822 69.595 71.9052L55.1947 68.6881C43.6633 66.1035 34.7628 60.068 34.7628 47.076C34.7021 42.0589 36.3415 37.1644 39.4229 33.1629Z"></path>
<path fill="#F9B1AB" d="M82.0221 76.827C88.2776 80.759 91.0205 86.2583 91.0205 94.1497C85.8426 100.666 76.7462 104.323 66.0545 104.323C48.0576 104.323 35.4626 95.6207 32.6637 80.4978H49.9468C52.172 87.4406 58.0636 90.6577 65.9285 90.6577C75.5287 90.6577 81.9102 85.6258 82.0361 76.7995"></path>
<path fill="#F9B1AB" d="M48.4074 49.4682C45.5509 47.8004 43.2073 45.404 41.6255 42.5332C40.0437 39.6624 39.2825 36.4244 39.423 33.1629C44.419 26.7013 53.1095 22.7556 63.7033 22.7556C82.0361 22.7556 92.6439 32.2693 95.2608 45.66H78.6354C76.8021 40.3807 72.212 36.27 63.8433 36.27C54.9008 36.27 48.7992 41.3843 48.4494 49.4682"></path>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -1 +1,19 @@
<svg width="48" height="48" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="24" cy="24" r="24" fill="#1CA1FA"/><path d="M19.77 16.09h-2.625v11.086c0 3.656 2.613 6.234 6.843 6.234 4.254 0 6.856-2.578 6.856-6.234V16.09h-2.625v10.875c0 2.414-1.535 4.113-4.23 4.113-2.684 0-4.22-1.7-4.22-4.113V16.09z" fill="#fff"/></svg> <svg width="48" height="48" viewBox="0 0 28 27" version="1.1" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g transform="translate(-22.000000, -23.000000)">
<g transform="translate(23.000000, 24.000000)">
<path
d="M25.59375,11.968254 C25.59375,12.8799621 24.8542859,13.6190476 23.9421107,13.6190476 C23.0299354,13.6190476 2.97006457,13.6190476 2.05788934,13.6190476 C1.14571412,13.6190476 0.40625,12.8799621 0.40625,11.968254 C0.40625,11.368056 0.726725255,10.8426707 1.2059758,10.5537152 C0.964572543,10.2667081 0.819159836,9.89635858 0.819159836,9.49206349 C0.819159836,8.83899235 1.19858525,8.27449538 1.74912718,8.00677482 C1.68179398,7.82682944 1.64497951,7.63199747 1.64497951,7.42857143 C1.64497951,6.51686327 2.38444363,5.77777778 3.29661885,5.77777778 C3.37476958,5.77777778 3.45165256,5.78320283 3.52691139,5.79369671 C3.38061557,5.54732422 3.29661885,5.2596568 3.29661885,4.95238095 C3.29661885,4.04067279 4.03608297,3.3015873 4.9482582,3.3015873 C5.25569146,3.3015873 5.54350625,3.38554101 5.79000496,3.53176193 C5.7795057,3.45654163 5.77407787,3.37969801 5.77407787,3.3015873 C5.77407787,2.38987914 6.51354199,1.65079365 7.42571721,1.65079365 C7.73083366,1.65079365 8.0166262,1.73348677 8.26188409,1.87767313 C8.35426205,1.05344 9.0538542,0.412698413 9.90317623,0.412698413 C10.4521218,0.412698413 10.938518,0.680366532 11.2388423,1.09224331 C11.4679015,0.455411137 12.0775125,0 12.7935451,0 C13.5095776,0 14.1191887,0.455411137 14.3482478,1.09224331 C14.6485721,0.680366532 15.1349684,0.412698413 15.6839139,0.412698413 C16.533236,0.412698413 17.2328281,1.05344 17.3252061,1.87767313 C17.570464,1.73348677 17.8562565,1.65079365 18.161373,1.65079365 C19.0735482,1.65079365 19.8130123,2.38987914 19.8130123,3.3015873 C19.8130123,3.37969801 19.8075845,3.45654163 19.7970852,3.53176193 C20.0435839,3.38554101 20.3313987,3.3015873 20.638832,3.3015873 C21.5510072,3.3015873 22.2904713,4.04067279 22.2904713,4.95238095 C22.2904713,5.2596568 22.2064746,5.54732422 22.0601788,5.79369671 C22.1354376,5.78320283 22.2123206,5.77777778 22.2904713,5.77777778 C23.2026465,5.77777778 23.9421107,6.51686327 23.9421107,7.42857143 C23.9421107,7.63199747 23.9052962,7.82682944 23.837963,8.00677482 C24.3885049,8.27449538 24.7679303,8.83899235 24.7679303,9.49206349 C24.7679303,9.83184534 24.665222,10.1476506 24.489143,10.4101567 C25.1324705,10.635781 25.59375,11.2481763 25.59375,11.968254 Z"
stroke="#000000" stroke-width="0.8" fill="#FFFFFF" stroke-linejoin="round"></path>
<rect fill="#000000" x="8.53125" y="23.9365079" width="8.9375" height="2.06349206"></rect>
<path
d="M0,12.7936508 L26,12.7936508 C25.579783,19.7028245 19.9201192,25.1746032 13,25.1746032 C6.07988078,25.1746032 0.420216968,19.7028245 0,12.7936508 L0,12.7936508 Z"
stroke="#000000" stroke-width="0.8" fill="#1890FF"></path>
<path
d="M7.3125,7.01587302 C7.08813432,7.01587302 6.90625,6.83110164 6.90625,6.6031746 C6.90625,6.37524756 7.08813432,6.19047619 7.3125,6.19047619 C7.53686568,6.19047619 7.71875,6.37524756 7.71875,6.6031746 C7.71875,6.83110164 7.53686568,7.01587302 7.3125,7.01587302 Z M5.6875,9.07936508 C5.46313432,9.07936508 5.28125,8.89459371 5.28125,8.66666667 C5.28125,8.43873963 5.46313432,8.25396825 5.6875,8.25396825 C5.91186568,8.25396825 6.09375,8.43873963 6.09375,8.66666667 C6.09375,8.89459371 5.91186568,9.07936508 5.6875,9.07936508 Z M7.3125,10.7301587 C7.08813432,10.7301587 6.90625,10.5453874 6.90625,10.3174603 C6.90625,10.0895333 7.08813432,9.9047619 7.3125,9.9047619 C7.53686568,9.9047619 7.71875,10.0895333 7.71875,10.3174603 C7.71875,10.5453874 7.53686568,10.7301587 7.3125,10.7301587 Z M8.9375,7.42857143 C8.71313432,7.42857143 8.53125,7.24380006 8.53125,7.01587302 C8.53125,6.78794598 8.71313432,6.6031746 8.9375,6.6031746 C9.16186568,6.6031746 9.34375,6.78794598 9.34375,7.01587302 C9.34375,7.24380006 9.16186568,7.42857143 8.9375,7.42857143 Z M18.6875,9.07936508 C18.4631343,9.07936508 18.28125,8.89459371 18.28125,8.66666667 C18.28125,8.43873963 18.4631343,8.25396825 18.6875,8.25396825 C18.9118657,8.25396825 19.09375,8.43873963 19.09375,8.66666667 C19.09375,8.89459371 18.9118657,9.07936508 18.6875,9.07936508 Z"
fill="#000000"></path>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 328 B

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@@ -1,6 +1,6 @@
{ {
"name": "@vercel/frameworks", "name": "@vercel/frameworks",
"version": "0.6.0", "version": "0.6.1-canary.1",
"main": "./dist/frameworks.js", "main": "./dist/frameworks.js",
"types": "./dist/frameworks.d.ts", "types": "./dist/frameworks.d.ts",
"files": [ "files": [

View File

@@ -2006,6 +2006,50 @@ export const frameworks = [
}, },
], ],
}, },
{
name: 'Sanity',
slug: 'sanity',
demo: 'https://sanity-studio-template.vercel.app',
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/sanity.svg',
tagline:
'The structured content platform.',
description: 'A Sanity Studio',
website: 'https://www.sanity.io',
envPrefix: 'SANITY_STUDIO_',
detectors: {
every: [
{
path: 'sanity.json',
},
],
},
settings: {
installCommand: {
placeholder: '`yarn install` or `npm install`',
},
buildCommand: {
placeholder: '`npm run build` or `sanity build`',
value: 'sanity build',
},
devCommand: {
value: 'sanity start --port $PORT',
},
outputDirectory: {
value: 'dist',
},
},
dependency: '@sanity/cli',
getOutputDirName: async () => 'dist',
defaultRoutes: [
{
handle: 'filesystem',
},
{
src: '/(.*)',
dest: '/index.html',
},
],
},
{ {
name: 'Other', name: 'Other',
slug: null, slug: null,

View File

@@ -1,6 +1,6 @@
{ {
"name": "@vercel/go", "name": "@vercel/go",
"version": "1.3.0", "version": "1.3.1-canary.1",
"license": "MIT", "license": "MIT",
"main": "./dist/index", "main": "./dist/index",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/go", "homepage": "https://vercel.com/docs/runtimes#official-runtimes/go",
@@ -24,7 +24,7 @@
"@types/fs-extra": "^5.0.5", "@types/fs-extra": "^5.0.5",
"@types/node-fetch": "^2.3.0", "@types/node-fetch": "^2.3.0",
"@types/tar": "^4.0.0", "@types/tar": "^4.0.0",
"@vercel/build-utils": "2.14.0", "@vercel/build-utils": "2.14.1-canary.1",
"@vercel/ncc": "0.24.0", "@vercel/ncc": "0.24.0",
"async-retry": "1.3.1", "async-retry": "1.3.1",
"execa": "^1.0.0", "execa": "^1.0.0",

2
packages/node-bridge/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
/helpers.js
/source-map-support.js

View File

@@ -0,0 +1,62 @@
#!/usr/bin/env node
const fs = require('fs-extra');
const execa = require('execa');
const { join } = require('path');
async function main() {
// Build TypeScript files
await execa('tsc', [], {
stdio: 'inherit',
});
// Bundle `helpers.ts` with ncc
await fs.remove(join(__dirname, 'helpers.js'));
const helpersDir = join(__dirname, 'helpers');
await execa(
'ncc',
[
'build',
join(__dirname, 'helpers.ts'),
'-e',
'@vercel/node-bridge',
'-e',
'@vercel/build-utils',
'-e',
'typescript',
'-o',
helpersDir,
],
{ stdio: 'inherit' }
);
await fs.rename(join(helpersDir, 'index.js'), join(__dirname, 'helpers.js'));
await fs.remove(helpersDir);
// Bundle `source-map-support/register` with ncc for source maps
const sourceMapSupportDir = join(__dirname, 'source-map-support');
await execa(
'ncc',
[
'build',
join(__dirname, '../../node_modules/source-map-support/register'),
'-e',
'@vercel/node-bridge',
'-e',
'@vercel/build-utils',
'-e',
'typescript',
'-o',
sourceMapSupportDir,
],
{ stdio: 'inherit' }
);
await fs.rename(
join(sourceMapSupportDir, 'index.js'),
join(__dirname, 'source-map-support.js')
);
await fs.remove(sourceMapSupportDir);
}
main().catch(err => {
console.error(err);
process.exit(1);
});

View File

@@ -1,4 +1,4 @@
import { import type {
VercelRequest, VercelRequest,
VercelResponse, VercelResponse,
VercelRequestCookies, VercelRequestCookies,
@@ -6,7 +6,7 @@ import {
VercelRequestBody, VercelRequestBody,
} from './types'; } from './types';
import { Server } from 'http'; import { Server } from 'http';
import type { Bridge } from '@vercel/node-bridge/bridge'; import type { Bridge } from './bridge';
function getBodyParser(req: VercelRequest, body: Buffer) { function getBodyParser(req: VercelRequest, body: Buffer) {
return function parseBody(): VercelRequestBody { return function parseBody(): VercelRequestBody {

View File

@@ -1,6 +1,6 @@
{ {
"name": "@vercel/node-bridge", "name": "@vercel/node-bridge",
"version": "2.1.1", "version": "2.1.2-canary.0",
"license": "MIT", "license": "MIT",
"main": "./index.js", "main": "./index.js",
"repository": { "repository": {
@@ -11,10 +11,12 @@
"files": [ "files": [
"bridge.*", "bridge.*",
"launcher.*", "launcher.*",
"index.js" "index.js",
"helpers.js",
"source-map-support.js"
], ],
"scripts": { "scripts": {
"build": "tsc", "build": "node build.js",
"test-unit": "jest --env node --verbose --runInBand --bail" "test-unit": "jest --env node --verbose --runInBand --bail"
}, },
"devDependencies": { "devDependencies": {

View File

@@ -2,7 +2,7 @@ const fetch = require('node-fetch');
const listen = require('test-listen'); const listen = require('test-listen');
const qs = require('querystring'); const qs = require('querystring');
const { createServerWithHelpers } = require('../dist/helpers'); const { createServerWithHelpers } = require('../helpers');
const mockListener = jest.fn(); const mockListener = jest.fn();
const consumeEventMock = jest.fn(); const consumeEventMock = jest.fn();

View File

@@ -1,5 +1,11 @@
/// <reference types="node" /> /// <reference types="node" />
import { Server, IncomingHttpHeaders, OutgoingHttpHeaders } from 'http'; import {
Server,
IncomingHttpHeaders,
OutgoingHttpHeaders,
ServerResponse,
IncomingMessage,
} from 'http';
export interface VercelProxyEvent { export interface VercelProxyEvent {
Action: string; Action: string;
body: string; body: string;
@@ -37,3 +43,20 @@ export type LauncherConfiguration = {
awsLambdaHandler?: string; awsLambdaHandler?: string;
useRequire?: boolean; useRequire?: boolean;
}; };
export type VercelRequestCookies = { [key: string]: string };
export type VercelRequestQuery = { [key: string]: string | string[] };
export type VercelRequestBody = any;
export type VercelRequest = IncomingMessage & {
query: VercelRequestQuery;
cookies: VercelRequestCookies;
body: VercelRequestBody;
};
export type VercelResponse = ServerResponse & {
send: (body: any) => VercelResponse;
json: (jsonBody: any) => VercelResponse;
status: (statusCode: number) => VercelResponse;
redirect: (statusOrUrl: string | number, url?: string) => VercelResponse;
};

View File

@@ -6,7 +6,6 @@ const { join } = require('path');
async function main() { async function main() {
const srcDir = join(__dirname, 'src'); const srcDir = join(__dirname, 'src');
const outDir = join(__dirname, 'dist'); const outDir = join(__dirname, 'dist');
const bridgeDir = join(__dirname, '../node-bridge');
// Start fresh // Start fresh
await fs.remove(outDir); await fs.remove(outDir);
@@ -16,12 +15,6 @@ async function main() {
stdio: 'inherit', stdio: 'inherit',
}); });
// Copy bridge and launcher as-is
await Promise.all([
fs.copyFile(join(bridgeDir, 'bridge.js'), join(outDir, 'bridge.js')),
fs.copyFile(join(bridgeDir, 'launcher.js'), join(outDir, 'launcher.js')),
]);
// Copy type file for ts test // Copy type file for ts test
await fs.copyFile( await fs.copyFile(
join(outDir, 'types.d.ts'), join(outDir, 'types.d.ts'),
@@ -33,52 +26,6 @@ async function main() {
await fs.remove(symlinkTarget); await fs.remove(symlinkTarget);
await fs.symlink('symlinked-asset', symlinkTarget); await fs.symlink('symlinked-asset', symlinkTarget);
// Bundle helpers.ts with ncc
await fs.remove(join(outDir, 'helpers.js'));
const helpersDir = join(outDir, 'helpers');
await execa(
'ncc',
[
'build',
join(srcDir, 'helpers.ts'),
'-e',
'@vercel/node-bridge',
'-e',
'@vercel/build-utils',
'-e',
'typescript',
'-o',
helpersDir,
],
{ stdio: 'inherit' }
);
await fs.rename(join(helpersDir, 'index.js'), join(outDir, 'helpers.js'));
await fs.remove(helpersDir);
// Build source-map-support/register for source maps
const sourceMapSupportDir = join(outDir, 'source-map-support');
await execa(
'ncc',
[
'build',
join(__dirname, '../../node_modules/source-map-support/register'),
'-e',
'@vercel/node-bridge',
'-e',
'@vercel/build-utils',
'-e',
'typescript',
'-o',
sourceMapSupportDir,
],
{ stdio: 'inherit' }
);
await fs.rename(
join(sourceMapSupportDir, 'index.js'),
join(outDir, 'source-map-support.js')
);
await fs.remove(sourceMapSupportDir);
const mainDir = join(outDir, 'main'); const mainDir = join(outDir, 'main');
await execa( await execa(
'ncc', 'ncc',
@@ -97,8 +44,11 @@ async function main() {
{ stdio: 'inherit' } { stdio: 'inherit' }
); );
await fs.rename(join(mainDir, 'index.js'), join(outDir, 'index.js')); await fs.rename(join(mainDir, 'index.js'), join(outDir, 'index.js'));
await fs.remove(mainDir); await Promise.all([
await fs.remove(join(outDir, 'example-import.js')); fs.remove(mainDir),
fs.remove(join(outDir, 'example-import.js')),
fs.remove(join(outDir, 'example-import.d.ts')),
]);
} }
main().catch(err => { main().catch(err => {

View File

@@ -1,6 +1,6 @@
{ {
"name": "@vercel/node", "name": "@vercel/node",
"version": "1.13.0", "version": "1.13.1-canary.1",
"license": "MIT", "license": "MIT",
"main": "./dist/index", "main": "./dist/index",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/node-js", "homepage": "https://vercel.com/docs/runtimes#official-runtimes/node-js",
@@ -11,7 +11,6 @@
}, },
"scripts": { "scripts": {
"build": "node build", "build": "node build",
"test-unit": "jest --env node --verbose --runInBand --bail test/helpers.test.js",
"test-integration-once": "jest --env node --verbose --runInBand --bail test/integration.test.js", "test-integration-once": "jest --env node --verbose --runInBand --bail test/integration.test.js",
"prepublishOnly": "node build" "prepublishOnly": "node build"
}, },
@@ -32,10 +31,10 @@
"@types/cookie": "0.3.3", "@types/cookie": "0.3.3",
"@types/etag": "1.8.0", "@types/etag": "1.8.0",
"@types/test-listen": "1.1.0", "@types/test-listen": "1.1.0",
"@vercel/build-utils": "2.14.0", "@vercel/build-utils": "2.14.1-canary.1",
"@vercel/ncc": "0.24.0", "@vercel/ncc": "0.24.0",
"@vercel/nft": "0.17.5", "@vercel/nft": "0.17.5",
"@vercel/node-bridge": "2.1.1", "@vercel/node-bridge": "2.1.2-canary.0",
"content-type": "1.0.4", "content-type": "1.0.4",
"cookie": "0.4.0", "cookie": "0.4.0",
"etag": "1.8.1", "etag": "1.8.1",

View File

@@ -88,8 +88,7 @@ if (!process.env.VERCEL_DEV_IS_ESM) {
import { createServer, Server, IncomingMessage, ServerResponse } from 'http'; import { createServer, Server, IncomingMessage, ServerResponse } from 'http';
import { Readable } from 'stream'; import { Readable } from 'stream';
import type { Bridge } from '@vercel/node-bridge/bridge'; import type { Bridge } from '@vercel/node-bridge/bridge';
// @ts-ignore - copied to the `dist` output as-is import { getVercelLauncher } from '@vercel/node-bridge/launcher.js';
import { getVercelLauncher } from './launcher.js';
function listen(server: Server, port: number, host: string): Promise<void> { function listen(server: Server, port: number, host: string): Promise<void> {
return new Promise(resolve => { return new Promise(resolve => {
@@ -120,6 +119,10 @@ async function main() {
helpersPath: './helpers.js', helpersPath: './helpers.js',
shouldAddHelpers, shouldAddHelpers,
useRequire, useRequire,
// not used
bridgePath: '',
sourcemapSupportPath: '',
}); });
bridge = launcher(); bridge = launcher();

View File

@@ -24,16 +24,13 @@ import {
File, File,
Files, Files,
Meta, Meta,
PrepareCacheOptions,
BuildOptions,
Config, Config,
StartDevServerOptions, StartDevServerOptions,
StartDevServerResult,
glob, glob,
download, download,
FileBlob, FileBlob,
FileFsRef, FileFsRef,
createLambda, NodejsLambda,
runNpmInstall, runNpmInstall,
runPackageJsonScript, runPackageJsonScript,
getNodeVersion, getNodeVersion,
@@ -42,15 +39,15 @@ import {
debug, debug,
isSymbolicLink, isSymbolicLink,
walkParentDirs, walkParentDirs,
BuildV3,
PrepareCache,
StartDevServer,
} from '@vercel/build-utils'; } from '@vercel/build-utils';
// @ts-ignore - copied to the `dist` output as-is
import { makeVercelLauncher, makeAwsLauncher } from './launcher.js';
import { Register, register } from './typescript'; import { Register, register } from './typescript';
export { shouldServe }; export { shouldServe };
export { export type {
NowRequest, NowRequest,
NowResponse, NowResponse,
VercelRequest, VercelRequest,
@@ -80,11 +77,6 @@ const tscPath = resolve(dirname(require_.resolve('typescript')), '../bin/tsc');
// eslint-disable-next-line no-useless-escape // eslint-disable-next-line no-useless-escape
const libPathRegEx = /^node_modules|[\/\\]node_modules[\/\\]/; const libPathRegEx = /^node_modules|[\/\\]node_modules[\/\\]/;
const LAUNCHER_FILENAME = '__launcher.js';
const BRIDGE_FILENAME = '__bridge.js';
const HELPERS_FILENAME = '__helpers.js';
const SOURCEMAP_SUPPORT_FILENAME = '__sourcemap_support.js';
async function downloadInstallAndBundle({ async function downloadInstallAndBundle({
files, files,
entrypoint, entrypoint,
@@ -130,7 +122,6 @@ async function compile(
workPath: string, workPath: string,
baseDir: string, baseDir: string,
entrypointPath: string, entrypointPath: string,
entrypoint: string,
config: Config config: Config
): Promise<{ ): Promise<{
preparedFiles: Files; preparedFiles: Files;
@@ -230,7 +221,7 @@ async function compile(
); );
for (const warning of warnings) { for (const warning of warnings) {
if (warning && warning.stack) { if (warning?.stack) {
debug(warning.stack.replace('Error: ', 'Warning: ')); debug(warning.stack.replace('Error: ', 'Warning: '));
} }
} }
@@ -342,18 +333,14 @@ export * from './types';
export const version = 3; export const version = 3;
export async function build({ export const build: BuildV3 = async ({
files, files,
entrypoint, entrypoint,
workPath, workPath,
repoRootPath, repoRootPath,
config = {}, config = {},
meta = {}, meta = {},
}: BuildOptions) { }) => {
const shouldAddHelpers = !(
config.helpers === false || process.env.NODEJS_HELPERS === '0'
);
const baseDir = repoRootPath || workPath; const baseDir = repoRootPath || workPath;
const awsLambdaHandler = getAWSLambdaHandler(entrypoint, config); const awsLambdaHandler = getAWSLambdaHandler(entrypoint, config);
@@ -379,71 +366,32 @@ export async function build({
workPath, workPath,
baseDir, baseDir,
entrypointPath, entrypointPath,
entrypoint,
config config
); );
debug(`Trace complete [${Date.now() - traceTime}ms]`); debug(`Trace complete [${Date.now() - traceTime}ms]`);
const getFileName = (str: string) => `___vc/${str}`; const shouldAddHelpers = !(
config.helpers === false || process.env.NODEJS_HELPERS === '0'
);
const launcher = awsLambdaHandler ? makeAwsLauncher : makeVercelLauncher; const lambda = new NodejsLambda({
files: preparedFiles,
const launcherSource = launcher({ handler: renameTStoJS(relative(baseDir, entrypointPath)),
entrypointPath: `../${renameTStoJS(relative(baseDir, entrypointPath))}`, runtime: nodeVersion.runtime,
bridgePath: `./${BRIDGE_FILENAME}`,
helpersPath: `./${HELPERS_FILENAME}`,
sourcemapSupportPath: `./${SOURCEMAP_SUPPORT_FILENAME}`,
shouldAddHelpers, shouldAddHelpers,
shouldAddSourcemapSupport, shouldAddSourcemapSupport,
awsLambdaHandler, awsLambdaHandler,
}); });
const launcherFiles: Files = {
[getFileName('package.json')]: new FileBlob({
data: JSON.stringify({ type: 'commonjs' }),
}),
[getFileName(LAUNCHER_FILENAME)]: new FileBlob({
data: launcherSource,
}),
[getFileName(BRIDGE_FILENAME)]: new FileFsRef({
fsPath: join(__dirname, 'bridge.js'),
}),
};
if (shouldAddSourcemapSupport) {
launcherFiles[getFileName(SOURCEMAP_SUPPORT_FILENAME)] = new FileFsRef({
fsPath: join(__dirname, 'source-map-support.js'),
});
}
if (shouldAddHelpers) {
launcherFiles[getFileName(HELPERS_FILENAME)] = new FileFsRef({
fsPath: join(__dirname, 'helpers.js'),
});
}
const lambda = await createLambda({
files: {
...preparedFiles,
...launcherFiles,
},
handler: `${getFileName(LAUNCHER_FILENAME).slice(0, -3)}.launcher`,
runtime: nodeVersion.runtime,
});
return { output: lambda }; return { output: lambda };
} };
export async function prepareCache({ export const prepareCache: PrepareCache = async ({ workPath }) => {
workPath,
}: PrepareCacheOptions): Promise<Files> {
const cache = await glob('node_modules/**', workPath); const cache = await glob('node_modules/**', workPath);
return cache; return cache;
} };
export async function startDevServer( export const startDevServer: StartDevServer = async opts => {
opts: StartDevServerOptions
): Promise<StartDevServerResult> {
const { entrypoint, workPath, config, meta = {} } = opts; const { entrypoint, workPath, config, meta = {} } = opts;
const entryDir = join(workPath, dirname(entrypoint)); const entryDir = join(workPath, dirname(entrypoint));
const projectTsConfig = await walkParentDirs({ const projectTsConfig = await walkParentDirs({
@@ -501,7 +449,7 @@ export async function startDevServer(
const reason = signal ? `"${signal}" signal` : `exit code ${exitCode}`; const reason = signal ? `"${signal}" signal` : `exit code ${exitCode}`;
throw new Error(`\`node ${entrypoint}\` failed with ${reason}`); throw new Error(`\`node ${entrypoint}\` failed with ${reason}`);
} }
} };
async function doTypeCheck( async function doTypeCheck(
{ entrypoint, workPath, meta = {} }: StartDevServerOptions, { entrypoint, workPath, meta = {} }: StartDevServerOptions,

View File

@@ -1,6 +1,6 @@
{ {
"name": "@vercel/python", "name": "@vercel/python",
"version": "2.2.0", "version": "2.2.1-canary.1",
"main": "./dist/index.js", "main": "./dist/index.js",
"license": "MIT", "license": "MIT",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/python", "homepage": "https://vercel.com/docs/runtimes#official-runtimes/python",
@@ -20,7 +20,7 @@
}, },
"devDependencies": { "devDependencies": {
"@types/execa": "^0.9.0", "@types/execa": "^0.9.0",
"@vercel/build-utils": "2.14.0", "@vercel/build-utils": "2.14.1-canary.1",
"@vercel/ncc": "0.24.0", "@vercel/ncc": "0.24.0",
"execa": "^1.0.0", "execa": "^1.0.0",
"typescript": "4.3.4" "typescript": "4.3.4"

View File

@@ -1,7 +1,7 @@
{ {
"name": "@vercel/ruby", "name": "@vercel/ruby",
"author": "Nathan Cahill <nathan@nathancahill.com>", "author": "Nathan Cahill <nathan@nathancahill.com>",
"version": "1.3.0", "version": "1.3.1-canary.1",
"license": "MIT", "license": "MIT",
"main": "./dist/index", "main": "./dist/index",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/ruby", "homepage": "https://vercel.com/docs/runtimes#official-runtimes/ruby",
@@ -22,7 +22,7 @@
"devDependencies": { "devDependencies": {
"@types/fs-extra": "8.0.0", "@types/fs-extra": "8.0.0",
"@types/semver": "6.0.0", "@types/semver": "6.0.0",
"@vercel/build-utils": "2.14.0", "@vercel/build-utils": "2.14.1-canary.1",
"@vercel/ncc": "0.24.0", "@vercel/ncc": "0.24.0",
"execa": "2.0.4", "execa": "2.0.4",
"fs-extra": "^7.0.1", "fs-extra": "^7.0.1",