Skip to content

Commit

Permalink
Fix #6
Browse files Browse the repository at this point in the history
  • Loading branch information
scripthunter7 committed Nov 28, 2022
1 parent 630b8a1 commit a75aec9
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ example.com,~example.net#%#//scriptlet('prevent-setInterval', 'check', '!300')
> *Please note that unnecessary spaces will disappear and CSS selectors will be regenerated according to uniform formatting*
```typescript
import { RuleParser } from "aglint/parser";
import { RuleParser } from "aglint";

// General rules (ADG/uBO/ABP)
console.log(RuleParser.generate(RuleParser.parse("##.ad")));
Expand Down
20 changes: 5 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,21 @@
},
"homepage": "https://github.com/AdguardTeam/AGLint#readme",
"type": "module",
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
},
"./parser": {
"import": "./dist/parser/index.mjs",
"require": "./dist/parser/index.cjs"
}
},
"typings": "dist/types",
"main": "dist/aglint.cjs",
"module": "dist/aglint.mjs",
"types": "dist/aglint.d.ts",
"files": [
"dist",
"src"
],
"engines": {
"node": ">=12"
"node": ">=14"
},
"scripts": {
"lint": "eslint . --ext .ts",
"test": "jest --runInBand .",
"coverage": "jest --coverage",
"build": "yarn rimraf dist && yarn rollup --config rollup.config.ts --configPlugin typescript && tsc --declaration --emitDeclarationOnly --outdir dist/types"
"build": "yarn rimraf dist && tsc --declaration --emitDeclarationOnly --outdir dist/types && yarn rollup --config rollup.config.ts --configPlugin typescript && yarn rimraf dist/types"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^23.0.2",
Expand Down
27 changes: 21 additions & 6 deletions rollup.config.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
/* eslint-disable max-len */
import typescript from "@rollup/plugin-typescript";
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import externals from "rollup-plugin-node-externals";
import dts from "rollup-plugin-dts";

const esm = {
input: "src/parser/index.ts",
input: "./src/index.ts",
output: [
{
file: `dist/parser/index.mjs`,
file: `./dist/aglint.mjs`,
format: "esm",
sourcemap: false,
},
],
plugins: [
externals(),
typescript({ declaration: false }),
typescript({
declaration: false,
compilerOptions: {
moduleResolution: "node16",
},
}),
commonjs({ sourceMap: false }),
resolve({ preferBuiltins: false }),
],
};

const cjs = {
input: "src/parser/index.ts",
input: "./src/index.ts",
output: [
{
file: `dist/parser/index.cjs`,
file: `./dist/aglint.cjs`,
format: "cjs",
exports: "auto",
sourcemap: false,
Expand All @@ -38,4 +45,12 @@ const cjs = {
],
};

export default [esm, cjs];
export default [
esm,
cjs,
{
input: "./dist/types/index.d.ts",
output: [{ file: "dist/aglint.d.ts", format: "es" }],
plugins: [dts()],
},
];
1 change: 1 addition & 0 deletions src/parser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export * from "./comment/comment";
export * from "./cosmetic/cosmetic";
export * from "./network/network";
export * from "./common/domain-list";
export * from "./common/modifier-list";
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
"skipLibCheck": true,
},
"include": ["./src/"],
"exclude": ["node_modules", "dist"]
"exclude": ["./node_modules", "./dist"]
}

0 comments on commit a75aec9

Please sign in to comment.