diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a4b7e02..2543a5d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,12 +19,12 @@ jobs: - name: Installing project dependencies run: | npm ci - # - name: Format - # run: | - # npm run format:check - # - name: Lint - # run: | - # npm run lint + - name: Format Check + run: | + npm run format:check + - name: Lint + run: | + npm run lint - name: Check Types run: | - npm run check \ No newline at end of file + npm run check diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..2312dc5 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +npx lint-staged diff --git a/.oxlintrc.json b/.oxlintrc.json new file mode 100644 index 0000000..9b25ed1 --- /dev/null +++ b/.oxlintrc.json @@ -0,0 +1,9 @@ +{ + "$schema": "./node_modules/oxlint/configuration_schema.json", + "categories": { + "correctness": "error" + }, + "rules": { + "eslint/no-unused-vars": "error" + } +} diff --git a/README.md b/README.md index 0b3d107..551126a 100644 --- a/README.md +++ b/README.md @@ -28,4 +28,12 @@ To start the production server, run: ```sh $ npm run serve -``` \ No newline at end of file +``` + +--- + +Additionally, before committing the following commands will run as part of Husky pre-commit hooks, but you can also run them manually: + +- `npm run lint` - Runs OXLint for JS / TS linting +- `npm run format` - Runs OXFmt for code formatting +- `npm run check` - Run TSGO for type-checking diff --git a/greenwood.config.ts b/greenwood.config.ts index 7760996..36b2c06 100644 --- a/greenwood.config.ts +++ b/greenwood.config.ts @@ -1,7 +1,7 @@ -import { greenwoodPluginImportRaw } from '@greenwood/plugin-import-raw'; -import { greenwoodPluginCssModules } from '@greenwood/plugin-css-modules'; -import { greenwoodPluginImportJsx } from '@greenwood/plugin-import-jsx'; -import { replBundlerResourcePlugin } from './repl-bundler-plugin.ts'; +import { greenwoodPluginImportRaw } from "@greenwood/plugin-import-raw"; +import { greenwoodPluginCssModules } from "@greenwood/plugin-css-modules"; +import { greenwoodPluginImportJsx } from "@greenwood/plugin-import-jsx"; +import { replBundlerResourcePlugin } from "./repl-bundler-plugin.ts"; import type { Config } from "@greenwood/cli"; const config: Config = { @@ -10,8 +10,8 @@ const config: Config = { greenwoodPluginCssModules(), greenwoodPluginImportRaw(), greenwoodPluginImportJsx(), - replBundlerResourcePlugin() - ] + replBundlerResourcePlugin(), + ], }; export default config; diff --git a/lint-staged.config.js b/lint-staged.config.js new file mode 100644 index 0000000..31f405d --- /dev/null +++ b/lint-staged.config.js @@ -0,0 +1,5 @@ +export default { + "*.js": ["npm run lint --"], + "*.ts": ["npm run lint --", "npm run check --"], + "*.*": ["npm run format --"], +}; diff --git a/netlify.toml b/netlify.toml index c75caff..bf2075a 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,9 +1,9 @@ [build] - publish = "public/" - command = "npm run build" +publish = "public/" +command = "npm run build" [build.processing] - skip_processing = true +skip_processing = true [build.environment] - NODE_VERSION = "24.4.0" \ No newline at end of file +NODE_VERSION = "24.4.0" diff --git a/package-lock.json b/package-lock.json index dff7f85..b573381 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,11 @@ "@greenwood/plugin-css-modules": "^0.34.0-alpha.4", "@greenwood/plugin-import-jsx": "^0.34.0-alpha.4", "@greenwood/plugin-import-raw": "^0.34.0-alpha.4", + "@typescript/native-preview": "^7.0.0-dev.20260209.1", + "husky": "^9.1.7", + "lint-staged": "^16.2.7", + "oxfmt": "^0.28.0", + "oxlint": "^1.43.0", "patch-package": "^8.0.1", "typescript": "^5.9.2" } @@ -165,6 +170,230 @@ "url": "https://paulmillr.com/funding/" } }, + "node_modules/@oxfmt/darwin-arm64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@oxfmt/darwin-arm64/-/darwin-arm64-0.28.0.tgz", + "integrity": "sha512-jmUfF7cNJPw57bEK7sMIqrYRgn4LH428tSgtgLTCtjuGuu1ShREyrkeB7y8HtkXRfhBs4lVY+HMLhqElJvZ6ww==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@oxfmt/darwin-x64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@oxfmt/darwin-x64/-/darwin-x64-0.28.0.tgz", + "integrity": "sha512-S6vlV8S7jbjzJOSjfVg2CimUC0r7/aHDLdUm/3+/B/SU/s1jV7ivqWkMv1/8EB43d1BBwT9JQ60ZMTkBqeXSFA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@oxfmt/linux-arm64-gnu": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@oxfmt/linux-arm64-gnu/-/linux-arm64-gnu-0.28.0.tgz", + "integrity": "sha512-TfJkMZjePbLiskmxFXVAbGI/OZtD+y+fwS0wyW8O6DWG0ARTf0AipY9zGwGoOdpFuXOJceXvN4SHGLbYNDMY4Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxfmt/linux-arm64-musl": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@oxfmt/linux-arm64-musl/-/linux-arm64-musl-0.28.0.tgz", + "integrity": "sha512-7fyQUdW203v4WWGr1T3jwTz4L7KX9y5DeATryQ6fLT6QQp9GEuct8/k0lYhd+ys42iTV/IkJF20e3YkfSOOILg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxfmt/linux-x64-gnu": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@oxfmt/linux-x64-gnu/-/linux-x64-gnu-0.28.0.tgz", + "integrity": "sha512-sRKqAvEonuz0qr1X1ncUZceOBJerKzkO2gZIZmosvy/JmqyffpIFL3OE2tqacFkeDhrC+dNYQpusO8zsfHo3pw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxfmt/linux-x64-musl": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@oxfmt/linux-x64-musl/-/linux-x64-musl-0.28.0.tgz", + "integrity": "sha512-fW6czbXutX/tdQe8j4nSIgkUox9RXqjyxwyWXUDItpoDkoXllq17qbD7GVc0whrEhYQC6hFE1UEAcDypLJoSzw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxfmt/win32-arm64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@oxfmt/win32-arm64/-/win32-arm64-0.28.0.tgz", + "integrity": "sha512-D/HDeQBAQRjTbD9OLV6kRDcStrIfO+JsUODDCdGmhRfNX8LPCx95GpfyybpZfn3wVF8Jq/yjPXV1xLkQ+s7RcA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@oxfmt/win32-x64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@oxfmt/win32-x64/-/win32-x64-0.28.0.tgz", + "integrity": "sha512-4+S2j4OxOIyo8dz5osm5dZuL0yVmxXvtmNdHB5xyGwAWVvyWNvf7tCaQD7w2fdSsAXQLOvK7KFQrHFe33nJUCA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@oxlint/darwin-arm64": { + "version": "1.43.0", + "resolved": "https://registry.npmjs.org/@oxlint/darwin-arm64/-/darwin-arm64-1.43.0.tgz", + "integrity": "sha512-C/GhObv/pQZg34NOzB6Mk8x0wc9AKj8fXzJF8ZRKTsBPyHusC6AZ6bba0QG0TUufw1KWuD0j++oebQfWeiFXNw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@oxlint/darwin-x64": { + "version": "1.43.0", + "resolved": "https://registry.npmjs.org/@oxlint/darwin-x64/-/darwin-x64-1.43.0.tgz", + "integrity": "sha512-4NjfUtEEH8ewRQ2KlZGmm6DyrvypMdHwBnQT92vD0dLScNOQzr0V9O8Ua4IWXdeCNl/XMVhAV3h4/3YEYern5A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@oxlint/linux-arm64-gnu": { + "version": "1.43.0", + "resolved": "https://registry.npmjs.org/@oxlint/linux-arm64-gnu/-/linux-arm64-gnu-1.43.0.tgz", + "integrity": "sha512-75tf1HvwdZ3ebk83yMbSB+moAEWK98mYqpXiaFAi6Zshie7r+Cx5PLXZFUEqkscenoZ+fcNXakHxfn94V6nf1g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxlint/linux-arm64-musl": { + "version": "1.43.0", + "resolved": "https://registry.npmjs.org/@oxlint/linux-arm64-musl/-/linux-arm64-musl-1.43.0.tgz", + "integrity": "sha512-BHV4fb36T2p/7bpA9fiJ5ayt7oJbiYX10nklW5arYp4l9/9yG/FQC5J4G1evzbJ/YbipF9UH0vYBAm5xbqGrvw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxlint/linux-x64-gnu": { + "version": "1.43.0", + "resolved": "https://registry.npmjs.org/@oxlint/linux-x64-gnu/-/linux-x64-gnu-1.43.0.tgz", + "integrity": "sha512-1l3nvnzWWse1YHibzZ4HQXdF/ibfbKZhp9IguElni3bBqEyPEyurzZ0ikWynDxKGXqZa+UNXTFuU1NRVX1RJ3g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxlint/linux-x64-musl": { + "version": "1.43.0", + "resolved": "https://registry.npmjs.org/@oxlint/linux-x64-musl/-/linux-x64-musl-1.43.0.tgz", + "integrity": "sha512-+jNYgLGRFTJxJuaSOZJBwlYo5M0TWRw0+3y5MHOL4ArrIdHyCthg6r4RbVWrsR1qUfUE1VSSHQ2bfbC99RXqMg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxlint/win32-arm64": { + "version": "1.43.0", + "resolved": "https://registry.npmjs.org/@oxlint/win32-arm64/-/win32-arm64-1.43.0.tgz", + "integrity": "sha512-dvs1C/HCjCyGTURMagiHprsOvVTT3omDiSzi5Qw0D4QFJ1pEaNlfBhVnOUYgUfS6O7Mcmj4+G+sidRsQcWQ/kA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@oxlint/win32-x64": { + "version": "1.43.0", + "resolved": "https://registry.npmjs.org/@oxlint/win32-x64/-/win32-x64-1.43.0.tgz", + "integrity": "sha512-bSuItSU8mTSDsvmmLTepTdCL2FkJI6dwt9tot/k0EmiYF+ArRzmsl4lXVLssJNRV5lJEc5IViyTrh7oiwrjUqA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@paralleldrive/cuid2": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/@paralleldrive/cuid2/-/cuid2-2.3.1.tgz", @@ -837,6 +1066,123 @@ "@types/node": "*" } }, + "node_modules/@typescript/native-preview": { + "version": "7.0.0-dev.20260209.1", + "resolved": "https://registry.npmjs.org/@typescript/native-preview/-/native-preview-7.0.0-dev.20260209.1.tgz", + "integrity": "sha512-UdA8RC9ic/qi9ajolQQP7ZG8YwtUbxtTMu6FxKBn4pYWicuXqMjzXqH/Ng+VlqqeYrl088P4Ou0erGPuLu4ajw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsgo": "bin/tsgo.js" + }, + "optionalDependencies": { + "@typescript/native-preview-darwin-arm64": "7.0.0-dev.20260209.1", + "@typescript/native-preview-darwin-x64": "7.0.0-dev.20260209.1", + "@typescript/native-preview-linux-arm": "7.0.0-dev.20260209.1", + "@typescript/native-preview-linux-arm64": "7.0.0-dev.20260209.1", + "@typescript/native-preview-linux-x64": "7.0.0-dev.20260209.1", + "@typescript/native-preview-win32-arm64": "7.0.0-dev.20260209.1", + "@typescript/native-preview-win32-x64": "7.0.0-dev.20260209.1" + } + }, + "node_modules/@typescript/native-preview-darwin-arm64": { + "version": "7.0.0-dev.20260209.1", + "resolved": "https://registry.npmjs.org/@typescript/native-preview-darwin-arm64/-/native-preview-darwin-arm64-7.0.0-dev.20260209.1.tgz", + "integrity": "sha512-TyFP7dGMo/Xz37MI3QNfGl3J2i8AKurYwLLD+bG0EDLWnz213wwBwN6U9vMcyatBzfdxKEHHPgdNP0UYCVx3kQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@typescript/native-preview-darwin-x64": { + "version": "7.0.0-dev.20260209.1", + "resolved": "https://registry.npmjs.org/@typescript/native-preview-darwin-x64/-/native-preview-darwin-x64-7.0.0-dev.20260209.1.tgz", + "integrity": "sha512-1Dr8toDQcmqKjXd5cQoTAjzMR46cscaojQiazbAPJsU/1PQFgBT36/Mb/epLpzN+ZKKgf7Xd6u2eqH2ze0kF6Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@typescript/native-preview-linux-arm": { + "version": "7.0.0-dev.20260209.1", + "resolved": "https://registry.npmjs.org/@typescript/native-preview-linux-arm/-/native-preview-linux-arm-7.0.0-dev.20260209.1.tgz", + "integrity": "sha512-svmoHHjs5gDekSDW6yLzk9iyDxhMnLKJZ9Xk6b1bSz0swrQNPPTJdR7mbhVMrv4HtXei0LHPlXdTr85AqI5qOQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@typescript/native-preview-linux-arm64": { + "version": "7.0.0-dev.20260209.1", + "resolved": "https://registry.npmjs.org/@typescript/native-preview-linux-arm64/-/native-preview-linux-arm64-7.0.0-dev.20260209.1.tgz", + "integrity": "sha512-xmGrxP0ERLeczerjJtask6gOln/QhAeELqTmaNoATvU7hZfEzDDxJOgSXZnX6bCIQHdN/Xn49gsyPjzTaK4rAg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@typescript/native-preview-linux-x64": { + "version": "7.0.0-dev.20260209.1", + "resolved": "https://registry.npmjs.org/@typescript/native-preview-linux-x64/-/native-preview-linux-x64-7.0.0-dev.20260209.1.tgz", + "integrity": "sha512-cK4XK3L7TXPj9fIalQcXRqSErdM+pZSqiNgp6QtNsNCyoH2W6J281hnjUA4TmD4TRMSn8CRn7Exy3CGNC3gZkA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@typescript/native-preview-win32-arm64": { + "version": "7.0.0-dev.20260209.1", + "resolved": "https://registry.npmjs.org/@typescript/native-preview-win32-arm64/-/native-preview-win32-arm64-7.0.0-dev.20260209.1.tgz", + "integrity": "sha512-U919FWN5FZG/1i75+Cv9mnd80Mw2rdFE/to/wJ6DX9m0dUL8IfZARQYPGDXDO1LEC6sV3CyCpCJ/HqsSkqgaAg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@typescript/native-preview-win32-x64": { + "version": "7.0.0-dev.20260209.1", + "resolved": "https://registry.npmjs.org/@typescript/native-preview-win32-x64/-/native-preview-win32-x64-7.0.0-dev.20260209.1.tgz", + "integrity": "sha512-1U/2fG/A1yZtkP59IkDlOVLw2cPtP6NbLROtTytNN0CLSqme+0OXoh+l7wlN2iSmGY5zIeaVcqs4UIL0SiQInQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@yarnpkg/lockfile": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz", @@ -917,6 +1263,35 @@ "node": ">=22" } }, + "node_modules/ansi-escapes": { + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-7.3.0.tgz", + "integrity": "sha512-BvU8nYgGQBxcmMuEeUEmNTvrMVjJNSH7RgW24vXexN4Ven6qCvy4TntnvlnwnMLTVlcRQQdbRY8NKnaIoeWDNg==", + "dev": true, + "license": "MIT", + "dependencies": { + "environment": "^1.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", + "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, "node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -1152,6 +1527,39 @@ "node": ">=8" } }, + "node_modules/cli-cursor": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-5.0.0.tgz", + "integrity": "sha512-aCj4O5wKyszjMmDT4tZj93kxyydN/K5zPWSCe6/0AV/AA1pqe5ZBIw0a2ZfPQV7lL5/yb5HsUreJ6UFAF1tEQw==", + "dev": true, + "license": "MIT", + "dependencies": { + "restore-cursor": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-5.1.1.tgz", + "integrity": "sha512-SroPvNHxUnk+vIW/dOSfNqdy1sPEFkrTk6TUtqLCnBlo3N7TNYYkzzN7uSD6+jVjrdO4+p8nH7JzH6cIvUem6A==", + "dev": true, + "license": "MIT", + "dependencies": { + "slice-ansi": "^7.1.0", + "string-width": "^8.0.0" + }, + "engines": { + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/co-body": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/co-body/-/co-body-6.2.0.tgz", @@ -1236,6 +1644,13 @@ "dev": true, "license": "MIT" }, + "node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "dev": true, + "license": "MIT" + }, "node_modules/commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", @@ -1501,6 +1916,13 @@ "dev": true, "license": "MIT" }, + "node_modules/emoji-regex": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz", + "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==", + "dev": true, + "license": "MIT" + }, "node_modules/encodeurl": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", @@ -1524,6 +1946,19 @@ "url": "https://github.com/fb55/entities?sponsor=1" } }, + "node_modules/environment": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/environment/-/environment-1.1.0.tgz", + "integrity": "sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/es-define-property": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", @@ -1592,6 +2027,13 @@ "dev": true, "license": "MIT" }, + "node_modules/eventemitter3": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz", + "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==", + "dev": true, + "license": "MIT" + }, "node_modules/fdir": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", @@ -1718,6 +2160,19 @@ "next": ">=13.2.0" } }, + "node_modules/get-east-asian-width": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.4.0.tgz", + "integrity": "sha512-QZjmEOC+IT1uk6Rx0sX22V6uHWVwbdbxf1faPqJ1QhLdGgsRGCZoyaQBm/piRdJy/D2um6hM1UP7ZEeQ4EkP+Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/get-intrinsic": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", @@ -1921,6 +2376,22 @@ "url": "https://opencollective.com/express" } }, + "node_modules/husky": { + "version": "9.1.7", + "resolved": "https://registry.npmjs.org/husky/-/husky-9.1.7.tgz", + "integrity": "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==", + "dev": true, + "license": "MIT", + "bin": { + "husky": "bin.js" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, "node_modules/iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -2006,6 +2477,22 @@ "node": ">=0.10.0" } }, + "node_modules/is-fullwidth-code-point": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-5.1.0.tgz", + "integrity": "sha512-5XHYaSyiqADb4RnZ1Bdad6cPp8Toise4TzEjcOYDHZkTCbKgiUl7WTUCpNWHuxmDt91wnsZBc9xinNzopv3JMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "get-east-asian-width": "^1.3.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", @@ -2213,6 +2700,59 @@ "dev": true, "license": "MIT" }, + "node_modules/lint-staged": { + "version": "16.2.7", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-16.2.7.tgz", + "integrity": "sha512-lDIj4RnYmK7/kXMya+qJsmkRFkGolciXjrsZ6PC25GdTfWOAWetR0ZbsNXRAj1EHHImRSalc+whZFg56F5DVow==", + "dev": true, + "license": "MIT", + "dependencies": { + "commander": "^14.0.2", + "listr2": "^9.0.5", + "micromatch": "^4.0.8", + "nano-spawn": "^2.0.0", + "pidtree": "^0.6.0", + "string-argv": "^0.3.2", + "yaml": "^2.8.1" + }, + "bin": { + "lint-staged": "bin/lint-staged.js" + }, + "engines": { + "node": ">=20.17" + }, + "funding": { + "url": "https://opencollective.com/lint-staged" + } + }, + "node_modules/lint-staged/node_modules/commander": { + "version": "14.0.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-14.0.3.tgz", + "integrity": "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20" + } + }, + "node_modules/listr2": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-9.0.5.tgz", + "integrity": "sha512-ME4Fb83LgEgwNw96RKNvKV4VTLuXfoKudAmm2lP8Kk87KaMK0/Xrx/aAkMWmT8mDb+3MlFDspfbCs7adjRxA2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "cli-truncate": "^5.0.0", + "colorette": "^2.0.20", + "eventemitter3": "^5.0.1", + "log-update": "^6.1.0", + "rfdc": "^1.4.1", + "wrap-ansi": "^9.0.0" + }, + "engines": { + "node": ">=20.0.0" + } + }, "node_modules/livereload": { "version": "0.9.3", "resolved": "https://registry.npmjs.org/livereload/-/livereload-0.9.3.tgz", @@ -2239,6 +2779,26 @@ "dev": true, "license": "MIT" }, + "node_modules/log-update": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-6.1.0.tgz", + "integrity": "sha512-9ie8ItPR6tjY5uYJh8K/Zrv/RMZ5VOlOWvtZdEHYSTFKZfIBPQa9tOAEeAWhd+AnIneLJ22w5fjOYtoutpWq5w==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-escapes": "^7.0.0", + "cli-cursor": "^5.0.0", + "slice-ansi": "^7.1.0", + "strip-ansi": "^7.1.0", + "wrap-ansi": "^9.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/magic-string": { "version": "0.30.21", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", @@ -2330,6 +2890,19 @@ "url": "https://opencollective.com/express" } }, + "node_modules/mimic-function": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/mimic-function/-/mimic-function-5.0.1.tgz", + "integrity": "sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/minimist": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", @@ -2352,6 +2925,19 @@ "thenify-all": "^1.0.0" } }, + "node_modules/nano-spawn": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/nano-spawn/-/nano-spawn-2.0.0.tgz", + "integrity": "sha512-tacvGzUY5o2D8CBh2rrwxyNojUsZNU2zjNTzKQrkgGJQTbGAfArVWXSKMBokBeeg6C7OLRGUEyoFlYbfeWQIqw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.17" + }, + "funding": { + "url": "https://github.com/sindresorhus/nano-spawn?sponsor=1" + } + }, "node_modules/negotiator": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", @@ -2452,6 +3038,22 @@ "wrappy": "1" } }, + "node_modules/onetime": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-7.0.0.tgz", + "integrity": "sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-function": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/open": { "version": "7.4.2", "resolved": "https://registry.npmjs.org/open/-/open-7.4.2.tgz", @@ -2482,6 +3084,69 @@ "dev": true, "license": "BSD-2-Clause" }, + "node_modules/oxfmt": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/oxfmt/-/oxfmt-0.28.0.tgz", + "integrity": "sha512-3+hhBqPE6Kp22KfJmnstrZbl+KdOVSEu1V0ABaFIg1rYLtrMgrupx9znnHgHLqKxAVHebjTdiCJDk30CXOt6cw==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinypool": "2.1.0" + }, + "bin": { + "oxfmt": "bin/oxfmt" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/sponsors/Boshen" + }, + "optionalDependencies": { + "@oxfmt/darwin-arm64": "0.28.0", + "@oxfmt/darwin-x64": "0.28.0", + "@oxfmt/linux-arm64-gnu": "0.28.0", + "@oxfmt/linux-arm64-musl": "0.28.0", + "@oxfmt/linux-x64-gnu": "0.28.0", + "@oxfmt/linux-x64-musl": "0.28.0", + "@oxfmt/win32-arm64": "0.28.0", + "@oxfmt/win32-x64": "0.28.0" + } + }, + "node_modules/oxlint": { + "version": "1.43.0", + "resolved": "https://registry.npmjs.org/oxlint/-/oxlint-1.43.0.tgz", + "integrity": "sha512-xiqTCsKZch+R61DPCjyqUVP2MhkQlRRYxLRBeBDi+dtQJ90MOgdcjIktvDCgXz0bgtx94EQzHEndsizZjMX2OA==", + "dev": true, + "license": "MIT", + "bin": { + "oxlint": "bin/oxlint" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/sponsors/Boshen" + }, + "optionalDependencies": { + "@oxlint/darwin-arm64": "1.43.0", + "@oxlint/darwin-x64": "1.43.0", + "@oxlint/linux-arm64-gnu": "1.43.0", + "@oxlint/linux-arm64-musl": "1.43.0", + "@oxlint/linux-x64-gnu": "1.43.0", + "@oxlint/linux-x64-musl": "1.43.0", + "@oxlint/win32-arm64": "1.43.0", + "@oxlint/win32-x64": "1.43.0" + }, + "peerDependencies": { + "oxlint-tsgolint": ">=0.11.2" + }, + "peerDependenciesMeta": { + "oxlint-tsgolint": { + "optional": true + } + } + }, "node_modules/parse5": { "version": "7.3.0", "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz", @@ -2578,6 +3243,19 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/pidtree": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.6.0.tgz", + "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==", + "dev": true, + "license": "MIT", + "bin": { + "pidtree": "bin/pidtree.js" + }, + "engines": { + "node": ">=0.10" + } + }, "node_modules/pirates": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.7.tgz", @@ -2677,6 +3355,30 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/restore-cursor": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-5.1.0.tgz", + "integrity": "sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA==", + "dev": true, + "license": "MIT", + "dependencies": { + "onetime": "^7.0.0", + "signal-exit": "^4.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/rfdc": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz", + "integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==", + "dev": true, + "license": "MIT" + }, "node_modules/rollup": { "version": "4.57.0", "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.57.0.tgz", @@ -2897,6 +3599,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/slash": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", @@ -2907,6 +3622,36 @@ "node": ">=6" } }, + "node_modules/slice-ansi": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-7.1.2.tgz", + "integrity": "sha512-iOBWFgUX7caIZiuutICxVgX1SdxwAVFFKwt1EvMYYec/NWO5meOJ6K5uQxhrYBdQJne4KxiqZc+KptFOWFSI9w==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.2.1", + "is-fullwidth-code-point": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/slice-ansi/node_modules/ansi-styles": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, "node_modules/smob": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/smob/-/smob-1.5.0.tgz", @@ -2962,6 +3707,49 @@ "node": ">= 0.8" } }, + "node_modules/string-argv": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz", + "integrity": "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.6.19" + } + }, + "node_modules/string-width": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-8.1.1.tgz", + "integrity": "sha512-KpqHIdDL9KwYk22wEOg/VIqYbrnLeSApsKT/bSj6Ez7pn3CftUiLAv2Lccpq1ALcpLV9UX1Ppn92npZWu2w/aw==", + "dev": true, + "license": "MIT", + "dependencies": { + "get-east-asian-width": "^1.3.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/strip-ansi": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", + "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, "node_modules/sucrase": { "version": "3.35.1", "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.1.tgz", @@ -3080,6 +3868,16 @@ "url": "https://github.com/sponsors/SuperchupuDev" } }, + "node_modules/tinypool": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-2.1.0.tgz", + "integrity": "sha512-Pugqs6M0m7Lv1I7FtxN4aoyToKg1C4tu+/381vH35y8oENM/Ai7f7C4StcoK4/+BSw9ebcS8jRiVrORFKCALLw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.0.0 || >=22.0.0" + } + }, "node_modules/tmp": { "version": "0.2.5", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.5.tgz", @@ -3237,6 +4035,55 @@ "node": ">= 8" } }, + "node_modules/wrap-ansi": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.2.tgz", + "integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.2.1", + "string-width": "^7.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/string-width": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", diff --git a/package.json b/package.json index 71cb7d8..eb2f34d 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,14 @@ { "name": "playground.wcc.dev", - "description": "Playground repository for wcc.dev", "version": "1.0.0", - "author": "Owen Buckley ", + "description": "Playground repository for wcc.dev", "keywords": [ - "WCC", - "WC Compiler", "REPL", + "WC Compiler", + "WCC", "playground" ], + "author": "Owen Buckley ", "repository": { "type": "git", "url": "git+https://github.com/ProjectEvergreen/playground.wcc.dev.git" @@ -18,7 +18,11 @@ "dev": "greenwood develop", "build": "NODE_OPTIONS='--import @greenwood/cli/register' greenwood build", "serve": "greenwood serve", - "check": "tsc", + "lint": "oxlint", + "format": "oxfmt", + "format:check": "oxfmt --check", + "check": "tsgo", + "prepare": "husky", "postinstall": "patch-package" }, "dependencies": { @@ -28,8 +32,13 @@ "devDependencies": { "@greenwood/cli": "~0.34.0-alpha.4", "@greenwood/plugin-css-modules": "^0.34.0-alpha.4", - "@greenwood/plugin-import-raw": "^0.34.0-alpha.4", "@greenwood/plugin-import-jsx": "^0.34.0-alpha.4", + "@greenwood/plugin-import-raw": "^0.34.0-alpha.4", + "@typescript/native-preview": "^7.0.0-dev.20260209.1", + "husky": "^9.1.7", + "lint-staged": "^16.2.7", + "oxfmt": "^0.28.0", + "oxlint": "^1.43.0", "patch-package": "^8.0.1", "typescript": "^5.9.2" } diff --git a/repl-bundler-plugin.ts b/repl-bundler-plugin.ts index 7319e5b..b3c7034 100644 --- a/repl-bundler-plugin.ts +++ b/repl-bundler-plugin.ts @@ -1,36 +1,36 @@ -import * as rollup from 'rollup'; +import * as rollup from "rollup"; // TODO: depend on these modules first party -import { nodeResolve } from '@rollup/plugin-node-resolve'; -import commonjs from '@rollup/plugin-commonjs'; -import type { ResourcePlugin } from '@greenwood/cli'; +import { nodeResolve } from "@rollup/plugin-node-resolve"; +import commonjs from "@rollup/plugin-commonjs"; +import type { ResourcePlugin } from "@greenwood/cli"; -function externalizeFsBuiltinRollupPlugin() { - return { - name: 'externalize-fs-builtin', - resolveId(source: string) { - if (source === 'fs') { - return source; - } - return null; - }, - load(id: string) { - if (id === 'fs') { - return ` - const noop = () => {}; - const fs = { - readFileSync: noop, - promises: { - readFile: noop - } - } +// function externalizeFsBuiltinRollupPlugin() { +// return { +// name: 'externalize-fs-builtin', +// resolveId(source: string) { +// if (source === 'fs') { +// return source; +// } +// return null; +// }, +// load(id: string) { +// if (id === 'fs') { +// return ` +// const noop = () => {}; +// const fs = { +// readFileSync: noop, +// promises: { +// readFile: noop +// } +// } - export default fs; - `; - } - return null; - }, - }; -} +// export default fs; +// `; +// } +// return null; +// }, +// }; +// } class ReplBundlerResource { extensions: string[]; @@ -39,36 +39,36 @@ class ReplBundlerResource { this.extensions = []; } - async shouldServe(url: URL) { - return url.pathname.endsWith('scripts/repl.ts'); + async shouldIntercept(url: URL) { + return url.pathname.endsWith("scripts/repl.ts"); } - async serve(url: URL) { + async intercept(url: URL) { const bundle = await rollup.rollup({ input: url.pathname, treeshake: false, plugins: [ - externalizeFsBuiltinRollupPlugin(), + // externalizeFsBuiltinRollupPlugin(), nodeResolve(), commonjs(), ], }); const { output } = await bundle.generate({ - format: 'esm', + format: "esm", }); return new Response(output[0].code, { headers: { - 'Content-Type': 'text/javascript', + "Content-Type": "text/javascript", }, }); } } -export function replBundlerResourcePlugin(options = {}): ResourcePlugin { +export function replBundlerResourcePlugin(): ResourcePlugin { return { - type: 'resource', - name: 'repl-bundler-resource-plugin', + type: "resource", + name: "repl-bundler-resource-plugin", provider: () => new ReplBundlerResource(), }; -} \ No newline at end of file +} diff --git a/src/components/footer/footer.tsx b/src/components/footer/footer.tsx index 7d58ce9..dcbfbc0 100644 --- a/src/components/footer/footer.tsx +++ b/src/components/footer/footer.tsx @@ -1,6 +1,6 @@ -import styles from './footer.module.css'; -import '../social-tray/social-tray.tsx'; -import wccLogo from '../../assets/wcc-logo.svg?type=raw'; +import styles from "./footer.module.css"; +import "../social-tray/social-tray.tsx"; +import wccLogo from "../../assets/wcc-logo.svg?type=raw"; export default class Footer extends HTMLElement { connectedCallback() { @@ -22,4 +22,4 @@ export default class Footer extends HTMLElement { } } -customElements.define('wcc-footer', Footer); +customElements.define("wcc-footer", Footer); diff --git a/src/components/header/header.tsx b/src/components/header/header.tsx index a28295e..f519e04 100644 --- a/src/components/header/header.tsx +++ b/src/components/header/header.tsx @@ -1,7 +1,7 @@ -import type { Page } from '@greenwood/cli'; -import wccLogo from '../../assets/wcc-logo.svg?type=raw'; -import mobileMenuIcon from '../../assets/tile.svg?type=raw'; -import styles from './header.module.css'; +import type { Page } from "@greenwood/cli"; +import wccLogo from "../../assets/wcc-logo.svg?type=raw"; +import mobileMenuIcon from "../../assets/tile.svg?type=raw"; +import styles from "./header.module.css"; function getNavItemsHtml(navItems: Page[], isMobile: boolean, currentRoute: string): string { const itemClass = isMobile ? styles.mobileMenuListItem : styles.navBarMenuItem; @@ -9,7 +9,7 @@ function getNavItemsHtml(navItems: Page[], isMobile: boolean, currentRoute: stri return navItems .map((item) => { const { route, label } = item; - const isActiveClass = currentRoute === item.route ? 'class="active"' : ''; + const isActiveClass = currentRoute === item.route ? 'class="active"' : ""; return `
  • @@ -17,7 +17,7 @@ function getNavItemsHtml(navItems: Page[], isMobile: boolean, currentRoute: stri
  • `; }) - .join(''); + .join(""); } export default class Header extends HTMLElement { @@ -26,33 +26,38 @@ export default class Header extends HTMLElement { constructor() { super(); - this.currentRoute = ''; + this.currentRoute = ""; this.navItems = []; } async connectedCallback() { - this.currentRoute = '/playground/'; - this.navItems = [{ - id: 'index', - title: 'Home', - route: 'http://wcc.dev/', - label: 'Home', - }, { - id: 'docs', - title: 'Docs', - route: 'http://wcc.dev/docs/', - label: 'Docs', - }, { - id: 'examples', - title: 'Examples', - route: 'http://wcc.dev/examples/', - label: 'Examples', - }, { - id: 'playground', - title: 'Playground', - route: '/playground/', - label: 'Playground', - }]; + this.currentRoute = "/playground/"; + this.navItems = [ + { + id: "index", + title: "Home", + route: "http://wcc.dev/", + label: "Home", + }, + { + id: "docs", + title: "Docs", + route: "http://wcc.dev/docs/", + label: "Docs", + }, + { + id: "examples", + title: "Examples", + route: "http://wcc.dev/examples/", + label: "Examples", + }, + { + id: "playground", + title: "Playground", + route: "/playground/", + label: "Playground", + }, + ]; this.render(); } @@ -112,4 +117,4 @@ export default class Header extends HTMLElement { } } -customElements.define('wcc-header', Header); +customElements.define("wcc-header", Header); diff --git a/src/components/social-tray/social-tray.tsx b/src/components/social-tray/social-tray.tsx index 7723816..043f72d 100644 --- a/src/components/social-tray/social-tray.tsx +++ b/src/components/social-tray/social-tray.tsx @@ -1,8 +1,8 @@ -import styles from './social-tray.module.css'; -import discordIcon from '../../assets/discord.svg?type=raw'; -import githubIcon from '../../assets/github.svg?type=raw'; -import twitterIcon from '../../assets/twitter-logo.svg?type=raw'; -import blueskyIcon from '../../assets/bluesky.svg?type=raw'; +import styles from "./social-tray.module.css"; +import discordIcon from "../../assets/discord.svg?type=raw"; +import githubIcon from "../../assets/github.svg?type=raw"; +import twitterIcon from "../../assets/twitter-logo.svg?type=raw"; +import blueskyIcon from "../../assets/bluesky.svg?type=raw"; export default class SocialTray extends HTMLElement { connectedCallback() { @@ -48,10 +48,10 @@ export default class SocialTray extends HTMLElement { } } -customElements.define('wcc-social-tray', SocialTray); +customElements.define("wcc-social-tray", SocialTray); declare global { interface HTMLElementTagNameMap { - 'wcc-social-tray': SocialTray; + "wcc-social-tray": SocialTray; } } diff --git a/src/scripts/repl-init.ts b/src/scripts/repl-init.ts index cec3b9e..816c0aa 100644 --- a/src/scripts/repl-init.ts +++ b/src/scripts/repl-init.ts @@ -1,15 +1,15 @@ -const inputArea = document.getElementById('input') as HTMLTextAreaElement; -const outputArea = document.getElementById('output') as HTMLTextAreaElement; -const workerUrl = new URL('./repl.ts', import.meta.url); +const inputArea = document.getElementById("input") as HTMLTextAreaElement; +const outputArea = document.getElementById("output") as HTMLTextAreaElement; +const workerUrl = new URL("./repl.ts", import.meta.url); const inputContent = inputArea.value; -const worker = new Worker(workerUrl, { type: 'module' }); +const worker = new Worker(workerUrl, { type: "module" }); worker.onmessage = (result) => { outputArea.value = result.data.html; }; worker.postMessage([inputContent]); -inputArea.addEventListener('input', function () { +inputArea.addEventListener("input", function () { worker.postMessage([inputArea.value]); }); diff --git a/src/scripts/repl.ts b/src/scripts/repl.ts index e88a47b..04b5d4e 100644 --- a/src/scripts/repl.ts +++ b/src/scripts/repl.ts @@ -1,39 +1,39 @@ // TODO: have this come from WCC // import { renderFromInput } from '../../src/wcc.js'; // TODO: have wc-compiler expose DOM shim through exports maps -import 'wc-compiler/dom-shim.js'; -import { transform } from 'sucrase'; -import * as acorn from 'acorn'; -import * as walk from 'acorn-walk'; -import { serialize } from 'parse5'; +import "wc-compiler/dom-shim.js"; +import { transform } from "sucrase"; +import * as acorn from "acorn"; +import * as walk from "acorn-walk"; +import { serialize } from "parse5"; // @ts-expect-error function isCustomElementDefinitionNode(node) { const { expression } = node; return ( - expression.type === 'CallExpression' && + expression.type === "CallExpression" && expression.callee && expression.callee.object && expression.callee.property && - expression.callee.object.name === 'customElements' && - expression.callee.property.name === 'define' + expression.callee.object.name === "customElements" && + expression.callee.property.name === "define" ); } // @ts-expect-error async function getTagName(moduleContents) { const result = transform(moduleContents, { - transforms: ['typescript', 'jsx'], - jsxRuntime: 'automatic', + transforms: ["typescript", "jsx"], + jsxRuntime: "automatic", production: true, }); let tagName; walk.simple( acorn.Parser.parse(result.code, { - ecmaVersion: 'latest', - sourceType: 'module', + ecmaVersion: "latest", + sourceType: "module", }), { ExpressionStatement(node) { @@ -51,7 +51,7 @@ async function getTagName(moduleContents) { // @ts-expect-error async function renderComponentRoots(tree, definitions) { for (const node of tree.childNodes) { - if (node.tagName && node.tagName.indexOf('-') > 0) { + if (node.tagName && node.tagName.indexOf("-") > 0) { const { attrs, tagName } = node; if (definitions[tagName]) { @@ -82,7 +82,7 @@ async function renderComponentRoots(tree, definitions) { // @ts-expect-error attrs.forEach((attr) => { - if (attr.name === 'hydrate') { + if (attr.name === "hydrate") { definitions[tagName].hydrate = attr.value; } }); @@ -137,7 +137,7 @@ async function initializeCustomElement( } onmessage = async (e) => { - console.log('Worker: Message received from main script', { e }); + console.log("Worker: Message received from main script", { e }); const input = e.data[0]; const props = e.data[1] ?? null; const wrappingEntryTag = true; @@ -148,7 +148,7 @@ onmessage = async (e) => { try { // await renderFromInput(input); - const blobURL = URL.createObjectURL(new Blob([input], { type: 'application/javascript' })); + const blobURL = URL.createObjectURL(new Blob([input], { type: "application/javascript" })); const definitions = {}; await import(blobURL); @@ -164,13 +164,13 @@ onmessage = async (e) => { // in case the entry point isn't valid if (elementInstance) { - elementInstance.nodeName = tagName ?? ''; - elementInstance.tagName = tagName ?? ''; + elementInstance.nodeName = tagName ?? ""; + elementInstance.tagName = tagName ?? ""; await renderComponentRoots( elementInstance.shadowRoot ? { - nodeName: '#document-fragment', + nodeName: "#document-fragment", childNodes: [elementInstance], } : elementInstance, @@ -186,7 +186,7 @@ onmessage = async (e) => { ` : serialize(elementInstance); } else { - console.warn('WARNING: No custom element class found for this entry point.'); + console.warn("WARNING: No custom element class found for this entry point."); } } catch (e) { console.error(e); @@ -196,7 +196,7 @@ onmessage = async (e) => { if (err) { postMessage(err); } else { - console.log('Worker: Posting message back to main script', { html }); + console.log("Worker: Posting message back to main script", { html }); postMessage({ html }); } }; diff --git a/src/styles/theme.css b/src/styles/theme.css index 202fb8a..c8fea9a 100644 --- a/src/styles/theme.css +++ b/src/styles/theme.css @@ -1,24 +1,24 @@ -@import 'open-props/borders'; -@import 'open-props/fonts'; -@import 'open-props/shadows'; -@import 'open-props/sizes'; +@import "open-props/borders"; +@import "open-props/fonts"; +@import "open-props/shadows"; +@import "open-props/sizes"; @font-face { - font-family: 'Geist-Sans'; - src: url('../../node_modules/geist/dist/fonts/geist-sans/Geist-Regular.woff2') format('truetype'); + font-family: "Geist-Sans"; + src: url("../../node_modules/geist/dist/fonts/geist-sans/Geist-Regular.woff2") format("truetype"); font-display: swap; } @font-face { - font-family: 'Geist-Mono'; - src: url('../../node_modules/geist/dist/fonts/geist-mono/GeistMono-Regular.woff2') - format('truetype'); + font-family: "Geist-Mono"; + src: url("../../node_modules/geist/dist/fonts/geist-mono/GeistMono-Regular.woff2") + format("truetype"); font-display: swap; } @font-face { - font-family: 'Geist-Sans Bold'; - src: url('../../node_modules/geist/dist/fonts/geist-sans/Geist-Bold.woff2') format('truetype'); + font-family: "Geist-Sans Bold"; + src: url("../../node_modules/geist/dist/fonts/geist-sans/Geist-Bold.woff2") format("truetype"); font-display: swap; } @@ -32,10 +32,10 @@ --color-background: #edefec; --color-prism-bg: #011627; /* matches Prism background color */ --font-primary: - 'Geist-Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, - Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; - --font-primary-bold: 'Geist-Sans Bold'; - --font-secondary: 'Geist-Mono', monospace; + "Geist-Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, + Cantarell, "Open Sans", "Helvetica Neue", sans-serif; + --font-primary-bold: "Geist-Sans Bold"; + --font-secondary: "Geist-Mono", monospace; } * { @@ -89,4 +89,4 @@ a:focus { position: absolute; white-space: nowrap; width: 1px; -} \ No newline at end of file +} diff --git a/src/types.d.ts b/src/types.d.ts index 3773f52..3981991 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -1,9 +1,9 @@ -declare module '*.module.css' { +declare module "*.module.css" { const styles: Readonly>; export default styles; } -declare module '*?type=raw' { +declare module "*?type=raw" { const content: string; export default content; } diff --git a/tsconfig.json b/tsconfig.json index 401c306..010736c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,7 @@ "noImplicitAny": true, "strict": true, "jsx": "preserve", - "jsxImportSource": "wc-compiler", + "jsxImportSource": "wc-compiler" }, "exclude": ["./public/", "./greenwood/", "node_modules"] }