Skip to content

Commit

Permalink
Merge branch 'canary' into edge/extract-build-id
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk authored May 6, 2024
2 parents 9c900e8 + 180d4f5 commit 0715521
Show file tree
Hide file tree
Showing 30 changed files with 115 additions and 100 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ revalidatePath(path: string, type?: 'page' | 'layout'): void;
```

- `path`: Either a string representing the filesystem path associated with the data you want to revalidate (for example, `/product/[slug]/page`), or the literal route segment (for example, `/product/123`). Must be less than 1024 characters. This value is case-sensitive.
- `type`: (optional) `'page'` or `'layout'` string to change the type of path to revalidate. If `path` contains a dynamic segment (for example, `/product/[slug]/page`), this parameter is required.
- `type`: (optional) `'page'` or `'layout'` string to change the type of path to revalidate. If `path` contains a dynamic segment (for example, `/product/[slug]/page`), this parameter is required. If path refers to the literal route segment, e.g., `/product/1` for a dynamic page (e.g., `/product/[slug]/page`), you should not provide `type`.

## Returns

Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "14.3.0-canary.42"
"version": "14.3.0-canary.43"
}
2 changes: 1 addition & 1 deletion packages/create-next-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-next-app",
"version": "14.3.0-canary.42",
"version": "14.3.0-canary.43",
"keywords": [
"react",
"next",
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-config-next",
"version": "14.3.0-canary.42",
"version": "14.3.0-canary.43",
"description": "ESLint configuration used by Next.js.",
"main": "index.js",
"license": "MIT",
Expand All @@ -10,7 +10,7 @@
},
"homepage": "https://nextjs.org/docs/app/building-your-application/configuring/eslint#eslint-config",
"dependencies": {
"@next/eslint-plugin-next": "14.3.0-canary.42",
"@next/eslint-plugin-next": "14.3.0-canary.43",
"@rushstack/eslint-patch": "^1.3.3",
"@typescript-eslint/parser": "^5.4.2 || ^6.0.0 || 7.0.0 - 7.2.0",
"eslint-import-resolver-node": "^0.3.6",
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-plugin-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/eslint-plugin-next",
"version": "14.3.0-canary.42",
"version": "14.3.0-canary.43",
"description": "ESLint plugin for Next.js.",
"main": "dist/index.js",
"license": "MIT",
Expand All @@ -15,7 +15,7 @@
"glob": "10.3.10"
},
"devDependencies": {
"eslint": "7.24.0"
"eslint": "8.56.0"
},
"scripts": {
"build": "swc -d dist src",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export = defineRule({
scriptImportName = node.local.name
},
JSXOpeningElement(node) {
const pathname = convertToCorrectSeparator(context.getFilename())
const pathname = convertToCorrectSeparator(context.filename)

const isInAppDir = pathname.includes(`${path.sep}app${path.sep}`)

Expand Down Expand Up @@ -57,7 +57,7 @@ export = defineRule({
return
}

const document = context.getFilename().split('pages', 2)[1]
const document = context.filename.split('pages', 2)[1]
if (document && path.parse(document).name.startsWith('_document')) {
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export = defineRule({
return
}

const paths = context.getFilename().split('pages')
const paths = context.filename.split('pages')
const page = paths[paths.length - 1]

if (
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-plugin-next/src/rules/no-duplicate-head.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export = defineRule({
schema: [],
},
create(context) {
const { sourceCode } = context
let documentImportName
return {
ImportDeclaration(node) {
Expand All @@ -26,7 +27,7 @@ export = defineRule({
}
},
ReturnStatement(node) {
const ancestors = context.getAncestors()
const ancestors = sourceCode.getAncestors(node)
const documentClass = ancestors.find(
(ancestorNode) =>
ancestorNode.type === 'ClassDeclaration' &&
Expand All @@ -39,7 +40,6 @@ export = defineRule({
return
}

// @ts-expect-error - `node.argument` could be a `JSXElement` which has property `children`
if (
node.argument &&
'children' in node.argument &&
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/src/rules/no-head-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export = defineRule({
create(context) {
return {
JSXOpeningElement(node) {
const paths = context.getFilename()
const paths = context.filename

const isInAppDir = () =>
paths.includes(`app${path.sep}`) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export = defineRule({
return
}

const document = context.getFilename().split('pages', 2)[1]
const document = context.filename.split('pages', 2)[1]
if (!document) {
return
}
Expand Down
5 changes: 3 additions & 2 deletions packages/eslint-plugin-next/src/rules/no-page-custom-font.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export = defineRule({
schema: [],
},
create(context) {
const paths = context.getFilename().split('pages')
const { sourceCode } = context
const paths = context.filename.split('pages')
const page = paths[paths.length - 1]

// outside of a file within `pages`, bail
Expand Down Expand Up @@ -71,7 +72,7 @@ export = defineRule({
return
}

const ancestors = context.getAncestors()
const ancestors = sourceCode.getAncestors(node)

// if `export default <name>` is further down within the file after the
// currently traversed component, then `localDefaultExportName` will
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export = defineRule({
create(context) {
return {
JSXOpeningElement(node) {
const document = context.getFilename().split('pages', 2)[1]
const document = context.filename.split('pages', 2)[1]
if (!document) {
return
}
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/src/rules/no-typos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export = defineRule({
}
return {
ExportNamedDeclaration(node) {
const page = context.getFilename().split('pages', 2)[1]
const page = context.filename.split('pages', 2)[1]
if (!page || path.parse(page).dir.startsWith('/api')) {
return
}
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/src/utils/get-root-dirs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const processRootDir = (rootDir: string): string[] => {
* Gets one or more Root, returns an array of root directories.
*/
export const getRootDirs = (context: Rule.RuleContext) => {
let rootDirs = [context.getCwd()]
let rootDirs = [context.cwd]

const nextSettings: { rootDir?: string | string[] } =
context.settings.next || {}
Expand Down
2 changes: 1 addition & 1 deletion packages/font/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/font",
"version": "14.3.0-canary.42",
"version": "14.3.0-canary.43",
"repository": {
"url": "vercel/next.js",
"directory": "packages/font"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-bundle-analyzer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/bundle-analyzer",
"version": "14.3.0-canary.42",
"version": "14.3.0-canary.43",
"main": "index.js",
"types": "index.d.ts",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-codemod/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/codemod",
"version": "14.3.0-canary.42",
"version": "14.3.0-canary.43",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-env/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/env",
"version": "14.3.0-canary.42",
"version": "14.3.0-canary.43",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-mdx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/mdx",
"version": "14.3.0-canary.42",
"version": "14.3.0-canary.43",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-storybook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-storybook",
"version": "14.3.0-canary.42",
"version": "14.3.0-canary.43",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-storybook"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-module/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-module",
"version": "14.3.0-canary.42",
"version": "14.3.0-canary.43",
"description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)",
"main": "dist/polyfill-module.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-nomodule/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-nomodule",
"version": "14.3.0-canary.42",
"version": "14.3.0-canary.43",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
14 changes: 11 additions & 3 deletions packages/next-swc/crates/next-core/src/next_client/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,16 @@ pub async fn get_client_resolve_options_context(
.cell())
}

fn internal_assets_conditions() -> ContextCondition {
ContextCondition::any(vec![
ContextCondition::InPath(next_js_fs().root()),
ContextCondition::InPath(
turbopack_binding::turbopack::ecmascript_runtime::embed_fs().root(),
),
ContextCondition::InPath(turbopack_binding::turbopack::node::embed_js::embed_fs().root()),
])
}

#[turbo_tasks::function]
pub async fn get_client_module_options_context(
project_path: Vc<FileSystemPath>,
Expand Down Expand Up @@ -288,10 +298,8 @@ pub async fn get_client_module_options_context(
foreign_code_context_condition(next_config, project_path).await?,
foreign_codes_options_context.cell(),
),
// If the module is an internal asset (i.e overlay, fallback) coming from the embedded
// FS, don't apply user defined transforms.
(
ContextCondition::InPath(next_js_fs().root()),
internal_assets_conditions(),
ModuleOptionsContext {
enable_typescript_transform: Some(TypescriptTransformOptions::default().cell()),
enable_jsx: Some(JsxTransformOptions::default().cell()),
Expand Down
27 changes: 22 additions & 5 deletions packages/next-swc/crates/next-core/src/next_server/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,23 @@ pub async fn get_server_compile_time_info(
.cell()
}

/// Determins if the module is an internal asset (i.e overlay, fallback) coming
/// from the embedded FS, don't apply user defined transforms.
///
/// [TODO] turbopack specific embed fs should be handled by internals of
/// turbopack itself and user config should not try to leak this. However,
/// currently we apply few transform options subject to next.js's configuration
/// even if it's embedded assets.
fn internal_assets_conditions() -> ContextCondition {
ContextCondition::any(vec![
ContextCondition::InPath(next_js_fs().root()),
ContextCondition::InPath(
turbopack_binding::turbopack::ecmascript_runtime::embed_fs().root(),
),
ContextCondition::InPath(turbopack_binding::turbopack::node::embed_js::embed_fs().root()),
])
}

#[turbo_tasks::function]
pub async fn get_server_module_options_context(
project_path: Vc<FileSystemPath>,
Expand Down Expand Up @@ -485,7 +502,7 @@ pub async fn get_server_module_options_context(
foreign_code_module_options_context.cell(),
),
(
ContextCondition::InPath(next_js_fs().root()),
internal_assets_conditions(),
internal_module_options_context.cell(),
),
],
Expand Down Expand Up @@ -537,7 +554,7 @@ pub async fn get_server_module_options_context(
foreign_code_module_options_context.cell(),
),
(
ContextCondition::InPath(next_js_fs().root()),
internal_assets_conditions(),
internal_module_options_context.cell(),
),
],
Expand Down Expand Up @@ -604,7 +621,7 @@ pub async fn get_server_module_options_context(
foreign_code_module_options_context.cell(),
),
(
ContextCondition::InPath(next_js_fs().root()),
internal_assets_conditions(),
internal_module_options_context.cell(),
),
],
Expand Down Expand Up @@ -667,7 +684,7 @@ pub async fn get_server_module_options_context(
foreign_code_module_options_context.cell(),
),
(
ContextCondition::InPath(next_js_fs().root()),
internal_assets_conditions(),
internal_module_options_context.cell(),
),
],
Expand Down Expand Up @@ -714,7 +731,7 @@ pub async fn get_server_module_options_context(
foreign_code_module_options_context.cell(),
),
(
ContextCondition::InPath(next_js_fs().root()),
internal_assets_conditions(),
internal_module_options_context.cell(),
),
],
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/swc",
"version": "14.3.0-canary.42",
"version": "14.3.0-canary.43",
"private": true,
"scripts": {
"clean": "node ../../scripts/rm.mjs native",
Expand Down
12 changes: 6 additions & 6 deletions packages/next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next",
"version": "14.3.0-canary.42",
"version": "14.3.0-canary.43",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -93,7 +93,7 @@
]
},
"dependencies": {
"@next/env": "14.3.0-canary.42",
"@next/env": "14.3.0-canary.43",
"@swc/helpers": "0.5.11",
"busboy": "1.6.0",
"caniuse-lite": "^1.0.30001579",
Expand Down Expand Up @@ -153,10 +153,10 @@
"@jest/types": "29.5.0",
"@mswjs/interceptors": "0.23.0",
"@napi-rs/triples": "1.2.0",
"@next/polyfill-module": "14.3.0-canary.42",
"@next/polyfill-nomodule": "14.3.0-canary.42",
"@next/react-refresh-utils": "14.3.0-canary.42",
"@next/swc": "14.3.0-canary.42",
"@next/polyfill-module": "14.3.0-canary.43",
"@next/polyfill-nomodule": "14.3.0-canary.43",
"@next/react-refresh-utils": "14.3.0-canary.43",
"@next/swc": "14.3.0-canary.43",
"@opentelemetry/api": "1.6.0",
"@playwright/test": "1.41.2",
"@taskr/clear": "1.1.0",
Expand Down
Loading

0 comments on commit 0715521

Please sign in to comment.