@vigla/adapter-static 0.0.0-stage → 0.1.1
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.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/platforms.d.ts +10 -0
- package/dist/platforms.d.ts.map +1 -0
- package/dist/platforms.js +35 -0
- package/dist/platforms.js.map +1 -0
- package/package.json +15 -5
- package/src/index.ts +63 -0
- package/src/platforms.ts +63 -0
- package/README.md +0 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Adapter } from '@vigla/kit';
|
|
2
|
+
export interface Options {
|
|
3
|
+
pages?: string;
|
|
4
|
+
assets?: string;
|
|
5
|
+
fallback?: string;
|
|
6
|
+
precompress?: boolean;
|
|
7
|
+
strict?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export default function adapter(options?: Options): Adapter;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAG1C,MAAM,WAAW,OAAO;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAkD1D"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { detectPlatform } from './platforms.js';
|
|
3
|
+
export default function adapter(options) {
|
|
4
|
+
return {
|
|
5
|
+
name: '@vigla/adapter-static',
|
|
6
|
+
async adapt(builder) {
|
|
7
|
+
if (!options?.fallback &&
|
|
8
|
+
options?.strict !== false &&
|
|
9
|
+
builder.config.router.type !== 'hash') {
|
|
10
|
+
const dynamic = builder.routes.filter((route) => route.prerender !== true);
|
|
11
|
+
if (dynamic.length) {
|
|
12
|
+
const routes = dynamic.map((route) => path.posix.join(path.relative('.', builder.config.files.routes), route.id));
|
|
13
|
+
builder.log.error(`Routes require prerendering or a fallback:\n${routes.join('\n')}`);
|
|
14
|
+
throw new Error('Encountered dynamic routes');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const platform = detectPlatform();
|
|
18
|
+
if (platform) {
|
|
19
|
+
if (options)
|
|
20
|
+
builder.log.warn(`Detected ${platform.name}; explicit options disable zero-config output`);
|
|
21
|
+
else
|
|
22
|
+
builder.log.info(`Detected ${platform.name}, using zero-config output`);
|
|
23
|
+
}
|
|
24
|
+
const { pages = 'build', assets = pages, fallback, precompress = false } = options ?? platform?.defaults ?? {};
|
|
25
|
+
builder.rimraf(assets);
|
|
26
|
+
if (pages !== assets)
|
|
27
|
+
builder.rimraf(pages);
|
|
28
|
+
builder.generateEnvModule();
|
|
29
|
+
builder.writeClient(assets);
|
|
30
|
+
builder.writePrerendered(pages);
|
|
31
|
+
if (fallback)
|
|
32
|
+
await builder.generateFallback(path.join(pages, fallback));
|
|
33
|
+
if (precompress)
|
|
34
|
+
await Promise.all([...new Set([pages, assets])].map((directory) => builder.compress(directory)));
|
|
35
|
+
builder.log(pages === assets
|
|
36
|
+
? `Wrote site to ${pages}`
|
|
37
|
+
: `Wrote pages to ${pages} and assets to ${assets}`);
|
|
38
|
+
if (!options)
|
|
39
|
+
platform?.complete(builder);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","source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
|
|
6
|
+
complete(builder: Builder): void;
|
|
7
|
+
}
|
|
8
|
+
export declare function detectPlatform(): Platform | undefined;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=platforms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platforms.d.ts","sourceRoot":"","sources":["../src/platforms.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,UAAU,QAAQ;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CACjC;AAWD,wBAAgB,cAAc,IAAI,QAAQ,GAAG,SAAS,CAQrD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
2
|
+
export function detectPlatform() {
|
|
3
|
+
return process.env.VERCEL
|
|
4
|
+
? {
|
|
5
|
+
name: 'Vercel',
|
|
6
|
+
defaults: { pages: '.vercel/output/static' },
|
|
7
|
+
complete: writeVercel
|
|
8
|
+
}
|
|
9
|
+
: undefined;
|
|
10
|
+
}
|
|
11
|
+
function writeVercel(builder) {
|
|
12
|
+
const routes = [];
|
|
13
|
+
const overrides = {};
|
|
14
|
+
for (const [source, redirect] of builder.prerendered.redirects) {
|
|
15
|
+
const src = source.replace(/\/$/, '') === redirect.location.replace(/\/$/, '')
|
|
16
|
+
? source
|
|
17
|
+
: source.replace(/\/?$/, '/?');
|
|
18
|
+
routes.push({ src, status: redirect.status, headers: { Location: redirect.location } });
|
|
19
|
+
}
|
|
20
|
+
for (const [url, page] of builder.prerendered.pages) {
|
|
21
|
+
let output = url.slice(1);
|
|
22
|
+
if (url !== '/') {
|
|
23
|
+
const alternate = url.endsWith('/') ? url.slice(0, -1) : url + '/';
|
|
24
|
+
if (url.endsWith('/'))
|
|
25
|
+
output = url.slice(1, -1);
|
|
26
|
+
routes.push({ src: url, dest: alternate }, { src: alternate, status: 308, headers: { Location: url } });
|
|
27
|
+
}
|
|
28
|
+
overrides[page.file] = { path: output };
|
|
29
|
+
}
|
|
30
|
+
const immutable = `/${builder.getAppPath()}/immutable/.+`;
|
|
31
|
+
routes.push({ src: immutable, headers: { 'cache-control': 'public, immutable, max-age=31536000' } }, { handle: 'filesystem' }, { src: immutable, status: 404, headers: { 'cache-control': 'no-store' }, continue: false });
|
|
32
|
+
mkdirSync('.vercel/output', { recursive: true });
|
|
33
|
+
writeFileSync('.vercel/output/config.json', JSON.stringify({ version: 3, routes, overrides }, null, 2));
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=platforms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platforms.js","sourceRoot":"","sources":["../src/platforms.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAmBnD,MAAM,UAAU,cAAc;IAC7B,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM;QACxB,CAAC,CAAC;YACA,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,EAAE,KAAK,EAAE,uBAAuB,EAAE;YAC5C,QAAQ,EAAE,WAAW;SACrB;QACF,CAAC,CAAC,SAAS,CAAC;AACd,CAAC;AAED,SAAS,WAAW,CAAC,OAAgB;IACpC,MAAM,MAAM,GAAkB,EAAE,CAAC;IACjC,MAAM,SAAS,GAAqC,EAAE,CAAC;IACvD,KAAK,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,OAAO,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC;QAChE,MAAM,GAAG,GACR,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;YACjE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e,EAAE,qCAAqC,EAAE,EAAE,EACvF,EAAE,MAAM,EAAE,YAAY,EAAE,EACxB,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,eAAe,EAAE,UAAU,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAC1F,CAAC;IACF,SAAS,CAAC,gBAAgB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACjD,aAAa,CACZ,4BAA4B,EAC5B,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAC1D,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@vigla/adapter-static",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist",
|
|
7
|
+
"src"
|
|
8
|
+
],
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./dist/index.js",
|
|
11
|
+
"./package.json": "./package.json"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@vigla/kit": "0.1.1"
|
|
15
|
+
}
|
|
16
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import type { Adapter } from '@vigla/kit';
|
|
3
|
+
import { detectPlatform } from './platforms.ts';
|
|
4
|
+
|
|
5
|
+
export interface Options {
|
|
6
|
+
pages?: string;
|
|
7
|
+
assets?: string;
|
|
8
|
+
fallback?: string;
|
|
9
|
+
precompress?: boolean;
|
|
10
|
+
strict?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default function adapter(options?: Options): Adapter {
|
|
14
|
+
return {
|
|
15
|
+
name: '@vigla/adapter-static',
|
|
16
|
+
async adapt(builder) {
|
|
17
|
+
if (
|
|
18
|
+
!options?.fallback &&
|
|
19
|
+
options?.strict !== false &&
|
|
20
|
+
builder.config.router.type !== 'hash'
|
|
21
|
+
) {
|
|
22
|
+
const dynamic = builder.routes.filter((route) => route.prerender !== true);
|
|
23
|
+
if (dynamic.length) {
|
|
24
|
+
const routes = dynamic.map((route) =>
|
|
25
|
+
path.posix.join(path.relative('.', builder.config.files.routes), route.id)
|
|
26
|
+
);
|
|
27
|
+
builder.log.error(`Routes require prerendering or a fallback:\n${routes.join('\n')}`);
|
|
28
|
+
throw new Error('Encountered dynamic routes');
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const platform = detectPlatform();
|
|
32
|
+
if (platform) {
|
|
33
|
+
if (options)
|
|
34
|
+
builder.log.warn(
|
|
35
|
+
`Detected ${platform.name}; explicit options disable zero-config output`
|
|
36
|
+
);
|
|
37
|
+
else builder.log.info(`Detected ${platform.name}, using zero-config output`);
|
|
38
|
+
}
|
|
39
|
+
const {
|
|
40
|
+
pages = 'build',
|
|
41
|
+
assets = pages,
|
|
42
|
+
fallback,
|
|
43
|
+
precompress = false
|
|
44
|
+
} = options ?? platform?.defaults ?? {};
|
|
45
|
+
builder.rimraf(assets);
|
|
46
|
+
if (pages !== assets) builder.rimraf(pages);
|
|
47
|
+
builder.generateEnvModule();
|
|
48
|
+
builder.writeClient(assets);
|
|
49
|
+
builder.writePrerendered(pages);
|
|
50
|
+
if (fallback) await builder.generateFallback(path.join(pages, fallback));
|
|
51
|
+
if (precompress)
|
|
52
|
+
await Promise.all(
|
|
53
|
+
[...new Set([pages, assets])].map((directory) => builder.compress(directory))
|
|
54
|
+
);
|
|
55
|
+
builder.log(
|
|
56
|
+
pages === assets
|
|
57
|
+
? `Wrote site to ${pages}`
|
|
58
|
+
: `Wrote pages to ${pages} and assets to ${assets}`
|
|
59
|
+
);
|
|
60
|
+
if (!options) platform?.complete(builder);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
package/src/platforms.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import type { Builder } from '@vigla/kit';
|
|
3
|
+
import type { Options } from './index.ts';
|
|
4
|
+
|
|
5
|
+
interface Platform {
|
|
6
|
+
name: string;
|
|
7
|
+
defaults: Options;
|
|
8
|
+
complete(builder: Builder): void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface OutputRoute {
|
|
12
|
+
src?: string;
|
|
13
|
+
dest?: string;
|
|
14
|
+
status?: number;
|
|
15
|
+
headers?: Record<string, string>;
|
|
16
|
+
handle?: string;
|
|
17
|
+
continue?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function detectPlatform(): Platform | undefined {
|
|
21
|
+
return process.env.VERCEL
|
|
22
|
+
? {
|
|
23
|
+
name: 'Vercel',
|
|
24
|
+
defaults: { pages: '.vercel/output/static' },
|
|
25
|
+
complete: writeVercel
|
|
26
|
+
}
|
|
27
|
+
: undefined;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function writeVercel(builder: Builder): void {
|
|
31
|
+
const routes: OutputRoute[] = [];
|
|
32
|
+
const overrides: Record<string, { path: string }> = {};
|
|
33
|
+
for (const [source, redirect] of builder.prerendered.redirects) {
|
|
34
|
+
const src =
|
|
35
|
+
source.replace(/\/$/, '') === redirect.location.replace(/\/$/, '')
|
|
36
|
+
? source
|
|
37
|
+
: source.replace(/\/?$/, '/?');
|
|
38
|
+
routes.push({ src, status: redirect.status, headers: { Location: redirect.location } });
|
|
39
|
+
}
|
|
40
|
+
for (const [url, page] of builder.prerendered.pages) {
|
|
41
|
+
let output = url.slice(1);
|
|
42
|
+
if (url !== '/') {
|
|
43
|
+
const alternate = url.endsWith('/') ? url.slice(0, -1) : url + '/';
|
|
44
|
+
if (url.endsWith('/')) output = url.slice(1, -1);
|
|
45
|
+
routes.push(
|
|
46
|
+
{ src: url, dest: alternate },
|
|
47
|
+
{ src: alternate, status: 308, headers: { Location: url } }
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
overrides[page.file] = { path: output };
|
|
51
|
+
}
|
|
52
|
+
const immutable = `/${builder.getAppPath()}/immutable/.+`;
|
|
53
|
+
routes.push(
|
|
54
|
+
{ src: immutable, headers: { 'cache-control': 'public, immutable, max-age=31536000' } },
|
|
55
|
+
{ handle: 'filesystem' },
|
|
56
|
+
{ src: immutable, status: 404, headers: { 'cache-control': 'no-store' }, continue: false }
|
|
57
|
+
);
|
|
58
|
+
mkdirSync('.vercel/output', { recursive: true });
|
|
59
|
+
writeFileSync(
|
|
60
|
+
'.vercel/output/config.json',
|
|
61
|
+
JSON.stringify({ version: 3, routes, overrides }, null, 2)
|
|
62
|
+
);
|
|
63
|
+
}
|
package/README.md
DELETED