Skip to content

Commit

Permalink
Merge branch 'canary' into patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
karlhorky authored Mar 30, 2023
2 parents 6e7a095 + 4803102 commit 1acc1bd
Show file tree
Hide file tree
Showing 374 changed files with 14,385 additions and 11,556 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/build_test_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ jobs:
run: |
cargo fmt -- --check
cargo clippy --all -- -D warnings -A deprecated
cargo check -p next-dev --no-default-features --features cli,custom_allocator,rustls-tls,__internal_nextjs_integration_test
working-directory: packages/next-swc

checkPrecompiled:
Expand Down Expand Up @@ -647,11 +648,8 @@ jobs:
name: next-swc-test-binary
path: packages/next-swc/native

- run: echo "CNA_CHANGE<<EOF" >> $GITHUB_OUTPUT; echo "$(node scripts/run-for-change.js --type cna --always-canary --exec echo 'yup')" >> $GITHUB_OUTPUT; echo "EOF" >> $GITHUB_OUTPUT
id: cna-change

- run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-jammy /bin/bash -c "cd /work && curl -s https://install-node.vercel.app/v${{ env.NODE_LTS_VERSION }} | FORCE=1 bash && npm i -g pnpm@${PNPM_VERSION} > /dev/null && NEXT_TEST_JOB=1 NEXT_TEST_CNA=1 xvfb-run node run-tests.js test/integration/create-next-app/index.test.ts test/integration/create-next-app/templates.test.ts >> /proc/1/fd/1"
if: ${{ needs.build.outputs.docsChange == 'nope' && steps.cna-change.outputs.CNA_CHANGE == 'yup' }}
if: ${{ needs.build.outputs.docsChange == 'nope' }}

- name: Upload test trace
if: always()
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/trigger_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ on:

name: Trigger Release

env:
NAPI_CLI_VERSION: 2.14.7
TURBO_VERSION: 1.6.3
RUST_TOOLCHAIN: nightly-2023-03-09
PNPM_VERSION: 7.24.3
NODE_MAINTENANCE_VERSION: 16
NODE_LTS_VERSION: 18

jobs:
start:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion docs/advanced-features/compiler.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ module.exports = {
src: './',
artifactDirectory: './__generated__',
language: 'typescript',
eagerEsModules: false;
eagerEsModules: false,
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion docs/api-reference/next/image.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ This `next/image` component uses browser native [lazy loading](https://caniuse.c

## Known Browser Bugs

- [Safari 15+](https://bugs.webkit.org/show_bug.cgi?id=243601) displays a gray border while loading. Possible solutions:
- [Safari 15 and 16](https://bugs.webkit.org/show_bug.cgi?id=243601) display a gray border while loading. Safari 16.4 [fixed this issue](https://webkit.org/blog/13966/webkit-features-in-safari-16-4/#:~:text=Now%20in%20Safari%2016.4%2C%20a%20gray%20line%20no%20longer%20appears%20to%20mark%20the%20space%20where%20a%20lazy%2Dloaded%20image%20will%20appear%20once%20it%E2%80%99s%20been%20loaded.). Possible solutions:
- Use CSS `@supports (font: -apple-system-body) and (-webkit-appearance: none) { img[loading="lazy"] { clip-path: inset(0.6px) } }`
- Use [`priority`](#priority) if the image is above the fold
- [Firefox 67+](https://bugzilla.mozilla.org/show_bug.cgi?id=1556156) displays a white background while loading. Possible solutions:
Expand Down
2 changes: 1 addition & 1 deletion docs/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ When deploying to Vercel, the platform [automatically detects Next.js](https://v
- [Pages](/docs/basic-features/pages.md) are automatically statically optimized, if possible
- Assets (JavaScript, CSS, images, fonts) are compressed and served from a [Global Edge Network](https://vercel.com/features/infrastructure?utm_source=next-site&utm_medium=docs&utm_campaign=next-website)
- [API Routes](/docs/api-routes/introduction.md) are automatically optimized as isolated [Serverless Functions](https://vercel.com/features/infrastructure?utm_source=next-site&utm_medium=docs&utm_campaign=next-website) that can scale infinitely
- [Middleware](/docs/middleware.md) are automatically optimized as [Edge Functions](https://vercel.com/features/edge-functions?utm_source=next-site&utm_medium=docs&utm_campaign=next-website) that have zero cold starts and boot instantly
- [Middleware](/docs/middleware.md) is automatically optimized as [Edge Functions](https://vercel.com/features/edge-functions?utm_source=next-site&utm_medium=docs&utm_campaign=next-website) that have zero cold starts and boot instantly

In addition, Vercel provides features like:

Expand Down
10 changes: 5 additions & 5 deletions docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,11 @@ To set up Jest, install `jest`, `jest-environment-jsdom`, `@testing-library/reac
npm install --save-dev jest jest-environment-jsdom @testing-library/react @testing-library/jest-dom
```

Create a `jest.config.js` file in your project's root directory and add the following:
Create a `jest.config.mjs` file in your project's root directory and add the following:

```jsx
// jest.config.js
const nextJest = require('next/jest')
// jest.config.mjs
import nextJest from 'next/jest.js'

const createJestConfig = nextJest({
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
Expand All @@ -317,15 +317,15 @@ const createJestConfig = nextJest({

// Add any custom config to be passed to Jest
/** @type {import('jest').Config} */
const customJestConfig = {
const config = {
// Add more setup options before each test is run
// setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],

testEnvironment: 'jest-environment-jsdom',
}

// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
module.exports = createJestConfig(customJestConfig)
export default createJestConfig(config)
```

Under the hood, `next/jest` is automatically configuring Jest for you, including:
Expand Down
2 changes: 1 addition & 1 deletion examples/convex/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Convex

This example demonstrates the Convex global state management framework.
This example demonstrates the Convex backend platform.

## Deploy your own

Expand Down
16 changes: 8 additions & 8 deletions examples/convex/convex/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ https://docs.convex.dev/using/writing-convex-functions for more.

A query function that takes two arguments looks like:

```typescript
// myQueryFunction.ts
```javascript
// myQueryFunction.js
import { query } from './_generated/server'

export default query(async ({ db }, first: number, second: string) => {
export default query(async ({ db }, first, second) => {
// Validate arguments here.
if (typeof first !== 'number' || first < 0) {
throw new Error('First argument is not a non-negative number.')
Expand All @@ -30,17 +30,17 @@ export default query(async ({ db }, first: number, second: string) => {

Using this query function in a React component looks like:

```typescript
```javascript
const data = useQuery('myQueryFunction', 10, 'hello')
```

A mutation function looks like:

```typescript
// myMutationFunction.ts
```javascript
// myMutationFunction.js
import { mutation } from './_generated/server'

export default mutation(async ({ db }, first: string, second: string) => {
export default mutation(async ({ db }, first, second) => {
// Validate arguments here.
if (typeof first !== 'string' || typeof second !== 'string') {
throw new Error('Both arguments must be strings')
Expand All @@ -58,7 +58,7 @@ export default mutation(async ({ db }, first: string, second: string) => {

Using this mutation function in a React component looks like:

```typescript
```javascript
const mutation = useMutation('myMutationFunction')
function handleButtonPress() {
// fire and forget, the most common way to use mutations
Expand Down
2 changes: 1 addition & 1 deletion examples/convex/convex/_generated/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* THIS CODE IS AUTOMATICALLY GENERATED.
*
* Generated by convex@0.9.1.
* Generated by convex@0.12.0.
* To regenerate, run `npx convex codegen`.
* @module
*/
Expand Down
4 changes: 2 additions & 2 deletions examples/convex/convex/_generated/dataModel.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* THIS CODE IS AUTOMATICALLY GENERATED.
*
* Generated by convex@0.9.1.
* Generated by convex@0.12.0.
* To regenerate, run `npx convex codegen`.
* @module
*/
Expand All @@ -24,7 +24,7 @@ export type TableNames = TableNamesInDataModel<DataModel>;
*
* @typeParam TableName - A string literal type of the table name (like "users").
*/
export type Document<TableName extends TableNames> = DocumentByName<
export type Doc<TableName extends TableNames> = DocumentByName<
DataModel,
TableName
>;
Expand Down
2 changes: 1 addition & 1 deletion examples/convex/convex/_generated/dataModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* THIS CODE IS AUTOMATICALLY GENERATED.
*
* Generated by convex@0.9.1.
* Generated by convex@0.12.0.
* To regenerate, run `npx convex codegen`.
* @module
*/
Expand Down
2 changes: 1 addition & 1 deletion examples/convex/convex/_generated/react.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* THIS CODE IS AUTOMATICALLY GENERATED.
*
* Generated by convex@0.9.1.
* Generated by convex@0.12.0.
* To regenerate, run `npx convex codegen`.
* @module
*/
Expand Down
2 changes: 1 addition & 1 deletion examples/convex/convex/_generated/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* THIS CODE IS AUTOMATICALLY GENERATED.
*
* Generated by convex@0.9.1.
* Generated by convex@0.12.0.
* To regenerate, run `npx convex codegen`.
* @module
*/
Expand Down
58 changes: 57 additions & 1 deletion examples/convex/convex/_generated/server.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* THIS CODE IS AUTOMATICALLY GENERATED.
*
* Generated by convex@0.9.1.
* Generated by convex@0.12.0.
* To regenerate, run `npx convex codegen`.
* @module
*/
Expand All @@ -14,6 +14,10 @@ import {
HttpEndpointBuilderForAPI,
MutationBuilder,
QueryBuilderForDataModel,
InternalActionBuilderForAPI,
InternalMutationBuilder,
InternalQueryBuilderForDataModel,
CronJobsForAPI,
ActionCtx as GenericActionCtx,
HttpEndpointCtx as GenericHttpEndpointCtx,
MutationCtx as GenericMutationCtx,
Expand All @@ -24,6 +28,30 @@ import {
import type { DataModel } from "./dataModel.js";
import type { API } from "./api.js";

/**
* Returns a cron job scheduler, used to schedule Convex functions to run on a recurring basis.
*
* ```js
* // convex/crons.js
* import { cronJobs } from './_generated/server';
*
* const crons = cronJobs();
* crons.weekly(
* "weekly re-engagement email",
* {
* hourUTC: 17, // (9:30am Pacific/10:30am Daylight Savings Pacific)
* minuteUTC: 30,
* },
* "sendEmails"
* )
* export default crons;
* ```
*
* @returns The cron job scheduler object. Create this object in `convex/crons.js` and export it
* as the default export.
*/
export declare const cronJobs: CronJobsForAPI<API>;

/**
* Define a query in this Convex app's public API.
*
Expand All @@ -34,6 +62,16 @@ import type { API } from "./api.js";
*/
export declare const query: QueryBuilderForDataModel<DataModel>;

/**
* Define a query that is only accessible from other Convex functions (but not from the client).
*
* This function will be allowed to read from your Convex database. It will not be accessible from the client.
*
* @param func - The query function. It receives a {@link QueryCtx} as its first argument.
* @returns The wrapped query. Include this as an `export` to name it and make it accessible.
*/
export declare const internalQuery: InternalQueryBuilderForDataModel<DataModel>;

/**
* Define a mutation in this Convex app's public API.
*
Expand All @@ -44,6 +82,16 @@ export declare const query: QueryBuilderForDataModel<DataModel>;
*/
export declare const mutation: MutationBuilder<DataModel, API>;

/**
* Define a mutation that is only accessible from other Convex functions (but not from the client).
*
* This function will be allowed to modify your Convex database. It will not be accessible from the client.
*
* @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
* @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
*/
export declare const internalMutation: InternalMutationBuilder<DataModel, API>;

/**
* Define an action in this Convex app's public API.
*
Expand All @@ -59,6 +107,14 @@ export declare const mutation: MutationBuilder<DataModel, API>;
*/
export declare const action: ActionBuilderForAPI<API>;

/**
* Define an action that is only accessible from other Convex functions (but not from the client).
*
* @param func - The function. It receives a {@link ActionCtx} as its first argument.
* @returns The wrapped function. Include this as an `export` to name it and make it accessible.
*/
export declare const internalAction: InternalActionBuilderForAPI<API>;

/**
* Define an HTTP endpoint.
*
Expand Down
Loading

0 comments on commit 1acc1bd

Please sign in to comment.