gatsby 2.29.1 → 2.29.2
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 +6 -0
- package/cli.js +0 -0
- package/dist/bootstrap/create-graphql-runner.d.ts +11 -11
- package/dist/bootstrap/get-config-file.d.ts +4 -4
- package/dist/bootstrap/load-plugins/index.d.ts +2 -2
- package/dist/bootstrap/load-plugins/load.d.ts +11 -11
- package/dist/bootstrap/load-plugins/types.d.ts +40 -40
- package/dist/bootstrap/load-plugins/validate.d.ts +39 -39
- package/dist/bootstrap/prefer-default.d.ts +1 -1
- package/dist/bootstrap/redirects-writer.d.ts +2 -2
- package/dist/bootstrap/remove-stale-jobs.d.ts +2 -2
- package/dist/bootstrap/requires-writer.d.ts +10 -10
- package/dist/bootstrap/resolve-module-exports.d.ts +15 -15
- package/dist/commands/build-html.js +31 -3
- package/dist/commands/build-html.js.map +1 -1
- package/dist/commands/develop-static.d.ts +3 -3
- package/dist/commands/types.d.ts +48 -48
- package/dist/db/common/query.d.ts +37 -37
- package/dist/internal.d.ts +5 -5
- package/dist/joi-schemas/joi.d.ts +6 -6
- package/dist/query/error-parser.d.ts +18 -18
- package/dist/query/file-parser.js +1 -5
- package/dist/query/file-parser.js.map +1 -1
- package/dist/query/graphql-runner.d.ts +30 -30
- package/dist/query/graphql-span-tracer.d.ts +19 -19
- package/dist/query/query-watcher.d.ts +17 -17
- package/dist/query/types.d.ts +34 -34
- package/dist/query/utils.d.ts +4 -4
- package/dist/redux/actions/add-page-dependency.d.ts +5 -5
- package/dist/redux/actions/index.d.ts +13 -13
- package/dist/redux/actions/internal.d.ts +109 -109
- package/dist/redux/actions/restricted.d.ts +293 -293
- package/dist/redux/index.d.ts +12 -12
- package/dist/redux/nodes.d.ts +92 -92
- package/dist/redux/persist.d.ts +3 -3
- package/dist/redux/plugin-runner.d.ts +1 -1
- package/dist/redux/reducers/babelrc.d.ts +9 -9
- package/dist/redux/reducers/components.d.ts +7 -7
- package/dist/redux/reducers/config.d.ts +2 -2
- package/dist/redux/reducers/definitions.d.ts +2 -2
- package/dist/redux/reducers/flattened-plugins.d.ts +15 -15
- package/dist/redux/reducers/index.d.ts +34 -34
- package/dist/redux/reducers/inference-metadata.d.ts +7 -7
- package/dist/redux/reducers/jobs.d.ts +5 -5
- package/dist/redux/reducers/jobsv2.d.ts +5 -5
- package/dist/redux/reducers/last-action.d.ts +2 -2
- package/dist/redux/reducers/nodes-by-type.d.ts +2 -2
- package/dist/redux/reducers/nodes-touched.d.ts +3 -3
- package/dist/redux/reducers/nodes.d.ts +2 -2
- package/dist/redux/reducers/page-data-stats.d.ts +2 -2
- package/dist/redux/reducers/page-data.d.ts +2 -2
- package/dist/redux/reducers/pages.d.ts +2 -2
- package/dist/redux/reducers/pending-page-data-writes.d.ts +4 -4
- package/dist/redux/reducers/program.d.ts +2 -2
- package/dist/redux/reducers/queries.d.ts +26 -26
- package/dist/redux/reducers/redirects.d.ts +2 -2
- package/dist/redux/reducers/resolved-nodes.d.ts +2 -2
- package/dist/redux/reducers/schema-customization.d.ts +23 -23
- package/dist/redux/reducers/schema.d.ts +3 -3
- package/dist/redux/reducers/static-queries-by-template.d.ts +2 -2
- package/dist/redux/reducers/static-query-components.d.ts +2 -2
- package/dist/redux/reducers/status.d.ts +5 -5
- package/dist/redux/reducers/themes.d.ts +2 -2
- package/dist/redux/reducers/visited-page.d.ts +2 -2
- package/dist/redux/reducers/webpack-compilation-hash.d.ts +2 -2
- package/dist/redux/reducers/webpack.d.ts +2 -2
- package/dist/redux/types.d.ts +667 -667
- package/dist/schema/context.d.ts +13 -13
- package/dist/schema/infer/inference-metadata.d.ts +72 -72
- package/dist/schema/infer/type-conflict-reporter.d.ts +28 -28
- package/dist/schema/resolvers.d.ts +34 -34
- package/dist/schema/type-definitions.d.ts +42 -42
- package/dist/schema/types/date.d.ts +40 -40
- package/dist/schema/types/derived-types.d.ts +42 -42
- package/dist/schema/types/filter.d.ts +12 -12
- package/dist/schema/types/node-interface.d.ts +14 -14
- package/dist/schema/types/sort.d.ts +18 -18
- package/dist/schema/types/type-builders.d.ts +36 -36
- package/dist/services/build-schema.d.ts +2 -2
- package/dist/services/calculate-dirty-queries.d.ts +5 -5
- package/dist/services/create-pages-statefully.d.ts +2 -2
- package/dist/services/create-pages.d.ts +5 -5
- package/dist/services/customize-schema.d.ts +2 -2
- package/dist/services/extract-queries.d.ts +2 -2
- package/dist/services/index.d.ts +19 -19
- package/dist/services/initialize.d.ts +8 -8
- package/dist/services/listen-for-mutations.d.ts +2 -2
- package/dist/services/listen-to-webpack.d.ts +3 -3
- package/dist/services/post-bootstrap.d.ts +2 -2
- package/dist/services/rebuild-schema-with-site-pages.d.ts +2 -2
- package/dist/services/recompile.d.ts +3 -3
- package/dist/services/run-mutation-batch.d.ts +2 -2
- package/dist/services/run-page-queries.d.ts +2 -2
- package/dist/services/run-static-queries.d.ts +2 -2
- package/dist/services/source-nodes.d.ts +5 -5
- package/dist/services/start-webpack-server.d.ts +9 -9
- package/dist/services/types.d.ts +45 -45
- package/dist/services/write-out-redirects.d.ts +2 -2
- package/dist/services/write-out-requires.d.ts +2 -2
- package/dist/state-machines/data-layer/actions.d.ts +8 -8
- package/dist/state-machines/data-layer/index.d.ts +24 -24
- package/dist/state-machines/data-layer/services.d.ts +3 -3
- package/dist/state-machines/data-layer/types.d.ts +30 -30
- package/dist/state-machines/develop/actions.d.ts +37 -37
- package/dist/state-machines/index.d.ts +7 -7
- package/dist/state-machines/query-running/actions.d.ts +9 -9
- package/dist/state-machines/query-running/index.d.ts +7 -7
- package/dist/state-machines/query-running/services.d.ts +3 -3
- package/dist/state-machines/query-running/types.d.ts +23 -23
- package/dist/state-machines/waiting/actions.d.ts +11 -11
- package/dist/state-machines/waiting/index.d.ts +12 -12
- package/dist/state-machines/waiting/services.d.ts +3 -3
- package/dist/state-machines/waiting/types.d.ts +12 -12
- package/dist/types.d.ts +9 -9
- package/dist/utils/api-browser-docs.d.ts +252 -252
- package/dist/utils/api-node-docs.d.ts +443 -443
- package/dist/utils/assert-store.d.ts +2 -2
- package/dist/utils/babel-parse-to-ast.d.ts +4 -4
- package/dist/utils/browserslist.d.ts +1 -1
- package/dist/utils/call-deferred-api.d.ts +8 -8
- package/dist/utils/changed-pages.d.ts +6 -6
- package/dist/utils/create-node-id.d.ts +24 -24
- package/dist/utils/create-schema-customization.d.ts +6 -6
- package/dist/utils/dev-ssr/render-dev-html.js +38 -0
- package/dist/utils/dev-ssr/render-dev-html.js.map +1 -1
- package/dist/utils/develop-preload-headers.d.ts +7 -7
- package/dist/utils/did-you-mean.d.ts +3 -3
- package/dist/utils/find-page-by-path.d.ts +2 -2
- package/dist/utils/flags.d.ts +17 -17
- package/dist/utils/gatsby-dependents.d.ts +8 -8
- package/dist/utils/gatsby-webpack-virtual-modules.d.ts +6 -6
- package/dist/utils/get-latest-apis.d.ts +6 -6
- package/dist/utils/get-page-data.d.ts +3 -3
- package/dist/utils/get-react-hot-loader-strategy.d.ts +1 -1
- package/dist/utils/get-value-at.d.ts +1 -1
- package/dist/utils/handle-flags.d.ts +7 -7
- package/dist/utils/is-32-bit-integer.d.ts +1 -1
- package/dist/utils/jobs-manager.d.ts +61 -61
- package/dist/utils/loading-indicator.d.ts +3 -3
- package/dist/utils/map-templates-to-static-query-hashes.d.ts +16 -16
- package/dist/utils/mett.d.ts +10 -10
- package/dist/utils/page-data.d.ts +22 -22
- package/dist/utils/path.d.ts +5 -5
- package/dist/utils/prepare-urls.d.ts +7 -7
- package/dist/utils/print-deprecation-warnings.d.ts +1 -1
- package/dist/utils/print-instructions.d.ts +2 -2
- package/dist/utils/sample-site-for-experiment.d.ts +2 -2
- package/dist/utils/show-experiment-notice.d.ts +6 -6
- package/dist/utils/source-nodes.d.ts +8 -8
- package/dist/utils/stack-trace-utils.d.ts +22 -22
- package/dist/utils/start-server.d.ts +25 -25
- package/dist/utils/test-require-error.d.ts +1 -1
- package/dist/utils/wait-until-jobs-complete.d.ts +1 -1
- package/dist/utils/webpack-error-utils.d.ts +26 -26
- package/dist/utils/webpack-status.d.ts +3 -3
- package/dist/utils/websocket-manager.d.ts +39 -39
- package/dist/utils/worker/pool.d.ts +2 -2
- package/gatsby-admin-public/4c744e84-7cab5788add6e0efa0f9.js.map +1 -1
- package/gatsby-admin-public/69bd6bf3-698d78cea2b9cdbdca4e.js.map +1 -1
- package/gatsby-admin-public/784b2cee55c07b638f20445dec340adf9f1888a3-ea23ae75e6272409f7df.js.map +1 -1
- package/gatsby-admin-public/854a7ef1f34af0aefbdfdd9304a0c00251662775-a7c8fd5f38a518e8c761.js.map +1 -1
- package/gatsby-admin-public/{app-67cad0f1d34d74fef677.js → app-dbedda99cab8f560c20e.js} +2 -2
- package/gatsby-admin-public/{app-67cad0f1d34d74fef677.js.LICENSE.txt → app-dbedda99cab8f560c20e.js.LICENSE.txt} +0 -0
- package/gatsby-admin-public/app-dbedda99cab8f560c20e.js.map +1 -0
- package/gatsby-admin-public/c432bec7e9afb3443fd639df9e5f119e13575cf7-fc6c096693e9436e346d.js.map +1 -1
- package/gatsby-admin-public/chunk-map.json +1 -1
- package/gatsby-admin-public/component---src-pages-index-tsx-6341c8d8fb5f3841683c.js.map +1 -1
- package/gatsby-admin-public/component---src-pages-plugins-tsx-c5889ee95012697435f9.js.map +1 -1
- package/gatsby-admin-public/{component---src-pages-recipe-js-150bcbac5a775a6e738b.js → component---src-pages-recipe-js-9036581d6cbe59523e75.js} +1 -1
- package/gatsby-admin-public/component---src-pages-recipe-js-9036581d6cbe59523e75.js.map +1 -0
- package/gatsby-admin-public/e2852b4470dcb2615e49edcd9de2a3c8119d4bec-55d2a0a404f9a989f370.js.map +1 -1
- package/gatsby-admin-public/framework-b5530edc347e85dd3979.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/polyfill-97232df0f1afeb313169.js.map +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-runtime-d13bebde8add98564af0.js → webpack-runtime-0049e37a70d148e02ff3.js} +2 -2
- package/gatsby-admin-public/{webpack-runtime-d13bebde8add98564af0.js.map → webpack-runtime-0049e37a70d148e02ff3.js.map} +1 -1
- package/gatsby-admin-public/webpack.stats.json +1 -1
- package/package.json +7 -7
- package/gatsby-admin-public/app-67cad0f1d34d74fef677.js.map +0 -1
- package/gatsby-admin-public/component---src-pages-recipe-js-150bcbac5a775a6e738b.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
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
|
+
## [2.29.2](https://github.com/gatsbyjs/gatsby/compare/gatsby@2.29.1...gatsby@2.29.2) (2020-12-23)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **gatsby:** remove redundant dispatch of query extraction error ([#28676](https://github.com/gatsbyjs/gatsby/issues/28676)) ([#28744](https://github.com/gatsbyjs/gatsby/issues/28744)) ([0b8ea51](https://github.com/gatsbyjs/gatsby/commit/0b8ea518949d73b8ce53b6edf795fed2232669fb))
|
|
11
|
+
|
|
6
12
|
## [2.29.1](https://github.com/gatsbyjs/gatsby/compare/gatsby@2.29.0...gatsby@2.29.1) (2020-12-16)
|
|
7
13
|
|
|
8
14
|
**Note:** Version bump only for package gatsby
|
package/cli.js
CHANGED
|
File without changes
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Span } from "opentracing";
|
|
2
|
-
import { ExecutionResultDataDefault } from "graphql/execution/execute";
|
|
3
|
-
import { Store } from "redux";
|
|
4
|
-
import { Reporter } from "../..";
|
|
5
|
-
import { ExecutionResult, Source } from "../../graphql";
|
|
6
|
-
import { IGatsbyState } from "../redux/types";
|
|
7
|
-
export declare type Runner = (query: string | Source, context: Record<string, any>) => Promise<ExecutionResult<ExecutionResultDataDefault>>;
|
|
8
|
-
export declare const createGraphQLRunner: (store: Store<IGatsbyState>, reporter: Reporter, { parentSpan, graphqlTracing, }?: {
|
|
9
|
-
parentSpan: Span | undefined;
|
|
10
|
-
graphqlTracing?: boolean | undefined;
|
|
11
|
-
}) => Runner;
|
|
1
|
+
import { Span } from "opentracing";
|
|
2
|
+
import { ExecutionResultDataDefault } from "graphql/execution/execute";
|
|
3
|
+
import { Store } from "redux";
|
|
4
|
+
import { Reporter } from "../..";
|
|
5
|
+
import { ExecutionResult, Source } from "../../graphql";
|
|
6
|
+
import { IGatsbyState } from "../redux/types";
|
|
7
|
+
export declare type Runner = (query: string | Source, context: Record<string, any>) => Promise<ExecutionResult<ExecutionResultDataDefault>>;
|
|
8
|
+
export declare const createGraphQLRunner: (store: Store<IGatsbyState>, reporter: Reporter, { parentSpan, graphqlTracing, }?: {
|
|
9
|
+
parentSpan: Span | undefined;
|
|
10
|
+
graphqlTracing?: boolean | undefined;
|
|
11
|
+
}) => Runner;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function getConfigFile(rootDir: string, configName: string, distance?: number): Promise<{
|
|
2
|
-
configModule: any;
|
|
3
|
-
configFilePath: string;
|
|
4
|
-
}>;
|
|
1
|
+
export declare function getConfigFile(rootDir: string, configName: string, distance?: number): Promise<{
|
|
2
|
+
configModule: any;
|
|
3
|
+
configFilePath: string;
|
|
4
|
+
}>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { IFlattenedPlugin, IRawSiteConfig } from "./types";
|
|
2
|
-
export declare function loadPlugins(rawConfig?: IRawSiteConfig, rootDir?: string | null): Promise<Array<IFlattenedPlugin>>;
|
|
1
|
+
import { IFlattenedPlugin, IRawSiteConfig } from "./types";
|
|
2
|
+
export declare function loadPlugins(rawConfig?: IRawSiteConfig, rootDir?: string | null): Promise<Array<IFlattenedPlugin>>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { IPluginInfo, ISiteConfig } from "./types";
|
|
2
|
-
/**
|
|
3
|
-
* @param pluginName
|
|
4
|
-
* This can be a name of a local plugin, the name of a plugin located in
|
|
5
|
-
* node_modules, or a Gatsby internal plugin. In the last case the pluginName
|
|
6
|
-
* will be an absolute path.
|
|
7
|
-
* @param rootDir
|
|
8
|
-
* This is the project location, from which are found the plugins
|
|
9
|
-
*/
|
|
10
|
-
export declare function resolvePlugin(pluginName: string, rootDir: string | null): IPluginInfo;
|
|
11
|
-
export declare function loadPlugins(config?: ISiteConfig, rootDir?: string | null): Array<IPluginInfo>;
|
|
1
|
+
import { IPluginInfo, ISiteConfig } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* @param pluginName
|
|
4
|
+
* This can be a name of a local plugin, the name of a plugin located in
|
|
5
|
+
* node_modules, or a Gatsby internal plugin. In the last case the pluginName
|
|
6
|
+
* will be an absolute path.
|
|
7
|
+
* @param rootDir
|
|
8
|
+
* This is the project location, from which are found the plugins
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolvePlugin(pluginName: string, rootDir: string | null): IPluginInfo;
|
|
11
|
+
export declare function loadPlugins(config?: ISiteConfig, rootDir?: string | null): Array<IPluginInfo>;
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
export interface IRawSiteConfig {
|
|
2
|
-
plugins?: Array<PluginRef>;
|
|
3
|
-
}
|
|
4
|
-
export interface ISiteConfig extends IRawSiteConfig {
|
|
5
|
-
plugins?: Array<IPluginRefObject>;
|
|
6
|
-
}
|
|
7
|
-
export interface IPluginInfo {
|
|
8
|
-
/** Unique ID describing a plugin */
|
|
9
|
-
id: string;
|
|
10
|
-
/** The absolute path to the plugin */
|
|
11
|
-
resolve: string;
|
|
12
|
-
/** The plugin name */
|
|
13
|
-
name: string;
|
|
14
|
-
/** The plugin version (can be content hash) */
|
|
15
|
-
version: string;
|
|
16
|
-
/** Options passed to the plugin */
|
|
17
|
-
pluginOptions?: IPluginInfoOptions;
|
|
18
|
-
}
|
|
19
|
-
export interface IPluginInfoOptions {
|
|
20
|
-
plugins?: Array<IPluginInfo>;
|
|
21
|
-
path?: string;
|
|
22
|
-
[option: string]: unknown;
|
|
23
|
-
}
|
|
24
|
-
export interface IFlattenedPlugin extends IPluginInfo {
|
|
25
|
-
skipSSR?: boolean;
|
|
26
|
-
ssrAPIs: Array<string>;
|
|
27
|
-
nodeAPIs: Array<string>;
|
|
28
|
-
browserAPIs: Array<string>;
|
|
29
|
-
}
|
|
30
|
-
export interface IPluginRefObject {
|
|
31
|
-
resolve: string;
|
|
32
|
-
options?: IPluginRefOptions;
|
|
33
|
-
parentDir?: string;
|
|
34
|
-
}
|
|
35
|
-
export declare type PluginRef = string | IPluginRefObject;
|
|
36
|
-
export interface IPluginRefOptions {
|
|
37
|
-
plugins?: Array<PluginRef>;
|
|
38
|
-
path?: string;
|
|
39
|
-
[option: string]: unknown;
|
|
40
|
-
}
|
|
1
|
+
export interface IRawSiteConfig {
|
|
2
|
+
plugins?: Array<PluginRef>;
|
|
3
|
+
}
|
|
4
|
+
export interface ISiteConfig extends IRawSiteConfig {
|
|
5
|
+
plugins?: Array<IPluginRefObject>;
|
|
6
|
+
}
|
|
7
|
+
export interface IPluginInfo {
|
|
8
|
+
/** Unique ID describing a plugin */
|
|
9
|
+
id: string;
|
|
10
|
+
/** The absolute path to the plugin */
|
|
11
|
+
resolve: string;
|
|
12
|
+
/** The plugin name */
|
|
13
|
+
name: string;
|
|
14
|
+
/** The plugin version (can be content hash) */
|
|
15
|
+
version: string;
|
|
16
|
+
/** Options passed to the plugin */
|
|
17
|
+
pluginOptions?: IPluginInfoOptions;
|
|
18
|
+
}
|
|
19
|
+
export interface IPluginInfoOptions {
|
|
20
|
+
plugins?: Array<IPluginInfo>;
|
|
21
|
+
path?: string;
|
|
22
|
+
[option: string]: unknown;
|
|
23
|
+
}
|
|
24
|
+
export interface IFlattenedPlugin extends IPluginInfo {
|
|
25
|
+
skipSSR?: boolean;
|
|
26
|
+
ssrAPIs: Array<string>;
|
|
27
|
+
nodeAPIs: Array<string>;
|
|
28
|
+
browserAPIs: Array<string>;
|
|
29
|
+
}
|
|
30
|
+
export interface IPluginRefObject {
|
|
31
|
+
resolve: string;
|
|
32
|
+
options?: IPluginRefOptions;
|
|
33
|
+
parentDir?: string;
|
|
34
|
+
}
|
|
35
|
+
export declare type PluginRef = string | IPluginRefObject;
|
|
36
|
+
export interface IPluginRefOptions {
|
|
37
|
+
plugins?: Array<PluginRef>;
|
|
38
|
+
path?: string;
|
|
39
|
+
[option: string]: unknown;
|
|
40
|
+
}
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { IPluginInfo, IFlattenedPlugin, ISiteConfig } from "./types";
|
|
2
|
-
interface IApi {
|
|
3
|
-
version?: string;
|
|
4
|
-
}
|
|
5
|
-
export interface IEntry {
|
|
6
|
-
exportName: string;
|
|
7
|
-
pluginName: string;
|
|
8
|
-
pluginVersion: string;
|
|
9
|
-
api?: IApi;
|
|
10
|
-
}
|
|
11
|
-
export declare type ExportType = "node" | "browser" | "ssr";
|
|
12
|
-
declare type IEntryMap = {
|
|
13
|
-
[exportType in ExportType]: Array<IEntry>;
|
|
14
|
-
};
|
|
15
|
-
export declare type ICurrentAPIs = {
|
|
16
|
-
[exportType in ExportType]: Array<string>;
|
|
17
|
-
};
|
|
18
|
-
export declare function handleBadExports({ currentAPIs, badExports, }: {
|
|
19
|
-
currentAPIs: ICurrentAPIs;
|
|
20
|
-
badExports: {
|
|
21
|
-
[api in ExportType]: Array<IEntry>;
|
|
22
|
-
};
|
|
23
|
-
}): Promise<void>;
|
|
24
|
-
export declare function validateConfigPluginsOptions(config: ISiteConfig | undefined, rootDir: string | null): Promise<void>;
|
|
25
|
-
/**
|
|
26
|
-
* Identify which APIs each plugin exports
|
|
27
|
-
*/
|
|
28
|
-
export declare function collatePluginAPIs({ currentAPIs, flattenedPlugins, }: {
|
|
29
|
-
currentAPIs: ICurrentAPIs;
|
|
30
|
-
flattenedPlugins: Array<IPluginInfo & Partial<IFlattenedPlugin>>;
|
|
31
|
-
}): {
|
|
32
|
-
flattenedPlugins: Array<IFlattenedPlugin>;
|
|
33
|
-
badExports: IEntryMap;
|
|
34
|
-
};
|
|
35
|
-
export declare const handleMultipleReplaceRenderers: ({ flattenedPlugins, }: {
|
|
36
|
-
flattenedPlugins: Array<IFlattenedPlugin>;
|
|
37
|
-
}) => Array<IFlattenedPlugin>;
|
|
38
|
-
export declare function warnOnIncompatiblePeerDependency(name: string, packageJSON: object): void;
|
|
39
|
-
export {};
|
|
1
|
+
import { IPluginInfo, IFlattenedPlugin, ISiteConfig } from "./types";
|
|
2
|
+
interface IApi {
|
|
3
|
+
version?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface IEntry {
|
|
6
|
+
exportName: string;
|
|
7
|
+
pluginName: string;
|
|
8
|
+
pluginVersion: string;
|
|
9
|
+
api?: IApi;
|
|
10
|
+
}
|
|
11
|
+
export declare type ExportType = "node" | "browser" | "ssr";
|
|
12
|
+
declare type IEntryMap = {
|
|
13
|
+
[exportType in ExportType]: Array<IEntry>;
|
|
14
|
+
};
|
|
15
|
+
export declare type ICurrentAPIs = {
|
|
16
|
+
[exportType in ExportType]: Array<string>;
|
|
17
|
+
};
|
|
18
|
+
export declare function handleBadExports({ currentAPIs, badExports, }: {
|
|
19
|
+
currentAPIs: ICurrentAPIs;
|
|
20
|
+
badExports: {
|
|
21
|
+
[api in ExportType]: Array<IEntry>;
|
|
22
|
+
};
|
|
23
|
+
}): Promise<void>;
|
|
24
|
+
export declare function validateConfigPluginsOptions(config: ISiteConfig | undefined, rootDir: string | null): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Identify which APIs each plugin exports
|
|
27
|
+
*/
|
|
28
|
+
export declare function collatePluginAPIs({ currentAPIs, flattenedPlugins, }: {
|
|
29
|
+
currentAPIs: ICurrentAPIs;
|
|
30
|
+
flattenedPlugins: Array<IPluginInfo & Partial<IFlattenedPlugin>>;
|
|
31
|
+
}): {
|
|
32
|
+
flattenedPlugins: Array<IFlattenedPlugin>;
|
|
33
|
+
badExports: IEntryMap;
|
|
34
|
+
};
|
|
35
|
+
export declare const handleMultipleReplaceRenderers: ({ flattenedPlugins, }: {
|
|
36
|
+
flattenedPlugins: Array<IFlattenedPlugin>;
|
|
37
|
+
}) => Array<IFlattenedPlugin>;
|
|
38
|
+
export declare function warnOnIncompatiblePeerDependency(name: string, packageJSON: object): void;
|
|
39
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const preferDefault: (m: any) => any;
|
|
1
|
+
export declare const preferDefault: (m: any) => any;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const writeRedirects: () => Promise<void>;
|
|
2
|
-
export declare const startRedirectListener: () => void;
|
|
1
|
+
export declare const writeRedirects: () => Promise<void>;
|
|
2
|
+
export declare const startRedirectListener: () => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { IGatsbyState, IRemoveStaleJobAction } from "../redux/types";
|
|
2
|
-
export declare const removeStaleJobs: (state: IGatsbyState) => Array<IRemoveStaleJobAction>;
|
|
1
|
+
import { IGatsbyState, IRemoveStaleJobAction } from "../redux/types";
|
|
2
|
+
export declare const removeStaleJobs: (state: IGatsbyState) => Array<IRemoveStaleJobAction>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { IGatsbyState, IGatsbyPage } from "../redux/types";
|
|
2
|
-
interface IGatsbyPageComponent {
|
|
3
|
-
component: string;
|
|
4
|
-
componentChunkName: string;
|
|
5
|
-
}
|
|
6
|
-
export declare const resetLastHash: () => void;
|
|
7
|
-
export declare const getComponents: (pages: Array<IGatsbyPage>) => Array<IGatsbyPageComponent>;
|
|
8
|
-
export declare const writeAll: (state: IGatsbyState) => Promise<boolean>;
|
|
9
|
-
export declare const startListener: () => void;
|
|
10
|
-
export {};
|
|
1
|
+
import { IGatsbyState, IGatsbyPage } from "../redux/types";
|
|
2
|
+
interface IGatsbyPageComponent {
|
|
3
|
+
component: string;
|
|
4
|
+
componentChunkName: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const resetLastHash: () => void;
|
|
7
|
+
export declare const getComponents: (pages: Array<IGatsbyPage>) => Array<IGatsbyPageComponent>;
|
|
8
|
+
export declare const writeAll: (state: IGatsbyState) => Promise<boolean>;
|
|
9
|
+
export declare const startListener: () => void;
|
|
10
|
+
export {};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/**
|
|
3
|
-
* Given a `require.resolve()` compatible path pointing to a JS module,
|
|
4
|
-
* return an array listing the names of the module's exports.
|
|
5
|
-
*
|
|
6
|
-
* Returns [] for invalid paths and modules without exports.
|
|
7
|
-
*
|
|
8
|
-
* @param modulePath
|
|
9
|
-
* @param mode
|
|
10
|
-
* @param resolver
|
|
11
|
-
*/
|
|
12
|
-
export declare const resolveModuleExports: (modulePath: string, { mode, resolver }?: {
|
|
13
|
-
mode?: string | undefined;
|
|
14
|
-
resolver?: RequireResolve | undefined;
|
|
15
|
-
}) => Array<string>;
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/**
|
|
3
|
+
* Given a `require.resolve()` compatible path pointing to a JS module,
|
|
4
|
+
* return an array listing the names of the module's exports.
|
|
5
|
+
*
|
|
6
|
+
* Returns [] for invalid paths and modules without exports.
|
|
7
|
+
*
|
|
8
|
+
* @param modulePath
|
|
9
|
+
* @param mode
|
|
10
|
+
* @param resolver
|
|
11
|
+
*/
|
|
12
|
+
export declare const resolveModuleExports: (modulePath: string, { mode, resolver }?: {
|
|
13
|
+
mode?: string | undefined;
|
|
14
|
+
resolver?: RequireResolve | undefined;
|
|
15
|
+
}) => Array<string>;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
5
|
exports.__esModule = true;
|
|
6
|
-
exports.buildHTML = exports.buildRenderer = void 0;
|
|
6
|
+
exports.buildHTML = exports.buildRenderer = exports.getDevSSRWebpack = void 0;
|
|
7
7
|
|
|
8
8
|
var _bluebird = _interopRequireDefault(require("bluebird"));
|
|
9
9
|
|
|
@@ -19,11 +19,29 @@ var _lodash = require("lodash");
|
|
|
19
19
|
|
|
20
20
|
var _webpack = _interopRequireDefault(require("webpack"));
|
|
21
21
|
|
|
22
|
+
var _redux = require("../redux");
|
|
23
|
+
|
|
22
24
|
var _webpack2 = _interopRequireDefault(require("../utils/webpack.config"));
|
|
23
25
|
|
|
24
26
|
var _webpackErrorUtils = require("../utils/webpack-error-utils");
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
let devssrWebpackCompiler;
|
|
29
|
+
let devssrWebpackWatcher;
|
|
30
|
+
let needToRecompileSSRBundle = true;
|
|
31
|
+
|
|
32
|
+
const getDevSSRWebpack = () => {
|
|
33
|
+
if (process.env.gatsby_executing_command !== `develop`) {
|
|
34
|
+
throw new Error(`This function can only be called in development`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
devssrWebpackWatcher,
|
|
39
|
+
devssrWebpackCompiler,
|
|
40
|
+
needToRecompileSSRBundle
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
exports.getDevSSRWebpack = getDevSSRWebpack;
|
|
27
45
|
let oldHash = ``;
|
|
28
46
|
let newHash = ``;
|
|
29
47
|
|
|
@@ -37,9 +55,19 @@ const runWebpack = (compilerConfig, stage, directory) => new _bluebird.default((
|
|
|
37
55
|
}
|
|
38
56
|
});
|
|
39
57
|
} else if (process.env.GATSBY_EXPERIMENTAL_DEV_SSR && stage === `develop-html`) {
|
|
40
|
-
(0, _webpack.default)(compilerConfig)
|
|
58
|
+
devssrWebpackCompiler = (0, _webpack.default)(compilerConfig);
|
|
59
|
+
devssrWebpackCompiler.hooks.invalid.tap(`ssr file invalidation`, file => {
|
|
60
|
+
needToRecompileSSRBundle = true;
|
|
61
|
+
});
|
|
62
|
+
devssrWebpackWatcher = devssrWebpackCompiler.watch({
|
|
41
63
|
ignored: /node_modules/
|
|
42
64
|
}, (err, stats) => {
|
|
65
|
+
needToRecompileSSRBundle = false;
|
|
66
|
+
|
|
67
|
+
_redux.emitter.emit(`DEV_SSR_COMPILATION_DONE`);
|
|
68
|
+
|
|
69
|
+
devssrWebpackWatcher.suspend();
|
|
70
|
+
|
|
43
71
|
if (err) {
|
|
44
72
|
return reject(err);
|
|
45
73
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/build-html.ts"],"names":["oldHash","newHash","runWebpack","compilerConfig","stage","directory","Bluebird","resolve","reject","process","env","GATSBY_EXPERIMENTAL_DEV_SSR","run","err","stats","watch","ignored","hash","restartWorker","require","doBuildRenderer","webpackConfig","hasErrors","reporter","panic","compilation","errors","buildRenderer","program","parentSpan","config","deleteRenderer","rendererPath","fs","remove","e","renderHTMLQueue","workerPool","activity","htmlComponentRendererPath","pages","envVars","NODE_ENV","gatsby_executing_command","gatsby_log_level","segments","map","pageSegment","renderHTML","paths","tick","length","BuildHTMLError","Error","constructor","error","message","codeFrame","Object","getOwnPropertyNames","forEach","key","doBuildPages","pagePaths","telemetry","addSiteMeasurement","pagesCount","prettyError","stack","buildError","context","buildHTML","span"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAKuB;AAEvB,IAAIA,OAAO,GAAI,EAAf;AACA,IAAIC,OAAO,GAAI,EAAf;;AACA,MAAMC,UAAU,GAAG,CACjBC,cADiB,EAEjBC,KAFiB,EAGjBC,SAHiB,KAKjB,IAAIC,iBAAJ,CAAa,CAACC,OAAD,EAAUC,MAAV,KAAqB;AAChC,MAAI,CAACC,OAAO,CAACC,GAAR,CAAYC,2BAAb,IAA4CP,KAAK,KAAM,YAA3D,EAAwE;AACtE,0BAAQD,cAAR,EAAwBS,GAAxB,CAA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AACkC,IAA1B,CAAxC;AACA,QAAMV,YAAY,CAAC9B,YAAD,EAAe+B,SAAf,EAA0BzB,QAA1B,EAAoCD,UAApC,CAAlB;;AACA,MAAIjC,KAAK,KAAM,cAAf,EAA8B;AAC5B,UAAM2B,cAAc,CAACC,YAAD,CAApB;AACD;AACF,CAlBM","sourcesContent":["import Bluebird from \"bluebird\"\nimport fs from \"fs-extra\"\nimport reporter from \"gatsby-cli/lib/reporter\"\nimport { createErrorFromString } from \"gatsby-cli/lib/reporter/errors\"\nimport telemetry from \"gatsby-telemetry\"\nimport { chunk } from \"lodash\"\nimport webpack from \"webpack\"\n\nimport webpackConfig from \"../utils/webpack.config\"\nimport { structureWebpackErrors } from \"../utils/webpack-error-utils\"\n\nimport { IProgram, Stage } from \"./types\"\n\ntype IActivity = any // TODO\ntype IWorkerPool = any // TODO\n\nlet oldHash = ``\nlet newHash = ``\nconst runWebpack = (\n compilerConfig,\n stage: Stage,\n directory\n): Bluebird<webpack.Stats> =>\n new Bluebird((resolve, reject) => {\n if (!process.env.GATSBY_EXPERIMENTAL_DEV_SSR || stage === `build-html`) {\n webpack(compilerConfig).run((err, stats) => {\n if (err) {\n return reject(err)\n } else {\n return resolve(stats)\n }\n })\n } else if (\n process.env.GATSBY_EXPERIMENTAL_DEV_SSR &&\n stage === `develop-html`\n ) {\n webpack(compilerConfig).watch(\n {\n ignored: /node_modules/,\n },\n (err, stats) => {\n if (err) {\n return reject(err)\n } else {\n newHash = stats.hash || ``\n\n const {\n restartWorker,\n } = require(`../utils/dev-ssr/render-dev-html`)\n // Make sure we use the latest version during development\n if (oldHash !== `` && newHash !== oldHash) {\n restartWorker(`${directory}/public/render-page.js`)\n }\n\n oldHash = newHash\n\n return resolve(stats)\n }\n }\n )\n }\n })\n\nconst doBuildRenderer = async (\n { directory }: IProgram,\n webpackConfig: webpack.Configuration,\n stage: Stage\n): Promise<string> => {\n const stats = await runWebpack(webpackConfig, stage, directory)\n if (stats.hasErrors()) {\n reporter.panic(structureWebpackErrors(stage, stats.compilation.errors))\n }\n\n // render-page.js is hard coded in webpack.config\n return `${directory}/public/render-page.js`\n}\n\nexport const buildRenderer = async (\n program: IProgram,\n stage: Stage,\n parentSpan?: IActivity\n): Promise<string> => {\n const { directory } = program\n const config = await webpackConfig(program, directory, stage, null, {\n parentSpan,\n })\n\n return doBuildRenderer(program, config, stage)\n}\n\nconst deleteRenderer = async (rendererPath: string): Promise<void> => {\n try {\n await fs.remove(rendererPath)\n await fs.remove(`${rendererPath}.map`)\n } catch (e) {\n // This function will fail on Windows with no further consequences.\n }\n}\n\nconst renderHTMLQueue = async (\n workerPool: IWorkerPool,\n activity: IActivity,\n htmlComponentRendererPath: string,\n pages: Array<string>\n): Promise<void> => {\n // We need to only pass env vars that are set programmatically in gatsby-cli\n // to child process. Other vars will be picked up from environment.\n const envVars = [\n [`NODE_ENV`, process.env.NODE_ENV],\n [`gatsby_executing_command`, process.env.gatsby_executing_command],\n [`gatsby_log_level`, process.env.gatsby_log_level],\n ]\n\n const segments = chunk(pages, 50)\n\n await Bluebird.map(segments, async pageSegment => {\n await workerPool.renderHTML({\n envVars,\n htmlComponentRendererPath,\n paths: pageSegment,\n })\n\n if (activity && activity.tick) {\n activity.tick(pageSegment.length)\n }\n })\n}\n\nclass BuildHTMLError extends Error {\n codeFrame = ``\n context?: {\n path: string\n }\n\n constructor(error: Error) {\n super(error.message)\n\n // We must use getOwnProperty because keys like `stack` are not enumerable,\n // but we want to copy over the entire error\n Object.getOwnPropertyNames(error).forEach(key => {\n this[key] = error[key]\n })\n }\n}\n\nconst doBuildPages = async (\n rendererPath: string,\n pagePaths: Array<string>,\n activity: IActivity,\n workerPool: IWorkerPool\n): Promise<void> => {\n telemetry.addSiteMeasurement(`BUILD_END`, {\n pagesCount: pagePaths.length,\n })\n\n try {\n await renderHTMLQueue(workerPool, activity, rendererPath, pagePaths)\n } catch (error) {\n const prettyError = await createErrorFromString(\n error.stack,\n `${rendererPath}.map`\n )\n const buildError = new BuildHTMLError(prettyError)\n buildError.context = error.context\n throw buildError\n }\n}\n\nexport const buildHTML = async ({\n program,\n stage,\n pagePaths,\n activity,\n workerPool,\n}: {\n program: IProgram\n stage: Stage\n pagePaths: Array<string>\n activity: IActivity\n workerPool: IWorkerPool\n}): Promise<void> => {\n const rendererPath = await buildRenderer(program, stage, activity.span)\n await doBuildPages(rendererPath, pagePaths, activity, workerPool)\n if (stage !== `develop-html`) {\n await deleteRenderer(rendererPath)\n }\n}\n"],"file":"build-html.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/commands/build-html.ts"],"names":["devssrWebpackCompiler","devssrWebpackWatcher","needToRecompileSSRBundle","getDevSSRWebpack","process","env","gatsby_executing_command","Error","oldHash","newHash","runWebpack","compilerConfig","stage","directory","Bluebird","resolve","reject","GATSBY_EXPERIMENTAL_DEV_SSR","run","err","stats","hooks","invalid","tap","file","watch","ignored","emitter","emit","suspend","hash","restartWorker","require","doBuildRenderer","webpackConfig","hasErrors","reporter","panic","compilation","errors","buildRenderer","program","parentSpan","config","deleteRenderer","rendererPath","fs","remove","e","renderHTMLQueue","workerPool","activity","htmlComponentRendererPath","pages","envVars","NODE_ENV","gatsby_log_level","segments","map","pageSegment","renderHTML","paths","tick","length","BuildHTMLError","constructor","error","message","codeFrame","Object","getOwnPropertyNames","forEach","key","doBuildPages","pagePaths","telemetry","addSiteMeasurement","pagesCount","prettyError","stack","buildError","context","buildHTML","span"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AAYA,IAAIA,qBAAJ;AACA,IAAIC,oBAAJ;AACA,IAAIC,wBAAwB,GAAG,IAA/B;;AACO,MAAMC,gBAAgB,GAAG,MAI3B;AACH,MAAIC,OAAO,CAACC,GAAR,CAAYC,wBAAZ,KAA0C,SAA9C,EAAwD;AACtD,UAAM,IAAIC,KAAJ,CAAW,iDAAX,CAAN;AACD;;AAED,SAAO;AACLN,IAAAA,oBADK;AAELD,IAAAA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ClByB,2BAAUC,kBAAV,CAA8B,WAA9B,EAA0C;AACxCC,IAAAA,UAAU,EAAEH,SAAS,CAACX;AADkB,GAA1C;;AAIA,MAAI;AACF,UAAMd,eAAe,CAACC,UAAD,EAAaC,QAAb,EAAuBN,YAAvB,EAAqC6B,SAArC,CAArB;AACD,GAFD,CAEE,OAAOR,KAAP,EAAc;AACd,UAAMY,WAAW,GAAG,MAAM,mCACxBZ,KAAK,CAACa,KADkB,EAEvB,GAAElC,YAAa,MAFQ,CAA1B;AAIA,UAAMmC,UAAU,GAAG,IAAIhB,cAAJ,CAAmBc,WAAnB,CAAnB;AACAE,IAAAA,UAAU,CAACC,OAAX,GAAqBf,KAAK,CAACe,OAA3B;AACA,UAAMD,UAAN;AACD;AACF,CArBD;;AAuBO,MAAME,SAAS,GAAG,OAAO;AAC9BzC,EAAAA,OAD8B;AAE9B7B,EAAAA,KAF8B;AAG9B8D,EAAAA,SAH8B;AAI9BvB,EAAAA,QAJ8B;AAK9BD,EAAAA;AAL8B,CAAP,KAYJ;AACnB,QAAML,YAAY,GAAG,MAAML,aAAa,CAACC,OAAD,EAAU7B,KAAV,EAAiBuC,QAAQ,CAACgC,IAA1B,CAAxC;AACA,QAAMV,YAAY,CAAC5B,YAAD,EAAe6B,SAAf,EAA0BvB,QAA1B,EAAoCD,UAApC,CAAlB;;AACA,MAAItC,KAAK,KAAM,cAAf,EAA8B;AAC5B,UAAMgC,cAAc,CAACC,YAAD,CAApB;AACD;AACF,CAlBM","sourcesContent":["import Bluebird from \"bluebird\"\nimport fs from \"fs-extra\"\nimport reporter from \"gatsby-cli/lib/reporter\"\nimport { createErrorFromString } from \"gatsby-cli/lib/reporter/errors\"\nimport telemetry from \"gatsby-telemetry\"\nimport { chunk } from \"lodash\"\nimport webpack from \"webpack\"\n\nimport { emitter } from \"../redux\"\nimport webpackConfig from \"../utils/webpack.config\"\nimport { structureWebpackErrors } from \"../utils/webpack-error-utils\"\n\nimport { IProgram, Stage } from \"./types\"\n\ntype IActivity = any // TODO\ntype IWorkerPool = any // TODO\n\nexport interface IWebpackWatchingPauseResume extends webpack.Watching {\n suspend: () => void\n resume: () => void\n}\n\nlet devssrWebpackCompiler: webpack.Compiler\nlet devssrWebpackWatcher: IWebpackWatchingPauseResume\nlet needToRecompileSSRBundle = true\nexport const getDevSSRWebpack = (): Record<\n IWebpackWatchingPauseResume,\n webpack.Compiler,\n needToRecompileSSRBundle\n> => {\n if (process.env.gatsby_executing_command !== `develop`) {\n throw new Error(`This function can only be called in development`)\n }\n\n return {\n devssrWebpackWatcher,\n devssrWebpackCompiler,\n needToRecompileSSRBundle,\n }\n}\n\nlet oldHash = ``\nlet newHash = ``\nconst runWebpack = (\n compilerConfig,\n stage: Stage,\n directory\n): Bluebird<webpack.Stats> =>\n new Bluebird((resolve, reject) => {\n if (!process.env.GATSBY_EXPERIMENTAL_DEV_SSR || stage === `build-html`) {\n webpack(compilerConfig).run((err, stats) => {\n if (err) {\n return reject(err)\n } else {\n return resolve(stats)\n }\n })\n } else if (\n process.env.GATSBY_EXPERIMENTAL_DEV_SSR &&\n stage === `develop-html`\n ) {\n devssrWebpackCompiler = webpack(compilerConfig)\n devssrWebpackCompiler.hooks.invalid.tap(`ssr file invalidation`, file => {\n needToRecompileSSRBundle = true\n })\n devssrWebpackWatcher = devssrWebpackCompiler.watch(\n {\n ignored: /node_modules/,\n },\n (err, stats) => {\n needToRecompileSSRBundle = false\n emitter.emit(`DEV_SSR_COMPILATION_DONE`)\n devssrWebpackWatcher.suspend()\n\n if (err) {\n return reject(err)\n } else {\n newHash = stats.hash || ``\n\n const {\n restartWorker,\n } = require(`../utils/dev-ssr/render-dev-html`)\n // Make sure we use the latest version during development\n if (oldHash !== `` && newHash !== oldHash) {\n restartWorker(`${directory}/public/render-page.js`)\n }\n\n oldHash = newHash\n\n return resolve(stats)\n }\n }\n )\n }\n })\n\nconst doBuildRenderer = async (\n { directory }: IProgram,\n webpackConfig: webpack.Configuration,\n stage: Stage\n): Promise<string> => {\n const stats = await runWebpack(webpackConfig, stage, directory)\n if (stats.hasErrors()) {\n reporter.panic(structureWebpackErrors(stage, stats.compilation.errors))\n }\n\n // render-page.js is hard coded in webpack.config\n return `${directory}/public/render-page.js`\n}\n\nexport const buildRenderer = async (\n program: IProgram,\n stage: Stage,\n parentSpan?: IActivity\n): Promise<string> => {\n const { directory } = program\n const config = await webpackConfig(program, directory, stage, null, {\n parentSpan,\n })\n\n return doBuildRenderer(program, config, stage)\n}\n\nconst deleteRenderer = async (rendererPath: string): Promise<void> => {\n try {\n await fs.remove(rendererPath)\n await fs.remove(`${rendererPath}.map`)\n } catch (e) {\n // This function will fail on Windows with no further consequences.\n }\n}\n\nconst renderHTMLQueue = async (\n workerPool: IWorkerPool,\n activity: IActivity,\n htmlComponentRendererPath: string,\n pages: Array<string>\n): Promise<void> => {\n // We need to only pass env vars that are set programmatically in gatsby-cli\n // to child process. Other vars will be picked up from environment.\n const envVars = [\n [`NODE_ENV`, process.env.NODE_ENV],\n [`gatsby_executing_command`, process.env.gatsby_executing_command],\n [`gatsby_log_level`, process.env.gatsby_log_level],\n ]\n\n const segments = chunk(pages, 50)\n\n await Bluebird.map(segments, async pageSegment => {\n await workerPool.renderHTML({\n envVars,\n htmlComponentRendererPath,\n paths: pageSegment,\n })\n\n if (activity && activity.tick) {\n activity.tick(pageSegment.length)\n }\n })\n}\n\nclass BuildHTMLError extends Error {\n codeFrame = ``\n context?: {\n path: string\n }\n\n constructor(error: Error) {\n super(error.message)\n\n // We must use getOwnProperty because keys like `stack` are not enumerable,\n // but we want to copy over the entire error\n Object.getOwnPropertyNames(error).forEach(key => {\n this[key] = error[key]\n })\n }\n}\n\nconst doBuildPages = async (\n rendererPath: string,\n pagePaths: Array<string>,\n activity: IActivity,\n workerPool: IWorkerPool\n): Promise<void> => {\n telemetry.addSiteMeasurement(`BUILD_END`, {\n pagesCount: pagePaths.length,\n })\n\n try {\n await renderHTMLQueue(workerPool, activity, rendererPath, pagePaths)\n } catch (error) {\n const prettyError = await createErrorFromString(\n error.stack,\n `${rendererPath}.map`\n )\n const buildError = new BuildHTMLError(prettyError)\n buildError.context = error.context\n throw buildError\n }\n}\n\nexport const buildHTML = async ({\n program,\n stage,\n pagePaths,\n activity,\n workerPool,\n}: {\n program: IProgram\n stage: Stage\n pagePaths: Array<string>\n activity: IActivity\n workerPool: IWorkerPool\n}): Promise<void> => {\n const rendererPath = await buildRenderer(program, stage, activity.span)\n await doBuildPages(rendererPath, pagePaths, activity, workerPool)\n if (stage !== `develop-html`) {\n await deleteRenderer(rendererPath)\n }\n}\n"],"file":"build-html.js"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import express from "express";
|
|
2
|
-
import { ServeStaticOptions } from "serve-static";
|
|
3
|
-
export declare function developStatic(root: string, options: ServeStaticOptions): express.Handler;
|
|
1
|
+
import express from "express";
|
|
2
|
+
import { ServeStaticOptions } from "serve-static";
|
|
3
|
+
export declare function developStatic(root: string, options: ServeStaticOptions): express.Handler;
|
package/dist/commands/types.d.ts
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { PackageJson, Reporter } from "gatsby";
|
|
3
|
-
import { Store, AnyAction } from "redux";
|
|
4
|
-
import { IGatsbyState } from "../redux/types";
|
|
5
|
-
export interface ICert {
|
|
6
|
-
key: Buffer;
|
|
7
|
-
cert: Buffer;
|
|
8
|
-
}
|
|
9
|
-
export interface IDebugInfo {
|
|
10
|
-
port: number;
|
|
11
|
-
break: boolean;
|
|
12
|
-
}
|
|
13
|
-
export interface IProgram {
|
|
14
|
-
_: `develop` | `build` | `clean` | `feedback` | `repl` | `serve`;
|
|
15
|
-
status?: string;
|
|
16
|
-
useYarn: boolean;
|
|
17
|
-
open: boolean;
|
|
18
|
-
openTracingConfigFile: string;
|
|
19
|
-
port: number;
|
|
20
|
-
proxyPort: number;
|
|
21
|
-
host: string;
|
|
22
|
-
report: Reporter;
|
|
23
|
-
[`cert-file`]?: string;
|
|
24
|
-
[`key-file`]?: string;
|
|
25
|
-
directory: string;
|
|
26
|
-
https?: boolean;
|
|
27
|
-
sitePackageJson: PackageJson;
|
|
28
|
-
ssl?: ICert;
|
|
29
|
-
inspect?: number;
|
|
30
|
-
inspectBrk?: number;
|
|
31
|
-
graphqlTracing?: boolean;
|
|
32
|
-
verbose?: boolean;
|
|
33
|
-
setStore?: (store: Store<IGatsbyState, AnyAction>) => void;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* @deprecated
|
|
37
|
-
* Use `Stage` instead
|
|
38
|
-
*/
|
|
39
|
-
export declare enum BuildHTMLStage {
|
|
40
|
-
DevelopHTML = "develop-html",
|
|
41
|
-
BuildHTML = "build-html"
|
|
42
|
-
}
|
|
43
|
-
export declare enum Stage {
|
|
44
|
-
Develop = "develop",
|
|
45
|
-
DevelopHTML = "develop-html",
|
|
46
|
-
BuildJavascript = "build-javascript",
|
|
47
|
-
BuildHTML = "build-html"
|
|
48
|
-
}
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { PackageJson, Reporter } from "gatsby";
|
|
3
|
+
import { Store, AnyAction } from "redux";
|
|
4
|
+
import { IGatsbyState } from "../redux/types";
|
|
5
|
+
export interface ICert {
|
|
6
|
+
key: Buffer;
|
|
7
|
+
cert: Buffer;
|
|
8
|
+
}
|
|
9
|
+
export interface IDebugInfo {
|
|
10
|
+
port: number;
|
|
11
|
+
break: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface IProgram {
|
|
14
|
+
_: `develop` | `build` | `clean` | `feedback` | `repl` | `serve`;
|
|
15
|
+
status?: string;
|
|
16
|
+
useYarn: boolean;
|
|
17
|
+
open: boolean;
|
|
18
|
+
openTracingConfigFile: string;
|
|
19
|
+
port: number;
|
|
20
|
+
proxyPort: number;
|
|
21
|
+
host: string;
|
|
22
|
+
report: Reporter;
|
|
23
|
+
[`cert-file`]?: string;
|
|
24
|
+
[`key-file`]?: string;
|
|
25
|
+
directory: string;
|
|
26
|
+
https?: boolean;
|
|
27
|
+
sitePackageJson: PackageJson;
|
|
28
|
+
ssl?: ICert;
|
|
29
|
+
inspect?: number;
|
|
30
|
+
inspectBrk?: number;
|
|
31
|
+
graphqlTracing?: boolean;
|
|
32
|
+
verbose?: boolean;
|
|
33
|
+
setStore?: (store: Store<IGatsbyState, AnyAction>) => void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated
|
|
37
|
+
* Use `Stage` instead
|
|
38
|
+
*/
|
|
39
|
+
export declare enum BuildHTMLStage {
|
|
40
|
+
DevelopHTML = "develop-html",
|
|
41
|
+
BuildHTML = "build-html"
|
|
42
|
+
}
|
|
43
|
+
export declare enum Stage {
|
|
44
|
+
Develop = "develop",
|
|
45
|
+
DevelopHTML = "develop-html",
|
|
46
|
+
BuildJavascript = "build-javascript",
|
|
47
|
+
BuildHTML = "build-html"
|
|
48
|
+
}
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
export interface IDbQueryQuery {
|
|
2
|
-
type: "query";
|
|
3
|
-
path: Array<string>;
|
|
4
|
-
query: IDbFilterStatement;
|
|
5
|
-
}
|
|
6
|
-
export interface IDbQueryElemMatch {
|
|
7
|
-
type: "elemMatch";
|
|
8
|
-
path: Array<string>;
|
|
9
|
-
nestedQuery: DbQuery;
|
|
10
|
-
}
|
|
11
|
-
export declare type DbQuery = IDbQueryQuery | IDbQueryElemMatch;
|
|
12
|
-
export declare enum DbComparator {
|
|
13
|
-
EQ = "$eq",
|
|
14
|
-
NE = "$ne",
|
|
15
|
-
GT = "$gt",
|
|
16
|
-
GTE = "$gte",
|
|
17
|
-
LT = "$lt",
|
|
18
|
-
LTE = "$lte",
|
|
19
|
-
IN = "$in",
|
|
20
|
-
NIN = "$nin",
|
|
21
|
-
REGEX = "$regex",
|
|
22
|
-
GLOB = "$glob"
|
|
23
|
-
}
|
|
24
|
-
declare type DbComparatorValue = string | number | boolean | RegExp | null;
|
|
25
|
-
export interface IDbFilterStatement {
|
|
26
|
-
comparator: DbComparator;
|
|
27
|
-
value: DbComparatorValue | Array<DbComparatorValue>;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Converts a nested mongo args object into array of DbQuery objects,
|
|
31
|
-
* structured representation of each distinct path of the query. We convert
|
|
32
|
-
* nested objects with multiple keys to separate instances.
|
|
33
|
-
*/
|
|
34
|
-
export declare function createDbQueriesFromObject(filter: Record<string, any>): Array<DbQuery>;
|
|
35
|
-
export declare function prefixResolvedFields(queries: Array<DbQuery>, resolvedFields: object): Array<DbQuery>;
|
|
36
|
-
export declare function objectToDottedField(obj: object, path?: Array<string>): object;
|
|
37
|
-
export {};
|
|
1
|
+
export interface IDbQueryQuery {
|
|
2
|
+
type: "query";
|
|
3
|
+
path: Array<string>;
|
|
4
|
+
query: IDbFilterStatement;
|
|
5
|
+
}
|
|
6
|
+
export interface IDbQueryElemMatch {
|
|
7
|
+
type: "elemMatch";
|
|
8
|
+
path: Array<string>;
|
|
9
|
+
nestedQuery: DbQuery;
|
|
10
|
+
}
|
|
11
|
+
export declare type DbQuery = IDbQueryQuery | IDbQueryElemMatch;
|
|
12
|
+
export declare enum DbComparator {
|
|
13
|
+
EQ = "$eq",
|
|
14
|
+
NE = "$ne",
|
|
15
|
+
GT = "$gt",
|
|
16
|
+
GTE = "$gte",
|
|
17
|
+
LT = "$lt",
|
|
18
|
+
LTE = "$lte",
|
|
19
|
+
IN = "$in",
|
|
20
|
+
NIN = "$nin",
|
|
21
|
+
REGEX = "$regex",
|
|
22
|
+
GLOB = "$glob"
|
|
23
|
+
}
|
|
24
|
+
declare type DbComparatorValue = string | number | boolean | RegExp | null;
|
|
25
|
+
export interface IDbFilterStatement {
|
|
26
|
+
comparator: DbComparator;
|
|
27
|
+
value: DbComparatorValue | Array<DbComparatorValue>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Converts a nested mongo args object into array of DbQuery objects,
|
|
31
|
+
* structured representation of each distinct path of the query. We convert
|
|
32
|
+
* nested objects with multiple keys to separate instances.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createDbQueriesFromObject(filter: Record<string, any>): Array<DbQuery>;
|
|
35
|
+
export declare function prefixResolvedFields(queries: Array<DbQuery>, resolvedFields: object): Array<DbQuery>;
|
|
36
|
+
export declare function objectToDottedField(obj: object, path?: Array<string>): object;
|
|
37
|
+
export {};
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from "./state-machines";
|
|
2
|
-
export * from "./services";
|
|
3
|
-
export * from "./redux/types";
|
|
4
|
-
export * from "./query/types";
|
|
5
|
-
export * from "./commands/types";
|
|
1
|
+
export * from "./state-machines";
|
|
2
|
+
export * from "./services";
|
|
3
|
+
export * from "./redux/types";
|
|
4
|
+
export * from "./query/types";
|
|
5
|
+
export * from "./commands/types";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/// <reference types="hapi__joi" />
|
|
2
|
-
import Joi from "@hapi/joi";
|
|
3
|
-
import { IGatsbyConfig, IGatsbyPage, IGatsbyNode } from "../redux/types";
|
|
4
|
-
export declare const gatsbyConfigSchema: Joi.ObjectSchema<IGatsbyConfig>;
|
|
5
|
-
export declare const pageSchema: Joi.ObjectSchema<IGatsbyPage>;
|
|
6
|
-
export declare const nodeSchema: Joi.ObjectSchema<IGatsbyNode>;
|
|
1
|
+
/// <reference types="hapi__joi" />
|
|
2
|
+
import Joi from "@hapi/joi";
|
|
3
|
+
import { IGatsbyConfig, IGatsbyPage, IGatsbyNode } from "../redux/types";
|
|
4
|
+
export declare const gatsbyConfigSchema: Joi.ObjectSchema<IGatsbyConfig>;
|
|
5
|
+
export declare const pageSchema: Joi.ObjectSchema<IGatsbyPage>;
|
|
6
|
+
export declare const nodeSchema: Joi.ObjectSchema<IGatsbyNode>;
|