Skip to content

Commit

Permalink
Vite 5.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
simon04 committed Nov 27, 2023
1 parent 5293311 commit 710c27b
Show file tree
Hide file tree
Showing 3 changed files with 233 additions and 160 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "OpenCartonaut",
"private": true,
"type": "module",
"license": "GPL-3.0-or-later",
"version": "1.0.0",
"homepage": "https://simon04.github.io/OpenCartonaut/",
Expand All @@ -21,7 +22,7 @@
"bun-types": "^0.5.8",
"peggy": "^3.0.2",
"prettier": "^3.0.2",
"vite": "^4.4.9"
"vite": "^5.0.2"
},
"dependencies": {
"ol": "8.2.0"
Expand Down
6 changes: 3 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type Plugin, defineConfig, createFilter } from "vite";
import { type ParserBuildOptions, generate } from "peggy";
import _peggy from "peggy";

export default defineConfig({
build: {
Expand All @@ -8,14 +8,14 @@ export default defineConfig({
plugins: [peggy()],
});

function peggy(options: ParserBuildOptions = {}): Plugin {
function peggy(options: _peggy.ParserBuildOptions = {}): Plugin {
return {
name: "peggy",
transform(grammar, id) {
const { include = ["*.pegjs", "**/*.pegjs"], exclude } = options;
const filter = createFilter(include, exclude);
if (!filter(id)) return null;
const code = generate(grammar, { output: "source", ...options });
const code = _peggy.generate(grammar, { output: "source", ...options });
return {
code: `export default ${code};`,
map: { mappings: "" },
Expand Down
Loading

0 comments on commit 710c27b

Please sign in to comment.