Skip to content

Commit

Permalink
Use @aegijsproject/url instead of own
Browse files Browse the repository at this point in the history
  • Loading branch information
shgysk8zer0 committed Oct 28, 2024
1 parent 0e92ce6 commit 5c51b86
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 22 deletions.
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/
test/
.github/
.editorconfig
.eslintignore
Expand All @@ -8,6 +9,7 @@ node_modules/
.gitignore
.nvmrc
.stylelintrc
.htmlhint
.stylelintignore
importmap.json
importmap.yaml
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed
- Use external `@aegijsproject/url` instead of own URL parser

### Fixed
- Cleanup unneeded files from published package

## [v0.0.12] - 2024-10-04

### Fixed
Expand Down
26 changes: 25 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
"rollup": "^4.13.1"
},
"dependencies": {
"@aegisjsproject/sanitizer": "^0.1.2"
"@aegisjsproject/sanitizer": "^0.1.2",
"@aegisjsproject/url": "^1.0.0"
}
}
10 changes: 5 additions & 5 deletions parsers.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export { html, el, doc, createHTMLParser } from './html.js';
export {
css, createCSSParser, styleSheetToLink, createStyleSheet, addStyleSheets,
setStyleSheets,
} from './css.js';
export { svg } from './svg.js';
export { math } from './math.js';
export { xml } from './xml.js';
export { html, el, doc, createHTMLParser } from './html.js';
export { json } from './json.js';
export { url } from './url.js';
export { math } from './math.js';
export { svg } from './svg.js';
export { createPolicy } from './trust.js';
export { url } from './url.js';
export { xml } from './xml.js';
1 change: 1 addition & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default [{
'@aegisjsproject/sanitizer/config/mathml.js',
'@aegisjsproject/sanitizer/config/base.js',
'@aegisjsproject/sanitizer/namespaces.js',
'@aegisjsproject/url',
],
output: {
file: 'parsers.cjs',
Expand Down
16 changes: 1 addition & 15 deletions url.js
Original file line number Diff line number Diff line change
@@ -1,15 +1 @@
import { stringify } from './utils.js';

export function escape(str) {
return encodeURIComponent(stringify(str).trim()).replaceAll('.', '%2E');
}

export function url(strings, base, ...values) {
if (base instanceof Blob && strings.length === 2 && strings[0] === '' && strings[1] === '') {
return URL.createObjectURL(base);
} else if (URL.canParse(base)) {
return URL.parse(String.raw(strings, '', ...values.map(escape)), base);
} else {
return URL.parse(String.raw(strings, escape(base), ...values.map(escape)));
}
}
export { escape, url } from '@aegisjsproject/url';

0 comments on commit 5c51b86

Please sign in to comment.