@vercel/gatsby-plugin-vercel-builder 2.0.4 → 2.0.6
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/dist/index.js +362 -75
- package/gatsby-node.js +7 -12
- package/package.json +5 -9
- package/templates/ssr-handler.js +80 -0
- package/dist/handlers/build.d.ts +0 -16
- package/dist/handlers/build.d.ts.map +0 -1
- package/dist/handlers/build.js +0 -88
- package/dist/handlers/build.js.map +0 -1
- package/dist/handlers/templates/ssr-handler.d.ts +0 -3
- package/dist/handlers/templates/ssr-handler.d.ts.map +0 -1
- package/dist/handlers/templates/ssr-handler.js +0 -68
- package/dist/handlers/templates/ssr-handler.js.map +0 -1
- package/dist/handlers/utils.d.ts +0 -3
- package/dist/handlers/utils.d.ts.map +0 -1
- package/dist/handlers/utils.js +0 -43
- package/dist/handlers/utils.js.map +0 -1
- package/dist/helpers/functions.d.ts +0 -9
- package/dist/helpers/functions.d.ts.map +0 -1
- package/dist/helpers/functions.js +0 -66
- package/dist/helpers/functions.js.map +0 -1
- package/dist/helpers/static.d.ts +0 -2
- package/dist/helpers/static.d.ts.map +0 -1
- package/dist/helpers/static.js +0 -18
- package/dist/helpers/static.js.map +0 -1
- package/dist/index.d.ts +0 -10
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/schemas.d.ts +0 -63
- package/dist/schemas.d.ts.map +0 -1
- package/dist/schemas.js +0 -42
- package/dist/schemas.js.map +0 -1
- package/dist/utils/symlink.d.ts +0 -2
- package/dist/utils/symlink.d.ts.map +0 -1
- package/dist/utils/symlink.js +0 -37
- package/dist/utils/symlink.js.map +0 -1
- package/gatsby-node.js.map +0 -1
- package/gatsby-node.ts +0 -9
package/dist/index.js
CHANGED
|
@@ -1,79 +1,366 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var src_exports = {};
|
|
32
|
+
__export(src_exports, {
|
|
33
|
+
generateVercelBuildOutputAPI3Output: () => generateVercelBuildOutputAPI3Output
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(src_exports);
|
|
36
|
+
var import_routing_utils = require("@vercel/routing-utils");
|
|
37
|
+
var import_fs_extra4 = require("fs-extra");
|
|
38
|
+
|
|
39
|
+
// src/schemas.ts
|
|
40
|
+
var import_typebox = require("@sinclair/typebox");
|
|
41
|
+
var import_custom = require("@sinclair/typebox/custom");
|
|
42
|
+
var import_compiler = require("@sinclair/typebox/compiler");
|
|
43
|
+
import_custom.Custom.Set("StringEnum", (schema, value) => {
|
|
44
|
+
return schema.enum.includes(value);
|
|
45
|
+
});
|
|
46
|
+
function StringEnum(values) {
|
|
47
|
+
return import_typebox.Type.Unsafe({
|
|
48
|
+
[import_typebox.Kind]: "StringEnum",
|
|
49
|
+
type: "string",
|
|
50
|
+
enum: values
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
var GatsbyPageSchema = import_typebox.Type.Object({
|
|
54
|
+
mode: StringEnum(["SSG", "DSG", "SSR"]),
|
|
55
|
+
path: import_typebox.Type.String()
|
|
56
|
+
});
|
|
57
|
+
var GatsbyFunctionSchema = import_typebox.Type.Object({
|
|
58
|
+
functionRoute: import_typebox.Type.String(),
|
|
59
|
+
originalAbsoluteFilePath: import_typebox.Type.String()
|
|
60
|
+
});
|
|
61
|
+
import_compiler.TypeCompiler.Compile(GatsbyFunctionSchema);
|
|
62
|
+
var GatsbyRedirectSchema = import_typebox.Type.Object({
|
|
63
|
+
fromPath: import_typebox.Type.String(),
|
|
64
|
+
toPath: import_typebox.Type.String(),
|
|
65
|
+
isPermanent: import_typebox.Type.Optional(import_typebox.Type.Boolean())
|
|
66
|
+
});
|
|
67
|
+
var GatsbyConfigSchema = import_typebox.Type.Object({
|
|
68
|
+
trailingSlash: import_typebox.Type.Optional(
|
|
69
|
+
StringEnum(["always", "never", "ignore", "legacy"])
|
|
70
|
+
),
|
|
71
|
+
pathPrefix: import_typebox.Type.Optional(import_typebox.Type.String())
|
|
72
|
+
});
|
|
73
|
+
var GatsbyStateSchema = import_typebox.Type.Object({
|
|
74
|
+
pages: import_typebox.Type.Array(import_typebox.Type.Tuple([import_typebox.Type.String(), GatsbyPageSchema])),
|
|
75
|
+
redirects: import_typebox.Type.Array(GatsbyRedirectSchema),
|
|
76
|
+
functions: import_typebox.Type.Array(GatsbyFunctionSchema),
|
|
77
|
+
config: GatsbyConfigSchema
|
|
78
|
+
});
|
|
79
|
+
var validateGatsbyState = import_compiler.TypeCompiler.Compile(GatsbyStateSchema);
|
|
80
|
+
|
|
81
|
+
// src/helpers/functions.ts
|
|
82
|
+
var import_path3 = require("path");
|
|
83
|
+
var import_fs_extra3 = require("fs-extra");
|
|
84
|
+
|
|
85
|
+
// src/utils/symlink.ts
|
|
86
|
+
var import_path = __toESM(require("path"));
|
|
87
|
+
var import_fs_extra = require("fs-extra");
|
|
88
|
+
var removeTrailingSlash = (str) => str.replace(/\/$/, "");
|
|
89
|
+
var createSymlink = async (pathName, destName) => {
|
|
90
|
+
const functionName = removeTrailingSlash(pathName).split(import_path.sep).pop();
|
|
91
|
+
const dirPath = removeTrailingSlash(
|
|
92
|
+
(0, import_path.join)(".vercel", "output", "functions", (0, import_path.normalize)((0, import_path.join)(pathName, "..")))
|
|
93
|
+
);
|
|
94
|
+
await (0, import_fs_extra.ensureDir)(dirPath);
|
|
95
|
+
(0, import_fs_extra.symlinkSync)(
|
|
96
|
+
import_path.default.relative(dirPath, (0, import_path.join)(".vercel", "output", "functions", destName)),
|
|
97
|
+
import_path.default.join(dirPath, `${functionName}.func`)
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// src/handlers/build.ts
|
|
102
|
+
var import_path2 = require("path");
|
|
103
|
+
var import_build_utils = require("@vercel/build-utils");
|
|
104
|
+
var import_esbuild = require("esbuild");
|
|
105
|
+
var import_fs_extra2 = require("fs-extra");
|
|
106
|
+
var writeHandler = async ({
|
|
107
|
+
outDir,
|
|
108
|
+
handlerFile
|
|
109
|
+
}) => {
|
|
110
|
+
const { major } = await (0, import_build_utils.getNodeVersion)(process.cwd());
|
|
111
|
+
try {
|
|
112
|
+
await (0, import_esbuild.build)({
|
|
113
|
+
entryPoints: [handlerFile],
|
|
114
|
+
loader: { ".ts": "ts" },
|
|
115
|
+
outfile: (0, import_path2.join)(outDir, "index.js"),
|
|
116
|
+
format: "cjs",
|
|
117
|
+
target: `node${major}`,
|
|
118
|
+
platform: "node",
|
|
119
|
+
bundle: true,
|
|
120
|
+
minify: true,
|
|
121
|
+
define: {
|
|
122
|
+
"process.env.NODE_ENV": "'production'"
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
} catch (e) {
|
|
126
|
+
console.error("Failed to build lambda handler", e.message);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
var writeVCConfig = async ({
|
|
130
|
+
functionDir,
|
|
131
|
+
handler = "index.js"
|
|
132
|
+
}) => {
|
|
133
|
+
const { runtime } = await (0, import_build_utils.getNodeVersion)(process.cwd());
|
|
134
|
+
const config = {
|
|
135
|
+
runtime,
|
|
136
|
+
handler,
|
|
137
|
+
launcherType: "Nodejs",
|
|
138
|
+
shouldAddHelpers: true
|
|
139
|
+
};
|
|
140
|
+
const configPath = (0, import_path2.join)(functionDir, ".vc-config.json");
|
|
141
|
+
await (0, import_fs_extra2.writeJson)(configPath, config);
|
|
142
|
+
};
|
|
143
|
+
var writePrerenderConfig = (outputPath, group) => {
|
|
144
|
+
const config = {
|
|
145
|
+
group,
|
|
146
|
+
expiration: 600
|
|
147
|
+
// 10 minutes TODO: make this configurable?
|
|
148
|
+
};
|
|
149
|
+
(0, import_fs_extra2.ensureFileSync)(outputPath);
|
|
150
|
+
return (0, import_fs_extra2.writeFileSync)(outputPath, JSON.stringify(config));
|
|
151
|
+
};
|
|
152
|
+
async function copyFunctionLibs({
|
|
153
|
+
functionDir
|
|
154
|
+
}) {
|
|
155
|
+
await Promise.allSettled(
|
|
156
|
+
[
|
|
157
|
+
{
|
|
158
|
+
src: (0, import_path2.join)(".cache", "query-engine"),
|
|
159
|
+
dest: (0, import_path2.join)(functionDir, ".cache", "query-engine")
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
src: (0, import_path2.join)(".cache", "page-ssr"),
|
|
163
|
+
dest: (0, import_path2.join)(functionDir, ".cache", "page-ssr")
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
src: (0, import_path2.join)(".cache", "data", "datastore"),
|
|
167
|
+
dest: (0, import_path2.join)(functionDir, ".cache", "data", "datastore")
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
src: (0, import_path2.join)(".cache", "caches"),
|
|
171
|
+
dest: (0, import_path2.join)(functionDir, ".cache", "caches")
|
|
172
|
+
}
|
|
173
|
+
].map(({ src, dest }) => (0, import_fs_extra2.copy)(src, dest))
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
async function copyHTMLFiles({ functionDir }) {
|
|
177
|
+
for (const htmlFile of ["404", "500"]) {
|
|
178
|
+
if (await (0, import_fs_extra2.pathExists)((0, import_path2.join)("public", `${htmlFile}.html`))) {
|
|
179
|
+
try {
|
|
180
|
+
await (0, import_fs_extra2.copyFile)(
|
|
181
|
+
(0, import_path2.join)("public", `${htmlFile}.html`),
|
|
182
|
+
(0, import_path2.join)(functionDir, `${htmlFile}.html`)
|
|
183
|
+
);
|
|
184
|
+
} catch (e) {
|
|
185
|
+
console.error("Failed to copy HTML files", e.message);
|
|
186
|
+
process.exit(1);
|
|
187
|
+
}
|
|
70
188
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// src/helpers/functions.ts
|
|
193
|
+
async function createServerlessFunctions(ssrRoutes, prefix) {
|
|
194
|
+
let functionName;
|
|
195
|
+
let functionDir;
|
|
196
|
+
const handlerFile = (0, import_path3.join)(__dirname, "../templates/ssr-handler.js");
|
|
197
|
+
await Promise.all(
|
|
198
|
+
ssrRoutes.map(async (page, index) => {
|
|
199
|
+
let pathName = page.path;
|
|
200
|
+
const ssrPath = (0, import_path3.join)(prefix ?? "", pathName, "index.html");
|
|
201
|
+
if (index === 0) {
|
|
202
|
+
functionName = `${ssrPath}.func`;
|
|
203
|
+
functionDir = (0, import_path3.join)(".vercel/output/functions", functionName);
|
|
204
|
+
await (0, import_fs_extra3.ensureDir)(functionDir);
|
|
205
|
+
await Promise.all([
|
|
206
|
+
writeHandler({ outDir: functionDir, handlerFile }),
|
|
207
|
+
copyFunctionLibs({ functionDir }),
|
|
208
|
+
copyHTMLFiles({ functionDir }),
|
|
209
|
+
writeVCConfig({ functionDir })
|
|
210
|
+
]);
|
|
211
|
+
} else {
|
|
212
|
+
await createSymlink(ssrPath, functionName);
|
|
213
|
+
}
|
|
214
|
+
if (page.mode === "DSG") {
|
|
215
|
+
writePrerenderConfig(
|
|
216
|
+
(0, import_path3.join)(
|
|
217
|
+
".vercel",
|
|
218
|
+
"output",
|
|
219
|
+
"functions",
|
|
220
|
+
`${ssrPath}.prerender-config.json`
|
|
221
|
+
),
|
|
222
|
+
index + 1
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
if (!pathName || pathName === "/") {
|
|
226
|
+
pathName = "index";
|
|
227
|
+
}
|
|
228
|
+
const pageDataPath = (0, import_path3.join)(
|
|
229
|
+
prefix ?? "",
|
|
230
|
+
"page-data",
|
|
231
|
+
pathName,
|
|
232
|
+
"page-data.json"
|
|
233
|
+
);
|
|
234
|
+
await createSymlink(pageDataPath, functionName);
|
|
235
|
+
if (page.mode === "DSG") {
|
|
236
|
+
writePrerenderConfig(
|
|
237
|
+
(0, import_path3.join)(
|
|
238
|
+
".vercel",
|
|
239
|
+
"output",
|
|
240
|
+
"functions",
|
|
241
|
+
`${pageDataPath}.prerender-config.json`
|
|
242
|
+
),
|
|
243
|
+
index + 1
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
})
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
async function createAPIRoutes(functions, prefix) {
|
|
250
|
+
const apiDir = (0, import_path3.join)(".vercel", "output", "functions", "api", prefix ?? "");
|
|
251
|
+
await (0, import_fs_extra3.ensureDir)(apiDir);
|
|
252
|
+
await Promise.allSettled(
|
|
253
|
+
functions.map(async (func) => {
|
|
254
|
+
const apiRouteDir = `${apiDir}/${func.functionRoute}.func`;
|
|
255
|
+
const handlerFile = func.originalAbsoluteFilePath;
|
|
256
|
+
await (0, import_fs_extra3.ensureDir)(apiRouteDir);
|
|
257
|
+
await Promise.all([
|
|
258
|
+
writeHandler({ outDir: apiRouteDir, handlerFile }),
|
|
259
|
+
writeVCConfig({ functionDir: apiRouteDir })
|
|
260
|
+
]);
|
|
261
|
+
})
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// src/helpers/static.ts
|
|
266
|
+
var import_path4 = require("path");
|
|
267
|
+
var import_build_utils2 = require("@vercel/build-utils");
|
|
268
|
+
async function createStaticDir(prefix) {
|
|
269
|
+
const publicDir = (0, import_path4.join)(process.cwd(), "public");
|
|
270
|
+
const targetDir = (0, import_path4.join)(
|
|
271
|
+
process.cwd(),
|
|
272
|
+
".vercel",
|
|
273
|
+
"output",
|
|
274
|
+
"static",
|
|
275
|
+
prefix ?? ""
|
|
276
|
+
);
|
|
277
|
+
try {
|
|
278
|
+
await (0, import_build_utils2.hardLinkDir)(publicDir, [targetDir]);
|
|
279
|
+
} catch (err) {
|
|
280
|
+
console.error(err);
|
|
281
|
+
throw new Error(
|
|
282
|
+
`Failed to hardlink (or copy) "public" dir files from "${publicDir}" to "${targetDir}".`
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// src/index.ts
|
|
288
|
+
var import_path5 = require("path");
|
|
289
|
+
async function generateVercelBuildOutputAPI3Output({
|
|
290
|
+
gatsbyStoreState
|
|
291
|
+
}) {
|
|
292
|
+
const state = {
|
|
293
|
+
pages: Array.from(gatsbyStoreState.pages.entries()),
|
|
294
|
+
// must transform from a Map for validation
|
|
295
|
+
redirects: gatsbyStoreState.redirects,
|
|
296
|
+
functions: gatsbyStoreState.functions,
|
|
297
|
+
config: gatsbyStoreState.config
|
|
298
|
+
};
|
|
299
|
+
if (validateGatsbyState.Check(state)) {
|
|
300
|
+
console.log("\u25B2 Creating Vercel build output");
|
|
301
|
+
const { pages, redirects, functions, config: gatsbyConfig } = state;
|
|
302
|
+
const { pathPrefix = "" } = gatsbyConfig;
|
|
303
|
+
const ssrRoutes = pages.map((p) => p[1]).filter((page) => page.mode === "SSR" || page.mode === "DSG");
|
|
304
|
+
const ops = [];
|
|
305
|
+
if (functions.length > 0) {
|
|
306
|
+
ops.push(createAPIRoutes(functions, pathPrefix));
|
|
307
|
+
}
|
|
308
|
+
if (ssrRoutes.length > 0) {
|
|
309
|
+
ops.push(createServerlessFunctions(ssrRoutes, pathPrefix));
|
|
310
|
+
}
|
|
311
|
+
await Promise.all(ops);
|
|
312
|
+
await createStaticDir(pathPrefix);
|
|
313
|
+
let trailingSlash = void 0;
|
|
314
|
+
if (gatsbyConfig.trailingSlash === "always") {
|
|
315
|
+
trailingSlash = true;
|
|
316
|
+
} else if (gatsbyConfig.trailingSlash === "never") {
|
|
317
|
+
trailingSlash = false;
|
|
76
318
|
}
|
|
319
|
+
const routes = (0, import_routing_utils.getTransformedRoutes)({
|
|
320
|
+
trailingSlash,
|
|
321
|
+
redirects: redirects.map(({ fromPath, toPath, isPermanent }) => ({
|
|
322
|
+
source: fromPath,
|
|
323
|
+
destination: toPath,
|
|
324
|
+
permanent: isPermanent
|
|
325
|
+
}))
|
|
326
|
+
}).routes || [];
|
|
327
|
+
routes.push({
|
|
328
|
+
handle: "error"
|
|
329
|
+
});
|
|
330
|
+
if (pathPrefix) {
|
|
331
|
+
routes.push({
|
|
332
|
+
status: 404,
|
|
333
|
+
src: "^(?!/api).*$",
|
|
334
|
+
dest: (0, import_path5.join)(pathPrefix, "404.html")
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
routes.push({
|
|
338
|
+
status: 404,
|
|
339
|
+
src: "^(?!/api).*$",
|
|
340
|
+
dest: "404.html"
|
|
341
|
+
});
|
|
342
|
+
const config = {
|
|
343
|
+
version: 3,
|
|
344
|
+
routes: routes || void 0
|
|
345
|
+
};
|
|
346
|
+
await (0, import_fs_extra4.writeJson)(".vercel/output/config.json", config);
|
|
347
|
+
console.log("Vercel output has been generated");
|
|
348
|
+
} else {
|
|
349
|
+
const errors = [...validateGatsbyState.Errors(state)];
|
|
350
|
+
throw new Error(
|
|
351
|
+
`Gatsby state validation failed:
|
|
352
|
+
${errors.map(
|
|
353
|
+
(err) => ` - ${err.message}, got ${typeof err.value} (${JSON.stringify(
|
|
354
|
+
err.value
|
|
355
|
+
)}) at path "${err.path}"
|
|
356
|
+
`
|
|
357
|
+
).join(
|
|
358
|
+
""
|
|
359
|
+
)}Please check your Gatsby configuration files, or file an issue at https://vercel.com/help#issues`
|
|
360
|
+
);
|
|
361
|
+
}
|
|
77
362
|
}
|
|
78
|
-
|
|
79
|
-
|
|
363
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
364
|
+
0 && (module.exports = {
|
|
365
|
+
generateVercelBuildOutputAPI3Output
|
|
366
|
+
});
|
package/gatsby-node.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.onPostBuild =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
// validated by `pluginOptionSchema`
|
|
9
|
-
gatsbyStoreState: store.getState(),
|
|
10
|
-
});
|
|
1
|
+
const { generateVercelBuildOutputAPI3Output } = require('./dist/index.js');
|
|
2
|
+
|
|
3
|
+
exports.onPostBuild = async ({ store }) => {
|
|
4
|
+
await generateVercelBuildOutputAPI3Output({
|
|
5
|
+
// validated by `pluginOptionSchema`
|
|
6
|
+
gatsbyStoreState: store.getState(),
|
|
7
|
+
});
|
|
11
8
|
};
|
|
12
|
-
exports.onPostBuild = onPostBuild;
|
|
13
|
-
//# sourceMappingURL=gatsby-node.js.map
|
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/gatsby-plugin-vercel-builder",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
7
|
-
"
|
|
8
|
-
"gatsby-node.js"
|
|
9
|
-
"gatsby-node.js.map"
|
|
7
|
+
"templates",
|
|
8
|
+
"gatsby-node.js"
|
|
10
9
|
],
|
|
11
10
|
"repository": {
|
|
12
11
|
"type": "git",
|
|
@@ -15,8 +14,7 @@
|
|
|
15
14
|
},
|
|
16
15
|
"dependencies": {
|
|
17
16
|
"@sinclair/typebox": "0.25.24",
|
|
18
|
-
"@vercel/build-utils": "7.
|
|
19
|
-
"@vercel/node": "3.0.4",
|
|
17
|
+
"@vercel/build-utils": "7.2.1",
|
|
20
18
|
"@vercel/routing-utils": "3.0.0",
|
|
21
19
|
"esbuild": "0.14.47",
|
|
22
20
|
"etag": "1.8.1",
|
|
@@ -31,8 +29,6 @@
|
|
|
31
29
|
"typescript": "4.9.5"
|
|
32
30
|
},
|
|
33
31
|
"scripts": {
|
|
34
|
-
"build": "
|
|
35
|
-
"build:gatsby": "tsc -p tsconfig.gatsby.json",
|
|
36
|
-
"build:src": "tsc -p tsconfig.src.json"
|
|
32
|
+
"build": "node ../../utils/build-builder.mjs"
|
|
37
33
|
}
|
|
38
34
|
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import os from 'os';
|
|
2
|
+
import etag from 'etag';
|
|
3
|
+
import { parse } from 'url';
|
|
4
|
+
import { copySync, existsSync } from 'fs-extra';
|
|
5
|
+
import { join, dirname, basename } from 'path';
|
|
6
|
+
|
|
7
|
+
const TMP_DATA_PATH = join(os.tmpdir(), 'data/datastore');
|
|
8
|
+
const CUR_DATA_PATH = join(__dirname, '.cache/data/datastore');
|
|
9
|
+
|
|
10
|
+
if (!existsSync(TMP_DATA_PATH)) {
|
|
11
|
+
// Copies executable `data` files to the writable /tmp directory.
|
|
12
|
+
copySync(CUR_DATA_PATH, TMP_DATA_PATH);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async function getGraphQLEngine() {
|
|
16
|
+
const { GraphQLEngine } = await import(
|
|
17
|
+
join(__dirname, '.cache/query-engine/index.js')
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
return new GraphQLEngine({ dbPath: TMP_DATA_PATH });
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async function getPageSSRHelpers() {
|
|
24
|
+
return await import(join(__dirname, '.cache/page-ssr/index.js'));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default async function handler(req, res) {
|
|
28
|
+
let pageName;
|
|
29
|
+
const pathname = parse(req.url).pathname || '/';
|
|
30
|
+
const isPageData = pathname.startsWith('/page-data/');
|
|
31
|
+
if (isPageData) {
|
|
32
|
+
// /page-data/index/page-data.json
|
|
33
|
+
// /page-data/using-ssr/page-data.json
|
|
34
|
+
pageName = basename(dirname(pathname));
|
|
35
|
+
if (pageName === 'index') {
|
|
36
|
+
pageName = '/';
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
39
|
+
// /using-ssr
|
|
40
|
+
// /using-ssr/
|
|
41
|
+
// /using-ssr/index.html
|
|
42
|
+
pageName = basename(pathname);
|
|
43
|
+
if (pageName === 'index.html') {
|
|
44
|
+
pageName = basename(dirname(pathname));
|
|
45
|
+
}
|
|
46
|
+
if (!pageName) {
|
|
47
|
+
pageName = '/';
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const [graphqlEngine, { getData, renderHTML, renderPageData }] =
|
|
52
|
+
await Promise.all([getGraphQLEngine(), getPageSSRHelpers()]);
|
|
53
|
+
|
|
54
|
+
const data = await getData({
|
|
55
|
+
pathName: pageName,
|
|
56
|
+
graphqlEngine,
|
|
57
|
+
req,
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const results = isPageData
|
|
61
|
+
? await renderPageData({ data })
|
|
62
|
+
: await renderHTML({ data });
|
|
63
|
+
|
|
64
|
+
if (data.serverDataHeaders) {
|
|
65
|
+
for (const [name, value] of Object.entries(data.serverDataHeaders)) {
|
|
66
|
+
res.setHeader(name, value);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (data.serverDataStatus) {
|
|
71
|
+
res.statusCode = data.serverDataStatus;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (isPageData) {
|
|
75
|
+
res.setHeader('ETag', etag(JSON.stringify(results)));
|
|
76
|
+
res.json(results);
|
|
77
|
+
} else {
|
|
78
|
+
res.send(results);
|
|
79
|
+
}
|
|
80
|
+
}
|
package/dist/handlers/build.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export declare const writeHandler: ({ outDir, handlerFile, }: {
|
|
2
|
-
outDir: string;
|
|
3
|
-
handlerFile: string;
|
|
4
|
-
}) => Promise<import("esbuild").BuildResult | undefined>;
|
|
5
|
-
export declare const writeVCConfig: ({ functionDir, handler, }: {
|
|
6
|
-
functionDir: string;
|
|
7
|
-
handler?: string | undefined;
|
|
8
|
-
}) => Promise<void>;
|
|
9
|
-
export declare const writePrerenderConfig: (outputPath: string, group: number) => void;
|
|
10
|
-
export declare function copyFunctionLibs({ functionDir, }: {
|
|
11
|
-
functionDir: string;
|
|
12
|
-
}): Promise<void>;
|
|
13
|
-
export declare function copyHTMLFiles({ functionDir }: {
|
|
14
|
-
functionDir: string;
|
|
15
|
-
}): Promise<void>;
|
|
16
|
-
//# sourceMappingURL=build.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/handlers/build.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,YAAY;YAIf,MAAM;iBACD,MAAM;wDAqBpB,CAAC;AAEF,eAAO,MAAM,aAAa;iBAIX,MAAM;;mBAcpB,CAAC;AAEF,eAAO,MAAM,oBAAoB,eAAgB,MAAM,SAAS,MAAM,SAOrE,CAAC;AAEF,wBAAsB,gBAAgB,CAAC,EACrC,WAAW,GACZ,EAAE;IACD,WAAW,EAAE,MAAM,CAAC;CACrB,iBAsBA;AAED,wBAAsB,aAAa,CAAC,EAAE,WAAW,EAAE,EAAE;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,iBAe3E"}
|
package/dist/handlers/build.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.copyHTMLFiles = exports.copyFunctionLibs = exports.writePrerenderConfig = exports.writeVCConfig = exports.writeHandler = void 0;
|
|
4
|
-
const path_1 = require("path");
|
|
5
|
-
const build_utils_1 = require("@vercel/build-utils");
|
|
6
|
-
const esbuild_1 = require("esbuild");
|
|
7
|
-
const fs_extra_1 = require("fs-extra");
|
|
8
|
-
const writeHandler = async ({ outDir, handlerFile, }) => {
|
|
9
|
-
const { major } = await (0, build_utils_1.getNodeVersion)(process.cwd());
|
|
10
|
-
try {
|
|
11
|
-
return await (0, esbuild_1.build)({
|
|
12
|
-
entryPoints: [handlerFile],
|
|
13
|
-
loader: { '.ts': 'ts' },
|
|
14
|
-
outfile: (0, path_1.join)(outDir, 'index.js'),
|
|
15
|
-
format: 'cjs',
|
|
16
|
-
target: `node${major}`,
|
|
17
|
-
platform: 'node',
|
|
18
|
-
bundle: true,
|
|
19
|
-
minify: true,
|
|
20
|
-
define: {
|
|
21
|
-
'process.env.NODE_ENV': "'production'",
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
catch (e) {
|
|
26
|
-
console.error('Failed to build lambda handler', e.message);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
exports.writeHandler = writeHandler;
|
|
30
|
-
const writeVCConfig = async ({ functionDir, handler = 'index.js', }) => {
|
|
31
|
-
const { runtime } = await (0, build_utils_1.getNodeVersion)(process.cwd());
|
|
32
|
-
const config = {
|
|
33
|
-
runtime,
|
|
34
|
-
handler,
|
|
35
|
-
launcherType: 'Nodejs',
|
|
36
|
-
shouldAddHelpers: true,
|
|
37
|
-
};
|
|
38
|
-
const configPath = (0, path_1.join)(functionDir, '.vc-config.json');
|
|
39
|
-
await (0, fs_extra_1.writeJson)(configPath, config);
|
|
40
|
-
};
|
|
41
|
-
exports.writeVCConfig = writeVCConfig;
|
|
42
|
-
const writePrerenderConfig = (outputPath, group) => {
|
|
43
|
-
const config = {
|
|
44
|
-
group,
|
|
45
|
-
expiration: 600, // 10 minutes TODO: make this configurable?
|
|
46
|
-
};
|
|
47
|
-
(0, fs_extra_1.ensureFileSync)(outputPath);
|
|
48
|
-
return (0, fs_extra_1.writeFileSync)(outputPath, JSON.stringify(config));
|
|
49
|
-
};
|
|
50
|
-
exports.writePrerenderConfig = writePrerenderConfig;
|
|
51
|
-
async function copyFunctionLibs({ functionDir, }) {
|
|
52
|
-
/* Copies the required libs for Serverless Functions from .cache to the <name>.func folder */
|
|
53
|
-
await Promise.allSettled([
|
|
54
|
-
{
|
|
55
|
-
src: (0, path_1.join)('.cache', 'query-engine'),
|
|
56
|
-
dest: (0, path_1.join)(functionDir, '.cache', 'query-engine'),
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
src: (0, path_1.join)('.cache', 'page-ssr'),
|
|
60
|
-
dest: (0, path_1.join)(functionDir, '.cache', 'page-ssr'),
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
src: (0, path_1.join)('.cache', 'data', 'datastore'),
|
|
64
|
-
dest: (0, path_1.join)(functionDir, '.cache', 'data', 'datastore'),
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
src: (0, path_1.join)('.cache', 'caches'),
|
|
68
|
-
dest: (0, path_1.join)(functionDir, '.cache', 'caches'),
|
|
69
|
-
},
|
|
70
|
-
].map(({ src, dest }) => (0, fs_extra_1.copy)(src, dest)));
|
|
71
|
-
}
|
|
72
|
-
exports.copyFunctionLibs = copyFunctionLibs;
|
|
73
|
-
async function copyHTMLFiles({ functionDir }) {
|
|
74
|
-
/* If available, copies the 404.html and 500.html files to the <name>.func/lib folder */
|
|
75
|
-
for (const htmlFile of ['404', '500']) {
|
|
76
|
-
if (await (0, fs_extra_1.pathExists)((0, path_1.join)('public', `${htmlFile}.html`))) {
|
|
77
|
-
try {
|
|
78
|
-
await (0, fs_extra_1.copyFile)((0, path_1.join)('public', `${htmlFile}.html`), (0, path_1.join)(functionDir, `${htmlFile}.html`));
|
|
79
|
-
}
|
|
80
|
-
catch (e) {
|
|
81
|
-
console.error('Failed to copy HTML files', e.message);
|
|
82
|
-
process.exit(1);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
exports.copyHTMLFiles = copyHTMLFiles;
|
|
88
|
-
//# sourceMappingURL=build.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/handlers/build.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAC5B,qDAAqD;AACrD,qCAAgC;AAChC,uCAOkB;AAMX,MAAM,YAAY,GAAG,KAAK,EAAE,EACjC,MAAM,EACN,WAAW,GAIZ,EAAE,EAAE;IACH,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAA,4BAAc,EAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAEtD,IAAI;QACF,OAAO,MAAM,IAAA,eAAK,EAAC;YACjB,WAAW,EAAE,CAAC,WAAW,CAAC;YAC1B,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;YACvB,OAAO,EAAE,IAAA,WAAI,EAAC,MAAM,EAAE,UAAU,CAAC;YACjC,MAAM,EAAE,KAAK;YACb,MAAM,EAAE,OAAO,KAAK,EAAE;YACtB,QAAQ,EAAE,MAAM;YAChB,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE;gBACN,sBAAsB,EAAE,cAAc;aACvC;SACF,CAAC,CAAC;KACJ;IAAC,OAAO,CAAM,EAAE;QACf,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;KAC5D;AACH,CAAC,CAAC;AA1BW,QAAA,YAAY,gBA0BvB;AAEK,MAAM,aAAa,GAAG,KAAK,EAAE,EAClC,WAAW,EACX,OAAO,GAAG,UAAU,GAIrB,EAAE,EAAE;IACH,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,4BAAc,EAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAExD,MAAM,MAAM,GAAmC;QAC7C,OAAO;QACP,OAAO;QACP,YAAY,EAAE,QAAQ;QAC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AAQ,EAAE,QAAQ,CAAC;SAC5C;KACF,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAA,eAAI,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAC1C,CAAC;AACJ,CAAC;AA1BD,4CA0BC;AAEM,KAAK,UAAU,aAAa,CAAC,EAAE,WAAW,EAA2B;IAC1E,wFAAwF;IACxF,KAAK,MAAM,QAAQ,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE;QACrC,IAAI,MAAM,IAAA,qBAAU,EAAC,IAAA,WAAI,EAAC,QAAQ,EAAE,GAAG,QAAQ,OAAO,CAAC,CAAC,EAAE;YACxD,IAAI;gBACF,MAAM,IAAA,mBAAQ,EACZ,IAAA,WAAI,EAAC,QAAQ,EAAE,GAAG,QAAQ,OAAO,CAAC,EAClC,IAAA,WAAI,EAAC,WAAW,EAAE,GAAG,QAAQ,OAAO,CAAC,CACtC,CAAC;aACH;YAAC,OAAO,CAAM,EAAE;gBACf,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;gBACtD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACjB;SACF;KACF;AACH,CAAC;AAfD,sCAeC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ssr-handler.d.ts","sourceRoot":"","sources":["../../../src/handlers/templates/ssr-handler.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAUlE,wBAA8B,OAAO,CAAC,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,cAAc,iBAqD5E"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const os_1 = __importDefault(require("os"));
|
|
7
|
-
const etag_1 = __importDefault(require("etag"));
|
|
8
|
-
const url_1 = require("url");
|
|
9
|
-
const fs_extra_1 = require("fs-extra");
|
|
10
|
-
const path_1 = require("path");
|
|
11
|
-
const utils_1 = require("../utils");
|
|
12
|
-
const TMP_DATA_PATH = (0, path_1.join)(os_1.default.tmpdir(), 'data/datastore');
|
|
13
|
-
const CUR_DATA_PATH = (0, path_1.join)(__dirname, '.cache/data/datastore');
|
|
14
|
-
if (!(0, fs_extra_1.existsSync)(TMP_DATA_PATH)) {
|
|
15
|
-
// Copies executable `data` files to the writable /tmp directory.
|
|
16
|
-
(0, fs_extra_1.copySync)(CUR_DATA_PATH, TMP_DATA_PATH);
|
|
17
|
-
}
|
|
18
|
-
async function handler(req, res) {
|
|
19
|
-
let pageName;
|
|
20
|
-
const pathname = (0, url_1.parse)(req.url).pathname || '/';
|
|
21
|
-
const isPageData = pathname.startsWith('/page-data/');
|
|
22
|
-
if (isPageData) {
|
|
23
|
-
// /page-data/index/page-data.json
|
|
24
|
-
// /page-data/using-ssr/page-data.json
|
|
25
|
-
pageName = (0, path_1.basename)((0, path_1.dirname)(pathname));
|
|
26
|
-
if (pageName === 'index') {
|
|
27
|
-
pageName = '/';
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
// /using-ssr
|
|
32
|
-
// /using-ssr/
|
|
33
|
-
// /using-ssr/index.html
|
|
34
|
-
pageName = (0, path_1.basename)(pathname);
|
|
35
|
-
if (pageName === 'index.html') {
|
|
36
|
-
pageName = (0, path_1.basename)((0, path_1.dirname)(pathname));
|
|
37
|
-
}
|
|
38
|
-
if (!pageName) {
|
|
39
|
-
pageName = '/';
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
const [graphqlEngine, { getData, renderHTML, renderPageData }] = await Promise.all([(0, utils_1.getGraphQLEngine)(), (0, utils_1.getPageSSRHelpers)()]);
|
|
43
|
-
const data = await getData({
|
|
44
|
-
pathName: pageName,
|
|
45
|
-
graphqlEngine,
|
|
46
|
-
req,
|
|
47
|
-
});
|
|
48
|
-
const results = isPageData
|
|
49
|
-
? await renderPageData({ data })
|
|
50
|
-
: await renderHTML({ data });
|
|
51
|
-
if (data.serverDataHeaders) {
|
|
52
|
-
for (const [name, value] of Object.entries(data.serverDataHeaders)) {
|
|
53
|
-
res.setHeader(name, value);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
if (data.serverDataStatus) {
|
|
57
|
-
res.statusCode = data.serverDataStatus;
|
|
58
|
-
}
|
|
59
|
-
if (isPageData) {
|
|
60
|
-
res.setHeader('ETag', (0, etag_1.default)(JSON.stringify(results)));
|
|
61
|
-
res.json(results);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
res.send(results);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
exports.default = handler;
|
|
68
|
-
//# sourceMappingURL=ssr-handler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ssr-handler.js","sourceRoot":"","sources":["../../../src/handlers/templates/ssr-handler.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,6BAA4B;AAC5B,uCAAgD;AAChD,+BAA+C;AAC/C,oCAA+D;AAG/D,MAAM,aAAa,GAAG,IAAA,WAAI,EAAC,YAAE,CAAC,MAAM,EAAE,EAAE,gBAAgB,CAAC,CAAC;AAC1D,MAAM,aAAa,GAAG,IAAA,WAAI,EAAC,SAAS,EAAE,uBAAuB,CAAC,CAAC;AAE/D,IAAI,CAAC,IAAA,qBAAU,EAAC,aAAa,CAAC,EAAE;IAC9B,iEAAiE;IACjE,IAAA,mBAAQ,EAAC,aAAa,EAAE,aAAa,CAAC,CAAC;CACxC;AAEc,KAAK,UAAU,OAAO,CAAC,GAAkB,EAAE,GAAmB;IAC3E,IAAI,QAAgB,CAAC;IACrB,MAAM,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AC,IAAI,CAAC,iBAAiB,CAAC,EAAE;YAClE,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,KAAe,CAAC,CAAC;SACtC;KACF;IAED,IAAI,IAAI,CAAC,gBAAgB,EAAE;QACzB,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC;KACxC;IAED,IAAI,UAAU,EAAE;QACd,GAAG,CAAC,SAAS,CAAC,MAAM,EAAE,IAAA,cAAI,EAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACrD,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KACnB;SAAM;QACL,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KACnB;AACH,CAAC;AArDD,0BAqDC"}
|
package/dist/handlers/utils.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/handlers/utils.ts"],"names":[],"mappings":"AAKA,wBAAsB,gBAAgB,iBAMrC;AAED,wBAAsB,iBAAiB,iBAEtC"}
|
package/dist/handlers/utils.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
var _a, _b;
|
|
29
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.getPageSSRHelpers = exports.getGraphQLEngine = void 0;
|
|
31
|
-
const path_1 = require("path");
|
|
32
|
-
const os_1 = __importDefault(require("os"));
|
|
33
|
-
const TMP_DATA_PATH = (0, path_1.join)(os_1.default.tmpdir(), 'data/datastore');
|
|
34
|
-
async function getGraphQLEngine() {
|
|
35
|
-
const { GraphQLEngine } = await (_a = (0, path_1.join)(__dirname, '.cache/query-engine/index.js'), Promise.resolve().then(() => __importStar(require(_a))));
|
|
36
|
-
return new GraphQLEngine({ dbPath: TMP_DATA_PATH });
|
|
37
|
-
}
|
|
38
|
-
exports.getGraphQLEngine = getGraphQLEngine;
|
|
39
|
-
async function getPageSSRHelpers() {
|
|
40
|
-
return await (_b = (0, path_1.join)(__dirname, '.cache/page-ssr/index.js'), Promise.resolve().then(() => __importStar(require(_b))));
|
|
41
|
-
}
|
|
42
|
-
exports.getPageSSRHelpers = getPageSSRHelpers;
|
|
43
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/handlers/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA4B;AAC5B,4CAAoB;AAEpB,MAAM,aAAa,GAAG,IAAA,WAAI,EAAC,YAAE,CAAC,MAAM,EAAE,EAAE,gBAAgB,CAAC,CAAC;AAEnD,KAAK,UAAU,gBAAgB;IACpC,MAAM,EAAE,aAAa,EAAE,GAAG,YACxB,IAAA,WAAI,EAAC,SAAS,EAAE,8BAA8B,CAAC,0DAChD,CAAC;IAEF,OAAO,IAAI,aAAa,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;AACtD,CAAC;AAND,4CAMC;AAEM,KAAK,UAAU,iBAAiB;IACrC,OAAO,YAAa,IAAA,WAAI,EAAC,SAAS,EAAE,0BAA0B,CAAC,0DAAC,CAAC;AACnE,CAAC;AAFD,8CAEC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { GatsbyFunction, GatsbyPage } from '../schemas';
|
|
2
|
-
/**
|
|
3
|
-
* Gatsby SSR/DSG on Vercel is enabled through Vercel Serverless Functions.
|
|
4
|
-
* This plugin creates one Serverless Function called `_ssr.func` that is used by SSR and DSG pages through symlinks.
|
|
5
|
-
* DSG is enabled through prerender functions.
|
|
6
|
-
*/
|
|
7
|
-
export declare function createServerlessFunctions(ssrRoutes: GatsbyPage[], prefix?: string): Promise<void>;
|
|
8
|
-
export declare function createAPIRoutes(functions: GatsbyFunction[], prefix?: string): Promise<void>;
|
|
9
|
-
//# sourceMappingURL=functions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../src/helpers/functions.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7D;;;;GAIG;AACH,wBAAsB,yBAAyB,CAC7C,SAAS,EAAE,UAAU,EAAE,EACvB,MAAM,CAAC,EAAE,MAAM,iBAoEhB;AAED,wBAAsB,eAAe,CACnC,SAAS,EAAE,cAAc,EAAE,EAC3B,MAAM,CAAC,EAAE,MAAM,iBAkBhB"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createAPIRoutes = exports.createServerlessFunctions = void 0;
|
|
4
|
-
const path_1 = require("path");
|
|
5
|
-
const fs_extra_1 = require("fs-extra");
|
|
6
|
-
const symlink_1 = require("../utils/symlink");
|
|
7
|
-
const build_1 = require("../handlers/build");
|
|
8
|
-
/**
|
|
9
|
-
* Gatsby SSR/DSG on Vercel is enabled through Vercel Serverless Functions.
|
|
10
|
-
* This plugin creates one Serverless Function called `_ssr.func` that is used by SSR and DSG pages through symlinks.
|
|
11
|
-
* DSG is enabled through prerender functions.
|
|
12
|
-
*/
|
|
13
|
-
async function createServerlessFunctions(ssrRoutes, prefix) {
|
|
14
|
-
let functionName;
|
|
15
|
-
let functionDir;
|
|
16
|
-
const handlerFile = (0, path_1.join)(__dirname, '../handlers/templates/ssr-handler.js');
|
|
17
|
-
await Promise.all(ssrRoutes.map(async (page, index) => {
|
|
18
|
-
let pathName = page.path;
|
|
19
|
-
// HTML renderer
|
|
20
|
-
const ssrPath = (0, path_1.join)(prefix ?? '', pathName, 'index.html');
|
|
21
|
-
if (index === 0) {
|
|
22
|
-
// For the first page, create the SSR Serverless Function
|
|
23
|
-
functionName = `${ssrPath}.func`;
|
|
24
|
-
functionDir = (0, path_1.join)('.vercel/output/functions', functionName);
|
|
25
|
-
await (0, fs_extra_1.ensureDir)(functionDir);
|
|
26
|
-
await Promise.all([
|
|
27
|
-
(0, build_1.writeHandler)({ outDir: functionDir, handlerFile }),
|
|
28
|
-
(0, build_1.copyFunctionLibs)({ functionDir }),
|
|
29
|
-
(0, build_1.copyHTMLFiles)({ functionDir }),
|
|
30
|
-
(0, build_1.writeVCConfig)({ functionDir }),
|
|
31
|
-
]);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
// If it's not the first page, then symlink to the first function
|
|
35
|
-
await (0, symlink_1.createSymlink)(ssrPath, functionName);
|
|
36
|
-
}
|
|
37
|
-
if (page.mode === 'DSG') {
|
|
38
|
-
(0, build_1.writePrerenderConfig)((0, path_1.join)('.vercel', 'output', 'functions', `${ssrPath}.prerender-config.json`), index + 1);
|
|
39
|
-
}
|
|
40
|
-
// page-data renderer
|
|
41
|
-
if (!pathName || pathName === '/') {
|
|
42
|
-
pathName = 'index';
|
|
43
|
-
}
|
|
44
|
-
const pageDataPath = (0, path_1.join)(prefix ?? '', 'page-data', pathName, 'page-data.json');
|
|
45
|
-
await (0, symlink_1.createSymlink)(pageDataPath, functionName);
|
|
46
|
-
if (page.mode === 'DSG') {
|
|
47
|
-
(0, build_1.writePrerenderConfig)((0, path_1.join)('.vercel', 'output', 'functions', `${pageDataPath}.prerender-config.json`), index + 1);
|
|
48
|
-
}
|
|
49
|
-
}));
|
|
50
|
-
}
|
|
51
|
-
exports.createServerlessFunctions = createServerlessFunctions;
|
|
52
|
-
async function createAPIRoutes(functions, prefix) {
|
|
53
|
-
const apiDir = (0, path_1.join)('.vercel', 'output', 'functions', 'api', prefix ?? '');
|
|
54
|
-
await (0, fs_extra_1.ensureDir)(apiDir);
|
|
55
|
-
await Promise.allSettled(functions.map(async (func) => {
|
|
56
|
-
const apiRouteDir = `${apiDir}/${func.functionRoute}.func`;
|
|
57
|
-
const handlerFile = func.originalAbsoluteFilePath;
|
|
58
|
-
await (0, fs_extra_1.ensureDir)(apiRouteDir);
|
|
59
|
-
await Promise.all([
|
|
60
|
-
(0, build_1.writeHandler)({ outDir: apiRouteDir, handlerFile }),
|
|
61
|
-
(0, build_1.writeVCConfig)({ functionDir: apiRouteDir }),
|
|
62
|
-
]);
|
|
63
|
-
}));
|
|
64
|
-
}
|
|
65
|
-
exports.createAPIRoutes = createAPIRoutes;
|
|
66
|
-
//# sourceMappingURL=functions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/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,EAAC,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;SAC5C,CAAC,CAAC;IACL,CAAC,CAAC,CACH,CAAC;AACJ,CAAC;AApBD,0CAoBC"}
|
package/dist/helpers/static.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"static.d.ts","sourceRoot":"","sources":["../../src/helpers/static.ts"],"names":[],"mappings":"AAGA,wBAAsB,eAAe,CAAC,MAAM,CAAC,EAAE,MAAM,iBAkBpD"}
|
package/dist/helpers/static.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createStaticDir = void 0;
|
|
4
|
-
const path_1 = require("path");
|
|
5
|
-
const build_utils_1 = require("@vercel/build-utils");
|
|
6
|
-
async function createStaticDir(prefix) {
|
|
7
|
-
const publicDir = (0, path_1.join)(process.cwd(), 'public');
|
|
8
|
-
const targetDir = (0, path_1.join)(process.cwd(), '.vercel', 'output', 'static', prefix ?? '');
|
|
9
|
-
try {
|
|
10
|
-
await (0, build_utils_1.hardLinkDir)(publicDir, [targetDir]);
|
|
11
|
-
}
|
|
12
|
-
catch (err) {
|
|
13
|
-
console.error(err);
|
|
14
|
-
throw new Error(`Failed to hardlink (or copy) "public" dir files from "${publicDir}" to "${targetDir}".`);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
exports.createStaticDir = createStaticDir;
|
|
18
|
-
//# sourceMappingURL=static.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"static.js","sourceRoot":"","sources":["../../src/helpers/static.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAC5B,qDAAkD;AAE3C,KAAK,UAAU,eAAe,CAAC,MAAe;IACnD,MAAM,SAAS,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC;IAChD,MAAM,SAAS,GAAG,IAAA,WAAI,EACpB,OAAO,CAAC,GAAG,EAAE,EACb,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,MAAM,IAAI,EAAE,CACb,CAAC;IAEF,IAAI;QACF,MAAM,IAAA,yBAAW,EAAC,SAAS,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;KAC3C;IAAC,OAAO,GAAQ,EAAE;QACjB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnB,MAAM,IAAI,KAAK,CACb,yDAAyD,SAAS,SAAS,SAAS,IAAI,CACzF,CAAC;KACH;AACH,CAAC;AAlBD,0CAkBC"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export interface GenerateVercelBuildOutputAPI3OutputOptions {
|
|
2
|
-
gatsbyStoreState: {
|
|
3
|
-
pages: Map<string, unknown>;
|
|
4
|
-
redirects: unknown;
|
|
5
|
-
functions: unknown;
|
|
6
|
-
config: unknown;
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
export declare function generateVercelBuildOutputAPI3Output({ gatsbyStoreState, }: GenerateVercelBuildOutputAPI3OutputOptions): Promise<void>;
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,0CAA0C;IACzD,gBAAgB,EAAE;QAChB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC5B,SAAS,EAAE,OAAO,CAAC;QACnB,SAAS,EAAE,OAAO,CAAC;QACnB,MAAM,EAAE,OAAO,CAAC;KACjB,CAAC;CACH;AAED,wBAAsB,mCAAmC,CAAC,EACxD,gBAAgB,GACjB,EAAE,0CAA0C,iBAwF5C"}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceR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AM,MAAM,GAAG,CAAC,GAAG,6BAAmB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACtD,MAAM,IAAI,KAAK,CACb,oCAAoC,MAAM;aACvC,GAAG,CACF,GAAG,CAAC,EAAE,CACJ,OAAO,GAAG,CAAC,OAAO,SAAS,OAAO,GAAG,CAAC,KAAK,KAAK,IAAI,CAAC,SAAS,CAC5D,GAAG,CAAC,KAAK,CACV,cAAc,GAAG,CAAC,IAAI,KAAK,CAC/B;aACA,IAAI,CACH,EAAE,CACH,kGAAkG,CACtG,CAAC;KACH;AACH,CAAC;AA1FD,kFA0FC"}
|
package/dist/schemas.d.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { Static } from '@sinclair/typebox';
|
|
2
|
-
declare const GatsbyPageSchema: import("@sinclair/typebox").TObject<{
|
|
3
|
-
mode: import("@sinclair/typebox").TUnsafe<"SSG" | "DSG" | "SSR">;
|
|
4
|
-
path: import("@sinclair/typebox").TString<string>;
|
|
5
|
-
}>;
|
|
6
|
-
export type GatsbyPage = Static<typeof GatsbyPageSchema>;
|
|
7
|
-
declare const GatsbyFunctionSchema: import("@sinclair/typebox").TObject<{
|
|
8
|
-
functionRoute: import("@sinclair/typebox").TString<string>;
|
|
9
|
-
originalAbsoluteFilePath: import("@sinclair/typebox").TString<string>;
|
|
10
|
-
}>;
|
|
11
|
-
export type GatsbyFunction = Static<typeof GatsbyFunctionSchema>;
|
|
12
|
-
declare const GatsbyRedirectSchema: import("@sinclair/typebox").TObject<{
|
|
13
|
-
fromPath: import("@sinclair/typebox").TString<string>;
|
|
14
|
-
toPath: import("@sinclair/typebox").TString<string>;
|
|
15
|
-
isPermanent: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
16
|
-
}>;
|
|
17
|
-
export type GatsbyRedirect = Static<typeof GatsbyRedirectSchema>;
|
|
18
|
-
declare const GatsbyConfigSchema: import("@sinclair/typebox").TObject<{
|
|
19
|
-
trailingSlash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnsafe<"always" | "never" | "ignore" | "legacy">>;
|
|
20
|
-
pathPrefix: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString<string>>;
|
|
21
|
-
}>;
|
|
22
|
-
export type GatsbyConfig = Static<typeof GatsbyConfigSchema>;
|
|
23
|
-
declare const GatsbyStateSchema: import("@sinclair/typebox").TObject<{
|
|
24
|
-
pages: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TString<string>, import("@sinclair/typebox").TObject<{
|
|
25
|
-
mode: import("@sinclair/typebox").TUnsafe<"SSG" | "DSG" | "SSR">;
|
|
26
|
-
path: import("@sinclair/typebox").TString<string>;
|
|
27
|
-
}>]>>;
|
|
28
|
-
redirects: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
29
|
-
fromPath: import("@sinclair/typebox").TString<string>;
|
|
30
|
-
toPath: import("@sinclair/typebox").TString<string>;
|
|
31
|
-
isPermanent: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
32
|
-
}>>;
|
|
33
|
-
functions: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
34
|
-
functionRoute: import("@sinclair/typebox").TString<string>;
|
|
35
|
-
originalAbsoluteFilePath: import("@sinclair/typebox").TString<string>;
|
|
36
|
-
}>>;
|
|
37
|
-
config: import("@sinclair/typebox").TObject<{
|
|
38
|
-
trailingSlash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnsafe<"always" | "never" | "ignore" | "legacy">>;
|
|
39
|
-
pathPrefix: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString<string>>;
|
|
40
|
-
}>;
|
|
41
|
-
}>;
|
|
42
|
-
export type GatsbyState = Static<typeof GatsbyStateSchema>;
|
|
43
|
-
export declare const validateGatsbyState: import("@sinclair/typebox/compiler").TypeCheck<import("@sinclair/typebox").TObject<{
|
|
44
|
-
pages: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TString<string>, import("@sinclair/typebox").TObject<{
|
|
45
|
-
mode: import("@sinclair/typebox").TUnsafe<"SSG" | "DSG" | "SSR">;
|
|
46
|
-
path: import("@sinclair/typebox").TString<string>;
|
|
47
|
-
}>]>>;
|
|
48
|
-
redirects: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
49
|
-
fromPath: import("@sinclair/typebox").TString<string>;
|
|
50
|
-
toPath: import("@sinclair/typebox").TString<string>;
|
|
51
|
-
isPermanent: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
52
|
-
}>>;
|
|
53
|
-
functions: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
54
|
-
functionRoute: import("@sinclair/typebox").TString<string>;
|
|
55
|
-
originalAbsoluteFilePath: import("@sinclair/typebox").TString<string>;
|
|
56
|
-
}>>;
|
|
57
|
-
config: import("@sinclair/typebox").TObject<{
|
|
58
|
-
trailingSlash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnsafe<"always" | "never" | "ignore" | "legacy">>;
|
|
59
|
-
pathPrefix: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString<string>>;
|
|
60
|
-
}>;
|
|
61
|
-
}>>;
|
|
62
|
-
export {};
|
|
63
|
-
//# sourceMappingURL=schemas.d.ts.map
|
package/dist/schemas.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAc,MAAM,mBAAmB,CAAC;AAgBvD,QAAA,MAAM,gBAAgB;;;EAGpB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEzD,QAAA,MAAM,oBAAoB;;;EAGxB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAGjE,QAAA,MAAM,oBAAoB;;;;EAIxB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEjE,QAAA,MAAM,kBAAkB;;;EAKtB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE7D,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;EAKrB,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE3D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;GAA0C,CAAC"}
|
package/dist/schemas.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateGatsbyState = void 0;
|
|
4
|
-
const typebox_1 = require("@sinclair/typebox");
|
|
5
|
-
const custom_1 = require("@sinclair/typebox/custom");
|
|
6
|
-
const compiler_1 = require("@sinclair/typebox/compiler");
|
|
7
|
-
custom_1.Custom.Set('StringEnum', (schema, value) => {
|
|
8
|
-
return schema.enum.includes(value);
|
|
9
|
-
});
|
|
10
|
-
function StringEnum(values) {
|
|
11
|
-
return typebox_1.Type.Unsafe({
|
|
12
|
-
[typebox_1.Kind]: 'StringEnum',
|
|
13
|
-
type: 'string',
|
|
14
|
-
enum: values,
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
const GatsbyPageSchema = typebox_1.Type.Object({
|
|
18
|
-
mode: StringEnum(['SSG', 'DSG', 'SSR']),
|
|
19
|
-
path: typebox_1.Type.String(),
|
|
20
|
-
});
|
|
21
|
-
const GatsbyFunctionSchema = typebox_1.Type.Object({
|
|
22
|
-
functionRoute: typebox_1.Type.String(),
|
|
23
|
-
originalAbsoluteFilePath: typebox_1.Type.String(),
|
|
24
|
-
});
|
|
25
|
-
compiler_1.TypeCompiler.Compile(GatsbyFunctionSchema);
|
|
26
|
-
const GatsbyRedirectSchema = typebox_1.Type.Object({
|
|
27
|
-
fromPath: typebox_1.Type.String(),
|
|
28
|
-
toPath: typebox_1.Type.String(),
|
|
29
|
-
isPermanent: typebox_1.Type.Optional(typebox_1.Type.Boolean()),
|
|
30
|
-
});
|
|
31
|
-
const GatsbyConfigSchema = typebox_1.Type.Object({
|
|
32
|
-
trailingSlash: typebox_1.Type.Optional(StringEnum(['always', 'never', 'ignore', 'legacy'])),
|
|
33
|
-
pathPrefix: typebox_1.Type.Optional(typebox_1.Type.String()),
|
|
34
|
-
});
|
|
35
|
-
const GatsbyStateSchema = typebox_1.Type.Object({
|
|
36
|
-
pages: typebox_1.Type.Array(typebox_1.Type.Tuple([typebox_1.Type.String(), GatsbyPageSchema])),
|
|
37
|
-
redirects: typebox_1.Type.Array(GatsbyRedirectSchema),
|
|
38
|
-
functions: typebox_1.Type.Array(GatsbyFunctionSchema),
|
|
39
|
-
config: GatsbyConfigSchema,
|
|
40
|
-
});
|
|
41
|
-
exports.validateGatsbyState = compiler_1.TypeCompiler.Compile(GatsbyStateSchema);
|
|
42
|
-
//# sourceMappingURL=schemas.js.map
|
package/dist/schemas.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":";;;AAAA,+CAAuD;AACvD,qDAAkD;AAClD,yDAA0D;AAE1D,eAAM,CAAC,GAAG,CAAqB,YAAY,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;IAC7D,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAe,CAAC,CAAC;AAC/C,CAAC,CAAC,CAAC;AAEH,SAAS,UAAU,CAAqB,MAAc;IACpD,OAAO,cAAI,CAAC,MAAM,CAAY;QAC5B,CAAC,cAAI,CAAC,EAAE,YAAY;QACpB,IAAI,EAAE,QAAQ;QACd,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IAC3C,MAAM,EAAE,kBAAkB;CAC3B,CAAC,CAAC;AAGU,QAAA,mBAAmB,GAAG,uBAAY,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC"}
|
package/dist/utils/symlink.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"symlink.d.ts","sourceRoot":"","sources":["../../src/utils/symlink.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa,aAAoB,MAAM,YAAY,MAAM,kBAarE,CAAC"}
|
package/dist/utils/symlink.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.createSymlink = void 0;
|
|
27
|
-
const path_1 = __importStar(require("path"));
|
|
28
|
-
const fs_extra_1 = require("fs-extra");
|
|
29
|
-
const removeTrailingSlash = (str) => str.replace(/\/$/, '');
|
|
30
|
-
const createSymlink = async (pathName, destName) => {
|
|
31
|
-
const functionName = removeTrailingSlash(pathName).split(path_1.sep).pop();
|
|
32
|
-
const dirPath = removeTrailingSlash((0, path_1.join)('.vercel', 'output', 'functions', (0, path_1.normalize)((0, path_1.join)(pathName, '..'))));
|
|
33
|
-
await (0, fs_extra_1.ensureDir)(dirPath);
|
|
34
|
-
(0, fs_extra_1.symlinkSync)(path_1.default.relative(dirPath, (0, path_1.join)('.vercel', 'output', 'functions', destName)), path_1.default.join(dirPath, `${functionName}.func`));
|
|
35
|
-
};
|
|
36
|
-
exports.createSymlink = createSymlink;
|
|
37
|
-
//# sourceMappingURL=symlink.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"symlink.js","sourceRoot":"","sources":["../../src/utils/symlink.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAkD;AAClD,uCAAkD;AAElD,MAAM,mBAAmB,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAE7D,MAAM,aAAa,GAAG,KAAK,EAAE,QAAgB,EAAE,QAAgB,EAAE,EAAE;IACxE,MAAM,YAAY,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,UAAG,CAAC,CAAC,GAAG,EAAE,CAAC;IAEpE,MAAM,OAAO,GAAG,mBAAmB,CACjC,IAAA,WAAI,EAAC,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAA,gBAAS,EAAC,IAAA,WAAI,EAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CACxE,CAAC;IAEF,MAAM,IAAA,oBAAS,EAAC,OAAO,CAAC,CAAC;IAEzB,IAAA,sBAAW,EACT,cAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAA,WAAI,EAAC,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC,EACxE,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,YAAY,OAAO,CAAC,CAC3C,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,aAAa,iBAaxB"}
|
package/gatsby-node.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gatsby-node.js","sourceRoot":"","sources":["gatsby-node.ts"],"names":[],"mappings":";;;AAAA,qEAAqE;AACrE,iCAA6D;AAEtD,MAAM,WAAW,GAAG,KAAK,EAAE,EAAE,KAAK,EAAkB,EAAE,EAAE;IAC7D,MAAM,IAAA,0CAAmC,EAAC;QACxC,oCAAoC;QACpC,gBAAgB,EAAE,KAAK,CAAC,QAAQ,EAAE;KACnC,CAAC,CAAC;AACL,CAAC,CAAC;AALW,QAAA,WAAW,eAKtB"}
|
package/gatsby-node.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// this gets built separately, so import from "dist" instead of "src"
|
|
2
|
-
import { generateVercelBuildOutputAPI3Output } from './dist';
|
|
3
|
-
|
|
4
|
-
export const onPostBuild = async ({ store }: { store: any }) => {
|
|
5
|
-
await generateVercelBuildOutputAPI3Output({
|
|
6
|
-
// validated by `pluginOptionSchema`
|
|
7
|
-
gatsbyStoreState: store.getState(),
|
|
8
|
-
});
|
|
9
|
-
};
|