Skip to content

Commit 02ed659

Browse files
committed
feat: add DOM shim and style/template generation utilities
- Introduced a minimal DOM shim in `dom-shim.ts` to support FAST Element's `css` and `html` tagged templates in Node.js. - Added `generate-stylesheets.ts` for converting compiled FAST ElementStyles JS modules into plain CSS files. - Implemented `generate-templates.ts` to convert compiled FAST Element ViewTemplate JS modules into declarative `<f-template>` HTML files. - Updated `index.ts` to export new utilities and types for style and template generation. - Removed unused asset reading functions from `assets.ts` and refactored SSR rendering logic in `render.ts` to utilize the new generation utilities.
1 parent 003a142 commit 02ed659

11 files changed

Lines changed: 1525 additions & 649 deletions

File tree

package-lock.json

Lines changed: 241 additions & 276 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/fast-test-harness/package.json

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@
2626
"test": "./src/index.ts",
2727
"default": "./dist/esm/index.js"
2828
},
29-
"./vite.config.mjs": {
30-
"default": "./vite.config.mjs"
29+
"./build/*.js": {
30+
"types": "./dist/dts/build/*.d.ts",
31+
"test": "./src/build/*.ts",
32+
"default": "./dist/esm/build/*.js"
3133
},
3234
"./ssr/*.js": {
3335
"types": "./dist/dts/ssr/*.d.ts",
@@ -38,29 +40,34 @@
3840
"./public/*": "./public/*",
3941
"./server.mjs": "./server.mjs",
4042
"./start.mjs": "./start.mjs",
43+
"./vite.config.mjs": "./vite.config.mjs",
4144
"./package.json": "./package.json"
4245
},
4346
"scripts": {
4447
"build": "npm run build:tsc",
4548
"build:tsc": "tsc -p tsconfig.build.json"
4649
},
50+
"files": [
51+
"dist",
52+
"playwright.config.ts",
53+
"public",
54+
"server.mjs",
55+
"start.mjs",
56+
"vite.config.mjs"
57+
],
4758
"dependencies": {
48-
"express": "5.2.1"
59+
"@microsoft/fast-build": ">=0.3.0",
60+
"cheerio": "1.2.0"
4961
},
5062
"devDependencies": {
51-
"@microsoft/fast-html": "*",
52-
"@microsoft/fast-build": "*"
63+
"@microsoft/fast-html": "*"
5364
},
5465
"peerDependencies": {
55-
"@microsoft/fast-build": ">=0.4.0 <1.0.0",
5666
"@microsoft/fast-html": ">=1.0.0-alpha.49 <1.0.0",
5767
"@playwright/test": ">=1.40.0",
5868
"vite": ">=7.0.0"
5969
},
6070
"peerDependenciesMeta": {
61-
"@microsoft/fast-build": {
62-
"optional": true
63-
},
6471
"@microsoft/fast-html": {
6572
"optional": true
6673
}

packages/fast-test-harness/playwright.config.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
import { defineConfig, devices } from "@playwright/test";
22

3+
const CI = process.env.CI === "true";
4+
const PORT = process.env.PORT ? Number(process.env.PORT) : 3278;
5+
36
export default defineConfig({
4-
retries: 3,
7+
retries: CI ? 3 : 1,
8+
timeout: CI ? 30_000 : 10_000,
59
fullyParallel: true,
610
use: {
11+
baseURL: `http://localhost:${PORT}`,
712
contextOptions: {
813
reducedMotion: "reduce",
914
},
@@ -22,8 +27,12 @@ export default defineConfig({
2227
reporter: "list",
2328
testMatch: "src/**/*.pw.spec.ts",
2429
webServer: {
25-
command: "node start.mjs",
26-
port: 5273,
30+
command: "fast-test-harness",
31+
port: PORT,
32+
env: {
33+
...process.env,
34+
PORT: PORT.toString(),
35+
},
2736
reuseExistingServer: true,
2837
stdout: "pipe",
2938
stderr: "pipe",

0 commit comments

Comments
 (0)