@vesk/adapter 0.2.34 → 0.2.36
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/css.d.ts +7 -2
- package/dist/css.d.ts.map +1 -1
- package/dist/css.js +16 -7
- package/dist/dev-config.js +2 -2
- package/dist/hmr.js +1 -1
- package/dist/ssr-function.js +1 -1
- package/package.json +4 -4
package/dist/css.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
export declare const GLOBAL_CSS_URL = "/_vesk/static/global.css";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Resolve the project's user stylesheet source. The app-directory convention
|
|
4
|
+
* (`app/global.css`, i.e. `resolve(appDir, 'global.css')`) is checked first;
|
|
5
|
+
* the legacy `src/global.css` and `src/app.css` locations are still honoured
|
|
6
|
+
* so existing projects keep working without a file move.
|
|
7
|
+
*/
|
|
3
8
|
export declare function resolveUserCssPath(appDir: string): string | null;
|
|
4
|
-
/** True when the project has a user stylesheet source (`src/global.css` or `src/app.css`). */
|
|
9
|
+
/** True when the project has a user stylesheet source (`app/global.css`, `src/global.css` or `src/app.css`). */
|
|
5
10
|
export declare function hasUserCss(appDir: string): boolean;
|
|
6
11
|
/** True when a non-empty `global.css` was produced for the build (prod disk output). */
|
|
7
12
|
export declare function hasBuiltGlobalCss(outDir: string): boolean;
|
package/dist/css.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../src/css.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../src/css.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,cAAc,6BAA6B,CAAC;AAEzD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQhE;AAED,gHAAgH;AAChH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAElD;AAED,wFAAwF;AACxF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAGzD;AAED,yEAAyE;AACzE,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CAE9F;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,EAAE,CAGpE"}
|
package/dist/css.js
CHANGED
|
@@ -6,17 +6,26 @@
|
|
|
6
6
|
* several ad-hoc copies.
|
|
7
7
|
*
|
|
8
8
|
* Vesk follows the single-file CSS convention used by other frameworks
|
|
9
|
-
* (Next.js/Remix/SvelteKit): a single `
|
|
10
|
-
*
|
|
11
|
-
* one `/_vesk/static/global.css`;
|
|
12
|
-
* the
|
|
13
|
-
*
|
|
9
|
+
* (Next.js/Remix/SvelteKit): a single `global.css` in the app directory
|
|
10
|
+
* (`app/global.css`) is the stylesheet source. When the Tailwind plugin is
|
|
11
|
+
* active the whole file is compiled into one `/_vesk/static/global.css`;
|
|
12
|
+
* otherwise the user CSS is served as-is from the same URL. There is no
|
|
13
|
+
* separate `_tailwind.css` anymore — user rules and the compiled Tailwind
|
|
14
|
+
* output live in the same file, in one `<link>`.
|
|
14
15
|
*/
|
|
15
16
|
import { readFileSync, existsSync } from 'node:fs';
|
|
16
17
|
import { resolve } from 'node:path';
|
|
17
18
|
export const GLOBAL_CSS_URL = '/_vesk/static/global.css';
|
|
18
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Resolve the project's user stylesheet source. The app-directory convention
|
|
21
|
+
* (`app/global.css`, i.e. `resolve(appDir, 'global.css')`) is checked first;
|
|
22
|
+
* the legacy `src/global.css` and `src/app.css` locations are still honoured
|
|
23
|
+
* so existing projects keep working without a file move.
|
|
24
|
+
*/
|
|
19
25
|
export function resolveUserCssPath(appDir) {
|
|
26
|
+
const appCssSrc = resolve(appDir, 'global.css');
|
|
27
|
+
if (existsSync(appCssSrc))
|
|
28
|
+
return appCssSrc;
|
|
20
29
|
const cssSrc = resolve(appDir, '..', 'src', 'global.css');
|
|
21
30
|
if (existsSync(cssSrc))
|
|
22
31
|
return cssSrc;
|
|
@@ -25,7 +34,7 @@ export function resolveUserCssPath(appDir) {
|
|
|
25
34
|
return altCssSrc;
|
|
26
35
|
return null;
|
|
27
36
|
}
|
|
28
|
-
/** True when the project has a user stylesheet source (`src/global.css` or `src/app.css`). */
|
|
37
|
+
/** True when the project has a user stylesheet source (`app/global.css`, `src/global.css` or `src/app.css`). */
|
|
29
38
|
export function hasUserCss(appDir) {
|
|
30
39
|
return resolveUserCssPath(appDir) !== null;
|
|
31
40
|
}
|
package/dist/dev-config.js
CHANGED
|
@@ -964,7 +964,7 @@ export async function addPluginToConfig(projectDir, pkg) {
|
|
|
964
964
|
let source;
|
|
965
965
|
if (!path) {
|
|
966
966
|
const importName = importNameForPackage(pkg);
|
|
967
|
-
const entry = pkg === '@vesk/plugin-tailwind' ? `${importName}({ entry: '
|
|
967
|
+
const entry = pkg === '@vesk/plugin-tailwind' ? `${importName}({ entry: 'app/global.css', appDir: 'app' })` : `${importName}()`;
|
|
968
968
|
source = `import { defineConfig } from '@vesk/compiler'\nimport ${importName} from '${pkg}'\n\nexport default defineConfig({\n\tplugins: [\n\t\t${entry}\n\t]\n})\n`;
|
|
969
969
|
target = resolve(projectDir, 'vesk.config.ts');
|
|
970
970
|
await writeConfigSource(projectDir, source);
|
|
@@ -1043,7 +1043,7 @@ export async function addPluginToConfig(projectDir, pkg) {
|
|
|
1043
1043
|
source = importLine + source;
|
|
1044
1044
|
}
|
|
1045
1045
|
}
|
|
1046
|
-
const entry = pkg === '@vesk/plugin-tailwind' ? `${importName}({ entry: '
|
|
1046
|
+
const entry = pkg === '@vesk/plugin-tailwind' ? `${importName}({ entry: 'app/global.css', appDir: 'app' })` : `${importName}()`;
|
|
1047
1047
|
const newSource = insertIntoPluginsArray(source, entry);
|
|
1048
1048
|
if (newSource === source)
|
|
1049
1049
|
return;
|
package/dist/hmr.js
CHANGED
|
@@ -344,7 +344,7 @@ function regenerateSsrFunction(routeNode, appDir, outDir, componentMap, options)
|
|
|
344
344
|
for (const [compName, compPath] of compMap) {
|
|
345
345
|
const compSrc = readFileSync(compPath, 'utf-8');
|
|
346
346
|
const escapedSrc = escapeSource(compSrc);
|
|
347
|
-
compRegEntries.push(`
|
|
347
|
+
compRegEntries.push(` __componentRegistry.set(${JSON.stringify(compName)}, async (props, __registry, __vesk) => {\n const _src = \`${escapedSrc}\`;\n const _comp = ${JSON.stringify(compName)};\n const _compiled = (() => { try { setVskHydrate(true); return compileFile(_src, { sourcePath: ${JSON.stringify(compPath)} }); } catch { return null; } finally { setVskHydrate(false); } })();\n const result = await renderPage(_src, _comp, props, __registry, { hydrate: true, cached: _compiled, sourcePath: ${JSON.stringify(compPath)} });\n return result.body;\n })`);
|
|
348
348
|
}
|
|
349
349
|
if (compRegEntries.length > 0) {
|
|
350
350
|
registryCode = `const __componentRegistry = new Map();\n{\n${compRegEntries.join('\n')}\n}\n`;
|
package/dist/ssr-function.js
CHANGED
|
@@ -141,7 +141,7 @@ export function generateSsrFunction(routeNode, appDir, outDir, componentMap, opt
|
|
|
141
141
|
const compMap = componentMap || new Map();
|
|
142
142
|
for (const [compName, compPath] of compMap) {
|
|
143
143
|
const plan = precompilePlan(compPath);
|
|
144
|
-
compRegEntries.push(` (() => {\n const _compiled = (() => { try { return hydratePrecompile(${plan}); } catch { return null; } })();\n
|
|
144
|
+
compRegEntries.push(` (() => {\n const _compiled = (() => { try { return hydratePrecompile(${plan}); } catch { return null; } })();\n __componentRegistry.set(${JSON.stringify(compName)}, async (props, __registry, __vesk) => {\n const result = await renderPage('', ${JSON.stringify(compName)}, props, __registry, { hydrate: true, cached: _compiled });\n return result.body;\n });\n })();`);
|
|
145
145
|
}
|
|
146
146
|
if (compRegEntries.length > 0) {
|
|
147
147
|
registryCode = 'const __componentRegistry = new Map();\n{\n' + compRegEntries.join('\n') + '\n}\n';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vesk/adapter",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.36",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Vesk adapter — builds deployable .vesk/ output for Deno and Node serverless",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"sharp": "^0.35.3"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@vesk/compiler": "^0.2.
|
|
27
|
-
"@vesk/runtime": "^0.2.
|
|
28
|
-
"@vesk/types": "^0.2.
|
|
26
|
+
"@vesk/compiler": "^0.2.36",
|
|
27
|
+
"@vesk/runtime": "^0.2.36",
|
|
28
|
+
"@vesk/types": "^0.2.36"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/ws": "^8.18.1",
|