gatsby 3.9.0-next.1 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/cache-dir/api-runner-ssr.js +58 -22
- package/cache-dir/app.js +8 -5
- package/cache-dir/commonjs/api-runner-ssr.js +66 -23
- package/cache-dir/commonjs/app.js +5 -1
- package/cache-dir/commonjs/dev-loader.js +7 -2
- package/cache-dir/commonjs/develop-static-entry.js +6 -5
- package/cache-dir/commonjs/server-utils/writable-as-promise.js +41 -0
- package/cache-dir/commonjs/ssr-develop-static-entry.js +16 -18
- package/cache-dir/commonjs/static-entry.js +33 -10
- package/cache-dir/dev-loader.js +7 -2
- package/cache-dir/develop-static-entry.js +11 -6
- package/cache-dir/server-utils/writable-as-promise.js +35 -0
- package/cache-dir/ssr-develop-static-entry.js +23 -12
- package/cache-dir/static-entry.js +30 -6
- package/cli.js +0 -0
- package/dist/bootstrap/remove-stale-jobs.js +2 -3
- package/dist/bootstrap/remove-stale-jobs.js.map +1 -1
- package/dist/commands/build-html.js +1 -1
- package/dist/commands/build-html.js.map +1 -1
- package/dist/datastore/common/iterable.js +191 -6
- package/dist/datastore/common/iterable.js.map +1 -1
- package/dist/datastore/common/query.js +81 -0
- package/dist/datastore/common/query.js.map +1 -1
- package/dist/datastore/in-memory/in-memory-datastore.js +7 -0
- package/dist/datastore/in-memory/in-memory-datastore.js.map +1 -1
- package/dist/datastore/in-memory/indexing.js.map +1 -1
- package/dist/datastore/in-memory/run-fast-filters.js +24 -56
- package/dist/datastore/in-memory/run-fast-filters.js.map +1 -1
- package/dist/datastore/lmdb/lmdb-datastore.js +16 -4
- package/dist/datastore/lmdb/lmdb-datastore.js.map +1 -1
- package/dist/gatsby/src/bootstrap/__mocks__/resolve-module-exports.d.ts +1 -1
- package/dist/gatsby/src/bootstrap/create-graphql-runner.d.ts +10 -10
- package/dist/gatsby/src/bootstrap/get-config-file.d.ts +4 -4
- package/dist/gatsby/src/bootstrap/index.d.ts +7 -7
- package/dist/gatsby/src/bootstrap/load-config-and-plugins.d.ts +8 -8
- package/dist/gatsby/src/bootstrap/load-plugins/index.d.ts +2 -2
- package/dist/gatsby/src/bootstrap/load-plugins/load.d.ts +14 -14
- package/dist/gatsby/src/bootstrap/load-plugins/types.d.ts +40 -40
- package/dist/gatsby/src/bootstrap/load-plugins/validate.d.ts +40 -40
- package/dist/gatsby/src/bootstrap/prefer-default.d.ts +1 -1
- package/dist/gatsby/src/bootstrap/redirects-writer.d.ts +2 -2
- package/dist/gatsby/src/bootstrap/remove-stale-jobs.d.ts +2 -2
- package/dist/gatsby/src/bootstrap/requires-writer.d.ts +10 -10
- package/dist/gatsby/src/bootstrap/resolve-module-exports.d.ts +15 -15
- package/dist/gatsby/src/bootstrap/schema-hot-reloader.d.ts +3 -3
- package/dist/gatsby/src/cache/cache-fs.d.ts +1 -1
- package/dist/gatsby/src/cache/json-file-store.d.ts +8 -8
- package/dist/gatsby/src/commands/build-html.d.ts +53 -53
- package/dist/gatsby/src/commands/build-javascript.d.ts +7 -7
- package/dist/gatsby/src/commands/build-utils.d.ts +8 -8
- package/dist/gatsby/src/commands/build.d.ts +1 -1
- package/dist/gatsby/src/commands/clean.d.ts +1 -1
- package/dist/gatsby/src/commands/develop-process.d.ts +1 -1
- package/dist/gatsby/src/commands/develop-static.d.ts +3 -3
- package/dist/gatsby/src/commands/develop.d.ts +2 -2
- package/dist/gatsby/src/commands/feedback.d.ts +1 -1
- package/dist/gatsby/src/commands/repl.d.ts +1 -1
- package/dist/gatsby/src/commands/serve.d.ts +1 -1
- package/dist/gatsby/src/commands/types.d.ts +48 -48
- package/dist/gatsby/src/datastore/common/iterable.d.ts +48 -10
- package/dist/gatsby/src/datastore/common/query.d.ts +68 -37
- package/dist/gatsby/src/datastore/datastore.d.ts +4 -4
- package/dist/gatsby/src/datastore/in-memory/in-memory-datastore.d.ts +2 -2
- package/dist/gatsby/src/datastore/in-memory/indexing.d.ts +59 -62
- package/dist/gatsby/src/datastore/in-memory/run-fast-filters.d.ts +28 -48
- package/dist/gatsby/src/datastore/index.d.ts +20 -20
- package/dist/gatsby/src/datastore/lmdb/lmdb-datastore.d.ts +2 -2
- package/dist/gatsby/src/datastore/lmdb/updates/nodes-by-type.d.ts +3 -3
- package/dist/gatsby/src/datastore/lmdb/updates/nodes.d.ts +5 -5
- package/dist/gatsby/src/datastore/types.d.ts +45 -26
- package/dist/gatsby/src/internal-plugins/functions/gatsby-node.d.ts +3 -3
- package/dist/gatsby/src/internal.d.ts +5 -5
- package/dist/gatsby/src/joi-schemas/joi.d.ts +5 -5
- package/dist/gatsby/src/query/error-parser.d.ts +19 -19
- package/dist/gatsby/src/query/graphql-runner.d.ts +34 -34
- package/dist/gatsby/src/query/graphql-span-tracer.d.ts +19 -19
- package/dist/gatsby/src/query/index.d.ts +26 -26
- package/dist/gatsby/src/query/query-runner.d.ts +13 -13
- package/dist/gatsby/src/query/query-watcher.d.ts +17 -17
- package/dist/gatsby/src/query/types.d.ts +34 -34
- package/dist/gatsby/src/query/utils.d.ts +4 -4
- package/dist/gatsby/src/redux/actions/add-page-dependency.d.ts +5 -5
- package/dist/gatsby/src/redux/actions/index.d.ts +12 -12
- package/dist/gatsby/src/redux/actions/internal.d.ts +120 -118
- package/dist/gatsby/src/redux/actions/restricted.d.ts +293 -293
- package/dist/gatsby/src/redux/index.d.ts +20 -19
- package/dist/gatsby/src/redux/persist.d.ts +5 -5
- package/dist/gatsby/src/redux/plugin-runner.d.ts +1 -1
- package/dist/gatsby/src/redux/reducers/babelrc.d.ts +9 -9
- package/dist/gatsby/src/redux/reducers/components.d.ts +2 -2
- package/dist/gatsby/src/redux/reducers/config.d.ts +2 -2
- package/dist/gatsby/src/redux/reducers/definitions.d.ts +2 -2
- package/dist/gatsby/src/redux/reducers/flattened-plugins.d.ts +15 -15
- package/dist/gatsby/src/redux/reducers/functions.d.ts +2 -2
- package/dist/gatsby/src/redux/reducers/html.d.ts +8 -8
- package/dist/gatsby/src/redux/reducers/index.d.ts +35 -35
- package/dist/gatsby/src/redux/reducers/inference-metadata.d.ts +7 -7
- package/dist/gatsby/src/redux/reducers/jobs.d.ts +5 -5
- package/dist/gatsby/src/redux/reducers/jobsv2.d.ts +5 -5
- package/dist/gatsby/src/redux/reducers/last-action.d.ts +2 -2
- package/dist/gatsby/src/redux/reducers/node-manifest.d.ts +2 -2
- package/dist/gatsby/src/redux/reducers/nodes-by-type.d.ts +2 -2
- package/dist/gatsby/src/redux/reducers/nodes-touched.d.ts +3 -3
- package/dist/gatsby/src/redux/reducers/nodes.d.ts +2 -2
- package/dist/gatsby/src/redux/reducers/normalize-path.d.ts +2 -2
- package/dist/gatsby/src/redux/reducers/page-data-stats.d.ts +2 -2
- package/dist/gatsby/src/redux/reducers/pages.d.ts +2 -2
- package/dist/gatsby/src/redux/reducers/pending-page-data-writes.d.ts +4 -4
- package/dist/gatsby/src/redux/reducers/program.d.ts +2 -2
- package/dist/gatsby/src/redux/reducers/queries.d.ts +26 -26
- package/dist/gatsby/src/redux/reducers/redirects.d.ts +2 -2
- package/dist/gatsby/src/redux/reducers/resolved-nodes.d.ts +2 -2
- package/dist/gatsby/src/redux/reducers/schema-customization.d.ts +23 -23
- package/dist/gatsby/src/redux/reducers/schema.d.ts +3 -3
- package/dist/gatsby/src/redux/reducers/static-queries-by-template.d.ts +2 -2
- package/dist/gatsby/src/redux/reducers/static-query-components.d.ts +2 -2
- package/dist/gatsby/src/redux/reducers/status.d.ts +6 -6
- package/dist/gatsby/src/redux/reducers/visited-page.d.ts +2 -2
- package/dist/gatsby/src/redux/reducers/webpack-compilation-hash.d.ts +2 -2
- package/dist/gatsby/src/redux/reducers/webpack.d.ts +2 -2
- package/dist/gatsby/src/redux/types.d.ts +738 -732
- package/dist/gatsby/src/schema/context.d.ts +13 -13
- package/dist/gatsby/src/schema/infer/build-example-data.d.ts +5 -5
- package/dist/gatsby/src/schema/infer/inference-metadata.d.ts +72 -72
- package/dist/gatsby/src/schema/infer/is-file.d.ts +1 -1
- package/dist/gatsby/src/schema/infer/type-conflict-reporter.d.ts +28 -28
- package/dist/gatsby/src/schema/resolvers.d.ts +37 -35
- package/dist/gatsby/src/schema/schema-composer.d.ts +3 -0
- package/dist/gatsby/src/schema/type-definitions.d.ts +42 -42
- package/dist/gatsby/src/schema/types/built-in-types.d.ts +3 -3
- package/dist/gatsby/src/schema/types/date.d.ts +40 -40
- package/dist/gatsby/src/schema/types/derived-types.d.ts +45 -45
- package/dist/gatsby/src/schema/types/filter.d.ts +12 -12
- package/dist/gatsby/src/schema/types/node-interface.d.ts +14 -14
- package/dist/gatsby/src/schema/types/pagination.d.ts +16 -16
- package/dist/gatsby/src/schema/types/sort.d.ts +18 -18
- package/dist/gatsby/src/schema/types/type-builders.d.ts +36 -36
- package/dist/gatsby/src/services/build-schema.d.ts +2 -2
- package/dist/gatsby/src/services/calculate-dirty-queries.d.ts +5 -5
- package/dist/gatsby/src/services/create-pages.d.ts +5 -5
- package/dist/gatsby/src/services/customize-schema.d.ts +2 -2
- package/dist/gatsby/src/services/extract-queries.d.ts +2 -2
- package/dist/gatsby/src/services/index.d.ts +18 -18
- package/dist/gatsby/src/services/initialize.d.ts +8 -8
- package/dist/gatsby/src/services/listen-for-mutations.d.ts +2 -2
- package/dist/gatsby/src/services/listen-to-webpack.d.ts +3 -3
- package/dist/gatsby/src/services/post-bootstrap.d.ts +2 -2
- package/dist/gatsby/src/services/rebuild-schema-with-site-pages.d.ts +2 -2
- package/dist/gatsby/src/services/recompile.d.ts +3 -3
- package/dist/gatsby/src/services/run-mutation-batch.d.ts +2 -2
- package/dist/gatsby/src/services/run-page-queries.d.ts +2 -2
- package/dist/gatsby/src/services/run-static-queries.d.ts +2 -2
- package/dist/gatsby/src/services/source-nodes.d.ts +5 -5
- package/dist/gatsby/src/services/start-webpack-server.d.ts +9 -9
- package/dist/gatsby/src/services/types.d.ts +45 -45
- package/dist/gatsby/src/services/write-out-redirects.d.ts +2 -2
- package/dist/gatsby/src/services/write-out-requires.d.ts +2 -2
- package/dist/gatsby/src/state-machines/data-layer/actions.d.ts +8 -8
- package/dist/gatsby/src/state-machines/data-layer/index.d.ts +24 -24
- package/dist/gatsby/src/state-machines/data-layer/services.d.ts +3 -3
- package/dist/gatsby/src/state-machines/data-layer/types.d.ts +23 -23
- package/dist/gatsby/src/state-machines/develop/actions.d.ts +37 -37
- package/dist/gatsby/src/state-machines/develop/index.d.ts +6 -6
- package/dist/gatsby/src/state-machines/develop/services.d.ts +3 -3
- package/dist/gatsby/src/state-machines/index.d.ts +7 -7
- package/dist/gatsby/src/state-machines/query-running/actions.d.ts +9 -9
- package/dist/gatsby/src/state-machines/query-running/index.d.ts +7 -7
- package/dist/gatsby/src/state-machines/query-running/services.d.ts +3 -3
- package/dist/gatsby/src/state-machines/query-running/types.d.ts +23 -23
- package/dist/gatsby/src/state-machines/waiting/actions.d.ts +11 -11
- package/dist/gatsby/src/state-machines/waiting/index.d.ts +12 -12
- package/dist/gatsby/src/state-machines/waiting/services.d.ts +3 -3
- package/dist/gatsby/src/state-machines/waiting/types.d.ts +12 -12
- package/dist/gatsby/src/types.d.ts +9 -9
- package/dist/gatsby/src/utils/api-browser-docs.d.ts +242 -242
- package/dist/gatsby/src/utils/api-node-docs.d.ts +460 -460
- package/dist/gatsby/src/utils/api-runner-error-parser.d.ts +5 -5
- package/dist/gatsby/src/utils/app-data.d.ts +2 -2
- package/dist/gatsby/src/utils/assert-store.d.ts +2 -2
- package/dist/gatsby/src/utils/babel-parse-to-ast.d.ts +4 -4
- package/dist/gatsby/src/utils/browserslist.d.ts +2 -1
- package/dist/gatsby/src/utils/cache.d.ts +16 -16
- package/dist/gatsby/src/utils/call-deferred-api.d.ts +8 -8
- package/dist/gatsby/src/utils/changed-pages.d.ts +6 -6
- package/dist/gatsby/src/utils/create-node-id.d.ts +24 -24
- package/dist/gatsby/src/utils/create-schema-customization.d.ts +6 -6
- package/dist/gatsby/src/utils/detect-port-in-use-and-prompt.d.ts +1 -1
- package/dist/gatsby/src/utils/dev-ssr/render-dev-html.d.ts +23 -22
- package/dist/gatsby/src/utils/develop-preload-headers.d.ts +7 -7
- package/dist/gatsby/src/utils/develop-proxy.d.ts +14 -14
- package/dist/gatsby/src/utils/did-you-mean.d.ts +3 -3
- package/dist/gatsby/src/utils/eslint-config.d.ts +4 -4
- package/dist/gatsby/src/utils/eslint-rules/limited-exports-page-templates.d.ts +1 -1
- package/dist/gatsby/src/utils/eslint-rules/no-anonymous-exports-page-templates.d.ts +1 -1
- package/dist/gatsby/src/utils/eslint-rules-helpers.d.ts +4 -4
- package/dist/gatsby/src/utils/fast-refresh-module.d.ts +22 -22
- package/dist/gatsby/src/utils/feedback.d.ts +5 -5
- package/dist/gatsby/src/utils/find-page-by-path.d.ts +2 -2
- package/dist/gatsby/src/utils/flags.d.ts +34 -34
- package/dist/gatsby/src/utils/gatsby-dependents.d.ts +8 -8
- package/dist/gatsby/src/utils/gatsby-webpack-eslint-graphql-schema-reload-plugin.d.ts +8 -8
- package/dist/gatsby/src/utils/gatsby-webpack-stats-extractor.d.ts +6 -6
- package/dist/gatsby/src/utils/gatsby-webpack-virtual-modules.d.ts +6 -6
- package/dist/gatsby/src/utils/get-cache.d.ts +2 -2
- package/dist/gatsby/src/utils/get-latest-apis.d.ts +6 -6
- package/dist/gatsby/src/utils/get-page-data.d.ts +3 -3
- package/dist/gatsby/src/utils/get-public-path.d.ts +5 -5
- package/dist/gatsby/src/utils/get-ssl-cert.d.ts +9 -9
- package/dist/gatsby/src/utils/get-static-dir.d.ts +12 -12
- package/dist/gatsby/src/utils/get-value-at.d.ts +1 -1
- package/dist/gatsby/src/utils/handle-flags.d.ts +7 -7
- package/dist/gatsby/src/utils/is-32-bit-integer.d.ts +1 -1
- package/dist/gatsby/src/utils/jobs-manager.d.ts +61 -61
- package/dist/gatsby/src/utils/js-chunk-names.d.ts +1 -1
- package/dist/gatsby/src/utils/loading-indicator.d.ts +3 -3
- package/dist/gatsby/src/utils/local-eslint-config-finder.d.ts +1 -1
- package/dist/gatsby/src/utils/merge-gatsby-config.d.ts +23 -23
- package/dist/gatsby/src/utils/mett.d.ts +10 -10
- package/dist/gatsby/src/utils/node-manifest.d.ts +43 -43
- package/dist/gatsby/src/utils/nodes.d.ts +13 -13
- package/dist/gatsby/src/utils/page-data.d.ts +22 -22
- package/dist/gatsby/src/utils/page-html.d.ts +4 -4
- package/dist/gatsby/src/utils/path.d.ts +5 -5
- package/dist/gatsby/src/utils/prepare-regex.d.ts +1 -1
- package/dist/gatsby/src/utils/prepare-urls.d.ts +7 -7
- package/dist/gatsby/src/utils/print-deprecation-warnings.d.ts +1 -1
- package/dist/gatsby/src/utils/print-instructions.d.ts +2 -2
- package/dist/gatsby/src/utils/reach-router-add-basecontext-export-loader.d.ts +1 -1
- package/dist/gatsby/src/utils/restarting-screen.d.ts +2 -2
- package/dist/gatsby/src/utils/sample-site-for-experiment.d.ts +2 -2
- package/dist/gatsby/src/utils/show-experiment-notice.d.ts +6 -6
- package/dist/gatsby/src/utils/source-nodes.d.ts +8 -8
- package/dist/gatsby/src/utils/stack-trace-utils.d.ts +22 -22
- package/dist/gatsby/src/utils/start-server.d.ts +25 -25
- package/dist/gatsby/src/utils/state-machine-logging.d.ts +2 -2
- package/dist/gatsby/src/utils/telemetry-server.d.ts +1 -1
- package/dist/gatsby/src/utils/test-require-error.d.ts +1 -1
- package/dist/gatsby/src/utils/tracer/index.d.ts +12 -12
- package/dist/gatsby/src/utils/tracer/jaeger-local.d.ts +4 -4
- package/dist/gatsby/src/utils/tracer/zipkin-local.d.ts +11 -11
- package/dist/gatsby/src/utils/validate-page-component.d.ts +12 -12
- package/dist/gatsby/src/utils/wait-until-jobs-complete.d.ts +1 -1
- package/dist/gatsby/src/utils/webpack/cache-folder-resolver.d.ts +9 -9
- package/dist/gatsby/src/utils/webpack/corejs-resolver.d.ts +12 -12
- package/dist/gatsby/src/utils/webpack/force-css-hmr-for-edge-cases.d.ts +22 -22
- package/dist/gatsby/src/utils/webpack/static-query-mapper.d.ts +7 -7
- package/dist/gatsby/src/utils/webpack-error-utils.d.ts +24 -24
- package/dist/gatsby/src/utils/webpack-plugins.d.ts +46 -46
- package/dist/gatsby/src/utils/webpack-status.d.ts +3 -3
- package/dist/gatsby/src/utils/webpack-utils.d.ts +122 -122
- package/dist/gatsby/src/utils/websocket-manager.d.ts +39 -39
- package/dist/gatsby/src/utils/worker/child/index.d.ts +4 -4
- package/dist/gatsby/src/utils/worker/child/load-config-and-plugins.d.ts +2 -2
- package/dist/gatsby/src/utils/worker/child/queries.d.ts +3 -3
- package/dist/gatsby/src/utils/worker/child/render-html.d.ts +20 -20
- package/dist/gatsby/src/utils/worker/child/schema.d.ts +2 -2
- package/dist/gatsby/src/utils/worker/child/state.d.ts +2 -2
- package/dist/gatsby/src/utils/worker/pool.d.ts +5 -5
- package/dist/gatsby-cli/src/structured-errors/error-map.d.ts +341 -341
- package/dist/gatsby-cli/src/structured-errors/types.d.ts +55 -55
- package/dist/redux/actions/internal.js +50 -1
- package/dist/redux/actions/internal.js.map +1 -1
- package/dist/redux/actions/public.js +4 -43
- package/dist/redux/actions/public.js.map +1 -1
- package/dist/redux/index.js.map +1 -1
- package/dist/redux/reducers/jobsv2.js +2 -4
- package/dist/redux/reducers/jobsv2.js.map +1 -1
- package/dist/redux/types.js.map +1 -1
- package/dist/schema/node-model.js +118 -64
- package/dist/schema/node-model.js.map +1 -1
- package/dist/schema/resolvers.js +57 -37
- package/dist/schema/resolvers.js.map +1 -1
- package/dist/schema/schema-composer.js +12 -26
- package/dist/schema/schema-composer.js.map +1 -1
- package/dist/schema/schema.js +8 -0
- package/dist/schema/schema.js.map +1 -1
- package/dist/utils/browserslist.js +10 -1
- package/dist/utils/browserslist.js.map +1 -1
- package/dist/utils/dev-ssr/render-dev-html-child.js +7 -2
- package/dist/utils/dev-ssr/render-dev-html-child.js.map +1 -1
- package/dist/utils/dev-ssr/render-dev-html.js +9 -17
- package/dist/utils/dev-ssr/render-dev-html.js.map +1 -1
- package/dist/utils/page-data.js +7 -2
- package/dist/utils/page-data.js.map +1 -1
- package/dist/utils/start-server.js +5 -3
- package/dist/utils/start-server.js.map +1 -1
- package/dist/utils/webpack.config.js +9 -3
- package/dist/utils/webpack.config.js.map +1 -1
- package/dist/utils/worker/child/render-html.js +2 -2
- package/dist/utils/worker/child/render-html.js.map +1 -1
- package/dist/utils/worker/pool.js +6 -8
- package/dist/utils/worker/pool.js.map +1 -1
- package/gatsby-admin-public/app-87ad9d5b0d69e1dff850.js.map +1 -1
- package/gatsby-admin-public/component---src-pages-recipe-js-67ce632b0cfbcb61d113.js.map +1 -1
- package/gatsby-admin-public/index.html +1 -1
- package/gatsby-admin-public/page-data/app-data.json +1 -1
- package/gatsby-admin-public/pages/index.html +1 -1
- package/gatsby-admin-public/plugins/index.html +1 -1
- package/gatsby-admin-public/recipe/index.html +1 -1
- package/gatsby-admin-public/recipes/index.html +1 -1
- package/gatsby-admin-public/webpack.stats.json +1 -1
- package/package.json +17 -17
- package/dist/gatsby/src/utils/worker/types.d.ts +0 -7
- package/dist/utils/worker/types.js +0 -4
- package/dist/utils/worker/types.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,21 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.9.0](https://github.com/gatsbyjs/gatsby/compare/gatsby@3.9.0-next.1...gatsby@3.9.0) (2021-07-06)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **gatsby:** add fallback for resolveType ([#32195](https://github.com/gatsbyjs/gatsby/issues/32195)) ([#32265](https://github.com/gatsbyjs/gatsby/issues/32265)) ([6bd5f9c](https://github.com/gatsbyjs/gatsby/commit/6bd5f9cb92311c7623f1b5a6a4328d1850e5a292))
|
|
11
|
+
- **gatsby:** update async requires in dev loader ([#32189](https://github.com/gatsbyjs/gatsby/issues/32189)) ([f4c5c48](https://github.com/gatsbyjs/gatsby/commit/f4c5c482ba5da626d4f7e2d592fdc4d43eb817ba))
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
- **gatsby:** enable async rendering with react 18 ([#32188](https://github.com/gatsbyjs/gatsby/issues/32188)) ([#32267](https://github.com/gatsbyjs/gatsby/issues/32267)) ([33ee108](https://github.com/gatsbyjs/gatsby/commit/33ee10864eb11c088dbf3fc815c8b5af98595925))
|
|
16
|
+
- **gatsby:** enable replaceRenderer to be async ([#32182](https://github.com/gatsbyjs/gatsby/issues/32182)) ([#32266](https://github.com/gatsbyjs/gatsby/issues/32266)) ([d93f258](https://github.com/gatsbyjs/gatsby/commit/d93f25860f9fd15db484e6041636b1c63d9323cd))
|
|
17
|
+
- worker pool that can execute tasks on all workers ([#32120](https://github.com/gatsbyjs/gatsby/issues/32120)) ([a82f6db](https://github.com/gatsbyjs/gatsby/commit/a82f6dbe354f2e82a5d944727622ddb0bb44e05d))
|
|
18
|
+
- **gatsby:** Add activity for writing out page-data.json files to the public directory ([#31987](https://github.com/gatsbyjs/gatsby/issues/31987)) ([0be1025](https://github.com/gatsbyjs/gatsby/commit/0be10250a7c461efdc4e7a6b6bf261e245954d53))
|
|
19
|
+
- **gatsby:** Prevent generation of polyfill bundle if not needed ([#31993](https://github.com/gatsbyjs/gatsby/issues/31993)) ([7d41a98](https://github.com/gatsbyjs/gatsby/commit/7d41a985669438e3504987968ed326eb2fd42bca))
|
|
20
|
+
|
|
6
21
|
# [3.9.0-next.1](https://github.com/gatsbyjs/gatsby/compare/gatsby@3.9.0-next.0...gatsby@3.9.0-next.1) (2021-06-28)
|
|
7
22
|
|
|
8
23
|
### Bug Fixes
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* global plugins */
|
|
1
2
|
// During bootstrap, we write requires at top of this file which looks like:
|
|
2
3
|
// var plugins = [
|
|
3
4
|
// {
|
|
@@ -12,41 +13,76 @@
|
|
|
12
13
|
|
|
13
14
|
const apis = require(`./api-ssr-docs`)
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
function augmentErrorWithPlugin(plugin, err) {
|
|
17
|
+
if (plugin.name !== `default-site-plugin`) {
|
|
18
|
+
// default-site-plugin is user code and will print proper stack trace,
|
|
19
|
+
// so no point in annotating error message pointing out which plugin is root of the problem
|
|
20
|
+
err.message += ` (from plugin: ${plugin.name})`
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
throw err
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function apiRunner(api, args, defaultReturn, argTransform) {
|
|
17
27
|
if (!apis[api]) {
|
|
18
28
|
console.log(`This API doesn't exist`, api)
|
|
19
29
|
}
|
|
20
30
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (!
|
|
25
|
-
return
|
|
31
|
+
const results = []
|
|
32
|
+
plugins.forEach(plugin => {
|
|
33
|
+
const apiFn = plugin.plugin[api]
|
|
34
|
+
if (!apiFn) {
|
|
35
|
+
return
|
|
26
36
|
}
|
|
37
|
+
|
|
27
38
|
try {
|
|
28
|
-
const result =
|
|
39
|
+
const result = apiFn(args, plugin.options)
|
|
40
|
+
|
|
29
41
|
if (result && argTransform) {
|
|
30
42
|
args = argTransform({ args, result })
|
|
31
43
|
}
|
|
32
|
-
return result
|
|
33
|
-
} catch (e) {
|
|
34
|
-
if (plugin.name !== `default-site-plugin`) {
|
|
35
|
-
// default-site-plugin is user code and will print proper stack trace,
|
|
36
|
-
// so no point in annotating error message pointing out which plugin is root of the problem
|
|
37
|
-
e.message += ` (from plugin: ${plugin.name})`
|
|
38
|
-
}
|
|
39
44
|
|
|
40
|
-
|
|
45
|
+
// This if case keeps behaviour as before, we should allow undefined here as the api is defined
|
|
46
|
+
// TODO V4
|
|
47
|
+
if (typeof result !== `undefined`) {
|
|
48
|
+
results.push(result)
|
|
49
|
+
}
|
|
50
|
+
} catch (e) {
|
|
51
|
+
augmentErrorWithPlugin(plugin, e)
|
|
41
52
|
}
|
|
42
53
|
})
|
|
43
54
|
|
|
44
|
-
|
|
45
|
-
|
|
55
|
+
return results.length ? results : [defaultReturn]
|
|
56
|
+
}
|
|
46
57
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return [defaultReturn]
|
|
58
|
+
export async function apiRunnerAsync(api, args, defaultReturn, argTransform) {
|
|
59
|
+
if (!apis[api]) {
|
|
60
|
+
console.log(`This API doesn't exist`, api)
|
|
51
61
|
}
|
|
62
|
+
|
|
63
|
+
const results = []
|
|
64
|
+
for (const plugin of plugins) {
|
|
65
|
+
const apiFn = plugin.plugin[api]
|
|
66
|
+
if (!apiFn) {
|
|
67
|
+
continue
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
try {
|
|
71
|
+
const result = await apiFn(args, plugin.options)
|
|
72
|
+
|
|
73
|
+
if (result && argTransform) {
|
|
74
|
+
args = argTransform({ args, result })
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// This if case keeps behaviour as before, we should allow undefined here as the api is defined
|
|
78
|
+
// TODO V4
|
|
79
|
+
if (typeof result !== `undefined`) {
|
|
80
|
+
results.push(result)
|
|
81
|
+
}
|
|
82
|
+
} catch (e) {
|
|
83
|
+
augmentErrorWithPlugin(plugin, e)
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return results.length ? results : [defaultReturn]
|
|
52
88
|
}
|
package/cache-dir/app.js
CHANGED
|
@@ -22,11 +22,14 @@ import "./blank.css"
|
|
|
22
22
|
// Enable fast-refresh for virtual sync-requires, gatsby-browser & navigation
|
|
23
23
|
// To ensure that our <Root /> component can hot reload in case anything below doesn't
|
|
24
24
|
// satisfy fast-refresh constraints
|
|
25
|
-
module.hot.accept(
|
|
26
|
-
`$virtual/async-requires`,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
module.hot.accept(
|
|
26
|
+
[`$virtual/async-requires`, `./api-runner-browser`, `./navigation`],
|
|
27
|
+
() => {
|
|
28
|
+
// asyncRequires should be automatically updated here (due to ESM import and webpack HMR spec),
|
|
29
|
+
// but loader doesn't know that and needs to be manually nudged
|
|
30
|
+
loader.updateAsyncRequires(asyncRequires)
|
|
31
|
+
}
|
|
32
|
+
)
|
|
30
33
|
|
|
31
34
|
window.___emitter = emitter
|
|
32
35
|
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.apiRunner = apiRunner;
|
|
5
|
+
exports.apiRunnerAsync = apiRunnerAsync;
|
|
6
|
+
|
|
7
|
+
/* global plugins */
|
|
3
8
|
// During bootstrap, we write requires at top of this file which looks like:
|
|
4
9
|
// var plugins = [
|
|
5
10
|
// {
|
|
@@ -11,48 +16,86 @@
|
|
|
11
16
|
// options: { ... },
|
|
12
17
|
// },
|
|
13
18
|
// ]
|
|
14
|
-
const apis = require(`./api-ssr-docs`);
|
|
19
|
+
const apis = require(`./api-ssr-docs`);
|
|
20
|
+
|
|
21
|
+
function augmentErrorWithPlugin(plugin, err) {
|
|
22
|
+
if (plugin.name !== `default-site-plugin`) {
|
|
23
|
+
// default-site-plugin is user code and will print proper stack trace,
|
|
24
|
+
// so no point in annotating error message pointing out which plugin is root of the problem
|
|
25
|
+
err.message += ` (from plugin: ${plugin.name})`;
|
|
26
|
+
}
|
|
15
27
|
|
|
28
|
+
throw err;
|
|
29
|
+
}
|
|
16
30
|
|
|
17
|
-
|
|
31
|
+
function apiRunner(api, args, defaultReturn, argTransform) {
|
|
18
32
|
if (!apis[api]) {
|
|
19
33
|
console.log(`This API doesn't exist`, api);
|
|
20
|
-
}
|
|
21
|
-
// eslint-disable-next-line no-undef
|
|
34
|
+
}
|
|
22
35
|
|
|
36
|
+
const results = [];
|
|
37
|
+
plugins.forEach(plugin => {
|
|
38
|
+
const apiFn = plugin.plugin[api];
|
|
23
39
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return undefined;
|
|
40
|
+
if (!apiFn) {
|
|
41
|
+
return;
|
|
27
42
|
}
|
|
28
43
|
|
|
29
44
|
try {
|
|
30
|
-
const result =
|
|
45
|
+
const result = apiFn(args, plugin.options);
|
|
31
46
|
|
|
32
47
|
if (result && argTransform) {
|
|
33
48
|
args = argTransform({
|
|
34
49
|
args,
|
|
35
50
|
result
|
|
36
51
|
});
|
|
37
|
-
}
|
|
52
|
+
} // This if case keeps behaviour as before, we should allow undefined here as the api is defined
|
|
53
|
+
// TODO V4
|
|
38
54
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// default-site-plugin is user code and will print proper stack trace,
|
|
43
|
-
// so no point in annotating error message pointing out which plugin is root of the problem
|
|
44
|
-
e.message += ` (from plugin: ${plugin.name})`;
|
|
55
|
+
|
|
56
|
+
if (typeof result !== `undefined`) {
|
|
57
|
+
results.push(result);
|
|
45
58
|
}
|
|
59
|
+
} catch (e) {
|
|
60
|
+
augmentErrorWithPlugin(plugin, e);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
return results.length ? results : [defaultReturn];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async function apiRunnerAsync(api, args, defaultReturn, argTransform) {
|
|
67
|
+
if (!apis[api]) {
|
|
68
|
+
console.log(`This API doesn't exist`, api);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const results = [];
|
|
46
72
|
|
|
47
|
-
|
|
73
|
+
for (const plugin of plugins) {
|
|
74
|
+
const apiFn = plugin.plugin[api];
|
|
75
|
+
|
|
76
|
+
if (!apiFn) {
|
|
77
|
+
continue;
|
|
48
78
|
}
|
|
49
|
-
}); // Filter out undefined results.
|
|
50
79
|
|
|
51
|
-
|
|
80
|
+
try {
|
|
81
|
+
const result = await apiFn(args, plugin.options);
|
|
52
82
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
83
|
+
if (result && argTransform) {
|
|
84
|
+
args = argTransform({
|
|
85
|
+
args,
|
|
86
|
+
result
|
|
87
|
+
});
|
|
88
|
+
} // This if case keeps behaviour as before, we should allow undefined here as the api is defined
|
|
89
|
+
// TODO V4
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
if (typeof result !== `undefined`) {
|
|
93
|
+
results.push(result);
|
|
94
|
+
}
|
|
95
|
+
} catch (e) {
|
|
96
|
+
augmentErrorWithPlugin(plugin, e);
|
|
97
|
+
}
|
|
57
98
|
}
|
|
58
|
-
|
|
99
|
+
|
|
100
|
+
return results.length ? results : [defaultReturn];
|
|
101
|
+
}
|
|
@@ -42,7 +42,11 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
42
42
|
// Enable fast-refresh for virtual sync-requires, gatsby-browser & navigation
|
|
43
43
|
// To ensure that our <Root /> component can hot reload in case anything below doesn't
|
|
44
44
|
// satisfy fast-refresh constraints
|
|
45
|
-
module.hot.accept([`$virtual/async-requires`, `./api-runner-browser`, `./navigation`])
|
|
45
|
+
module.hot.accept([`$virtual/async-requires`, `./api-runner-browser`, `./navigation`], () => {
|
|
46
|
+
// asyncRequires should be automatically updated here (due to ESM import and webpack HMR spec),
|
|
47
|
+
// but loader doesn't know that and needs to be manually nudged
|
|
48
|
+
loader.updateAsyncRequires(_asyncRequires.default);
|
|
49
|
+
});
|
|
46
50
|
window.___emitter = _emitter.default;
|
|
47
51
|
const loader = new _devLoader.default(_asyncRequires.default, _matchPaths.default);
|
|
48
52
|
(0, _loader.setLoader)(loader);
|
|
@@ -32,15 +32,16 @@ function mergePageEntry(cachedPage, newPageData) {
|
|
|
32
32
|
class DevLoader extends _loader.BaseLoader {
|
|
33
33
|
constructor(asyncRequires, matchPaths) {
|
|
34
34
|
const loadComponent = chunkName => {
|
|
35
|
-
if (!asyncRequires.components[chunkName]) {
|
|
35
|
+
if (!this.asyncRequires.components[chunkName]) {
|
|
36
36
|
throw new Error(`We couldn't find the correct component chunk with the name "${chunkName}"`);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
return asyncRequires.components[chunkName]().then(preferDefault) // loader will handle the case when component is error
|
|
39
|
+
return this.asyncRequires.components[chunkName]().then(preferDefault) // loader will handle the case when component is error
|
|
40
40
|
.catch(err => err);
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
super(loadComponent, matchPaths);
|
|
44
|
+
this.asyncRequires = asyncRequires;
|
|
44
45
|
const socket = (0, _socketIo.default)();
|
|
45
46
|
this.notFoundPagePathsInCaches = new Set();
|
|
46
47
|
|
|
@@ -59,6 +60,10 @@ class DevLoader extends _loader.BaseLoader {
|
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
62
|
|
|
63
|
+
updateAsyncRequires(asyncRequires) {
|
|
64
|
+
this.asyncRequires = asyncRequires;
|
|
65
|
+
}
|
|
66
|
+
|
|
62
67
|
loadPage(pagePath) {
|
|
63
68
|
const realPath = (0, _findPath.findPath)(pagePath);
|
|
64
69
|
return super.loadPage(realPath).then(result => {
|
|
@@ -11,8 +11,9 @@ var _server = require("react-dom/server");
|
|
|
11
11
|
|
|
12
12
|
var _lodash = require("lodash");
|
|
13
13
|
|
|
14
|
-
var _apiRunnerSsr =
|
|
14
|
+
var _apiRunnerSsr = require("./api-runner-ssr");
|
|
15
15
|
|
|
16
|
+
/* global BROWSER_ESM_ONLY */
|
|
16
17
|
// import testRequireError from "./test-require-error"
|
|
17
18
|
// For some extremely mysterious reason, webpack adds the above module *after*
|
|
18
19
|
// this module so that when this code runs, testRequireError is undefined.
|
|
@@ -95,7 +96,7 @@ var _default = ({
|
|
|
95
96
|
postBodyComponents = components;
|
|
96
97
|
};
|
|
97
98
|
|
|
98
|
-
(0, _apiRunnerSsr.
|
|
99
|
+
(0, _apiRunnerSsr.apiRunner)(`onRenderBody`, {
|
|
99
100
|
setHeadComponents,
|
|
100
101
|
setHtmlAttributes,
|
|
101
102
|
setBodyAttributes,
|
|
@@ -104,7 +105,7 @@ var _default = ({
|
|
|
104
105
|
setBodyProps,
|
|
105
106
|
pathname: pagePath
|
|
106
107
|
});
|
|
107
|
-
(0, _apiRunnerSsr.
|
|
108
|
+
(0, _apiRunnerSsr.apiRunner)(`onPreRenderHTML`, {
|
|
108
109
|
getHeadComponents,
|
|
109
110
|
replaceHeadComponents,
|
|
110
111
|
getPreBodyComponents,
|
|
@@ -127,7 +128,7 @@ var _default = ({
|
|
|
127
128
|
htmlAttributes,
|
|
128
129
|
bodyAttributes,
|
|
129
130
|
preBodyComponents,
|
|
130
|
-
postBodyComponents: postBodyComponents.concat([/*#__PURE__*/_react.default.createElement("script", {
|
|
131
|
+
postBodyComponents: postBodyComponents.concat([!BROWSER_ESM_ONLY && /*#__PURE__*/_react.default.createElement("script", {
|
|
131
132
|
key: `polyfill`,
|
|
132
133
|
src: "/polyfill.js",
|
|
133
134
|
noModule: true
|
|
@@ -137,7 +138,7 @@ var _default = ({
|
|
|
137
138
|
}), /*#__PURE__*/_react.default.createElement("script", {
|
|
138
139
|
key: `commons`,
|
|
139
140
|
src: "/commons.js"
|
|
140
|
-
})])
|
|
141
|
+
})].filter(Boolean))
|
|
141
142
|
});
|
|
142
143
|
|
|
143
144
|
htmlStr = (0, _server.renderToStaticMarkup)(htmlElement);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.WritableAsPromise = void 0;
|
|
5
|
+
|
|
6
|
+
var _stream = require("stream");
|
|
7
|
+
|
|
8
|
+
class WritableAsPromise extends _stream.Writable {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
this._output = ``;
|
|
12
|
+
this._deferred = {
|
|
13
|
+
promise: null,
|
|
14
|
+
resolve: null,
|
|
15
|
+
reject: null
|
|
16
|
+
};
|
|
17
|
+
this._deferred.promise = new Promise((resolve, reject) => {
|
|
18
|
+
this._deferred.resolve = resolve;
|
|
19
|
+
this._deferred.reject = reject;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
_write(chunk, enc, cb) {
|
|
24
|
+
this._output += chunk.toString();
|
|
25
|
+
cb();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
end() {
|
|
29
|
+
this._deferred.resolve(this._output);
|
|
30
|
+
|
|
31
|
+
this.destroy();
|
|
32
|
+
} // disguise us as a promise
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
then(resolve, reject) {
|
|
36
|
+
return this._deferred.promise.then(resolve, reject);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
exports.WritableAsPromise = WritableAsPromise;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
5
|
exports.__esModule = true;
|
|
6
|
-
exports.default =
|
|
6
|
+
exports.default = staticPage;
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
@@ -15,7 +15,7 @@ var _lodash = require("lodash");
|
|
|
15
15
|
|
|
16
16
|
var _path = _interopRequireDefault(require("path"));
|
|
17
17
|
|
|
18
|
-
var _apiRunnerSsr =
|
|
18
|
+
var _apiRunnerSsr = require("./api-runner-ssr");
|
|
19
19
|
|
|
20
20
|
var _findPath = require("./find-path");
|
|
21
21
|
|
|
@@ -25,6 +25,7 @@ var _routeAnnouncerProps = require("./route-announcer-props");
|
|
|
25
25
|
|
|
26
26
|
var _router = require("@reach/router");
|
|
27
27
|
|
|
28
|
+
/* global BROWSER_ESM_ONLY */
|
|
28
29
|
// import testRequireError from "./test-require-error"
|
|
29
30
|
// For some extremely mysterious reason, webpack adds the above module *after*
|
|
30
31
|
// this module so that when this code runs, testRequireError is undefined.
|
|
@@ -61,7 +62,7 @@ try {
|
|
|
61
62
|
|
|
62
63
|
Html = Html && Html.__esModule ? Html.default : Html;
|
|
63
64
|
|
|
64
|
-
|
|
65
|
+
async function staticPage(pagePath, isClientOnlyPage, publicDir, error, callback) {
|
|
65
66
|
let bodyHtml = ``;
|
|
66
67
|
let headComponents = [/*#__PURE__*/_react.default.createElement("meta", {
|
|
67
68
|
key: "environment",
|
|
@@ -85,7 +86,7 @@ var _default = (pagePath, isClientOnlyPage, publicDir, error, callback) => {
|
|
|
85
86
|
}, /*#__PURE__*/_react.default.createElement("h1", null, "Failed to Server Render (SSR)"), /*#__PURE__*/_react.default.createElement("h2", null, "Error message:"), /*#__PURE__*/_react.default.createElement("p", null, error.sourceMessage), /*#__PURE__*/_react.default.createElement("h2", null, "File:"), /*#__PURE__*/_react.default.createElement("p", null, error.source, ":", error.line, ":", error.column), /*#__PURE__*/_react.default.createElement("h2", null, "Stack:"), /*#__PURE__*/_react.default.createElement("pre", null, /*#__PURE__*/_react.default.createElement("code", null, error.stack)))]);
|
|
86
87
|
}
|
|
87
88
|
|
|
88
|
-
const generateBodyHTML = () => {
|
|
89
|
+
const generateBodyHTML = async () => {
|
|
89
90
|
const setHeadComponents = components => {
|
|
90
91
|
headComponents = headComponents.concat(components);
|
|
91
92
|
};
|
|
@@ -153,8 +154,7 @@ var _default = (pagePath, isClientOnlyPage, publicDir, error, callback) => {
|
|
|
153
154
|
|
|
154
155
|
const pageData = getPageData(pagePath);
|
|
155
156
|
const {
|
|
156
|
-
componentChunkName
|
|
157
|
-
staticQueryHashes = []
|
|
157
|
+
componentChunkName
|
|
158
158
|
} = pageData;
|
|
159
159
|
let scriptsAndStyles = (0, _lodash.flatten)([`commons`].map(chunkKey => {
|
|
160
160
|
const fetchKey = `assetsByChunkName[${chunkKey}]`;
|
|
@@ -194,7 +194,7 @@ var _default = (pagePath, isClientOnlyPage, publicDir, error, callback) => {
|
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
return chunks;
|
|
197
|
-
})).filter(s => (0, _lodash.isObject)(s)).sort((s1,
|
|
197
|
+
})).filter(s => (0, _lodash.isObject)(s)).sort((s1, _s2) => s1.rel == `preload` ? -1 : 1); // given priority to preload
|
|
198
198
|
|
|
199
199
|
scriptsAndStyles = (0, _lodash.uniqBy)(scriptsAndStyles, item => item.name);
|
|
200
200
|
const styles = scriptsAndStyles.filter(style => style.name && style.name.endsWith(`.css`));
|
|
@@ -229,7 +229,7 @@ var _default = (pagePath, isClientOnlyPage, publicDir, error, callback) => {
|
|
|
229
229
|
pageElement = () => null;
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
-
const wrappedPage = (0, _apiRunnerSsr.
|
|
232
|
+
const wrappedPage = (0, _apiRunnerSsr.apiRunner)(`wrapPageElement`, {
|
|
233
233
|
element: pageElement,
|
|
234
234
|
props
|
|
235
235
|
}, pageElement, ({
|
|
@@ -254,7 +254,7 @@ var _default = (pagePath, isClientOnlyPage, publicDir, error, callback) => {
|
|
|
254
254
|
path: "/*"
|
|
255
255
|
})), /*#__PURE__*/_react.default.createElement("div", _routeAnnouncerProps.RouteAnnouncerProps));
|
|
256
256
|
|
|
257
|
-
const bodyComponent = (0, _apiRunnerSsr.
|
|
257
|
+
const bodyComponent = (0, _apiRunnerSsr.apiRunner)(`wrapRootElement`, {
|
|
258
258
|
element: routerElement,
|
|
259
259
|
pathname: pagePath
|
|
260
260
|
}, routerElement, ({
|
|
@@ -266,7 +266,7 @@ var _default = (pagePath, isClientOnlyPage, publicDir, error, callback) => {
|
|
|
266
266
|
};
|
|
267
267
|
}).pop(); // Let the site or plugin render the page component.
|
|
268
268
|
|
|
269
|
-
(0, _apiRunnerSsr.
|
|
269
|
+
await (0, _apiRunnerSsr.apiRunnerAsync)(`replaceRenderer`, {
|
|
270
270
|
bodyComponent,
|
|
271
271
|
replaceBodyHTMLString,
|
|
272
272
|
setHeadComponents,
|
|
@@ -288,7 +288,7 @@ var _default = (pagePath, isClientOnlyPage, publicDir, error, callback) => {
|
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
-
(0, _apiRunnerSsr.
|
|
291
|
+
(0, _apiRunnerSsr.apiRunner)(`onRenderBody`, {
|
|
292
292
|
setHeadComponents,
|
|
293
293
|
setHtmlAttributes,
|
|
294
294
|
setBodyAttributes,
|
|
@@ -297,7 +297,7 @@ var _default = (pagePath, isClientOnlyPage, publicDir, error, callback) => {
|
|
|
297
297
|
setBodyProps,
|
|
298
298
|
pathname: pagePath
|
|
299
299
|
});
|
|
300
|
-
(0, _apiRunnerSsr.
|
|
300
|
+
(0, _apiRunnerSsr.apiRunner)(`onPreRenderHTML`, {
|
|
301
301
|
getHeadComponents,
|
|
302
302
|
replaceHeadComponents,
|
|
303
303
|
getPreBodyComponents,
|
|
@@ -309,7 +309,7 @@ var _default = (pagePath, isClientOnlyPage, publicDir, error, callback) => {
|
|
|
309
309
|
return bodyHtml;
|
|
310
310
|
};
|
|
311
311
|
|
|
312
|
-
const bodyStr = generateBodyHTML();
|
|
312
|
+
const bodyStr = await generateBodyHTML();
|
|
313
313
|
|
|
314
314
|
const htmlElement = /*#__PURE__*/_react.default.createElement(Html, { ...bodyProps,
|
|
315
315
|
body: bodyStr,
|
|
@@ -320,7 +320,7 @@ var _default = (pagePath, isClientOnlyPage, publicDir, error, callback) => {
|
|
|
320
320
|
htmlAttributes,
|
|
321
321
|
bodyAttributes,
|
|
322
322
|
preBodyComponents,
|
|
323
|
-
postBodyComponents: postBodyComponents.concat([/*#__PURE__*/_react.default.createElement("script", {
|
|
323
|
+
postBodyComponents: postBodyComponents.concat([!BROWSER_ESM_ONLY && /*#__PURE__*/_react.default.createElement("script", {
|
|
324
324
|
key: `polyfill`,
|
|
325
325
|
src: "/polyfill.js",
|
|
326
326
|
noModule: true
|
|
@@ -330,12 +330,10 @@ var _default = (pagePath, isClientOnlyPage, publicDir, error, callback) => {
|
|
|
330
330
|
}), /*#__PURE__*/_react.default.createElement("script", {
|
|
331
331
|
key: `commons`,
|
|
332
332
|
src: "/commons.js"
|
|
333
|
-
})])
|
|
333
|
+
})].filter(Boolean))
|
|
334
334
|
});
|
|
335
335
|
|
|
336
336
|
let htmlStr = (0, _server.renderToStaticMarkup)(htmlElement);
|
|
337
337
|
htmlStr = `<!DOCTYPE html>${htmlStr}`;
|
|
338
338
|
callback(null, htmlStr);
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
exports.default = _default;
|
|
339
|
+
}
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
5
|
exports.__esModule = true;
|
|
6
|
-
exports.default =
|
|
6
|
+
exports.default = staticPage;
|
|
7
|
+
exports.sanitizeComponents = void 0;
|
|
7
8
|
|
|
8
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
10
|
|
|
@@ -13,7 +14,8 @@ const path = require(`path`);
|
|
|
13
14
|
|
|
14
15
|
const {
|
|
15
16
|
renderToString,
|
|
16
|
-
renderToStaticMarkup
|
|
17
|
+
renderToStaticMarkup,
|
|
18
|
+
pipeToNodeWritable
|
|
17
19
|
} = require(`react-dom/server`);
|
|
18
20
|
|
|
19
21
|
const {
|
|
@@ -38,7 +40,10 @@ const {
|
|
|
38
40
|
RouteAnnouncerProps
|
|
39
41
|
} = require(`./route-announcer-props`);
|
|
40
42
|
|
|
41
|
-
const
|
|
43
|
+
const {
|
|
44
|
+
apiRunner,
|
|
45
|
+
apiRunnerAsync
|
|
46
|
+
} = require(`./api-runner-ssr`);
|
|
42
47
|
|
|
43
48
|
const syncRequires = require(`$virtual/sync-requires`);
|
|
44
49
|
|
|
@@ -125,7 +130,7 @@ const ensureArray = components => {
|
|
|
125
130
|
}
|
|
126
131
|
};
|
|
127
132
|
|
|
128
|
-
|
|
133
|
+
async function staticPage({
|
|
129
134
|
pagePath,
|
|
130
135
|
pageData,
|
|
131
136
|
staticQueryContext,
|
|
@@ -133,7 +138,7 @@ var _default = ({
|
|
|
133
138
|
scripts,
|
|
134
139
|
reversedStyles,
|
|
135
140
|
reversedScripts
|
|
136
|
-
})
|
|
141
|
+
}) {
|
|
137
142
|
// for this to work we need this function to be sync or at least ensure there is single execution of it at a time
|
|
138
143
|
global.unsafeBuiltinUsage = [];
|
|
139
144
|
|
|
@@ -276,7 +281,7 @@ var _default = ({
|
|
|
276
281
|
};
|
|
277
282
|
}).pop()); // Let the site or plugin render the page component.
|
|
278
283
|
|
|
279
|
-
|
|
284
|
+
await apiRunnerAsync(`replaceRenderer`, {
|
|
280
285
|
bodyComponent,
|
|
281
286
|
replaceBodyHTMLString,
|
|
282
287
|
setHeadComponents,
|
|
@@ -291,7 +296,27 @@ var _default = ({
|
|
|
291
296
|
|
|
292
297
|
if (!bodyHtml) {
|
|
293
298
|
try {
|
|
294
|
-
|
|
299
|
+
// react 18 enabled
|
|
300
|
+
if (pipeToNodeWritable) {
|
|
301
|
+
const {
|
|
302
|
+
WritableAsPromise
|
|
303
|
+
} = require(`./server-utils/writable-as-promise`);
|
|
304
|
+
|
|
305
|
+
const writableStream = new WritableAsPromise();
|
|
306
|
+
const {
|
|
307
|
+
startWriting
|
|
308
|
+
} = pipeToNodeWritable(bodyComponent, writableStream, {
|
|
309
|
+
onCompleteAll() {
|
|
310
|
+
startWriting();
|
|
311
|
+
},
|
|
312
|
+
|
|
313
|
+
onError() {}
|
|
314
|
+
|
|
315
|
+
});
|
|
316
|
+
bodyHtml = await writableStream;
|
|
317
|
+
} else {
|
|
318
|
+
bodyHtml = renderToString(bodyComponent);
|
|
319
|
+
}
|
|
295
320
|
} catch (e) {
|
|
296
321
|
// ignore @reach/router redirect errors
|
|
297
322
|
if (!isRedirect(e)) throw e;
|
|
@@ -440,6 +465,4 @@ var _default = ({
|
|
|
440
465
|
e.unsafeBuiltinsUsage = global.unsafeBuiltinUsage;
|
|
441
466
|
throw e;
|
|
442
467
|
}
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
exports.default = _default;
|
|
468
|
+
}
|
package/cache-dir/dev-loader.js
CHANGED
|
@@ -26,20 +26,21 @@ function mergePageEntry(cachedPage, newPageData) {
|
|
|
26
26
|
class DevLoader extends BaseLoader {
|
|
27
27
|
constructor(asyncRequires, matchPaths) {
|
|
28
28
|
const loadComponent = chunkName => {
|
|
29
|
-
if (!asyncRequires.components[chunkName]) {
|
|
29
|
+
if (!this.asyncRequires.components[chunkName]) {
|
|
30
30
|
throw new Error(
|
|
31
31
|
`We couldn't find the correct component chunk with the name "${chunkName}"`
|
|
32
32
|
)
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
return (
|
|
36
|
-
asyncRequires.components[chunkName]()
|
|
36
|
+
this.asyncRequires.components[chunkName]()
|
|
37
37
|
.then(preferDefault)
|
|
38
38
|
// loader will handle the case when component is error
|
|
39
39
|
.catch(err => err)
|
|
40
40
|
)
|
|
41
41
|
}
|
|
42
42
|
super(loadComponent, matchPaths)
|
|
43
|
+
this.asyncRequires = asyncRequires
|
|
43
44
|
|
|
44
45
|
const socket = getSocket()
|
|
45
46
|
|
|
@@ -60,6 +61,10 @@ class DevLoader extends BaseLoader {
|
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
63
|
|
|
64
|
+
updateAsyncRequires(asyncRequires) {
|
|
65
|
+
this.asyncRequires = asyncRequires
|
|
66
|
+
}
|
|
67
|
+
|
|
63
68
|
loadPage(pagePath) {
|
|
64
69
|
const realPath = findPath(pagePath)
|
|
65
70
|
return super.loadPage(realPath).then(result => {
|