chore(peggy-loader): Review build configuration (#37629)

This commit is contained in:
Tasso Evangelista 2025-11-27 16:32:57 -03:00 committed by GitHub
parent 66a2a20f2a
commit f0531bc985
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 95 additions and 120 deletions

View File

@ -1,2 +0,0 @@
/node_modules
/dist

View File

@ -1,8 +1,4 @@
{
"extends": ["@rocket.chat/eslint-config"],
"plugins": ["jest"],
"env": {
"jest/globals": true
},
"ignorePatterns": ["**/dist"]
"ignorePatterns": ["dist"]
}

View File

@ -1 +0,0 @@
/dist

View File

@ -1,2 +0,0 @@
/node_modules
/dist

View File

@ -1 +0,0 @@
module.exports = require('@rocket.chat/prettier-config/fuselage');

View File

@ -1,59 +1,57 @@
{
"name": "@rocket.chat/peggy-loader",
"version": "0.31.27",
"description": "Peggy loader for webpack",
"keywords": [
"peggy",
"loader",
"webpack"
],
"author": {
"name": "Rocket.Chat",
"url": "https://rocket.chat/"
},
"homepage": "https://github.com/RocketChat/fuselage#readme",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/RocketChat/fuselage.git",
"directory": "packages/peggy-loader"
},
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
"files": [
"/dist"
],
"scripts": {
"build": "run-s .:build:clean .:build:esm .:build:cjs",
".:build:clean": "rimraf dist",
".:build:esm": "tsc -p tsconfig.json",
".:build:cjs": "tsc -p tsconfig.cjs.json",
"lint": "eslint src"
},
"bugs": {
"url": "https://github.com/RocketChat/fuselage/issues"
},
"peerDependencies": {
"peggy": "*",
"webpack": "*"
},
"devDependencies": {
"@rocket.chat/eslint-config": "workspace:~",
"@rocket.chat/prettier-config": "~0.31.25",
"@types/node": "~22.16.5",
"eslint": "~8.45.0",
"npm-run-all": "^4.1.5",
"peggy": "4.1.1",
"prettier": "~3.3.3",
"rimraf": "^6.0.1",
"typescript": "~5.9.3",
"webpack": "~5.99.9"
},
"volta": {
"extends": "../../package.json"
}
"name": "@rocket.chat/peggy-loader",
"version": "0.31.27",
"description": "Peggy loader for webpack",
"keywords": [
"peggy",
"loader",
"webpack"
],
"homepage": "https://github.com/RocketChat/fuselage#readme",
"bugs": {
"url": "https://github.com/RocketChat/fuselage/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/RocketChat/fuselage.git",
"directory": "packages/peggy-loader"
},
"license": "MIT",
"author": {
"name": "Rocket.Chat",
"url": "https://rocket.chat/"
},
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"/dist"
],
"scripts": {
".:build:clean": "rimraf dist",
".:build:tsc": "tsc -p tsconfig.build.json",
"build": "run-s .:build:clean .:build:tsc",
"lint": "eslint src"
},
"devDependencies": {
"@rocket.chat/eslint-config": "workspace:~",
"@rocket.chat/prettier-config": "~0.31.25",
"@types/node": "~22.16.5",
"eslint": "~8.45.0",
"npm-run-all": "^4.1.5",
"peggy": "4.1.1",
"prettier": "~3.3.3",
"rimraf": "^6.0.1",
"typescript": "~5.9.3",
"webpack": "~5.99.9"
},
"peerDependencies": {
"peggy": "*",
"webpack": "*"
},
"volta": {
"extends": "../../package.json"
},
"publishConfig": {
"access": "public"
}
}

View File

@ -1,38 +1,32 @@
import type {
BuildOptionsBase,
OutputFormatAmdCommonjsEs,
OutputFormatBare,
OutputFormatGlobals,
OutputFormatUmd,
SourceOptionsBase,
BuildOptionsBase,
OutputFormatAmdCommonjsEs,
OutputFormatBare,
OutputFormatGlobals,
OutputFormatUmd,
SourceOptionsBase,
} from 'peggy';
import peggy from 'peggy';
import type { LoaderContext } from 'webpack';
type Options = BuildOptionsBase &
(
| Omit<
OutputFormatAmdCommonjsEs<'source'>,
keyof SourceOptionsBase<'source'>
>
| Omit<OutputFormatUmd<'source'>, keyof SourceOptionsBase<'source'>>
| Omit<OutputFormatGlobals<'source'>, keyof SourceOptionsBase<'source'>>
| Omit<OutputFormatBare<'source'>, keyof SourceOptionsBase<'source'>>
);
(
| Omit<OutputFormatAmdCommonjsEs<'source'>, keyof SourceOptionsBase<'source'>>
| Omit<OutputFormatUmd<'source'>, keyof SourceOptionsBase<'source'>>
| Omit<OutputFormatGlobals<'source'>, keyof SourceOptionsBase<'source'>>
| Omit<OutputFormatBare<'source'>, keyof SourceOptionsBase<'source'>>
);
function peggyLoader(
this: LoaderContext<Options>,
grammarContent: string,
): string {
const options: Options = {
format: 'commonjs',
...this.getOptions(),
};
function peggyLoader(this: LoaderContext<Options>, grammarContent: string): string {
const options: Options = {
format: 'commonjs',
...this.getOptions(),
};
return peggy.generate(grammarContent, {
output: 'source',
...options,
});
return peggy.generate(grammarContent, {
output: 'source',
...options,
});
}
export default peggyLoader;

View File

@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"declaration": true,
"declarationMap": true,
"sourceMap": true,
}
}

View File

@ -1,7 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "./dist/cjs"
}
}

View File

@ -1,16 +1,7 @@
{
"compilerOptions": {
"target": "es5",
"module": "ESNext",
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"outDir": "./dist/esm",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"resolveJsonModule": true
}
"extends": "@rocket.chat/tsconfig/server.json",
"compilerOptions": {
"module": "esnext",
},
"include": ["src"]
}

View File

@ -8708,7 +8708,7 @@ __metadata:
languageName: unknown
linkType: soft
"@rocket.chat/fuselage@npm:*, @rocket.chat/fuselage@npm:~0.68.1":
"@rocket.chat/fuselage@npm:~0.68.1":
version: 0.68.1
resolution: "@rocket.chat/fuselage@npm:0.68.1"
dependencies:
@ -8847,7 +8847,7 @@ __metadata:
languageName: unknown
linkType: soft
"@rocket.chat/icons@npm:*, @rocket.chat/icons@npm:~0.45.0":
"@rocket.chat/icons@npm:~0.45.0":
version: 0.45.0
resolution: "@rocket.chat/icons@npm:0.45.0"
checksum: 10/9e0967eba17cbef1c482616bb94cf871dfac20e92ac5fad6164cbe60bab95882d9675bf9de2c611928da6d37806a1279d671b0a3463dda0a3148cdade9291147
@ -10394,11 +10394,11 @@ __metadata:
"@rocket.chat/core-typings": "workspace:^"
"@rocket.chat/ddp-client": "workspace:~"
"@rocket.chat/emitter": "npm:~0.31.25"
"@rocket.chat/fuselage": "npm:*"
"@rocket.chat/fuselage": "npm:~0.68.1"
"@rocket.chat/fuselage-hooks": "npm:~0.38.1"
"@rocket.chat/fuselage-tokens": "npm:~0.33.2"
"@rocket.chat/i18n": "workspace:~"
"@rocket.chat/icons": "npm:*"
"@rocket.chat/icons": "npm:~0.45.0"
"@rocket.chat/jest-presets": "workspace:~"
"@rocket.chat/password-policies": "workspace:^"
"@rocket.chat/rest-typings": "workspace:^"