@parlor/shell-web 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +10 -2
- package/dist/build.d.ts +5 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/build.js +16 -0
- package/dist/build.js.map +1 -0
- package/dist/csp.d.ts +31 -0
- package/dist/csp.d.ts.map +1 -0
- package/dist/csp.js +82 -0
- package/dist/csp.js.map +1 -0
- package/dist/dev.d.ts +5 -0
- package/dist/dev.d.ts.map +1 -0
- package/dist/dev.js +9 -0
- package/dist/dev.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin.d.ts +28 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +126 -0
- package/dist/plugin.js.map +1 -0
- package/dist/route-tree.d.ts +16 -0
- package/dist/route-tree.d.ts.map +1 -0
- package/dist/route-tree.js +40 -0
- package/dist/route-tree.js.map +1 -0
- package/dist/vite-config.d.ts +14 -0
- package/dist/vite-config.d.ts.map +1 -0
- package/dist/vite-config.js +77 -0
- package/dist/vite-config.js.map +1 -0
- package/package.json +40 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 cychien
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @parlor/shell-web
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The web shell: the Vite config every target builds from, file routes, the PWA and the content security policy. Installed by `@parlor/cli`; you do not depend on it directly.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { FRAMEWORK_VITE_KEYS } from "@parlor/shell-web";
|
|
7
|
+
|
|
8
|
+
console.log(FRAMEWORK_VITE_KEYS);
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Docs: https://cychien.github.io/parlor/guides/styling/
|
package/dist/build.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type LoadedConfig } from "@parlor/config";
|
|
2
|
+
import type { WebOptions } from "./plugin.js";
|
|
3
|
+
export declare function webOutDir(rootDir: string): string;
|
|
4
|
+
export declare function buildWeb(loaded: LoadedConfig, options?: WebOptions): Promise<string>;
|
|
5
|
+
//# sourceMappingURL=build.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGlE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,YAAY,EACpB,OAAO,GAAE,UAAe,GACvB,OAAO,CAAC,MAAM,CAAC,CASjB"}
|
package/dist/build.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { GENERATED_DIR } from "@parlor/config";
|
|
3
|
+
import { build } from "vite";
|
|
4
|
+
import { parlorViteConfig } from "./vite-config.js";
|
|
5
|
+
export function webOutDir(rootDir) {
|
|
6
|
+
return join(rootDir, GENERATED_DIR, "web");
|
|
7
|
+
}
|
|
8
|
+
export async function buildWeb(loaded, options = {}) {
|
|
9
|
+
const outDir = webOutDir(loaded.rootDir);
|
|
10
|
+
await build(parlorViteConfig(loaded, options, {
|
|
11
|
+
build: { outDir, emptyOutDir: true },
|
|
12
|
+
logLevel: "warn",
|
|
13
|
+
}));
|
|
14
|
+
return outDir;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAqB,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAG7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,UAAU,SAAS,CAAC,OAAe;IACvC,OAAO,IAAI,CAAC,OAAO,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,MAAoB,EACpB,OAAO,GAAe,EAAE;IAExB,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACzC,MAAM,KAAK,CACT,gBAAgB,CAAC,MAAM,EAAE,OAAO,EAAE;QAChC,KAAK,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE;QACpC,QAAQ,EAAE,MAAM;KACjB,CAAC,CACH,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/csp.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CSP_DIRECTIVES, type ParlorConfig } from "@parlor/config";
|
|
2
|
+
export type CspDirective = (typeof CSP_DIRECTIVES)[number];
|
|
3
|
+
export type CspDirectives = {
|
|
4
|
+
readonly [D in CspDirective]?: readonly string[];
|
|
5
|
+
};
|
|
6
|
+
export interface DefaultCspInput {
|
|
7
|
+
/** The backend origin the shell build talks to (`server.url`), or the page's own. */
|
|
8
|
+
readonly serverOrigin?: string | undefined;
|
|
9
|
+
/** Extra origins `connect-src` needs, such as a sync relay. */
|
|
10
|
+
readonly connect?: readonly string[] | undefined;
|
|
11
|
+
/** Allows Vite's HMR client and websocket. */
|
|
12
|
+
readonly dev?: boolean | undefined;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The policy a chat-enabled app ships by default: `script-src 'self'` with no inline
|
|
16
|
+
* script or eval, `connect-src` only to its backend, `frame-ancestors 'none'`,
|
|
17
|
+
* `object-src 'none'`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function defaultCsp(input?: DefaultCspInput): CspDirectives;
|
|
20
|
+
/**
|
|
21
|
+
* Adds sources an app allows on top of the default. Never removes a restriction: a
|
|
22
|
+
* `script-src` addition of `'unsafe-inline'` or `'unsafe-eval'` throws.
|
|
23
|
+
*/
|
|
24
|
+
export declare function extendCsp(base: CspDirectives, additions: CspDirectives): CspDirectives;
|
|
25
|
+
/** The header or `<meta http-equiv>` value. */
|
|
26
|
+
export declare function serializeCsp(directives: CspDirectives): string;
|
|
27
|
+
/** A `<meta http-equiv>` policy cannot carry `frame-ancestors`; browsers ignore it and warn. */
|
|
28
|
+
export declare function metaCsp(directives: CspDirectives): CspDirectives;
|
|
29
|
+
/** The policy an app ships: the default for this shell's backend plus `web.csp`. */
|
|
30
|
+
export declare function appCsp(config: ParlorConfig, input: DefaultCspInput): CspDirectives;
|
|
31
|
+
//# sourceMappingURL=csp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csp.d.ts","sourceRoot":"","sources":["../src/csp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnE,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D,MAAM,MAAM,aAAa,GAAG;IAAE,QAAQ,EAAE,CAAC,IAAI,YAAY,CAAC,CAAC,EAAE,SAAS,MAAM,EAAE;CAAE,CAAC;AAEjF,MAAM,WAAW,eAAe;IAC9B,qFAAqF;IACrF,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3C,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IACjD,8CAA8C;IAC9C,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACpC;AAOD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,GAAE,eAAoB,GAAG,aAAa,CAuBrE;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,GAAG,aAAa,CAqBtF;AAED,+CAA+C;AAC/C,wBAAgB,YAAY,CAAC,UAAU,EAAE,aAAa,GAAG,MAAM,CAW9D;AAED,gGAAgG;AAChG,wBAAgB,OAAO,CAAC,UAAU,EAAE,aAAa,GAAG,aAAa,CAGhE;AAED,oFAAoF;AACpF,wBAAgB,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,GAAG,aAAa,CAElF"}
|
package/dist/csp.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { CSP_DIRECTIVES } from "@parlor/config";
|
|
2
|
+
const SELF = "'self'";
|
|
3
|
+
const NONE = "'none'";
|
|
4
|
+
const SCRIPT_LOOSENERS = new Set(["'unsafe-inline'", "'unsafe-eval'"]);
|
|
5
|
+
const UNSAFE_SOURCE = /[\s;,]/;
|
|
6
|
+
/**
|
|
7
|
+
* The policy a chat-enabled app ships by default: `script-src 'self'` with no inline
|
|
8
|
+
* script or eval, `connect-src` only to its backend, `frame-ancestors 'none'`,
|
|
9
|
+
* `object-src 'none'`.
|
|
10
|
+
*/
|
|
11
|
+
export function defaultCsp(input = {}) {
|
|
12
|
+
const connect = [
|
|
13
|
+
SELF,
|
|
14
|
+
...(input.serverOrigin ? [new URL(input.serverOrigin).origin] : []),
|
|
15
|
+
...(input.connect ?? []),
|
|
16
|
+
...(input.dev ? ["ws:"] : []),
|
|
17
|
+
];
|
|
18
|
+
const inline = input.dev ? ["'unsafe-inline'"] : [];
|
|
19
|
+
return {
|
|
20
|
+
"default-src": [SELF],
|
|
21
|
+
"script-src": [SELF, ...inline],
|
|
22
|
+
"style-src": [SELF, ...inline],
|
|
23
|
+
"img-src": [SELF, "data:"],
|
|
24
|
+
"font-src": [SELF],
|
|
25
|
+
"connect-src": unique(connect),
|
|
26
|
+
"worker-src": [SELF],
|
|
27
|
+
"manifest-src": [SELF],
|
|
28
|
+
"frame-src": [NONE],
|
|
29
|
+
"frame-ancestors": [NONE],
|
|
30
|
+
"object-src": [NONE],
|
|
31
|
+
"base-uri": [SELF],
|
|
32
|
+
"form-action": [SELF],
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Adds sources an app allows on top of the default. Never removes a restriction: a
|
|
37
|
+
* `script-src` addition of `'unsafe-inline'` or `'unsafe-eval'` throws.
|
|
38
|
+
*/
|
|
39
|
+
export function extendCsp(base, additions) {
|
|
40
|
+
const extended = { ...base };
|
|
41
|
+
for (const directive of CSP_DIRECTIVES) {
|
|
42
|
+
const added = additions[directive];
|
|
43
|
+
if (!added || added.length === 0)
|
|
44
|
+
continue;
|
|
45
|
+
if (directive === "script-src") {
|
|
46
|
+
const loosening = added.find((source) => SCRIPT_LOOSENERS.has(source.toLowerCase()));
|
|
47
|
+
if (loosening) {
|
|
48
|
+
throw new Error(`script-src cannot take ${loosening}: the default policy forbids it`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const current = (base[directive] ?? []).filter((source) => source !== NONE || added.includes(NONE));
|
|
52
|
+
extended[directive] = unique([...current, ...added]);
|
|
53
|
+
}
|
|
54
|
+
return extended;
|
|
55
|
+
}
|
|
56
|
+
/** The header or `<meta http-equiv>` value. */
|
|
57
|
+
export function serializeCsp(directives) {
|
|
58
|
+
return CSP_DIRECTIVES.flatMap((directive) => {
|
|
59
|
+
const sources = directives[directive];
|
|
60
|
+
if (!sources)
|
|
61
|
+
return [];
|
|
62
|
+
for (const source of sources) {
|
|
63
|
+
if (UNSAFE_SOURCE.test(source) || source === "") {
|
|
64
|
+
throw new Error(`${directive} has an invalid source: ${JSON.stringify(source)}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return [[directive, ...(sources.length === 0 ? [NONE] : sources)].join(" ")];
|
|
68
|
+
}).join("; ");
|
|
69
|
+
}
|
|
70
|
+
/** A `<meta http-equiv>` policy cannot carry `frame-ancestors`; browsers ignore it and warn. */
|
|
71
|
+
export function metaCsp(directives) {
|
|
72
|
+
const { "frame-ancestors": _ignored, ...rest } = directives;
|
|
73
|
+
return rest;
|
|
74
|
+
}
|
|
75
|
+
/** The policy an app ships: the default for this shell's backend plus `web.csp`. */
|
|
76
|
+
export function appCsp(config, input) {
|
|
77
|
+
return extendCsp(defaultCsp(input), config.web.csp ?? {});
|
|
78
|
+
}
|
|
79
|
+
function unique(sources) {
|
|
80
|
+
return [...new Set(sources)];
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=csp.js.map
|
package/dist/csp.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csp.js","sourceRoot":"","sources":["../src/csp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAqB,MAAM,gBAAgB,CAAC;AAenE,MAAM,IAAI,GAAG,QAAQ,CAAC;AACtB,MAAM,IAAI,GAAG,QAAQ,CAAC;AACtB,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC,CAAC;AACvE,MAAM,aAAa,GAAG,QAAQ,CAAC;AAE/B;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,KAAK,GAAoB,EAAE;IACpD,MAAM,OAAO,GAAG;QACd,IAAI;QACJ,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACnE,GAAG,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC;QACxB,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KAC9B,CAAC;IACF,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACpD,OAAO;QACL,aAAa,EAAE,CAAC,IAAI,CAAC;QACrB,YAAY,EAAE,CAAC,IAAI,EAAE,GAAG,MAAM,CAAC;QAC/B,WAAW,EAAE,CAAC,IAAI,EAAE,GAAG,MAAM,CAAC;QAC9B,SAAS,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC;Q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AC,OAAO,CAAC,CAAC,CAAC;AAC/B,CAAC"}
|
package/dist/dev.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { LoadedConfig } from "@parlor/config";
|
|
2
|
+
import { type ViteDevServer } from "vite";
|
|
3
|
+
import type { WebOptions } from "./plugin.js";
|
|
4
|
+
export declare function startWebDev(loaded: LoadedConfig, options?: WebOptions): Promise<ViteDevServer>;
|
|
5
|
+
//# sourceMappingURL=dev.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../src/dev.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,MAAM,CAAC;AAExD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,wBAAsB,WAAW,CAC/B,MAAM,EAAE,YAAY,EACpB,OAAO,GAAE,UAAe,GACvB,OAAO,CAAC,aAAa,CAAC,CAKxB"}
|
package/dist/dev.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createServer } from "vite";
|
|
2
|
+
import { parlorViteConfig } from "./vite-config.js";
|
|
3
|
+
export async function startWebDev(loaded, options = {}) {
|
|
4
|
+
const server = await createServer(parlorViteConfig(loaded, options, {}));
|
|
5
|
+
await server.listen();
|
|
6
|
+
server.printUrls();
|
|
7
|
+
return server;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=dev.js.map
|
package/dist/dev.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../src/dev.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAsB,MAAM,MAAM,CAAC;AAGxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAAoB,EACpB,OAAO,GAAe,EAAE;IAExB,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,gBAAgB,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IACzE,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC;IACtB,MAAM,CAAC,SAAS,EAAE,CAAC;IACnB,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { buildWeb, webOutDir } from "./build.js";
|
|
2
|
+
export { appCsp, type CspDirective, type CspDirectives, defaultCsp, type DefaultCspInput, extendCsp, metaCsp, serializeCsp, } from "./csp.js";
|
|
3
|
+
export { startWebDev } from "./dev.js";
|
|
4
|
+
export { generateRouteTree, routeGeneratorOptions, routesDirectory, routeTreeFile, } from "./route-tree.js";
|
|
5
|
+
export { DEFAULT_ROUTE_TREE, FRAMEWORK_ROUTE_PREFIX, parlorWeb, webManifest, type WebOptions, } from "./plugin.js";
|
|
6
|
+
export { FRAMEWORK_VITE_KEYS, mergeViteConfig, type MergedViteConfig, parlorViteConfig, strayViteConfig, } from "./vite-config.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EACL,MAAM,EACN,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,UAAU,EACV,KAAK,eAAe,EACpB,SAAS,EACT,OAAO,EACP,YAAY,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,aAAa,GACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,SAAS,EACT,WAAW,EACX,KAAK,UAAU,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,KAAK,gBAAgB,EACrB,gBAAgB,EAChB,eAAe,GAChB,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { buildWeb, webOutDir } from "./build.js";
|
|
2
|
+
export { appCsp, defaultCsp, extendCsp, metaCsp, serializeCsp, } from "./csp.js";
|
|
3
|
+
export { startWebDev } from "./dev.js";
|
|
4
|
+
export { generateRouteTree, routeGeneratorOptions, routesDirectory, routeTreeFile, } from "./route-tree.js";
|
|
5
|
+
export { DEFAULT_ROUTE_TREE, FRAMEWORK_ROUTE_PREFIX, parlorWeb, webManifest, } from "./plugin.js";
|
|
6
|
+
export { FRAMEWORK_VITE_KEYS, mergeViteConfig, parlorViteConfig, strayViteConfig, } from "./vite-config.js";
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EACL,MAAM,EAGN,UAAU,EAEV,SAAS,EACT,OAAO,EACP,YAAY,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,aAAa,GACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,SAAS,EACT,WAAW,GAEZ,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,mBAAmB,EACnB,eAAe,EAEf,gBAAgB,EAChB,eAAe,GAChB,MAAM,kBAAkB,CAAC"}
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { DEFAULT_ROUTE_TREE } from "@parlor/agent-ui/vite";
|
|
2
|
+
import { type ParlorConfig } from "@parlor/config";
|
|
3
|
+
import { type PluginOption } from "vite";
|
|
4
|
+
export declare const FRAMEWORK_ROUTE_PREFIX = "/_parlor";
|
|
5
|
+
/** OAuth discovery lives at the origin root (RFC 8414, RFC 9728), outside the framework prefix. */
|
|
6
|
+
export declare const OAUTH_DISCOVERY_PREFIXES: readonly ["/.well-known/oauth-protected-resource", "/.well-known/oauth-authorization-server"];
|
|
7
|
+
export { DEFAULT_ROUTE_TREE };
|
|
8
|
+
export interface WebOptions {
|
|
9
|
+
readonly conditions?: readonly string[] | undefined;
|
|
10
|
+
readonly serverUrl?: string | undefined;
|
|
11
|
+
/** The origin every target of one `parlor dev` signs for and pairs with, when it is not this page's. */
|
|
12
|
+
readonly appOrigin?: string | undefined;
|
|
13
|
+
readonly root?: string | undefined;
|
|
14
|
+
/** Writes the policy into the built `index.html` for shells that serve it without HTTP headers. */
|
|
15
|
+
readonly cspMeta?: boolean | undefined;
|
|
16
|
+
}
|
|
17
|
+
export declare function webManifest(config: ParlorConfig): {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
short_name: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
start_url: string;
|
|
23
|
+
display: "standalone";
|
|
24
|
+
theme_color: string;
|
|
25
|
+
background_color: string;
|
|
26
|
+
};
|
|
27
|
+
export declare function parlorWeb(config: ParlorConfig, options?: WebOptions): PluginOption[];
|
|
28
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGlE,OAAO,EAA2B,KAAK,YAAY,EAAE,MAAM,MAAM,CAAC;AAMlE,eAAO,MAAM,sBAAsB,aAAa,CAAC;AACjD,mGAAmG;AACnG,eAAO,MAAM,wBAAwB,YACnC,uCAAuC,EACvC,yCAAyC,CACjC,CAAC;AACX,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IACpD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,wGAAwG;IACxG,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,mGAAmG;IACnG,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACxC;AAoCD,wBAAgB,WAAW,CAAC,MAAM,EAAE,YAAY;;;;;;aAOnC,YAAY;;;EAIxB;AAiBD,wBAAgB,SAAS,CACvB,MAAM,EAAE,YAAY,EACpB,OAAO,GAAE,UAAe,GACvB,YAAY,EAAE,CAqDhB"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { agentManifest, DEFAULT_ROUTE_TREE } from "@parlor/agent-ui/vite";
|
|
4
|
+
import { GENERATED_DIR } from "@parlor/config";
|
|
5
|
+
import { tanstackRouter } from "@tanstack/router-plugin/vite";
|
|
6
|
+
import react from "@vitejs/plugin-react";
|
|
7
|
+
import { defaultClientConditions } from "vite";
|
|
8
|
+
import { VitePWA } from "vite-plugin-pwa";
|
|
9
|
+
import { appCsp, metaCsp, serializeCsp } from "./csp.js";
|
|
10
|
+
import { routeGeneratorOptions, routesDirectory, routeTreeFile } from "./route-tree.js";
|
|
11
|
+
export const FRAMEWORK_ROUTE_PREFIX = "/_parlor";
|
|
12
|
+
/** OAuth discovery lives at the origin root (RFC 8414, RFC 9728), outside the framework prefix. */
|
|
13
|
+
export const OAUTH_DISCOVERY_PREFIXES = [
|
|
14
|
+
"/.well-known/oauth-protected-resource",
|
|
15
|
+
"/.well-known/oauth-authorization-server",
|
|
16
|
+
];
|
|
17
|
+
export { DEFAULT_ROUTE_TREE };
|
|
18
|
+
function isFrameworkPath(url) {
|
|
19
|
+
const path = (url ?? "").split("?")[0] ?? "";
|
|
20
|
+
return [FRAMEWORK_ROUTE_PREFIX, ...OAUTH_DISCOVERY_PREFIXES].some((prefix) => path === prefix || path.startsWith(`${prefix}/`));
|
|
21
|
+
}
|
|
22
|
+
function cspPlugin(config, options) {
|
|
23
|
+
const serverOrigin = options.serverUrl || undefined;
|
|
24
|
+
return {
|
|
25
|
+
name: "parlor:csp",
|
|
26
|
+
configureServer(server) {
|
|
27
|
+
const header = serializeCsp(appCsp(config, { serverOrigin, dev: true }));
|
|
28
|
+
server.middlewares.use((request, response, next) => {
|
|
29
|
+
if (!isFrameworkPath(request.url)) {
|
|
30
|
+
response.setHeader("content-security-policy", header);
|
|
31
|
+
}
|
|
32
|
+
next();
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
transformIndexHtml(_html, context) {
|
|
36
|
+
if (context.server || !options.cspMeta)
|
|
37
|
+
return;
|
|
38
|
+
const content = serializeCsp(metaCsp(appCsp(config, { serverOrigin })));
|
|
39
|
+
return [
|
|
40
|
+
{
|
|
41
|
+
tag: "meta",
|
|
42
|
+
attrs: { "http-equiv": "Content-Security-Policy", content },
|
|
43
|
+
injectTo: "head-prepend",
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export function webManifest(config) {
|
|
50
|
+
return {
|
|
51
|
+
id: config.app.id,
|
|
52
|
+
name: config.app.name,
|
|
53
|
+
short_name: config.app.name,
|
|
54
|
+
...(config.app.description ? { description: config.app.description } : {}),
|
|
55
|
+
start_url: "/",
|
|
56
|
+
display: "standalone",
|
|
57
|
+
theme_color: config.web.themeColor,
|
|
58
|
+
background_color: config.web.backgroundColor,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function fileRoutes(config, root) {
|
|
62
|
+
if (!existsSync(resolve(root, routesDirectory(config))))
|
|
63
|
+
return [];
|
|
64
|
+
return [tanstackRouter(routeGeneratorOptions(config, root))];
|
|
65
|
+
}
|
|
66
|
+
function titlePlugin(config) {
|
|
67
|
+
return {
|
|
68
|
+
name: "parlor:title",
|
|
69
|
+
transformIndexHtml(html) {
|
|
70
|
+
if (/<title>/i.test(html))
|
|
71
|
+
return;
|
|
72
|
+
return [{ tag: "title", children: config.app.name, injectTo: "head" }];
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
export function parlorWeb(config, options = {}) {
|
|
77
|
+
const conditions = options.conditions ?? [];
|
|
78
|
+
const plugins = [
|
|
79
|
+
...fileRoutes(config, options.root ?? process.cwd()),
|
|
80
|
+
react(),
|
|
81
|
+
cspPlugin(config, options),
|
|
82
|
+
titlePlugin(config),
|
|
83
|
+
agentManifest({
|
|
84
|
+
app: {
|
|
85
|
+
id: config.app.id,
|
|
86
|
+
name: config.app.name,
|
|
87
|
+
...(config.app.description ? { description: config.app.description } : {}),
|
|
88
|
+
...(config.app.scheme ? { scheme: config.app.scheme } : {}),
|
|
89
|
+
},
|
|
90
|
+
routeTree: routeTreeFile(config),
|
|
91
|
+
}),
|
|
92
|
+
{
|
|
93
|
+
name: "parlor:web",
|
|
94
|
+
config: () => ({
|
|
95
|
+
define: {
|
|
96
|
+
"import.meta.env.PARLOR_SERVER_URL": JSON.stringify(options.serverUrl ?? ""),
|
|
97
|
+
"import.meta.env.PARLOR_APP_ORIGIN": JSON.stringify(options.appOrigin ?? ""),
|
|
98
|
+
},
|
|
99
|
+
resolve: { conditions: [...defaultClientConditions, ...conditions] },
|
|
100
|
+
server: {
|
|
101
|
+
port: config.web.port,
|
|
102
|
+
strictPort: true,
|
|
103
|
+
watch: { ignored: [`**/${GENERATED_DIR}/**`] },
|
|
104
|
+
proxy: Object.fromEntries([FRAMEWORK_ROUTE_PREFIX, ...OAUTH_DISCOVERY_PREFIXES].map((prefix) => [
|
|
105
|
+
prefix,
|
|
106
|
+
`http://localhost:${config.server.port}`,
|
|
107
|
+
])),
|
|
108
|
+
},
|
|
109
|
+
}),
|
|
110
|
+
},
|
|
111
|
+
];
|
|
112
|
+
if (config.web.pwa) {
|
|
113
|
+
plugins.push(VitePWA({
|
|
114
|
+
registerType: "autoUpdate",
|
|
115
|
+
manifest: webManifest(config),
|
|
116
|
+
workbox: {
|
|
117
|
+
navigateFallbackDenylist: [
|
|
118
|
+
FRAMEWORK_ROUTE_PREFIX,
|
|
119
|
+
...OAUTH_DISCOVERY_PREFIXES,
|
|
120
|
+
].map((prefix) => new RegExp(`^${prefix.replaceAll(".", "\\.")}(/|$)`)),
|
|
121
|
+
},
|
|
122
|
+
}));
|
|
123
|
+
}
|
|
124
|
+
return plugins;
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAqB,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,MAAM,sBAAsB,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAqB,MAAM,MAAM,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,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,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;oBAC5E,mCAAmC,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;iBAC7E;gBACD,OAAO,EAAE,EAAE,UAAU,EAAE,CAAC,GAAG,uBAAuB,EAAE,GAAG,UAAU,CAAC,EAAE;gBACpE,MAAM,EAAE;oBACN,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI;oBACrB,UAAU,EAAE,IAAI;oBAChB,KAAK,EAAE,EAAE,OAAO,EAAE,CAAC,MAAM,aAAa,KAAK,CAAC,EAAE;oBAC9C,KAAK,EAAE,MAAM,CAAC,WAAW,CACvB,CAAC,sBAAsB,EAAE,GAAG,wBAAwB,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;wBACpE,MAAM;wBACN,oBAAoB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;qBACzC,CAAC,CACH;iBACF;aACF,CAAC;SACH;KACF,CAAC;IACF,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;QACnB,OAAO,CAAC,IAAI,CACV,OAAO,CAAC;YACN,YAAY,EAAE,YAAY;YAC1B,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC;YAC7B,OAAO,EAAE;gBACP,wBAAwB,EAAE;oBACxB,sBAAsB;oBACtB,GAAG,wBAAwB;iBAC5B,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;aACxE;SACF,CAAC,CACH,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type LoadedConfig, type ParlorConfig } from "@parlor/config";
|
|
2
|
+
export declare function routeTreeFile(config: ParlorConfig): string;
|
|
3
|
+
export declare function routesDirectory(config: ParlorConfig): string;
|
|
4
|
+
/** Shared by the Vite plugin and `parlor typegen`, so both write the same file byte for byte. */
|
|
5
|
+
export declare function routeGeneratorOptions(config: ParlorConfig, root: string): {
|
|
6
|
+
readonly target: "react";
|
|
7
|
+
readonly routesDirectory: string;
|
|
8
|
+
readonly generatedRouteTree: string;
|
|
9
|
+
readonly tmpDir: string;
|
|
10
|
+
readonly quoteStyle: "double";
|
|
11
|
+
readonly semicolons: true;
|
|
12
|
+
};
|
|
13
|
+
/** The generator `@tanstack/router-plugin` itself depends on, so typegen and dev run one version. */
|
|
14
|
+
export declare function routerGeneratorPath(): string;
|
|
15
|
+
export declare function generateRouteTree({ config, rootDir, }: LoadedConfig): Promise<void>;
|
|
16
|
+
//# sourceMappingURL=route-tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-tree.d.ts","sourceRoot":"","sources":["../src/route-tree.ts"],"names":[],"mappings":"AAMA,OAAO,EAAiB,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAKrF,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAE1D;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAE5D;AAED,iGAAiG;AACjG,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM;qBAE5D,OAAO;;;;yBAIH,QAAQ;;EAGvB;AAED,qGAAqG;AACrG,wBAAgB,mBAAmB,IAAI,MAAM,CAU5C;AAED,wBAAsB,iBAAiB,CAAC,EACtC,MAAM,EACN,OAAO,GACR,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAS9B"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { dirname, join, resolve } from "node:path";
|
|
4
|
+
import { pathToFileURL } from "node:url";
|
|
5
|
+
import { DEFAULT_ROUTE_TREE } from "@parlor/agent-ui/vite";
|
|
6
|
+
import { GENERATED_DIR } from "@parlor/config";
|
|
7
|
+
export function routeTreeFile(config) {
|
|
8
|
+
return config.web.routeTree ?? DEFAULT_ROUTE_TREE;
|
|
9
|
+
}
|
|
10
|
+
export function routesDirectory(config) {
|
|
11
|
+
return join(dirname(routeTreeFile(config)), "routes");
|
|
12
|
+
}
|
|
13
|
+
/** Shared by the Vite plugin and `parlor typegen`, so both write the same file byte for byte. */
|
|
14
|
+
export function routeGeneratorOptions(config, root) {
|
|
15
|
+
return {
|
|
16
|
+
target: "react",
|
|
17
|
+
routesDirectory: routesDirectory(config),
|
|
18
|
+
generatedRouteTree: routeTreeFile(config),
|
|
19
|
+
tmpDir: resolve(root, GENERATED_DIR, "tanstack"),
|
|
20
|
+
quoteStyle: "double",
|
|
21
|
+
semicolons: true,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/** The generator `@tanstack/router-plugin` itself depends on, so typegen and dev run one version. */
|
|
25
|
+
export function routerGeneratorPath() {
|
|
26
|
+
const fromHere = createRequire(import.meta.url);
|
|
27
|
+
const fromPlugin = createRequire(fromHere.resolve("@tanstack/router-plugin/package.json"));
|
|
28
|
+
const manifestPath = fromPlugin.resolve("@tanstack/router-generator/package.json");
|
|
29
|
+
const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
30
|
+
return join(dirname(manifestPath), manifest.exports["."].import.default);
|
|
31
|
+
}
|
|
32
|
+
export async function generateRouteTree({ config, rootDir, }) {
|
|
33
|
+
const { Generator, getConfig } = (await import(pathToFileURL(routerGeneratorPath()).href));
|
|
34
|
+
const generator = new Generator({
|
|
35
|
+
config: getConfig(routeGeneratorOptions(config, rootDir), rootDir),
|
|
36
|
+
root: rootDir,
|
|
37
|
+
});
|
|
38
|
+
await generator.run();
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=route-tree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,UAAU,CAAC,OAAO,CAAC,yCAAyC,CAAC,CAAC;IACnF,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAE7D,CAAC;IACF,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAC3E,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,EACtC,MAAM,EACN,OAAO,GACM;IACb,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,CAAC,MAAM,MAAM,CAC5C,aAAa,CAAC,mBAAmB,EAAE,CAAC,CAAC,IAAI,CAC1C,CAAoB,CAAC;IACtB,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC;QAC9B,MAAM,EAAE,SAAS,CAAC,qBAAqB,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC;QAClE,IAAI,EAAE,OAAO;KACd,CAAC,CAAC;IACH,MAAM,SAAS,CAAC,GAAG,EAAE,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { LoadedConfig } from "@parlor/config";
|
|
2
|
+
import { type InlineConfig, type UserConfig } from "vite";
|
|
3
|
+
import { type WebOptions } from "./plugin.js";
|
|
4
|
+
export declare const FRAMEWORK_VITE_KEYS: readonly ["root", "base", "configFile", "build.outDir", "build.emptyOutDir", "server.port", "server.strictPort"];
|
|
5
|
+
export declare const STRAY_VITE_CONFIGS: readonly ["vite.config.ts", "vite.config.mts", "vite.config.js", "vite.config.mjs"];
|
|
6
|
+
export interface MergedViteConfig {
|
|
7
|
+
readonly config: InlineConfig;
|
|
8
|
+
readonly ignored: readonly string[];
|
|
9
|
+
}
|
|
10
|
+
/** The framework wins every scalar it sets, so the proxy, conditions and defines Parlor needs survive. */
|
|
11
|
+
export declare function mergeViteConfig(user: UserConfig | undefined, framework: InlineConfig): MergedViteConfig;
|
|
12
|
+
export declare function strayViteConfig(rootDir: string): string | undefined;
|
|
13
|
+
export declare function parlorViteConfig({ config, rootDir }: LoadedConfig, options: WebOptions, framework: InlineConfig): InlineConfig;
|
|
14
|
+
//# sourceMappingURL=vite-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-config.d.ts","sourceRoot":"","sources":["../src/vite-config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,KAAK,YAAY,EAAe,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvE,OAAO,EAAa,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzD,eAAO,MAAM,mBAAmB,YAC9B,MAAM,EACN,MAAM,EACN,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,mBAAmB,CACX,CAAC;AAEX,eAAO,MAAM,kBAAkB,YAC7B,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,CACT,CAAC;AAEX,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAED,0GAA0G;AAC1G,wBAAgB,eAAe,CAC7B,IAAI,EAAE,UAAU,GAAG,SAAS,EAC5B,SAAS,EAAE,YAAY,GACtB,gBAAgB,CAwBlB;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEnE;AAYD,wBAAgB,gBAAgB,CAC9B,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,YAAY,EACjC,OAAO,EAAE,UAAU,EACnB,SAAS,EAAE,YAAY,GACtB,YAAY,CAoBd"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { mergeConfig } from "vite";
|
|
4
|
+
import { parlorWeb } from "./plugin.js";
|
|
5
|
+
export const FRAMEWORK_VITE_KEYS = [
|
|
6
|
+
"root",
|
|
7
|
+
"base",
|
|
8
|
+
"configFile",
|
|
9
|
+
"build.outDir",
|
|
10
|
+
"build.emptyOutDir",
|
|
11
|
+
"server.port",
|
|
12
|
+
"server.strictPort",
|
|
13
|
+
];
|
|
14
|
+
export const STRAY_VITE_CONFIGS = [
|
|
15
|
+
"vite.config.ts",
|
|
16
|
+
"vite.config.mts",
|
|
17
|
+
"vite.config.js",
|
|
18
|
+
"vite.config.mjs",
|
|
19
|
+
];
|
|
20
|
+
/** The framework wins every scalar it sets, so the proxy, conditions and defines Parlor needs survive. */
|
|
21
|
+
export function mergeViteConfig(user, framework) {
|
|
22
|
+
if (!user)
|
|
23
|
+
return { config: framework, ignored: [] };
|
|
24
|
+
const { plugins: userPlugins = [], ...userRest } = user;
|
|
25
|
+
const own = { ...userRest };
|
|
26
|
+
const ignored = [];
|
|
27
|
+
for (const key of FRAMEWORK_VITE_KEYS) {
|
|
28
|
+
const [head = "", leaf] = key.split(".");
|
|
29
|
+
if (leaf === undefined) {
|
|
30
|
+
if (head in own)
|
|
31
|
+
ignored.push(key);
|
|
32
|
+
delete own[head];
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
const section = own[head];
|
|
36
|
+
if (typeof section !== "object" || section === null || !(leaf in section))
|
|
37
|
+
continue;
|
|
38
|
+
const { [leaf]: _dropped, ...rest } = section;
|
|
39
|
+
own[head] = rest;
|
|
40
|
+
ignored.push(key);
|
|
41
|
+
}
|
|
42
|
+
const { plugins: frameworkPlugins = [], ...frameworkRest } = framework;
|
|
43
|
+
const merged = mergeConfig(own, frameworkRest);
|
|
44
|
+
return {
|
|
45
|
+
config: { ...merged, plugins: [...frameworkPlugins, ...userPlugins] },
|
|
46
|
+
ignored,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export function strayViteConfig(rootDir) {
|
|
50
|
+
return STRAY_VITE_CONFIGS.find((name) => existsSync(join(rootDir, name)));
|
|
51
|
+
}
|
|
52
|
+
const warned = new Set();
|
|
53
|
+
function warnOnce(messages) {
|
|
54
|
+
for (const message of messages) {
|
|
55
|
+
if (warned.has(message))
|
|
56
|
+
continue;
|
|
57
|
+
warned.add(message);
|
|
58
|
+
console.warn(message);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export function parlorViteConfig({ config, rootDir }, options, framework) {
|
|
62
|
+
const { config: merged, ignored } = mergeViteConfig(config.vite, {
|
|
63
|
+
...framework,
|
|
64
|
+
root: rootDir,
|
|
65
|
+
configFile: false,
|
|
66
|
+
plugins: parlorWeb(config, { ...options, root: rootDir }),
|
|
67
|
+
});
|
|
68
|
+
warnOnce(ignored.map((key) => `vite.${key} in parlor.config.ts is ignored: Parlor sets it from its own config.`));
|
|
69
|
+
const stray = strayViteConfig(rootDir);
|
|
70
|
+
if (stray) {
|
|
71
|
+
warnOnce([
|
|
72
|
+
`${stray} is not read. Put Vite options in the vite field of parlor.config.ts.`,
|
|
73
|
+
]);
|
|
74
|
+
}
|
|
75
|
+
return merged;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=vite-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-config.js","sourceRoot":"","sources":["../src/vite-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAqB,WAAW,EAAmB,MAAM,MAAM,CAAC;AAEvE,OAAO,EAAE,SAAS,EAAmB,MAAM,aAAa,CAAC;AAEzD,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,MAAM;IACN,MAAM;IACN,YAAY;IACZ,cAAc;IACd,mBAAmB;IACnB,aAAa;IACb,mBAAmB;CACX,CAA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KAAK,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IACvC,IAAI,KAAK,EAAE,CAAC;QACV,QAAQ,CAAC;YACP,GAAG,KAAK,uEAAuE;SAChF,CAAC,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parlor/shell-web",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"homepage": "https://cychien.github.io/parlor",
|
|
5
|
+
"bugs": "https://github.com/cychien/parlor/issues",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/cychien/parlor.git",
|
|
10
|
+
"directory": "packages/shell-web"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"type": "module",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@tanstack/router-plugin": "^1.168.47",
|
|
24
|
+
"@vitejs/plugin-react": "^6.1.2",
|
|
25
|
+
"vite": "^8.3.5",
|
|
26
|
+
"vite-plugin-pwa": "^2.0.0",
|
|
27
|
+
"workbox-build": "^7.4.1",
|
|
28
|
+
"workbox-window": "^7.4.1",
|
|
29
|
+
"@parlor/agent-ui": "0.1.0",
|
|
30
|
+
"@parlor/config": "0.1.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@tanstack/router-generator": "^1.167.45",
|
|
34
|
+
"@types/node": "^24.14.0",
|
|
35
|
+
"typescript": "^7.0.2",
|
|
36
|
+
"vitest": "^5.0.3"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "tsc -p tsconfig.json",
|
|
40
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
41
|
+
"test": "vitest run"
|
|
42
|
+
}
|
|
6
43
|
}
|