@vercel/static-build 0.18.1-canary.1 → 0.22.2-canary.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/LICENSE +202 -190
- package/dist/index.js +9917 -1850
- package/dist/utils/gatsby.js +3 -1
- package/dist/utils/nuxt.js +31 -0
- package/dist/utils/read-build-output.js +148 -58
- package/package.json +9 -6
- package/dist/bridge.js +0 -178
- package/dist/build-utils.js +0 -11
- package/dist/frameworks.js +0 -601
- package/dist/launcher.js +0 -130
package/dist/frameworks.js
DELETED
|
@@ -1,601 +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
|
-
exports.frameworks = void 0;
|
|
7
|
-
const fs_1 = require("fs");
|
|
8
|
-
const path_1 = require("path");
|
|
9
|
-
const build_utils_1 = require("@vercel/build-utils");
|
|
10
|
-
const frameworks_1 = __importDefault(require("@vercel/frameworks"));
|
|
11
|
-
const { readdir, stat, readFile, unlink } = fs_1.promises;
|
|
12
|
-
const isDir = async (file) => (await stat(file)).isDirectory();
|
|
13
|
-
// Please note that is extremely important
|
|
14
|
-
// that the `dependency` property needs
|
|
15
|
-
// to reference a CLI. This is needed because
|
|
16
|
-
// you might want (for example) a Gatsby
|
|
17
|
-
// site that is powered by Preact, so you
|
|
18
|
-
// can't look for the `preact` dependency.
|
|
19
|
-
// Instead, you need to look for `preact-cli`
|
|
20
|
-
// when optimizing Preact CLI projects.
|
|
21
|
-
const frameworkList = [
|
|
22
|
-
{
|
|
23
|
-
name: 'Gatsby.js',
|
|
24
|
-
slug: 'gatsby',
|
|
25
|
-
dependency: 'gatsby',
|
|
26
|
-
buildCommand: 'gatsby build',
|
|
27
|
-
getOutputDirName: async () => 'public',
|
|
28
|
-
defaultRoutes: async (dirPrefix) => {
|
|
29
|
-
// This file could be generated by gatsby-plugin-now or gatsby-plugin-zeit-now
|
|
30
|
-
try {
|
|
31
|
-
const nowRoutesPath = path_1.join(dirPrefix, 'public', '__now_routes_g4t5bY.json');
|
|
32
|
-
const content = await readFile(nowRoutesPath, 'utf8');
|
|
33
|
-
const nowRoutes = JSON.parse(content);
|
|
34
|
-
try {
|
|
35
|
-
await unlink(nowRoutesPath);
|
|
36
|
-
}
|
|
37
|
-
catch (err) {
|
|
38
|
-
// do nothing if deleting the file fails
|
|
39
|
-
}
|
|
40
|
-
return nowRoutes;
|
|
41
|
-
}
|
|
42
|
-
catch (err) {
|
|
43
|
-
// if the file doesn't exist, we implement gatsby's recommendations
|
|
44
|
-
// https://www.gatsbyjs.org/docs/caching
|
|
45
|
-
return [
|
|
46
|
-
{
|
|
47
|
-
src: '^/static/(.*)$',
|
|
48
|
-
headers: { 'cache-control': 'public,max-age=31536000,immutable' },
|
|
49
|
-
continue: true,
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
src: '^/.*\\.(js|css)$',
|
|
53
|
-
headers: { 'cache-control': 'public,max-age=31536000,immutable' },
|
|
54
|
-
continue: true,
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
src: '^/(sw\\.js|app-data\\.json|.*\\.html|page-data/.*)$',
|
|
58
|
-
headers: { 'cache-control': 'public,max-age=0,must-revalidate' },
|
|
59
|
-
continue: true,
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
handle: 'filesystem',
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
src: '.*',
|
|
66
|
-
status: 404,
|
|
67
|
-
dest: '404.html',
|
|
68
|
-
},
|
|
69
|
-
];
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
cachePattern: '{.cache,public}/**',
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
name: 'Hexo',
|
|
76
|
-
slug: 'hexo',
|
|
77
|
-
dependency: 'hexo',
|
|
78
|
-
buildCommand: 'hexo generate',
|
|
79
|
-
getOutputDirName: async () => 'public',
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
name: 'Eleventy',
|
|
83
|
-
slug: 'eleventy',
|
|
84
|
-
dependency: '@11ty/eleventy',
|
|
85
|
-
buildCommand: 'npx @11ty/eleventy',
|
|
86
|
-
getOutputDirName: async () => '_site',
|
|
87
|
-
cachePattern: '.cache/**',
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
name: 'Docusaurus 2',
|
|
91
|
-
slug: 'docusaurus-2',
|
|
92
|
-
dependency: '@docusaurus/core',
|
|
93
|
-
buildCommand: 'docusaurus build',
|
|
94
|
-
getOutputDirName: async (dirPrefix) => {
|
|
95
|
-
const base = 'build';
|
|
96
|
-
try {
|
|
97
|
-
const location = path_1.join(dirPrefix, base);
|
|
98
|
-
const content = await readdir(location);
|
|
99
|
-
// If there is only one file in it that is a dir we'll use it as dist dir
|
|
100
|
-
if (content.length === 1 && (await isDir(path_1.join(location, content[0])))) {
|
|
101
|
-
return path_1.join(base, content[0]);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
catch (error) {
|
|
105
|
-
build_utils_1.debug(`Error detecting output directory: `, error);
|
|
106
|
-
}
|
|
107
|
-
return base;
|
|
108
|
-
},
|
|
109
|
-
defaultRoutes: [
|
|
110
|
-
{
|
|
111
|
-
src: '^/[^./]+\\.[0-9a-f]{8}\\.(css|js)$',
|
|
112
|
-
headers: { 'cache-control': 'max-age=31536000, immutable' },
|
|
113
|
-
continue: true,
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
src: '^/assets/images/[^/]+-[0-9a-f]{32}\\.(ico|svg|jpg|jpeg|png|gif|webp)$',
|
|
117
|
-
headers: { 'cache-control': 'max-age=31536000, immutable' },
|
|
118
|
-
continue: true,
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
src: '^/assets/medias/[^/]+-[0-9a-f]{32}\\.(ogv|wav|mp3|m4a|aac|oga|flac)$',
|
|
122
|
-
headers: { 'cache-control': 'max-age=31536000, immutable' },
|
|
123
|
-
continue: true,
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
src: '^/assets/files/[^/]+-[0-9a-f]{32}\\.(pdf|doc|docx|xls|xlsx|zip|rar)$',
|
|
127
|
-
headers: { 'cache-control': 'max-age=31536000, immutable' },
|
|
128
|
-
continue: true,
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
src: '^/ideal-img/[^/]+\\.[0-9a-f]{7}\\.\\d+\\.(png|jpe?g|gif)$',
|
|
132
|
-
headers: { 'cache-control': 'max-age=31536000, immutable' },
|
|
133
|
-
continue: true,
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
handle: 'filesystem',
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
src: '.*',
|
|
140
|
-
status: 404,
|
|
141
|
-
dest: '404.html',
|
|
142
|
-
},
|
|
143
|
-
],
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
name: 'Preact',
|
|
147
|
-
slug: 'preact',
|
|
148
|
-
dependency: 'preact-cli',
|
|
149
|
-
buildCommand: 'preact build',
|
|
150
|
-
getOutputDirName: async () => 'build',
|
|
151
|
-
defaultRoutes: [
|
|
152
|
-
{
|
|
153
|
-
handle: 'filesystem',
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
src: '/(.*)',
|
|
157
|
-
dest: '/index.html',
|
|
158
|
-
},
|
|
159
|
-
],
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
name: 'Dojo',
|
|
163
|
-
slug: 'dojo',
|
|
164
|
-
dependency: '@dojo/cli',
|
|
165
|
-
buildCommand: 'dojo build',
|
|
166
|
-
getOutputDirName: async () => path_1.join('output', 'dist'),
|
|
167
|
-
defaultRoutes: [
|
|
168
|
-
{
|
|
169
|
-
handle: 'filesystem',
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
src: '/service-worker.js',
|
|
173
|
-
headers: { 'cache-control': 's-maxage=0' },
|
|
174
|
-
continue: true,
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
src: '/(.*)',
|
|
178
|
-
dest: '/index.html',
|
|
179
|
-
},
|
|
180
|
-
],
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
name: 'Ember',
|
|
184
|
-
slug: 'ember',
|
|
185
|
-
dependency: 'ember-cli',
|
|
186
|
-
buildCommand: 'ember build',
|
|
187
|
-
getOutputDirName: async () => 'dist',
|
|
188
|
-
defaultRoutes: [
|
|
189
|
-
{
|
|
190
|
-
handle: 'filesystem',
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
src: '/(.*)',
|
|
194
|
-
dest: '/index.html',
|
|
195
|
-
},
|
|
196
|
-
],
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
name: 'Vue.js',
|
|
200
|
-
slug: 'vue',
|
|
201
|
-
dependency: '@vue/cli-service',
|
|
202
|
-
buildCommand: 'vue-cli-service build',
|
|
203
|
-
getOutputDirName: async () => 'dist',
|
|
204
|
-
defaultRoutes: [
|
|
205
|
-
{
|
|
206
|
-
src: '^/[^/]*\\.(js|txt|ico|json)',
|
|
207
|
-
headers: { 'cache-control': 'max-age=300' },
|
|
208
|
-
continue: true,
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
src: '^/(img|js|css|fonts|media)/[^/]+\\.[0-9a-f]{8}\\.*',
|
|
212
|
-
headers: { 'cache-control': 'max-age=31536000, immutable' },
|
|
213
|
-
continue: true,
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
handle: 'filesystem',
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
src: '^.*',
|
|
220
|
-
dest: '/index.html',
|
|
221
|
-
},
|
|
222
|
-
],
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
name: 'Scully',
|
|
226
|
-
slug: 'scully',
|
|
227
|
-
dependency: '@scullyio/init',
|
|
228
|
-
buildCommand: 'ng build && scully',
|
|
229
|
-
getOutputDirName: async () => 'dist/static',
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
name: 'Ionic Angular',
|
|
233
|
-
slug: 'ionic-angular',
|
|
234
|
-
dependency: '@ionic/angular',
|
|
235
|
-
buildCommand: 'ng build',
|
|
236
|
-
getOutputDirName: async () => 'www',
|
|
237
|
-
defaultRoutes: [
|
|
238
|
-
{
|
|
239
|
-
handle: 'filesystem',
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
src: '/(.*)',
|
|
243
|
-
dest: '/index.html',
|
|
244
|
-
},
|
|
245
|
-
],
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
name: 'Angular',
|
|
249
|
-
slug: 'angular',
|
|
250
|
-
dependency: '@angular/cli',
|
|
251
|
-
buildCommand: 'ng build',
|
|
252
|
-
getOutputDirName: async (dirPrefix) => {
|
|
253
|
-
const base = 'dist';
|
|
254
|
-
try {
|
|
255
|
-
const location = path_1.join(dirPrefix, base);
|
|
256
|
-
const content = await readdir(location);
|
|
257
|
-
// If there is only one file in it that is a dir we'll use it as dist dir
|
|
258
|
-
if (content.length === 1 && (await isDir(path_1.join(location, content[0])))) {
|
|
259
|
-
return path_1.join(base, content[0]);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
catch (error) {
|
|
263
|
-
build_utils_1.debug(`Error detecting output directory: `, error);
|
|
264
|
-
}
|
|
265
|
-
return base;
|
|
266
|
-
},
|
|
267
|
-
defaultRoutes: [
|
|
268
|
-
{
|
|
269
|
-
handle: 'filesystem',
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
src: '/(.*)',
|
|
273
|
-
dest: '/index.html',
|
|
274
|
-
},
|
|
275
|
-
],
|
|
276
|
-
},
|
|
277
|
-
{
|
|
278
|
-
name: 'Polymer',
|
|
279
|
-
slug: 'polymer',
|
|
280
|
-
dependency: 'polymer-cli',
|
|
281
|
-
buildCommand: 'polymer build',
|
|
282
|
-
getOutputDirName: async (dirPrefix) => {
|
|
283
|
-
const base = 'build';
|
|
284
|
-
try {
|
|
285
|
-
const location = path_1.join(dirPrefix, base);
|
|
286
|
-
const content = await readdir(location);
|
|
287
|
-
const paths = content.filter(item => !item.includes('.'));
|
|
288
|
-
return path_1.join(base, paths[0]);
|
|
289
|
-
}
|
|
290
|
-
catch (error) {
|
|
291
|
-
build_utils_1.debug(`Error detecting output directory: `, error);
|
|
292
|
-
}
|
|
293
|
-
return base;
|
|
294
|
-
},
|
|
295
|
-
defaultRoutes: [
|
|
296
|
-
{
|
|
297
|
-
handle: 'filesystem',
|
|
298
|
-
},
|
|
299
|
-
{
|
|
300
|
-
src: '/(.*)',
|
|
301
|
-
dest: '/index.html',
|
|
302
|
-
},
|
|
303
|
-
],
|
|
304
|
-
},
|
|
305
|
-
{
|
|
306
|
-
name: 'Svelte',
|
|
307
|
-
slug: 'svelte',
|
|
308
|
-
dependency: 'sirv-cli',
|
|
309
|
-
buildCommand: 'rollup -c',
|
|
310
|
-
getOutputDirName: async () => 'public',
|
|
311
|
-
defaultRoutes: [
|
|
312
|
-
{
|
|
313
|
-
handle: 'filesystem',
|
|
314
|
-
},
|
|
315
|
-
{
|
|
316
|
-
src: '/(.*)',
|
|
317
|
-
dest: '/index.html',
|
|
318
|
-
},
|
|
319
|
-
],
|
|
320
|
-
},
|
|
321
|
-
{
|
|
322
|
-
name: 'Ionic React',
|
|
323
|
-
slug: 'ionic-react',
|
|
324
|
-
dependency: '@ionic/react',
|
|
325
|
-
buildCommand: 'react-scripts build',
|
|
326
|
-
getOutputDirName: async () => 'build',
|
|
327
|
-
defaultRoutes: [
|
|
328
|
-
{
|
|
329
|
-
src: '/static/(.*)',
|
|
330
|
-
headers: { 'cache-control': 's-maxage=31536000, immutable' },
|
|
331
|
-
continue: true,
|
|
332
|
-
},
|
|
333
|
-
{
|
|
334
|
-
src: '/service-worker.js',
|
|
335
|
-
headers: { 'cache-control': 's-maxage=0' },
|
|
336
|
-
continue: true,
|
|
337
|
-
},
|
|
338
|
-
{
|
|
339
|
-
src: '/sockjs-node/(.*)',
|
|
340
|
-
dest: '/sockjs-node/$1',
|
|
341
|
-
},
|
|
342
|
-
{
|
|
343
|
-
handle: 'filesystem',
|
|
344
|
-
},
|
|
345
|
-
{
|
|
346
|
-
src: '/(.*)',
|
|
347
|
-
headers: { 'cache-control': 's-maxage=0' },
|
|
348
|
-
dest: '/index.html',
|
|
349
|
-
},
|
|
350
|
-
],
|
|
351
|
-
},
|
|
352
|
-
{
|
|
353
|
-
name: 'Create React App',
|
|
354
|
-
slug: 'create-react-app',
|
|
355
|
-
dependency: 'react-scripts',
|
|
356
|
-
buildCommand: 'react-scripts build',
|
|
357
|
-
getOutputDirName: async () => 'build',
|
|
358
|
-
defaultRoutes: [
|
|
359
|
-
{
|
|
360
|
-
src: '/static/(.*)',
|
|
361
|
-
headers: { 'cache-control': 's-maxage=31536000, immutable' },
|
|
362
|
-
continue: true,
|
|
363
|
-
},
|
|
364
|
-
{
|
|
365
|
-
src: '/service-worker.js',
|
|
366
|
-
headers: { 'cache-control': 's-maxage=0' },
|
|
367
|
-
continue: true,
|
|
368
|
-
},
|
|
369
|
-
{
|
|
370
|
-
src: '/sockjs-node/(.*)',
|
|
371
|
-
dest: '/sockjs-node/$1',
|
|
372
|
-
},
|
|
373
|
-
{
|
|
374
|
-
handle: 'filesystem',
|
|
375
|
-
},
|
|
376
|
-
{
|
|
377
|
-
src: '/(.*)',
|
|
378
|
-
headers: { 'cache-control': 's-maxage=0' },
|
|
379
|
-
dest: '/index.html',
|
|
380
|
-
},
|
|
381
|
-
],
|
|
382
|
-
},
|
|
383
|
-
{
|
|
384
|
-
name: 'Create React App (ejected)',
|
|
385
|
-
slug: 'create-react-app',
|
|
386
|
-
dependency: 'react-dev-utils',
|
|
387
|
-
buildCommand: 'react-scripts build',
|
|
388
|
-
getOutputDirName: async () => 'build',
|
|
389
|
-
defaultRoutes: [
|
|
390
|
-
{
|
|
391
|
-
src: '/static/(.*)',
|
|
392
|
-
headers: { 'cache-control': 's-maxage=31536000, immutable' },
|
|
393
|
-
continue: true,
|
|
394
|
-
},
|
|
395
|
-
{
|
|
396
|
-
src: '/service-worker.js',
|
|
397
|
-
headers: { 'cache-control': 's-maxage=0' },
|
|
398
|
-
continue: true,
|
|
399
|
-
},
|
|
400
|
-
{
|
|
401
|
-
src: '/sockjs-node/(.*)',
|
|
402
|
-
dest: '/sockjs-node/$1',
|
|
403
|
-
},
|
|
404
|
-
{
|
|
405
|
-
handle: 'filesystem',
|
|
406
|
-
},
|
|
407
|
-
{
|
|
408
|
-
src: '/(.*)',
|
|
409
|
-
headers: { 'cache-control': 's-maxage=0' },
|
|
410
|
-
dest: '/index.html',
|
|
411
|
-
},
|
|
412
|
-
],
|
|
413
|
-
},
|
|
414
|
-
{
|
|
415
|
-
name: 'Gridsome',
|
|
416
|
-
slug: 'gridsome',
|
|
417
|
-
dependency: 'gridsome',
|
|
418
|
-
buildCommand: 'gridsome build',
|
|
419
|
-
getOutputDirName: async () => 'dist',
|
|
420
|
-
},
|
|
421
|
-
{
|
|
422
|
-
name: 'UmiJS',
|
|
423
|
-
slug: 'umijs',
|
|
424
|
-
dependency: 'umi',
|
|
425
|
-
buildCommand: 'umi build',
|
|
426
|
-
getOutputDirName: async () => 'dist',
|
|
427
|
-
defaultRoutes: [
|
|
428
|
-
{
|
|
429
|
-
handle: 'filesystem',
|
|
430
|
-
},
|
|
431
|
-
{
|
|
432
|
-
src: '/(.*)',
|
|
433
|
-
dest: '/index.html',
|
|
434
|
-
},
|
|
435
|
-
],
|
|
436
|
-
},
|
|
437
|
-
{
|
|
438
|
-
name: 'Docusaurus 1.0',
|
|
439
|
-
slug: 'docusaurus',
|
|
440
|
-
dependency: 'docusaurus',
|
|
441
|
-
buildCommand: 'docusaurus-build',
|
|
442
|
-
getOutputDirName: async (dirPrefix) => {
|
|
443
|
-
const base = 'build';
|
|
444
|
-
try {
|
|
445
|
-
const location = path_1.join(dirPrefix, base);
|
|
446
|
-
const content = await readdir(location);
|
|
447
|
-
// If there is only one file in it that is a dir we'll use it as dist dir
|
|
448
|
-
if (content.length === 1 && (await isDir(path_1.join(location, content[0])))) {
|
|
449
|
-
return path_1.join(base, content[0]);
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
catch (error) {
|
|
453
|
-
build_utils_1.debug(`Error detecting output directory: `, error);
|
|
454
|
-
}
|
|
455
|
-
return base;
|
|
456
|
-
},
|
|
457
|
-
},
|
|
458
|
-
{
|
|
459
|
-
name: 'Sapper',
|
|
460
|
-
slug: 'sapper',
|
|
461
|
-
dependency: 'sapper',
|
|
462
|
-
buildCommand: 'sapper export',
|
|
463
|
-
getOutputDirName: async () => '__sapper__/export',
|
|
464
|
-
},
|
|
465
|
-
{
|
|
466
|
-
name: 'Saber',
|
|
467
|
-
slug: 'saber',
|
|
468
|
-
dependency: 'saber',
|
|
469
|
-
buildCommand: 'saber build',
|
|
470
|
-
getOutputDirName: async () => 'public',
|
|
471
|
-
defaultRoutes: [
|
|
472
|
-
{
|
|
473
|
-
src: '/_saber/.*',
|
|
474
|
-
headers: { 'cache-control': 'max-age=31536000, immutable' },
|
|
475
|
-
},
|
|
476
|
-
{
|
|
477
|
-
handle: 'filesystem',
|
|
478
|
-
},
|
|
479
|
-
{
|
|
480
|
-
src: '.*',
|
|
481
|
-
status: 404,
|
|
482
|
-
dest: '404.html',
|
|
483
|
-
},
|
|
484
|
-
],
|
|
485
|
-
},
|
|
486
|
-
{
|
|
487
|
-
name: 'Stencil',
|
|
488
|
-
slug: 'stencil',
|
|
489
|
-
dependency: '@stencil/core',
|
|
490
|
-
buildCommand: 'stencil build',
|
|
491
|
-
getOutputDirName: async () => 'www',
|
|
492
|
-
defaultRoutes: [
|
|
493
|
-
{
|
|
494
|
-
src: '/assets/(.*)',
|
|
495
|
-
headers: { 'cache-control': 'max-age=2592000' },
|
|
496
|
-
continue: true,
|
|
497
|
-
},
|
|
498
|
-
{
|
|
499
|
-
src: '/build/p-.*',
|
|
500
|
-
headers: { 'cache-control': 'max-age=31536000, immutable' },
|
|
501
|
-
continue: true,
|
|
502
|
-
},
|
|
503
|
-
{
|
|
504
|
-
src: '/sw.js',
|
|
505
|
-
headers: { 'cache-control': 'no-cache' },
|
|
506
|
-
continue: true,
|
|
507
|
-
},
|
|
508
|
-
{
|
|
509
|
-
handle: 'filesystem',
|
|
510
|
-
},
|
|
511
|
-
{
|
|
512
|
-
src: '/(.*)',
|
|
513
|
-
dest: '/index.html',
|
|
514
|
-
},
|
|
515
|
-
],
|
|
516
|
-
},
|
|
517
|
-
{
|
|
518
|
-
name: 'Nuxt.js',
|
|
519
|
-
slug: 'nuxtjs',
|
|
520
|
-
dependency: 'nuxt',
|
|
521
|
-
buildCommand: 'nuxt generate',
|
|
522
|
-
getOutputDirName: async () => 'dist',
|
|
523
|
-
cachePattern: '.nuxt/**',
|
|
524
|
-
defaultRoutes: [
|
|
525
|
-
{
|
|
526
|
-
src: '/sw.js',
|
|
527
|
-
headers: { 'cache-control': 'no-cache' },
|
|
528
|
-
continue: true,
|
|
529
|
-
},
|
|
530
|
-
{
|
|
531
|
-
src: '/_nuxt/(.*)',
|
|
532
|
-
headers: { 'cache-control': 'public,max-age=31536000,immutable' },
|
|
533
|
-
continue: true,
|
|
534
|
-
},
|
|
535
|
-
{
|
|
536
|
-
handle: 'filesystem',
|
|
537
|
-
},
|
|
538
|
-
{
|
|
539
|
-
src: '/(.*)',
|
|
540
|
-
dest: '/200.html',
|
|
541
|
-
},
|
|
542
|
-
],
|
|
543
|
-
},
|
|
544
|
-
{
|
|
545
|
-
name: 'Hugo',
|
|
546
|
-
slug: 'hugo',
|
|
547
|
-
buildCommand: 'hugo -D --gc',
|
|
548
|
-
getOutputDirName: async (dirPrefix) => {
|
|
549
|
-
const config = await build_utils_1.readConfigFile(['config.json', 'config.yaml', 'config.toml'].map(fileName => {
|
|
550
|
-
return path_1.join(dirPrefix, fileName);
|
|
551
|
-
}));
|
|
552
|
-
return (config && config.publishDir) || 'public';
|
|
553
|
-
},
|
|
554
|
-
},
|
|
555
|
-
{
|
|
556
|
-
name: 'Jekyll',
|
|
557
|
-
slug: 'jekyll',
|
|
558
|
-
buildCommand: 'jekyll build',
|
|
559
|
-
getOutputDirName: async (dirPrefix) => {
|
|
560
|
-
const config = await build_utils_1.readConfigFile(path_1.join(dirPrefix, '_config.yml'));
|
|
561
|
-
return (config && config.destination) || '_site';
|
|
562
|
-
},
|
|
563
|
-
},
|
|
564
|
-
{
|
|
565
|
-
name: 'Brunch',
|
|
566
|
-
slug: 'brunch',
|
|
567
|
-
buildCommand: 'brunch build --production',
|
|
568
|
-
getOutputDirName: async () => 'public',
|
|
569
|
-
},
|
|
570
|
-
{
|
|
571
|
-
name: 'Middleman',
|
|
572
|
-
slug: 'middleman',
|
|
573
|
-
buildCommand: 'bundle exec middleman build',
|
|
574
|
-
getOutputDirName: async () => 'build',
|
|
575
|
-
},
|
|
576
|
-
{
|
|
577
|
-
name: 'Zola',
|
|
578
|
-
slug: 'zola',
|
|
579
|
-
buildCommand: 'zola build',
|
|
580
|
-
getOutputDirName: async () => 'public',
|
|
581
|
-
},
|
|
582
|
-
];
|
|
583
|
-
function getValue(framework, name) {
|
|
584
|
-
const setting = framework && framework.settings && framework.settings[name];
|
|
585
|
-
return setting && setting.value;
|
|
586
|
-
}
|
|
587
|
-
exports.frameworks = frameworkList.map(partialFramework => {
|
|
588
|
-
const frameworkItem = frameworks_1.default.find(f => f.slug === partialFramework.slug);
|
|
589
|
-
const devCommand = getValue(frameworkItem, 'devCommand');
|
|
590
|
-
const buildCommand = getValue(frameworkItem, 'buildCommand');
|
|
591
|
-
const outputDirectory = getValue(frameworkItem, 'outputDirectory');
|
|
592
|
-
const getOutputDirName = partialFramework.getOutputDirName
|
|
593
|
-
? partialFramework.getOutputDirName
|
|
594
|
-
: async () => outputDirectory || 'public';
|
|
595
|
-
return {
|
|
596
|
-
devCommand,
|
|
597
|
-
buildCommand,
|
|
598
|
-
...partialFramework,
|
|
599
|
-
getOutputDirName,
|
|
600
|
-
};
|
|
601
|
-
});
|