Skip to content

Commit

Permalink
Merge branch 'canary' into hotfix-router-with-google-analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Sep 4, 2020
2 parents 955e6f3 + f7435b4 commit b6b1ed6
Show file tree
Hide file tree
Showing 17 changed files with 82 additions and 23 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "9.5.4-canary.1"
"version": "9.5.4-canary.2"
}
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": "9.5.4-canary.1",
"version": "9.5.4-canary.2",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion 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": "9.5.4-canary.1",
"version": "9.5.4-canary.2",
"description": "ESLint plugin for NextJS.",
"main": "lib/index.js",
"license": "MIT",
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": "9.5.4-canary.1",
"version": "9.5.4-canary.2",
"main": "index.js",
"license": "MIT",
"repository": {
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": "9.5.4-canary.1",
"version": "9.5.4-canary.2",
"license": "MIT",
"dependencies": {
"chalk": "4.1.0",
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": "9.5.4-canary.1",
"version": "9.5.4-canary.2",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-google-analytics/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-google-analytics",
"version": "9.5.4-canary.1",
"version": "9.5.4-canary.2",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-google-analytics"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-sentry/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-sentry",
"version": "9.5.4-canary.1",
"version": "9.5.4-canary.2",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-sentry"
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": "9.5.4-canary.1",
"version": "9.5.4-canary.2",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-storybook"
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": "9.5.4-canary.1",
"version": "9.5.4-canary.2",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
41 changes: 34 additions & 7 deletions packages/next/build/babel/plugins/next-page-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,47 @@ export default function nextPageConfig({
exportPath.scope.getBinding(CONFIG_KEY)?.path.node,
].filter(Boolean)

for (const declaration of declarations) {
if (
!BabelTypes.isIdentifier(declaration.id, {
name: CONFIG_KEY,
})
) {
if (BabelTypes.isImportSpecifier(declaration)) {
for (const specifier of exportPath.node.specifiers) {
if (specifier.exported.name === CONFIG_KEY) {
// export {} from 'somewhere'
if (BabelTypes.isStringLiteral(exportPath.node.source)) {
throw new Error(
errorMessage(
exportState,
`Expected object but got import`
)
)
// import hello from 'world'
// export { hello as config }
} else if (
BabelTypes.isIdentifier(
(specifier as BabelTypes.ExportSpecifier).local
)
) {
if (
BabelTypes.isImportSpecifier(
exportPath.scope.getBinding(
(specifier as BabelTypes.ExportSpecifier).local.name
)?.path.node
)
) {
throw new Error(
errorMessage(
exportState,
`Expected object but got import`
)
)
}
}
}
}

for (const declaration of declarations) {
if (
!BabelTypes.isIdentifier(declaration.id, {
name: CONFIG_KEY,
})
) {
continue
}

Expand Down
8 changes: 4 additions & 4 deletions packages/next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next",
"version": "9.5.4-canary.1",
"version": "9.5.4-canary.2",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -77,8 +77,8 @@
"@babel/preset-typescript": "7.10.4",
"@babel/runtime": "7.11.2",
"@babel/types": "7.11.5",
"@next/react-dev-overlay": "9.5.4-canary.1",
"@next/react-refresh-utils": "9.5.4-canary.1",
"@next/react-dev-overlay": "9.5.4-canary.2",
"@next/react-refresh-utils": "9.5.4-canary.2",
"ast-types": "0.13.2",
"babel-plugin-syntax-jsx": "6.18.0",
"babel-plugin-transform-define": "2.0.0",
Expand Down Expand Up @@ -123,7 +123,7 @@
"react-dom": "^16.6.0"
},
"devDependencies": {
"@next/polyfill-nomodule": "9.5.4-canary.1",
"@next/polyfill-nomodule": "9.5.4-canary.2",
"@taskr/clear": "1.1.0",
"@taskr/esnext": "1.1.0",
"@taskr/watch": "1.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dev-overlay/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/react-dev-overlay",
"version": "9.5.4-canary.1",
"version": "9.5.4-canary.2",
"description": "A development-only overlay for developing React applications.",
"repository": {
"url": "vercel/next.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-refresh-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/react-refresh-utils",
"version": "9.5.4-canary.1",
"version": "9.5.4-canary.2",
"description": "An experimental package providing utilities for React Refresh.",
"repository": {
"url": "vercel/next.js",
Expand Down
10 changes: 10 additions & 0 deletions test/integration/page-config/pages/valid/config-import.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// eslint-disable-next-line no-unused-vars
import { config } from '../../config'

export const getServerSideProps = () => {
return {
props: {},
}
}

export default () => <p>hello world</p>
10 changes: 10 additions & 0 deletions test/integration/page-config/pages/valid/not-config-export.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// eslint-disable-next-line no-unused-vars
export { config as notConfig } from '../../config'

export const getServerSideProps = () => {
return {
props: {},
}
}

export default () => <p>hello world</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// eslint-disable-next-line no-unused-vars
import { config } from '../../config'

export { config as notConfig }

export const getServerSideProps = () => {
return {
props: {},
}
}

export default () => <p>hello world</p>

0 comments on commit b6b1ed6

Please sign in to comment.