Skip to content

Commit

Permalink
Add package.json exports to AGTree
Browse files Browse the repository at this point in the history
Merge in ADGUARD-FILTERS/tsurlfilter from fix/agtree-package-json-exports to master

Squashed commit of the following:

commit 0b12d23
Merge: 8526074 b4453b2
Author: scripthunter7 <d.tota@adguard.com>
Date:   Mon Sep 4 11:17:38 2023 +0200

    Merge branch 'master' into fix/agtree-package-json-exports

commit 8526074
Author: scripthunter7 <d.tota@adguard.com>
Date:   Fri Sep 1 15:58:32 2023 +0200

    Add comment

commit 522c23a
Author: scripthunter7 <d.tota@adguard.com>
Date:   Fri Sep 1 15:50:37 2023 +0200

    Change scriptlets lib import

commit b8ae548
Author: scripthunter7 <d.tota@adguard.com>
Date:   Fri Sep 1 15:47:25 2023 +0200

    Add exports to package.json
  • Loading branch information
scripthunter7 committed Sep 4, 2023
1 parent b4453b2 commit c8c7fe6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
9 changes: 9 additions & 0 deletions packages/agtree/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@
"module": "dist/agtree.esm.js",
"browser": "dist/agtree.umd.min.js",
"types": "dist/agtree.d.ts",
"exports": {
".": {
"import": "./dist/agtree.esm.js",
"require": "./dist/agtree.cjs"
},
"./es": "./dist/agtree.esm.js",
"./iife": "./dist/agtree.iife.min.js",
"./umd": "./dist/agtree.umd.min.js"
},
"files": [
"dist"
],
Expand Down
8 changes: 7 additions & 1 deletion packages/agtree/src/converter/misc/network-rule-modifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@
*/

import cloneDeep from 'clone-deep';
import { redirects } from '@adguard/scriptlets';
import scriptlets from '@adguard/scriptlets';

import { type ModifierList } from '../../parser/common';
import { SEMICOLON, SPACE } from '../../utils/constants';
import { createModifierListNode, createModifierNode } from '../../ast-utils/modifiers';
import { ConverterBase } from '../base-interfaces/converter-base';
import { RuleConversionError } from '../../errors/rule-conversion-error';

// Since scriptlets library doesn't have ESM exports, we should import
// the whole module and then extract the required functions from it here.
// Otherwise importing AGTree will cause an error in ESM environment,
// because scriptlets library doesn't support named exports.
const { redirects } = scriptlets;

/**
* Modifier conversion interface.
*/
Expand Down

0 comments on commit c8c7fe6

Please sign in to comment.