From 6084a9e03dfa9e73276fc97488c8b0f63f7d75cd Mon Sep 17 00:00:00 2001 From: LekoArts Date: Wed, 29 Jun 2022 15:00:32 +0200 Subject: [PATCH 01/16] update microbundle versions --- packages/create-gatsby/package.json | 2 +- packages/gatsby-design-tokens/package.json | 2 +- packages/gatsby-legacy-polyfills/package.json | 2 +- packages/gatsby-plugin-image/package.json | 2 +- yarn.lock | 72 ++++++------------- 5 files changed, 25 insertions(+), 55 deletions(-) diff --git a/packages/create-gatsby/package.json b/packages/create-gatsby/package.json index a9df9350d5a15..b1dbb2b02eccf 100644 --- a/packages/create-gatsby/package.json +++ b/packages/create-gatsby/package.json @@ -30,7 +30,7 @@ "fs-extra": "^10.1.0", "gatsby-plugin-utils": "^3.12.0-next.1", "joi": "^17.4.2", - "microbundle": "^0.14.2", + "microbundle": "^0.15.0", "node-fetch": "^2.6.6", "string-length": "^4.0.2", "terminal-link": "^2.1.1", diff --git a/packages/gatsby-design-tokens/package.json b/packages/gatsby-design-tokens/package.json index 5e7e454259692..170558104d441 100644 --- a/packages/gatsby-design-tokens/package.json +++ b/packages/gatsby-design-tokens/package.json @@ -32,7 +32,7 @@ "devDependencies": { "agadoo": "^2.0.0", "cross-env": "^7.0.3", - "microbundle": "^0.14.2", + "microbundle": "^0.15.0", "preval.macro": "^5.0.0" }, "engines": { diff --git a/packages/gatsby-legacy-polyfills/package.json b/packages/gatsby-legacy-polyfills/package.json index b55437a667224..b48fb7215c963 100644 --- a/packages/gatsby-legacy-polyfills/package.json +++ b/packages/gatsby-legacy-polyfills/package.json @@ -40,7 +40,7 @@ "event-target-polyfill": "^0.0.3", "execa": "^5.1.1", "fs-extra": "^10.1.0", - "microbundle": "^0.14.2", + "microbundle": "^0.15.0", "npm-run-all": "^4.1.5", "object-assign": "^4.1.1", "url-polyfill": "^1.1.12", diff --git a/packages/gatsby-plugin-image/package.json b/packages/gatsby-plugin-image/package.json index 9451986776859..9a1a0ce6fcd28 100644 --- a/packages/gatsby-plugin-image/package.json +++ b/packages/gatsby-plugin-image/package.json @@ -56,7 +56,7 @@ "cssnano": "^4.1.10", "del-cli": "^3.0.1", "do-sync": "^3.0.11", - "microbundle": "^0.13.0", + "microbundle": "^0.15.0", "npm-run-all": "^4.1.5", "postcss": "^8.2.9", "semver": "^7.3.7", diff --git a/yarn.lock b/yarn.lock index 6da73bbf4abb5..c8ad352244cdf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12010,7 +12010,7 @@ good-listener@^1.2.2: dependencies: delegate "^3.1.2" -got@^11.8.2, got@^11.8.3, got@^11.8.5: +got@^11.8.2, got@^11.8.5: version "11.8.5" resolved "https://registry.yarnpkg.com/got/-/got-11.8.5.tgz#ce77d045136de56e8f024bebb82ea349bc730046" integrity sha512-o0Je4NvQObAuZPHLFoRSkdG2lTgtcynqymzg2Vupdx6PorhaT5MCbIyXG6d4D94kk8ZG57QeosgdiqfJWhEhlQ== @@ -16536,56 +16536,10 @@ methods@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" -microbundle@^0.13.0: - version "0.13.3" - resolved "https://registry.yarnpkg.com/microbundle/-/microbundle-0.13.3.tgz#cfc5055b50cf7a0bcc5eec441604f4520ccd07ec" - integrity sha512-nlP20UmyqGGeh6jhk8VaVFEoRlF+JAvnwixPLQUwHEcAF59ROJCyh34eylJzUAVNvF3yrCaHxIBv8lYcphDM1g== - dependencies: - "@babel/core" "^7.12.10" - "@babel/plugin-proposal-class-properties" "7.12.1" - "@babel/plugin-syntax-import-meta" "^7.10.4" - "@babel/plugin-syntax-jsx" "^7.12.1" - "@babel/plugin-transform-flow-strip-types" "^7.12.10" - "@babel/plugin-transform-react-jsx" "^7.12.11" - "@babel/plugin-transform-regenerator" "^7.12.1" - "@babel/preset-env" "^7.12.11" - "@babel/preset-flow" "^7.12.1" - "@babel/preset-react" "^7.12.10" - "@rollup/plugin-alias" "^3.1.1" - "@rollup/plugin-babel" "^5.2.2" - "@rollup/plugin-commonjs" "^17.0.0" - "@rollup/plugin-json" "^4.1.0" - "@rollup/plugin-node-resolve" "^11.0.1" - asyncro "^3.0.0" - autoprefixer "^10.1.0" - babel-plugin-macros "^3.0.1" - babel-plugin-transform-async-to-promises "^0.8.15" - babel-plugin-transform-replace-expressions "^0.2.0" - brotli-size "^4.0.0" - builtin-modules "^3.1.0" - camelcase "^6.2.0" - escape-string-regexp "^4.0.0" - filesize "^6.1.0" - gzip-size "^6.0.0" - kleur "^4.1.3" - lodash.merge "^4.6.2" - postcss "^8.2.1" - pretty-bytes "^5.4.1" - rollup "^2.35.1" - rollup-plugin-bundle-size "^1.0.3" - rollup-plugin-postcss "^4.0.0" - rollup-plugin-terser "^7.0.2" - rollup-plugin-typescript2 "^0.29.0" - sade "^1.7.4" - terser "^5.7.0" - tiny-glob "^0.2.8" - tslib "^2.0.3" - typescript "^4.1.3" - -microbundle@^0.14.2: - version "0.14.2" - resolved "https://registry.yarnpkg.com/microbundle/-/microbundle-0.14.2.tgz#2db869c8145bd159aa55058ead47223f58f93bf2" - integrity sha512-jODALfU3w7jnJAqw7Tou9uU8e8zH0GRVWzOd/V7eAvD1fsfb9pyMbmzhFZqnX6SCb54eP1EF5oRyNlSxBAxoag== +microbundle@^0.15.0: + version "0.15.0" + resolved "https://registry.yarnpkg.com/microbundle/-/microbundle-0.15.0.tgz#d5a63ce02271b20d79fd30d83a123aaf962a5191" + integrity sha512-EkFst5ntLXoQGewkvga/Kd72RcN7IuJRl5ivLihJSbvLfJQo8LDS0n9X0q81vegiC59vhtKIM6qjrl1fOAtuGw== dependencies: "@babel/core" "^7.12.10" "@babel/plugin-proposal-class-properties" "7.12.1" @@ -16623,6 +16577,7 @@ microbundle@^0.14.2: rollup-plugin-postcss "^4.0.0" rollup-plugin-terser "^7.0.2" rollup-plugin-typescript2 "^0.29.0" + rollup-plugin-visualizer "^5.6.0" sade "^1.7.4" terser "^5.7.0" tiny-glob "^0.2.8" @@ -17117,6 +17072,11 @@ nanoid@^3.1.30: resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.30.tgz#63f93cc548d2a113dc5dfbc63bfa09e2b9b64362" integrity sha512-zJpuPDwOv8D2zq2WRoMe1HsfZthVewpel9CAvTfc/2mBD1uUT/agc5f7GHGWXlYkFvi1mVxe4IjvP2HNrop7nQ== +nanoid@^3.1.32: + version "3.3.4" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab" + integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw== + nanomatch@^1.2.9: version "1.2.13" resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" @@ -21972,6 +21932,16 @@ rollup-plugin-virtual@^1.0.1: resolved "https://registry.yarnpkg.com/rollup-plugin-virtual/-/rollup-plugin-virtual-1.0.1.tgz#8227c94c605b981adfe433ea74de3551e42ffeb4" integrity sha512-HCTBpV8MwP5lNzZrHD2moVxHIToHU1EkzkKGVj6Z0DcgUfxrxrZmeQirQeLz2yhnkJqRjwiVywK9CS8jDYakrw== +rollup-plugin-visualizer@^5.6.0: + version "5.6.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-visualizer/-/rollup-plugin-visualizer-5.6.0.tgz#06aa7cf3fd504a29d404335700f2a3f28ebb33f3" + integrity sha512-CKcc8GTUZjC+LsMytU8ocRr/cGZIfMR7+mdy4YnlyetlmIl/dM8BMnOEpD4JPIGt+ZVW7Db9ZtSsbgyeBH3uTA== + dependencies: + nanoid "^3.1.32" + open "^8.4.0" + source-map "^0.7.3" + yargs "^17.3.1" + rollup-pluginutils@^2.8.2: version "2.8.2" resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz#72f2af0748b592364dbd3389e600e5a9444a351e" From 16be5029b0d61a0d02c387960cdb4fe0497eeb25 Mon Sep 17 00:00:00 2001 From: LekoArts Date: Wed, 29 Jun 2022 15:00:39 +0200 Subject: [PATCH 02/16] gatsby-script change --- packages/gatsby-script/.babelrc | 6 ------ packages/gatsby-script/package.json | 25 +++++++++++++++---------- 2 files changed, 15 insertions(+), 16 deletions(-) delete mode 100644 packages/gatsby-script/.babelrc diff --git a/packages/gatsby-script/.babelrc b/packages/gatsby-script/.babelrc deleted file mode 100644 index ff76a7a2f0f3b..0000000000000 --- a/packages/gatsby-script/.babelrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "presets": [ - ["babel-preset-gatsby-package", { "browser": true, "esm": true }], - "@babel/preset-typescript" - ] -} diff --git a/packages/gatsby-script/package.json b/packages/gatsby-script/package.json index 3e00ecb54b9fd..e71fe71f7b469 100644 --- a/packages/gatsby-script/package.json +++ b/packages/gatsby-script/package.json @@ -6,7 +6,16 @@ "bugs": { "url": "https://github.com/gatsbyjs/gatsby/issues" }, + "source": "src/index.ts", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs", + "types": "./dist/index.d.ts" + } + }, "main": "dist/index.js", + "module": "dist/index.mjs", "types": "dist/index.d.ts", "typesVersions": { "*": { @@ -20,19 +29,15 @@ "dist/*" ], "scripts": { - "typegen": "rimraf \"dist/**/*.d.ts\" && tsc --emitDeclarationOnly --declaration --declarationDir dist/", - "build": "babel src --extensions \".js,.jsx,.ts,.tsx\" --out-dir dist --ignore \"**/__tests__\"", - "watch": "babel -w src --extensions \".js,.jsx,.ts,.tsx\" --out-dir dist --ignore \"**/__tests__\"", - "prepare": "cross-env NODE_ENV=production npm run build && npm run typegen" + "build": "microbundle -f cjs,es --jsx React.createElement", + "watch": "microbundle watch -f cjs,es --jsx React.createElement", + "prepare": "npm run clean && npm run build", + "clean": "del-cli dist/*" }, "devDependencies": { - "@babel/cli": "^7.15.4", - "@babel/core": "^7.15.5", - "@babel/preset-typescript": "^7.16.7", "@testing-library/react": "^11.2.7", - "babel-preset-gatsby-package": "^2.18.0-next.1", - "cross-env": "^7.0.3", - "rimraf": "^3.0.2", + "del-cli": "^3.0.1", + "microbundle": "^0.15.0", "typescript": "^4.7.2" }, "peerDependencies": { From 8596be63e18277a6284679779ec2c1cf72038cea Mon Sep 17 00:00:00 2001 From: LekoArts Date: Thu, 30 Jun 2022 06:34:56 +0200 Subject: [PATCH 03/16] use --jsxFragment option --- packages/gatsby-plugin-image/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/gatsby-plugin-image/package.json b/packages/gatsby-plugin-image/package.json index 9a1a0ce6fcd28..8341dc6965b4d 100644 --- a/packages/gatsby-plugin-image/package.json +++ b/packages/gatsby-plugin-image/package.json @@ -4,9 +4,9 @@ "scripts": { "build": "npm-run-all --npm-path npm -s clean -p build:*", "build:gatsby-node": "tsc --jsx react --downlevelIteration true --skipLibCheck true --esModuleInterop true --outDir dist/ src/gatsby-node.ts src/babel-plugin-parse-static-images.ts src/resolver-utils.ts src/types.d.ts -d --declarationDir dist/src", - "build:gatsby-ssr": "microbundle -i src/gatsby-ssr.tsx -f cjs -o ./[name].js --no-pkg-main --jsx React.createElement --no-compress --external=common-tags,react --no-sourcemap", - "build:server": "microbundle -f cjs,es --jsx React.createElement --define SERVER=true", - "build:browser": "microbundle -i src/index.browser.ts -f cjs,modern --jsx React.createElement -o dist/gatsby-image.browser --define SERVER=false", + "build:gatsby-ssr": "microbundle -i src/gatsby-ssr.tsx -f cjs -o ./[name].js --no-pkg-main --jsx React.createElement --jsxFragment React.Fragment --no-compress --external=common-tags,react --no-sourcemap", + "build:server": "microbundle -f cjs,es --jsx React.createElement --jsxFragment React.Fragment --define SERVER=true", + "build:browser": "microbundle -i src/index.browser.ts -f cjs,modern --jsx React.createElement --jsxFragment React.Fragment -o dist/gatsby-image.browser --define SERVER=false", "prepare": "yarn build", "watch": "npm-run-all --npm-path npm -s clean -p watch:*", "watch:gatsby-node": "yarn build:gatsby-node --watch", From facd225057eb771518aaf40067df6de145af1e60 Mon Sep 17 00:00:00 2001 From: LekoArts Date: Thu, 30 Jun 2022 06:37:03 +0200 Subject: [PATCH 04/16] use modern --- packages/gatsby-script/package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/gatsby-script/package.json b/packages/gatsby-script/package.json index e71fe71f7b469..ffcc55ef1a85f 100644 --- a/packages/gatsby-script/package.json +++ b/packages/gatsby-script/package.json @@ -10,12 +10,12 @@ "exports": { ".": { "require": "./dist/index.js", - "import": "./dist/index.mjs", + "import": "./dist/index.modern.js", "types": "./dist/index.d.ts" } }, "main": "dist/index.js", - "module": "dist/index.mjs", + "module": "dist/index.modern.js", "types": "dist/index.d.ts", "typesVersions": { "*": { @@ -29,8 +29,8 @@ "dist/*" ], "scripts": { - "build": "microbundle -f cjs,es --jsx React.createElement", - "watch": "microbundle watch -f cjs,es --jsx React.createElement", + "build": "microbundle -f cjs,modern --jsx React.createElement", + "watch": "microbundle watch -f cjs,modern --jsx React.createElement --no-compress", "prepare": "npm run clean && npm run build", "clean": "del-cli dist/*" }, From c42dc826532da5ad96c9b326f8d65be3ef2e0983 Mon Sep 17 00:00:00 2001 From: LekoArts Date: Thu, 30 Jun 2022 08:32:14 +0200 Subject: [PATCH 05/16] gatsby-link --- packages/gatsby-link/.babelrc | 3 --- packages/gatsby-link/package.json | 33 +++++++++++++++++++----------- packages/gatsby-link/tsconfig.json | 3 --- 3 files changed, 21 insertions(+), 18 deletions(-) delete mode 100644 packages/gatsby-link/.babelrc delete mode 100644 packages/gatsby-link/tsconfig.json diff --git a/packages/gatsby-link/.babelrc b/packages/gatsby-link/.babelrc deleted file mode 100644 index 152bd0cb4257e..0000000000000 --- a/packages/gatsby-link/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": [["babel-preset-gatsby-package", { "browser": true, "esm": true }]] -} diff --git a/packages/gatsby-link/package.json b/packages/gatsby-link/package.json index b3c7988cd69ff..7a17b5b018491 100644 --- a/packages/gatsby-link/package.json +++ b/packages/gatsby-link/package.json @@ -6,18 +6,34 @@ "bugs": { "url": "https://github.com/gatsbyjs/gatsby/issues" }, + "source": "src/index.js", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.modern.js" + } + }, + "main": "dist/index.js", + "module": "dist/index.modern.js", + "types": "index.d.ts", + "files": [ + "dist/*" + ], + "scripts": { + "build": "microbundle -f cjs,modern --jsx React.createElement --generateTypes false", + "watch": "npm run build watch --no-compress", + "prepare": "npm run clean && npm run build", + "clean": "del-cli dist/*" + }, "dependencies": { - "@babel/runtime": "^7.15.4", "@types/reach__router": "^1.3.10", "gatsby-page-utils": "^2.18.0-next.1", "prop-types": "^15.8.1" }, "devDependencies": { - "@babel/cli": "^7.15.4", - "@babel/core": "^7.15.5", "@testing-library/react": "^11.2.7", - "babel-preset-gatsby-package": "^2.18.0-next.1", - "cross-env": "^7.0.3" + "del-cli": "^3.0.1", + "microbundle": "^0.15.0" }, "peerDependencies": { "@gatsbyjs/reach-router": "^1.3.5", @@ -29,18 +45,11 @@ "gatsby" ], "license": "MIT", - "main": "index.js", "repository": { "type": "git", "url": "https://github.com/gatsbyjs/gatsby.git", "directory": "packages/gatsby-link" }, - "scripts": { - "build": "babel src --out-dir . --ignore \"**/__tests__\"", - "prepare": "cross-env NODE_ENV=production npm run build", - "watch": "babel -w src --out-dir . --ignore \"**/__tests__\"" - }, - "types": "index.d.ts", "engines": { "node": ">=14.15.0" } diff --git a/packages/gatsby-link/tsconfig.json b/packages/gatsby-link/tsconfig.json deleted file mode 100644 index 4082f16a5d91c..0000000000000 --- a/packages/gatsby-link/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tsconfig.json" -} From 581fa87969c638ddad318f2b9db620c77e5e5331 Mon Sep 17 00:00:00 2001 From: LekoArts Date: Thu, 30 Jun 2022 08:39:42 +0200 Subject: [PATCH 06/16] fix circular dep in gatsby-link --- packages/gatsby-link/src/index.js | 33 ++----------------- packages/gatsby-link/src/prefix-helpers.js | 32 ++++++++++++++++++ packages/gatsby-link/src/rewrite-link-path.js | 2 +- 3 files changed, 35 insertions(+), 32 deletions(-) create mode 100644 packages/gatsby-link/src/prefix-helpers.js diff --git a/packages/gatsby-link/src/index.js b/packages/gatsby-link/src/index.js index 490289713aad2..67cc83d6eee3c 100644 --- a/packages/gatsby-link/src/index.js +++ b/packages/gatsby-link/src/index.js @@ -4,38 +4,9 @@ import { Link, Location } from "@gatsbyjs/reach-router" import { parsePath } from "./parse-path" import { isLocalLink } from "./is-local-link" import { rewriteLinkPath } from "./rewrite-link-path" +import { withPrefix, getGlobalPathPrefix } from "./prefix-helpers" -export { parsePath } - -export function withPrefix(path, prefix = getGlobalBasePrefix()) { - if (!isLocalLink(path)) { - return path - } - - if (path.startsWith(`./`) || path.startsWith(`../`)) { - return path - } - const base = prefix ?? getGlobalPathPrefix() ?? `/` - - return `${base?.endsWith(`/`) ? base.slice(0, -1) : base}${ - path.startsWith(`/`) ? path : `/${path}` - }` -} - -// These global values are wrapped in typeof clauses to ensure the values exist. -// This is especially problematic in unit testing of this component. -const getGlobalPathPrefix = () => - process.env.NODE_ENV !== `production` - ? typeof __PATH_PREFIX__ !== `undefined` - ? __PATH_PREFIX__ - : undefined - : __PATH_PREFIX__ -const getGlobalBasePrefix = () => - process.env.NODE_ENV !== `production` - ? typeof __BASE_PATH__ !== `undefined` - ? __BASE_PATH__ - : undefined - : __BASE_PATH__ +export { parsePath, withPrefix } export function withAssetPrefix(path) { return withPrefix(path, getGlobalPathPrefix()) diff --git a/packages/gatsby-link/src/prefix-helpers.js b/packages/gatsby-link/src/prefix-helpers.js new file mode 100644 index 0000000000000..054e417b314ca --- /dev/null +++ b/packages/gatsby-link/src/prefix-helpers.js @@ -0,0 +1,32 @@ +import { isLocalLink } from "./is-local-link" + +export const getGlobalBasePrefix = () => + process.env.NODE_ENV !== `production` + ? typeof __BASE_PATH__ !== `undefined` + ? __BASE_PATH__ + : undefined + : __BASE_PATH__ + +// These global values are wrapped in typeof clauses to ensure the values exist. +// This is especially problematic in unit testing of this component. +export const getGlobalPathPrefix = () => + process.env.NODE_ENV !== `production` + ? typeof __PATH_PREFIX__ !== `undefined` + ? __PATH_PREFIX__ + : undefined + : __PATH_PREFIX__ + +export function withPrefix(path, prefix = getGlobalBasePrefix()) { + if (!isLocalLink(path)) { + return path + } + + if (path.startsWith(`./`) || path.startsWith(`../`)) { + return path + } + const base = prefix ?? getGlobalPathPrefix() ?? `/` + + return `${base?.endsWith(`/`) ? base.slice(0, -1) : base}${ + path.startsWith(`/`) ? path : `/${path}` + }` +} diff --git a/packages/gatsby-link/src/rewrite-link-path.js b/packages/gatsby-link/src/rewrite-link-path.js index 242205961a8aa..6ac57ee203264 100644 --- a/packages/gatsby-link/src/rewrite-link-path.js +++ b/packages/gatsby-link/src/rewrite-link-path.js @@ -3,7 +3,7 @@ import { resolve } from "@gatsbyjs/reach-router/lib/utils" import { applyTrailingSlashOption } from "gatsby-page-utils/apply-trailing-slash-option" import { parsePath } from "./parse-path" import { isLocalLink } from "./is-local-link" -import { withPrefix } from "." +import { withPrefix } from "./prefix-helpers" const isAbsolutePath = path => path?.startsWith(`/`) From 9ecb8eb0d1f020c97c0604ee4dd879f825b08c7c Mon Sep 17 00:00:00 2001 From: Ward Peeters Date: Thu, 30 Jun 2022 10:54:18 +0200 Subject: [PATCH 07/16] cleanup script --- packages/gatsby-script/.babelrc | 3 +++ packages/gatsby-script/package.json | 15 --------------- 2 files changed, 3 insertions(+), 15 deletions(-) create mode 100644 packages/gatsby-script/.babelrc diff --git a/packages/gatsby-script/.babelrc b/packages/gatsby-script/.babelrc new file mode 100644 index 0000000000000..ac0ad292bb087 --- /dev/null +++ b/packages/gatsby-script/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": [["babel-preset-gatsby-package"]] +} diff --git a/packages/gatsby-script/package.json b/packages/gatsby-script/package.json index ffcc55ef1a85f..7bf58a73f9ada 100644 --- a/packages/gatsby-script/package.json +++ b/packages/gatsby-script/package.json @@ -7,24 +7,9 @@ "url": "https://github.com/gatsbyjs/gatsby/issues" }, "source": "src/index.ts", - "exports": { - ".": { - "require": "./dist/index.js", - "import": "./dist/index.modern.js", - "types": "./dist/index.d.ts" - } - }, "main": "dist/index.js", "module": "dist/index.modern.js", "types": "dist/index.d.ts", - "typesVersions": { - "*": { - "*": [ - "dist/*.d.ts", - "dist/index.d.ts" - ] - } - }, "files": [ "dist/*" ], From 10c64a932c56402468cd2356bb10db2189064a88 Mon Sep 17 00:00:00 2001 From: Ward Peeters Date: Thu, 30 Jun 2022 11:02:34 +0200 Subject: [PATCH 08/16] update --- packages/gatsby-link/.babelrc | 1 + packages/gatsby-link/package.json | 6 ------ packages/gatsby-script/.babelrc | 4 +--- 3 files changed, 2 insertions(+), 9 deletions(-) create mode 100644 packages/gatsby-link/.babelrc diff --git a/packages/gatsby-link/.babelrc b/packages/gatsby-link/.babelrc new file mode 100644 index 0000000000000..0967ef424bce6 --- /dev/null +++ b/packages/gatsby-link/.babelrc @@ -0,0 +1 @@ +{} diff --git a/packages/gatsby-link/package.json b/packages/gatsby-link/package.json index 7a17b5b018491..83a45f435f5ce 100644 --- a/packages/gatsby-link/package.json +++ b/packages/gatsby-link/package.json @@ -7,12 +7,6 @@ "url": "https://github.com/gatsbyjs/gatsby/issues" }, "source": "src/index.js", - "exports": { - ".": { - "require": "./dist/index.js", - "import": "./dist/index.modern.js" - } - }, "main": "dist/index.js", "module": "dist/index.modern.js", "types": "index.d.ts", diff --git a/packages/gatsby-script/.babelrc b/packages/gatsby-script/.babelrc index ac0ad292bb087..0967ef424bce6 100644 --- a/packages/gatsby-script/.babelrc +++ b/packages/gatsby-script/.babelrc @@ -1,3 +1 @@ -{ - "presets": [["babel-preset-gatsby-package"]] -} +{} From 14d0aceac69be02e18eda59267ad2d6da8597602 Mon Sep 17 00:00:00 2001 From: Ward Peeters Date: Thu, 30 Jun 2022 11:04:43 +0200 Subject: [PATCH 09/16] deduplicate yarn --- yarn.lock | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/yarn.lock b/yarn.lock index c8ad352244cdf..ea2c54554b20a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17067,12 +17067,7 @@ nan@^2.10.0, nan@^2.14.2: resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.2.tgz#f5376400695168f4cc694ac9393d0c9585eeea19" integrity sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ== -nanoid@^3.1.30: - version "3.1.30" - resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.30.tgz#63f93cc548d2a113dc5dfbc63bfa09e2b9b64362" - integrity sha512-zJpuPDwOv8D2zq2WRoMe1HsfZthVewpel9CAvTfc/2mBD1uUT/agc5f7GHGWXlYkFvi1mVxe4IjvP2HNrop7nQ== - -nanoid@^3.1.32: +nanoid@^3.1.30, nanoid@^3.1.32: version "3.3.4" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab" integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw== From 7984662fda1d4ace7660eacaf8d3303cf117219a Mon Sep 17 00:00:00 2001 From: LekoArts Date: Thu, 30 Jun 2022 08:57:20 +0200 Subject: [PATCH 10/16] add sideEffects --- packages/gatsby-link/package.json | 1 + packages/gatsby-script/package.json | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/gatsby-link/package.json b/packages/gatsby-link/package.json index 83a45f435f5ce..590ce539d018f 100644 --- a/packages/gatsby-link/package.json +++ b/packages/gatsby-link/package.json @@ -13,6 +13,7 @@ "files": [ "dist/*" ], + "sideEffects": false, "scripts": { "build": "microbundle -f cjs,modern --jsx React.createElement --generateTypes false", "watch": "npm run build watch --no-compress", diff --git a/packages/gatsby-script/package.json b/packages/gatsby-script/package.json index 7bf58a73f9ada..a195e5155e005 100644 --- a/packages/gatsby-script/package.json +++ b/packages/gatsby-script/package.json @@ -13,6 +13,7 @@ "files": [ "dist/*" ], + "sideEffects": false, "scripts": { "build": "microbundle -f cjs,modern --jsx React.createElement", "watch": "microbundle watch -f cjs,modern --jsx React.createElement --no-compress", From 2c906c243a52904afd509c2c353931916345a29e Mon Sep 17 00:00:00 2001 From: LekoArts Date: Thu, 30 Jun 2022 09:02:02 +0200 Subject: [PATCH 11/16] re-add cross-env --- packages/gatsby-core-utils/package.json | 6 +----- packages/gatsby-link/package.json | 3 ++- packages/gatsby-script/package.json | 3 ++- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/gatsby-core-utils/package.json b/packages/gatsby-core-utils/package.json index 0080212d85a0d..99f1d7e4840e2 100644 --- a/packages/gatsby-core-utils/package.json +++ b/packages/gatsby-core-utils/package.json @@ -39,10 +39,9 @@ "url": "https://github.com/gatsbyjs/gatsby/issues" }, "files": [ - "dist/" + "dist/*" ], "dependencies": { - "@babel/runtime": "^7.15.4", "ci-info": "2.0.0", "configstore": "^5.0.1", "fastq": "^1.13.0", @@ -59,10 +58,7 @@ "xdg-basedir": "^4.0.0" }, "devDependencies": { - "@babel/cli": "^7.15.4", - "@babel/core": "^7.15.5", "@types/ci-info": "2.0.0", - "babel-preset-gatsby-package": "^2.18.0-next.1", "cross-env": "^7.0.3", "is-uuid": "^1.0.2", "msw": "^0.38.2", diff --git a/packages/gatsby-link/package.json b/packages/gatsby-link/package.json index 590ce539d018f..fe41898d79c31 100644 --- a/packages/gatsby-link/package.json +++ b/packages/gatsby-link/package.json @@ -17,7 +17,7 @@ "scripts": { "build": "microbundle -f cjs,modern --jsx React.createElement --generateTypes false", "watch": "npm run build watch --no-compress", - "prepare": "npm run clean && npm run build", + "prepare": "cross-env NODE_ENV=production npm run clean && npm run build", "clean": "del-cli dist/*" }, "dependencies": { @@ -27,6 +27,7 @@ }, "devDependencies": { "@testing-library/react": "^11.2.7", + "cross-env": "^7.0.3", "del-cli": "^3.0.1", "microbundle": "^0.15.0" }, diff --git a/packages/gatsby-script/package.json b/packages/gatsby-script/package.json index a195e5155e005..70726cb41296d 100644 --- a/packages/gatsby-script/package.json +++ b/packages/gatsby-script/package.json @@ -17,11 +17,12 @@ "scripts": { "build": "microbundle -f cjs,modern --jsx React.createElement", "watch": "microbundle watch -f cjs,modern --jsx React.createElement --no-compress", - "prepare": "npm run clean && npm run build", + "prepare": "cross-env NODE_ENV=production npm run clean && npm run build", "clean": "del-cli dist/*" }, "devDependencies": { "@testing-library/react": "^11.2.7", + "cross-env": "^7.0.3", "del-cli": "^3.0.1", "microbundle": "^0.15.0", "typescript": "^4.7.2" From 2b2ed6d536679750efc657a8e27dcfe0cc1e5bcd Mon Sep 17 00:00:00 2001 From: LekoArts Date: Thu, 30 Jun 2022 12:22:11 +0200 Subject: [PATCH 12/16] core utils beginning --- packages/gatsby-core-utils/.babelrc | 3 --- packages/gatsby-core-utils/package.json | 32 ++++++++++++++++++------- 2 files changed, 23 insertions(+), 12 deletions(-) delete mode 100644 packages/gatsby-core-utils/.babelrc diff --git a/packages/gatsby-core-utils/.babelrc b/packages/gatsby-core-utils/.babelrc deleted file mode 100644 index ac0ad292bb087..0000000000000 --- a/packages/gatsby-core-utils/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": [["babel-preset-gatsby-package"]] -} diff --git a/packages/gatsby-core-utils/package.json b/packages/gatsby-core-utils/package.json index 99f1d7e4840e2..54cd11261aeed 100644 --- a/packages/gatsby-core-utils/package.json +++ b/packages/gatsby-core-utils/package.json @@ -6,10 +6,23 @@ "gatsby", "gatsby-core-utils" ], + "source": "src/*.ts", + "main": "dist/index.js", + "module": "dist/index.mjs", + "types": "dist/index.d.ts", "exports": { - ".": "./dist/index.js", - "./*": "./dist/*.js", - "./dist/*": "./dist/*.js" + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs" + }, + "./*": { + "require": "./dist/*.js", + "import": "./dist/*.mjs" + }, + "./dist/*": { + "require": "./dist/*.js", + "import": "./dist/*.mjs" + } }, "typesVersions": { "*": { @@ -19,21 +32,20 @@ ] } }, + "sideEffects": false, "author": "Ward Peeters ", "homepage": "https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-core-utils#readme", "license": "MIT", - "main": "dist/index.js", - "types": "dist/index.d.ts", "repository": { "type": "git", "url": "https://github.com/gatsbyjs/gatsby.git", "directory": "packages/gatsby-core-utils" }, "scripts": { - "build": "babel src --out-dir dist/ --ignore \"**/__tests__\" --ignore \"**/__mocks__\" --extensions \".ts\"", - "typegen": "tsc --emitDeclarationOnly --declaration --declarationDir dist/", - "prepare": "cross-env NODE_ENV=production npm run build && npm run typegen", - "watch": "babel -w src --out-dir dist/ --ignore \"**/__tests__\" --extensions \".ts\"" + "build": "microbundle -f cjs,es --target node --no-sourcemap", + "watch": "npm run build watch", + "prepare": "cross-env NODE_ENV=production npm run clean && npm run build", + "clean": "del-cli dist/*" }, "bugs": { "url": "https://github.com/gatsbyjs/gatsby/issues" @@ -60,7 +72,9 @@ "devDependencies": { "@types/ci-info": "2.0.0", "cross-env": "^7.0.3", + "del-cli": "^3.0.1", "is-uuid": "^1.0.2", + "microbundle": "^0.15.0", "msw": "^0.38.2", "typescript": "^4.7.2" }, From 088ffd8e4e981437c825eb940ab01e9083521332 Mon Sep 17 00:00:00 2001 From: LekoArts Date: Thu, 30 Jun 2022 12:42:28 +0200 Subject: [PATCH 13/16] empty babelrc for core-utils --- packages/gatsby-core-utils/.babelrc | 1 + 1 file changed, 1 insertion(+) create mode 100644 packages/gatsby-core-utils/.babelrc diff --git a/packages/gatsby-core-utils/.babelrc b/packages/gatsby-core-utils/.babelrc new file mode 100644 index 0000000000000..9e26dfeeb6e64 --- /dev/null +++ b/packages/gatsby-core-utils/.babelrc @@ -0,0 +1 @@ +{} \ No newline at end of file From c3b8c78d48d538d29d492bed4e00dc575fa6dc61 Mon Sep 17 00:00:00 2001 From: Lennart Date: Thu, 30 Jun 2022 14:14:31 +0200 Subject: [PATCH 14/16] Restore package.json --- packages/gatsby-core-utils/package.json | 38 +++++++++---------------- 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/packages/gatsby-core-utils/package.json b/packages/gatsby-core-utils/package.json index 54cd11261aeed..0080212d85a0d 100644 --- a/packages/gatsby-core-utils/package.json +++ b/packages/gatsby-core-utils/package.json @@ -6,23 +6,10 @@ "gatsby", "gatsby-core-utils" ], - "source": "src/*.ts", - "main": "dist/index.js", - "module": "dist/index.mjs", - "types": "dist/index.d.ts", "exports": { - ".": { - "require": "./dist/index.js", - "import": "./dist/index.mjs" - }, - "./*": { - "require": "./dist/*.js", - "import": "./dist/*.mjs" - }, - "./dist/*": { - "require": "./dist/*.js", - "import": "./dist/*.mjs" - } + ".": "./dist/index.js", + "./*": "./dist/*.js", + "./dist/*": "./dist/*.js" }, "typesVersions": { "*": { @@ -32,28 +19,30 @@ ] } }, - "sideEffects": false, "author": "Ward Peeters ", "homepage": "https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-core-utils#readme", "license": "MIT", + "main": "dist/index.js", + "types": "dist/index.d.ts", "repository": { "type": "git", "url": "https://github.com/gatsbyjs/gatsby.git", "directory": "packages/gatsby-core-utils" }, "scripts": { - "build": "microbundle -f cjs,es --target node --no-sourcemap", - "watch": "npm run build watch", - "prepare": "cross-env NODE_ENV=production npm run clean && npm run build", - "clean": "del-cli dist/*" + "build": "babel src --out-dir dist/ --ignore \"**/__tests__\" --ignore \"**/__mocks__\" --extensions \".ts\"", + "typegen": "tsc --emitDeclarationOnly --declaration --declarationDir dist/", + "prepare": "cross-env NODE_ENV=production npm run build && npm run typegen", + "watch": "babel -w src --out-dir dist/ --ignore \"**/__tests__\" --extensions \".ts\"" }, "bugs": { "url": "https://github.com/gatsbyjs/gatsby/issues" }, "files": [ - "dist/*" + "dist/" ], "dependencies": { + "@babel/runtime": "^7.15.4", "ci-info": "2.0.0", "configstore": "^5.0.1", "fastq": "^1.13.0", @@ -70,11 +59,12 @@ "xdg-basedir": "^4.0.0" }, "devDependencies": { + "@babel/cli": "^7.15.4", + "@babel/core": "^7.15.5", "@types/ci-info": "2.0.0", + "babel-preset-gatsby-package": "^2.18.0-next.1", "cross-env": "^7.0.3", - "del-cli": "^3.0.1", "is-uuid": "^1.0.2", - "microbundle": "^0.15.0", "msw": "^0.38.2", "typescript": "^4.7.2" }, From f960991e502222bd18533e2f249b1306cb588778 Mon Sep 17 00:00:00 2001 From: Lennart Date: Thu, 30 Jun 2022 14:14:46 +0200 Subject: [PATCH 15/16] Restore .babelrc --- packages/gatsby-core-utils/.babelrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/gatsby-core-utils/.babelrc b/packages/gatsby-core-utils/.babelrc index 9e26dfeeb6e64..ac0ad292bb087 100644 --- a/packages/gatsby-core-utils/.babelrc +++ b/packages/gatsby-core-utils/.babelrc @@ -1 +1,3 @@ -{} \ No newline at end of file +{ + "presets": [["babel-preset-gatsby-package"]] +} From 9f8f6835e01d0a550a8d7933d3c0b2ff0d929294 Mon Sep 17 00:00:00 2001 From: LekoArts Date: Fri, 1 Jul 2022 09:42:15 +0200 Subject: [PATCH 16/16] fix file extension --- packages/gatsby-link/package.json | 2 +- packages/gatsby-script/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/gatsby-link/package.json b/packages/gatsby-link/package.json index 995dc418f1eb1..8abf5e275538d 100644 --- a/packages/gatsby-link/package.json +++ b/packages/gatsby-link/package.json @@ -8,7 +8,7 @@ }, "source": "src/index.js", "main": "dist/index.js", - "module": "dist/index.modern.js", + "module": "dist/index.modern.mjs", "types": "index.d.ts", "files": [ "dist/*" diff --git a/packages/gatsby-script/package.json b/packages/gatsby-script/package.json index 82f2001c73200..f900fae028a57 100644 --- a/packages/gatsby-script/package.json +++ b/packages/gatsby-script/package.json @@ -8,7 +8,7 @@ }, "source": "src/index.ts", "main": "dist/index.js", - "module": "dist/index.modern.js", + "module": "dist/index.modern.mjs", "types": "dist/index.d.ts", "files": [ "dist/*"