@vesk/testing 0.2.50-canary.9 → 0.2.51
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 -1
- package/dist/index.js +7 -1
- package/dist/package.json +1 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,16 @@ export interface RenderOptions {
|
|
|
16
16
|
hydrate?: boolean;
|
|
17
17
|
/** File name used in error messages and source paths. */
|
|
18
18
|
fileName?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Directory the source is treated as living in, for module resolution.
|
|
21
|
+
* Defaults to `process.cwd()`. This is what makes an import of a real
|
|
22
|
+
* package resolve: SSR resolves bare specifiers from the importing file's
|
|
23
|
+
* directory upward through `node_modules`, so a harness that passed no
|
|
24
|
+
* directory could never resolve `lucide-vesk` (or anything else) and every
|
|
25
|
+
* component-importing fixture failed — including ones that work in a real
|
|
26
|
+
* build.
|
|
27
|
+
*/
|
|
28
|
+
dir?: string;
|
|
19
29
|
}
|
|
20
30
|
/**
|
|
21
31
|
* Compile and server-render a component from `.vsk` source.
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAyBA,4EAA4E;AAC5E,MAAM,WAAW,iBAAiB;IAChC,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yDAAyD;IACzD,QAAQ,CAA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A+E;IAC/E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAID;;;;;;GAMG;AACH,wBAAgB,KAAK,CACnB,MAAM,EAAE,MAAM,EACd,aAAa,CAAC,EAAE,MAAM,EACtB,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACnC,OAAO,GAAE,YAAiB,GACzB,gBAAgB,GAAG;IAAE,OAAO,IAAI,IAAI,CAAA;CAAE,CAmFxC;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIvF"}
|
package/dist/index.js
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
* is for the other 90%.
|
|
21
21
|
*/
|
|
22
22
|
import { parseHTML } from 'linkedom';
|
|
23
|
+
import { resolve } from 'node:path';
|
|
23
24
|
import { renderPage } from '@vesk/compiler/src/server-codegen';
|
|
24
25
|
/**
|
|
25
26
|
* Compile and server-render a component from `.vsk` source.
|
|
@@ -30,9 +31,14 @@ import { renderPage } from '@vesk/compiler/src/server-codegen';
|
|
|
30
31
|
*/
|
|
31
32
|
export function renderComponent(source, componentName, props = {}, options = {}) {
|
|
32
33
|
const hydrate = options.hydrate !== false;
|
|
34
|
+
// A real path, even for an in-memory source: it is the anchor module
|
|
35
|
+
// resolution uses. `__harness__.vsk` sits in the same directory the app's own
|
|
36
|
+
// components would, so a bare import walks up to the project's node_modules
|
|
37
|
+
// exactly as it does in `vesk dev` / `vesk build`.
|
|
38
|
+
const sourcePath = resolve(options.dir ?? process.cwd(), options.fileName ?? '__harness__.vsk');
|
|
33
39
|
const result = renderPage(source, componentName || 'App', props, new Map(), {
|
|
34
40
|
hydrate,
|
|
35
|
-
sourcePath
|
|
41
|
+
sourcePath,
|
|
36
42
|
});
|
|
37
43
|
return { html: result.body, head: result.head, props: result.props };
|
|
38
44
|
}
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vesk/testing",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.51",
|
|
4
4
|
"description": "Test harness for Vesk components: SSR a .vsk file, hydrate it in a real DOM, drive it, assert on the result.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"build": "tsc -p tsconfig.build.json"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@vesk/adapter": "^0.2.
|
|
23
|
-
"@vesk/compiler": "^0.2.
|
|
24
|
-
"@vesk/runtime": "^0.2.
|
|
25
|
-
"@vesk/types": "^0.2.
|
|
22
|
+
"@vesk/adapter": "^0.2.51",
|
|
23
|
+
"@vesk/compiler": "^0.2.51",
|
|
24
|
+
"@vesk/runtime": "^0.2.51",
|
|
25
|
+
"@vesk/types": "^0.2.51",
|
|
26
26
|
"linkedom": "^0.18.13"
|
|
27
27
|
},
|
|
28
28
|
"license": "MIT"
|