larry babby and threejs for glsl

This commit is contained in:
Sam
2024-06-24 21:24:00 +12:00
parent 87d5dc634d
commit 907ebae4c0
6474 changed files with 1279596 additions and 8 deletions

View File

@@ -0,0 +1,339 @@
## <small>0.10.2 (2022-01-17)</small>
* Decrease package size ([20d81a8](https://github.com/posthtml/posthtml-parser/commit/20d81a8)), closes [#85](https://github.com/posthtml/posthtml-parser/issues/85)
## <small>0.10.1 (2021-08-30)</small>
* 0.10.1 ([c6fff56](https://github.com/posthtml/posthtml-parser/commit/c6fff56))
* Force in something that works ([fb96d68](https://github.com/posthtml/posthtml-parser/commit/fb96d68))
* Linting ([5166475](https://github.com/posthtml/posthtml-parser/commit/5166475))
* Try and record previous indicies and rewrite if needed ([667ccf6](https://github.com/posthtml/posthtml-parser/commit/667ccf6))
* Use isImplied ([4847a08](https://github.com/posthtml/posthtml-parser/commit/4847a08))
* Use patched version ([c9fde63](https://github.com/posthtml/posthtml-parser/commit/c9fde63))
* Use patched version ([1bd6633](https://github.com/posthtml/posthtml-parser/commit/1bd6633))
* Use release ([2c53321](https://github.com/posthtml/posthtml-parser/commit/2c53321))
* Use release ([4f00e5c](https://github.com/posthtml/posthtml-parser/commit/4f00e5c))
* Use updated patched version ([4184539](https://github.com/posthtml/posthtml-parser/commit/4184539))
* test: break test to demonstrate bug ([74c165c](https://github.com/posthtml/posthtml-parser/commit/74c165c))
* build(deps): bump path-parse from 1.0.6 to 1.0.7 ([4f4ab7e](https://github.com/posthtml/posthtml-parser/commit/4f4ab7e))
* docs: update import ([53bee3d](https://github.com/posthtml/posthtml-parser/commit/53bee3d))
## 0.10.0 (2021-07-28)
* 0.10.0 ([b569e1a](https://github.com/posthtml/posthtml-parser/commit/b569e1a))
* refactor: parse now export not default ([f8ae42d](https://github.com/posthtml/posthtml-parser/commit/f8ae42d))
* perf: resolve types ([9ed9bd0](https://github.com/posthtml/posthtml-parser/commit/9ed9bd0))
## <small>0.9.1 (2021-07-26)</small>
* 0.9.1 ([a03017e](https://github.com/posthtml/posthtml-parser/commit/a03017e))
* Update readme.md ([7081062](https://github.com/posthtml/posthtml-parser/commit/7081062))
* test: dom nest parsing issues #76 ([fdfe82e](https://github.com/posthtml/posthtml-parser/commit/fdfe82e)), closes [#76](https://github.com/posthtml/posthtml-parser/issues/76)
* test: remove only ([78b7fc7](https://github.com/posthtml/posthtml-parser/commit/78b7fc7))
* style: after prettier ([ccbfd69](https://github.com/posthtml/posthtml-parser/commit/ccbfd69))
* style: after prettier ([72f2092](https://github.com/posthtml/posthtml-parser/commit/72f2092))
* build: set object-curly-spacing always ([47dceb6](https://github.com/posthtml/posthtml-parser/commit/47dceb6))
* build(deps): bump handlebars from 4.7.6 to 4.7.7 ([e6bc6cd](https://github.com/posthtml/posthtml-parser/commit/e6bc6cd))
* build(deps): bump hosted-git-info from 2.8.8 to 2.8.9 ([2137591](https://github.com/posthtml/posthtml-parser/commit/2137591))
* build(deps): bump lodash from 4.17.20 to 4.17.21 ([e9b8d04](https://github.com/posthtml/posthtml-parser/commit/e9b8d04))
* build(deps): bump normalize-url from 4.5.0 to 4.5.1 ([9e0d1f9](https://github.com/posthtml/posthtml-parser/commit/9e0d1f9))
* perf: type for replace ([94ebb8d](https://github.com/posthtml/posthtml-parser/commit/94ebb8d))
## 0.9.0 (2021-05-11)
* 0.9.0 ([d725e83](https://github.com/posthtml/posthtml-parser/commit/d725e83))
* Add description to docs ([d61007b](https://github.com/posthtml/posthtml-parser/commit/d61007b))
* Move location tracker to a separate file and refactor into class ([7d6f76b](https://github.com/posthtml/posthtml-parser/commit/7d6f76b))
* feat: add optional support for source locations ([6faf50d](https://github.com/posthtml/posthtml-parser/commit/6faf50d))
## <small>0.8.5 (2021-05-06)</small>
* 0.8.5 ([14d353e](https://github.com/posthtml/posthtml-parser/commit/14d353e))
* perf: content two dimensional array ([8373816](https://github.com/posthtml/posthtml-parser/commit/8373816))
## <small>0.8.4 (2021-05-06)</small>
* 0.8.4 ([aaa0b3e](https://github.com/posthtml/posthtml-parser/commit/aaa0b3e))
* perf: attr value as number ([3d08ec5](https://github.com/posthtml/posthtml-parser/commit/3d08ec5))
## <small>0.8.3 (2021-05-06)</small>
* 0.8.3 ([80e07ca](https://github.com/posthtml/posthtml-parser/commit/80e07ca))
* perf: attr value as boolean ([d143dbb](https://github.com/posthtml/posthtml-parser/commit/d143dbb))
## <small>0.8.2 (2021-05-06)</small>
* 0.8.2 ([f57d7ed](https://github.com/posthtml/posthtml-parser/commit/f57d7ed))
* perf: type node text as number ([bf2fb73](https://github.com/posthtml/posthtml-parser/commit/bf2fb73))
## <small>0.8.1 (2021-05-05)</small>
* 0.8.1 ([67a337b](https://github.com/posthtml/posthtml-parser/commit/67a337b))
* ci: add node 16 ([58c6740](https://github.com/posthtml/posthtml-parser/commit/58c6740))
* perf: types content ([e9f59a2](https://github.com/posthtml/posthtml-parser/commit/e9f59a2))
* perf: types content ([87b2a82](https://github.com/posthtml/posthtml-parser/commit/87b2a82))
## 0.8.0 (2021-04-16)
* 0.8.0 ([9676edd](https://github.com/posthtml/posthtml-parser/commit/9676edd))
* ci: drop support for node 10 (found not to be working) ([585d552](https://github.com/posthtml/posthtml-parser/commit/585d552))
* build: add prepare script ([1dc46fc](https://github.com/posthtml/posthtml-parser/commit/1dc46fc))
## <small>0.7.2 (2021-04-12)</small>
* 0.7.2 ([7beaee9](https://github.com/posthtml/posthtml-parser/commit/7beaee9))
* fix: correctly parse text content after comments ([818e2f5](https://github.com/posthtml/posthtml-parser/commit/818e2f5))
* build(deps): bump y18n from 4.0.0 to 4.0.1 ([6b52ac1](https://github.com/posthtml/posthtml-parser/commit/6b52ac1))
## <small>0.7.1 (2021-02-15)</small>
* 0.7.1 ([86a7954](https://github.com/posthtml/posthtml-parser/commit/86a7954))
* perf: tag name type ([60ec0c1](https://github.com/posthtml/posthtml-parser/commit/60ec0c1))
## 0.7.0 (2021-02-09)
* 0.7.0 ([5887ed4](https://github.com/posthtml/posthtml-parser/commit/5887ed4))
* build: default build cjs ([41b7b25](https://github.com/posthtml/posthtml-parser/commit/41b7b25))
* build: not generate dts ([662f8d9](https://github.com/posthtml/posthtml-parser/commit/662f8d9))
* build: perf config for ts ([a3b5bc4](https://github.com/posthtml/posthtml-parser/commit/a3b5bc4))
* build: refactor builder/lint/test system ([baa7bcc](https://github.com/posthtml/posthtml-parser/commit/baa7bcc))
* build(deps): bump ini from 1.3.5 to 1.3.8 ([471a77f](https://github.com/posthtml/posthtml-parser/commit/471a77f))
* docs: default import description ([c824343](https://github.com/posthtml/posthtml-parser/commit/c824343))
* perf: export default declare ([eb63940](https://github.com/posthtml/posthtml-parser/commit/eb63940))
* perf: target to node 10 ([3f0a707](https://github.com/posthtml/posthtml-parser/commit/3f0a707))
* style: after update xo ([dc66abe](https://github.com/posthtml/posthtml-parser/commit/dc66abe))
* test: rewrite to typscript ([63a3415](https://github.com/posthtml/posthtml-parser/commit/63a3415))
* refactor: rewrite to typscript ([b1450a8](https://github.com/posthtml/posthtml-parser/commit/b1450a8))
## 0.6.0 (2020-11-13)
* 0.6.0 ([cf98487](https://github.com/posthtml/posthtml-parser/commit/cf98487))
* refactor: update htmlparser2 to version 5 ([58258b4](https://github.com/posthtml/posthtml-parser/commit/58258b4))
## <small>0.5.3 (2020-11-13)</small>
* 0.5.3 ([88475c2](https://github.com/posthtml/posthtml-parser/commit/88475c2))
* build: down grade xo is broken ([9631e7d](https://github.com/posthtml/posthtml-parser/commit/9631e7d))
* fix: downgrade htmlpareser2 to 3* version, issue #53 ([7353f6b](https://github.com/posthtml/posthtml-parser/commit/7353f6b)), closes [#53](https://github.com/posthtml/posthtml-parser/issues/53)
## <small>0.5.2 (2020-10-30)</small>
* 0.5.2 ([c8641cd](https://github.com/posthtml/posthtml-parser/commit/c8641cd))
* fix: converting html entity name, close #51 ([4a8be73](https://github.com/posthtml/posthtml-parser/commit/4a8be73)), closes [#51](https://github.com/posthtml/posthtml-parser/issues/51)
* test: converting html entity name, issue #51 ([6bd5975](https://github.com/posthtml/posthtml-parser/commit/6bd5975)), closes [#51](https://github.com/posthtml/posthtml-parser/issues/51)
## <small>0.5.1 (2020-10-27)</small>
* 0.5.1 ([b6b4a8b](https://github.com/posthtml/posthtml-parser/commit/b6b4a8b))
* style: 2 space, close issue #33 ([cdd7dbd](https://github.com/posthtml/posthtml-parser/commit/cdd7dbd)), closes [#33](https://github.com/posthtml/posthtml-parser/issues/33)
* style: after lint ([23dd2a0](https://github.com/posthtml/posthtml-parser/commit/23dd2a0))
* build: change eslint to xo ([5233a43](https://github.com/posthtml/posthtml-parser/commit/5233a43))
* build: change lint to eslint ([f6eef50](https://github.com/posthtml/posthtml-parser/commit/f6eef50))
* build: update bump version script ([7b7cfbf](https://github.com/posthtml/posthtml-parser/commit/7b7cfbf))
* build: update dep dev ([8601e40](https://github.com/posthtml/posthtml-parser/commit/8601e40))
* perf: concate with prev content string ([fe7ddb0](https://github.com/posthtml/posthtml-parser/commit/fe7ddb0))
* perf: downgrade code for old node ([b160b9d](https://github.com/posthtml/posthtml-parser/commit/b160b9d))
* perf: migrate to parser v5 ([c2349ad](https://github.com/posthtml/posthtml-parser/commit/c2349ad))
* ci: change nyc to c8 ([1638a07](https://github.com/posthtml/posthtml-parser/commit/1638a07))
* ci: forgot config for c8 ([ba45ba6](https://github.com/posthtml/posthtml-parser/commit/ba45ba6))
* ci: migrate to github action from travis ([05e3768](https://github.com/posthtml/posthtml-parser/commit/05e3768))
* test: contents are split with '<' in comment, issue #18 ([cbeb319](https://github.com/posthtml/posthtml-parser/commit/cbeb319)), closes [#18](https://github.com/posthtml/posthtml-parser/issues/18)
* test: contents are split with '<' in comment, issue #45 ([74169cd](https://github.com/posthtml/posthtml-parser/commit/74169cd)), closes [#45](https://github.com/posthtml/posthtml-parser/issues/45)
* fix: contents are split with '<' in comment, close #18, close #45 ([8e64082](https://github.com/posthtml/posthtml-parser/commit/8e64082)), closes [#18](https://github.com/posthtml/posthtml-parser/issues/18) [#45](https://github.com/posthtml/posthtml-parser/issues/45)
* refactor: migrate to es-next syntax ([d89bf85](https://github.com/posthtml/posthtml-parser/commit/d89bf85))
* docs: simple update ([0c10d9d](https://github.com/posthtml/posthtml-parser/commit/0c10d9d))
## 0.5.0 (2020-08-22)
* 0.5.0 ([be05a9f](https://github.com/posthtml/posthtml-parser/commit/be05a9f))
* build: forgot conventional-changelog-cli ([8ff437a](https://github.com/posthtml/posthtml-parser/commit/8ff437a))
* build: update changelog ([d0a07dc](https://github.com/posthtml/posthtml-parser/commit/d0a07dc))
* build: update dep dev ([f8efe55](https://github.com/posthtml/posthtml-parser/commit/f8efe55))
* build: update lint/build system ([54adc49](https://github.com/posthtml/posthtml-parser/commit/54adc49))
* build(deps): bump handlebars from 4.0.11 to 4.5.3 ([8773f14](https://github.com/posthtml/posthtml-parser/commit/8773f14))
* revert: incorrect changes ([0601fbd](https://github.com/posthtml/posthtml-parser/commit/0601fbd))
* style: lintstage lint update ([43398d5](https://github.com/posthtml/posthtml-parser/commit/43398d5))
* ci: drop old node support ([cf95d62](https://github.com/posthtml/posthtml-parser/commit/cf95d62))
* ci: drop support old node ([d415fb9](https://github.com/posthtml/posthtml-parser/commit/d415fb9))
* fix: incorrect merge defaultOptions, close #47 ([11ba7fb](https://github.com/posthtml/posthtml-parser/commit/11ba7fb)), closes [#47](https://github.com/posthtml/posthtml-parser/issues/47)
* test: update for, #41 ([3cfc5c6](https://github.com/posthtml/posthtml-parser/commit/3cfc5c6)), closes [#41](https://github.com/posthtml/posthtml-parser/issues/41)
## <small>0.4.2 (2019-11-08)</small>
* 0.4.2 ([f8a63ab](https://github.com/posthtml/posthtml-parser/commit/f8a63ab))
* fix: version pkg ([d531970](https://github.com/posthtml/posthtml-parser/commit/d531970))
* perf: remove objectAssign polyfill ([8083f07](https://github.com/posthtml/posthtml-parser/commit/8083f07))
* build: update depDev ([df66e8d](https://github.com/posthtml/posthtml-parser/commit/df66e8d))
* ci(.travis): update Node.js versions ([b6f4b50](https://github.com/posthtml/posthtml-parser/commit/b6f4b50))
* feat: introduce TypeScript definitions ([100adc1](https://github.com/posthtml/posthtml-parser/commit/100adc1))
* style: fix indent ([47cb744](https://github.com/posthtml/posthtml-parser/commit/47cb744))
* docs: update options ([e771ac6](https://github.com/posthtml/posthtml-parser/commit/e771ac6))
## <small>0.4.1 (2018-02-16)</small>
* remove isobject module ([49a0ee6](https://github.com/posthtml/posthtml-parser/commit/49a0ee6))
* v0.4.1 ([b8e5dff](https://github.com/posthtml/posthtml-parser/commit/b8e5dff))
* fix: improve readablity ([222aa79](https://github.com/posthtml/posthtml-parser/commit/222aa79))
## 0.4.0 (2018-01-23)
* build RegEx from RegEx.source ([4bc2807](https://github.com/posthtml/posthtml-parser/commit/4bc2807))
* fix code style ([01f8cad](https://github.com/posthtml/posthtml-parser/commit/01f8cad))
* lowercase and reassign 'name' var ([6f046c8](https://github.com/posthtml/posthtml-parser/commit/6f046c8))
* refactor directive parser ([f7d296c](https://github.com/posthtml/posthtml-parser/commit/f7d296c))
* split directive checking per condition ([1b800f7](https://github.com/posthtml/posthtml-parser/commit/1b800f7))
* v0.4.0 ([3bad693](https://github.com/posthtml/posthtml-parser/commit/3bad693))
* directive: add support for regular expression custom directive. ([9403660](https://github.com/posthtml/posthtml-parser/commit/9403660))
## <small>0.3.3 (2018-01-19)</small>
* v0.3.3 ([137aa45](https://github.com/posthtml/posthtml-parser/commit/137aa45))
* fix: icorrect concat directives ([b17f7c0](https://github.com/posthtml/posthtml-parser/commit/b17f7c0))
## <small>0.3.2 (2018-01-18)</small>
* 0.3.1 ([dd11797](https://github.com/posthtml/posthtml-parser/commit/dd11797))
* revert default value for option ([8b9e4ed](https://github.com/posthtml/posthtml-parser/commit/8b9e4ed))
* use `htmlparser2/lib/Parser` directly ([24c5e4e](https://github.com/posthtml/posthtml-parser/commit/24c5e4e))
* v0.3.2 ([21d117d](https://github.com/posthtml/posthtml-parser/commit/21d117d))
* test: fix test ([cad515c](https://github.com/posthtml/posthtml-parser/commit/cad515c))
* fix: incoming options not merge with default options ([8eaa928](https://github.com/posthtml/posthtml-parser/commit/8eaa928))
## <small>0.3.1 (2017-12-27)</small>
* fix: if directive in content ([5e1650a](https://github.com/posthtml/posthtml-parser/commit/5e1650a))
* fix: try fix for old node ([3086a08](https://github.com/posthtml/posthtml-parser/commit/3086a08))
* fix(index): parse obj in attrs, close #22 ([7e32484](https://github.com/posthtml/posthtml-parser/commit/7e32484)), closes [#22](https://github.com/posthtml/posthtml-parser/issues/22)
* revert(index): collect attrs ([7277faf](https://github.com/posthtml/posthtml-parser/commit/7277faf))
* style: fix lint error ([6d1a2d5](https://github.com/posthtml/posthtml-parser/commit/6d1a2d5))
* style(test): update title ([17b0c04](https://github.com/posthtml/posthtml-parser/commit/17b0c04))
* test: for custom process directive ([db31f89](https://github.com/posthtml/posthtml-parser/commit/db31f89))
* test: for directives and tag ([0b0f098](https://github.com/posthtml/posthtml-parser/commit/0b0f098))
* test: update test for custom directives ([25ba6d0](https://github.com/posthtml/posthtml-parser/commit/25ba6d0))
* test(test): add test for issue #11 ([aa8d0e3](https://github.com/posthtml/posthtml-parser/commit/aa8d0e3)), closes [#11](https://github.com/posthtml/posthtml-parser/issues/11)
* test(test): for issue #22 ([a44f4fe](https://github.com/posthtml/posthtml-parser/commit/a44f4fe)), closes [#22](https://github.com/posthtml/posthtml-parser/issues/22)
* chore: bump ([6abbc6d](https://github.com/posthtml/posthtml-parser/commit/6abbc6d))
* chore(index): update htmlparser2 ([b3e4c2d](https://github.com/posthtml/posthtml-parser/commit/b3e4c2d))
* chore(package): fix htmlparse2 version ([67edc28](https://github.com/posthtml/posthtml-parser/commit/67edc28))
* perf: for loop directives ([3d7ef5a](https://github.com/posthtml/posthtml-parser/commit/3d7ef5a))
* perf: forgot export default directives ([924cfca](https://github.com/posthtml/posthtml-parser/commit/924cfca))
* feat: parse directives according incoming options ([7e8e624](https://github.com/posthtml/posthtml-parser/commit/7e8e624))
* docs: desctiption for option directives ([12c0db9](https://github.com/posthtml/posthtml-parser/commit/12c0db9))
## <small>0.2.1 (2017-02-14)</small>
* Bump version to 0.2.1 ([00b41b0](https://github.com/posthtml/posthtml-parser/commit/00b41b0))
* Disable lowerCaseAttributeNames option by default ([2145089](https://github.com/posthtml/posthtml-parser/commit/2145089))
## 0.2.0 (2016-07-19)
* 0.2.0 ([bf7395e](https://github.com/posthtml/posthtml-parser/commit/bf7395e))
* add strict mode ([6980b91](https://github.com/posthtml/posthtml-parser/commit/6980b91))
* Allow pass options to parser ([2cdc3e6](https://github.com/posthtml/posthtml-parser/commit/2cdc3e6)), closes [posthtml/posthtml/pull/150#issuecomment-232707133](https://github.com/posthtml/posthtml/pull/150/issues/issuecomment-232707133)
* Create MAINTAINERS ([df024a4](https://github.com/posthtml/posthtml-parser/commit/df024a4))
* document PostHTML AST ([65ee207](https://github.com/posthtml/posthtml-parser/commit/65ee207))
* drop isEmpty helper ([10fc685](https://github.com/posthtml/posthtml-parser/commit/10fc685))
* minor improvements ([fcfc1e9](https://github.com/posthtml/posthtml-parser/commit/fcfc1e9))
* use if statement ([b867a45](https://github.com/posthtml/posthtml-parser/commit/b867a45))
* use repository shortcut syntax ([878bd17](https://github.com/posthtml/posthtml-parser/commit/878bd17))
## <small>0.1.3 (2016-03-04)</small>
* 0.1.3 ([cf3927e](https://github.com/posthtml/posthtml-parser/commit/cf3927e))
* Update index.js ([ea645e5](https://github.com/posthtml/posthtml-parser/commit/ea645e5))
* Update index.js ([9a15925](https://github.com/posthtml/posthtml-parser/commit/9a15925))
* Update index.js ([a327a5d](https://github.com/posthtml/posthtml-parser/commit/a327a5d))
* Update index.js ([532cdf8](https://github.com/posthtml/posthtml-parser/commit/532cdf8))
* Update index.js ([b1c6b5b](https://github.com/posthtml/posthtml-parser/commit/b1c6b5b))
* Update index.js ([1dea63b](https://github.com/posthtml/posthtml-parser/commit/1dea63b))
* Update test.js ([729ec64](https://github.com/posthtml/posthtml-parser/commit/729ec64))
* Update test.js ([5e691b4](https://github.com/posthtml/posthtml-parser/commit/5e691b4))
* Update test.js ([d1847c7](https://github.com/posthtml/posthtml-parser/commit/d1847c7))
## <small>0.1.2 (2016-03-03)</small>
* 0.1.2 ([906fa7e](https://github.com/posthtml/posthtml-parser/commit/906fa7e))
* add more about PostHTML link ([ca1ff66](https://github.com/posthtml/posthtml-parser/commit/ca1ff66))
* add PostHTML link ([e18ee18](https://github.com/posthtml/posthtml-parser/commit/e18ee18))
* add test for camelCase tag name ([550755e](https://github.com/posthtml/posthtml-parser/commit/550755e))
* Update index.js ([ab07822](https://github.com/posthtml/posthtml-parser/commit/ab07822))
## <small>0.1.1 (2015-11-02)</small>
* add npm scripts ([b4b6571](https://github.com/posthtml/posthtml-parser/commit/b4b6571))
* doctype test ([d829aaa](https://github.com/posthtml/posthtml-parser/commit/d829aaa))
* fix test texts & add test tag ([43ab5da](https://github.com/posthtml/posthtml-parser/commit/43ab5da))
* Release 0.1.1 ([41b6b3a](https://github.com/posthtml/posthtml-parser/commit/41b6b3a))
* test a not single nodes ([0360f87](https://github.com/posthtml/posthtml-parser/commit/0360f87))
* test comments ([ca86fba](https://github.com/posthtml/posthtml-parser/commit/ca86fba))
* tests for texts ([dc40c7c](https://github.com/posthtml/posthtml-parser/commit/dc40c7c))
* upd Readme ([c8e9c29](https://github.com/posthtml/posthtml-parser/commit/c8e9c29))
## 0.1.0 (2015-10-20)
* add package.json ([3daf4bc](https://github.com/posthtml/posthtml-parser/commit/3daf4bc))
* basic ([2e38720](https://github.com/posthtml/posthtml-parser/commit/2e38720))
* Initial commit ([285d87f](https://github.com/posthtml/posthtml-parser/commit/285d87f))

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var i=class{constructor(t){this.source=t,this.lastPosition={line:1,column:1},this.lastIndex=0}getPosition(t){if(t<this.lastIndex)throw new Error("Source indices must be monotonic");for(;this.lastIndex<t;)this.source.charCodeAt(this.lastIndex)===10?(this.lastPosition.line++,this.lastPosition.column=1):this.lastPosition.column++,this.lastIndex++;return{line:this.lastPosition.line,column:this.lastPosition.column}}};exports.a = i;

View File

@@ -0,0 +1,26 @@
import { ParserOptions } from 'htmlparser2';
import { SourceLocation } from './location-tracker';
declare type Directive = {
name: string | RegExp;
start: string;
end: string;
};
declare type Options = {
directives?: Directive[];
sourceLocations?: boolean;
} & ParserOptions;
declare type Tag = string | boolean;
declare type Attributes = Record<string, string | number | boolean>;
declare type Content = NodeText | Array<Node | Node[]>;
declare type NodeText = string | number;
declare type NodeTag = {
tag?: Tag;
attrs?: Attributes;
content?: Content;
location?: SourceLocation;
};
declare type Node = NodeText | NodeTag;
declare const parser: (html: string, options?: Options) => Node[];
export { Attributes, Content, Directive, Node, NodeTag, NodeText, Options, Tag, parser };

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkT6SARJYHjs = require('./chunk.T6SARJYH.js');var _htmlparser2 = require('htmlparser2');var j={lowerCaseTags:!1,lowerCaseAttributeNames:!1,decodeEntities:!1},v=[{name:"!doctype",start:"<",end:">"}],I= exports.parser =(d,f={})=>{let c=new (0, _chunkT6SARJYHjs.a)(d),i=[],s=[],p=0;function a(){return i[i.length-1]}function b(n,t){return n.name instanceof RegExp?new RegExp(n.name.source,"i").test(t):t===n.name}function y(n){let t={};return Object.keys(n).forEach(e=>{let o={};o[e]=String(n[e]).replace(/&quot;/g,'"'),Object.assign(t,o)}),t}function x(n,t){var g;let e=v.concat((g=f.directives)!=null?g:[]),o=a();for(let u of e){let l=u.start+t+u.end;if(b(u,n.toLowerCase())){if(o===void 0){s.push(l);return}typeof o=="object"&&(o.content===void 0&&(o.content=[]),Array.isArray(o.content)&&o.content.push(l))}}}function A(n){let t=a(),e=`<!--${n}-->`;if(t===void 0){s.push(e);return}typeof t=="object"&&(t.content===void 0&&(t.content=[]),Array.isArray(t.content)&&t.content.push(e))}function m(n,t){let e={tag:n};f.sourceLocations&&(e.location={start:c.getPosition(r.startIndex),end:c.getPosition(r.endIndex)},p=r.endIndex),Object.keys(t).length>0&&(e.attrs=y(t)),i.push(e)}function h(n,t){let e=i.pop();if(e&&typeof e=="object"&&e.location&&r.endIndex!==null&&(t?p<r.startIndex&&(e.location.end=c.getPosition(r.startIndex-1)):e.location.end=c.getPosition(r.endIndex)),e){let o=a();if(i.length<=0){s.push(e);return}typeof o=="object"&&(o.content===void 0&&(o.content=[]),Array.isArray(o.content)&&o.content.push(e))}}function N(n){let t=a();if(t===void 0){s.push(n);return}if(typeof t=="object"){if(t.content&&Array.isArray(t.content)&&t.content.length>0){let e=t.content[t.content.length-1];if(typeof e=="string"&&!e.startsWith("<!--")){t.content[t.content.length-1]=`${e}${n}`;return}}t.content===void 0&&(t.content=[]),Array.isArray(t.content)&&t.content.push(n)}}let r=new (0, _htmlparser2.Parser)({onprocessinginstruction:x,oncomment:A,onopentag:m,onclosetag:h,ontext:N},{...j,...f});return r.write(d),r.end(),s};exports.parser = I;

View File

@@ -0,0 +1,17 @@
declare type SourceLocation = {
start: Position;
end: Position;
};
declare type Position = {
line: number;
column: number;
};
declare class LocationTracker {
private readonly source;
private lastPosition;
private lastIndex;
constructor(source: string);
getPosition(index: number): Position;
}
export { LocationTracker, Position, SourceLocation };

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkT6SARJYHjs = require('./chunk.T6SARJYH.js');exports.LocationTracker = _chunkT6SARJYHjs.a;

View File

@@ -0,0 +1,22 @@
(The MIT License)
Copyright (c) 2015 Ivan Voischev <voischev.ivan@ya.ru>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,69 @@
{
"name": "posthtml-parser",
"version": "0.10.2",
"description": "Parse HTML/XML to PostHTMLTree",
"license": "MIT",
"repository": "posthtml/posthtml-parser",
"homepage": "https://github.com/posthtml/posthtml-parser#readme",
"bugs": {
"url": "https://github.com/posthtml/posthtml-parser/issues"
},
"author": "Ivan Voischev <voischev@posthtml.org>",
"contributors": [
{
"name": "Ivan Voischev",
"email": "voischev@posthtml.org"
},
{
"name": "Ivan Demidov",
"email": "scrum@posthtml.org"
}
],
"main": "dist",
"engines": {
"node": ">=12"
},
"scripts": {
"version": "conventional-changelog -i changelog.md -s -r 0 && git add changelog.md",
"build": "rm -rf dist && tsup src/*.ts --dts --minify",
"dev": "npm run build -- --watch",
"test": "xo && c8 ava",
"pretest": "clinton",
"prepare": "npm run build"
},
"files": [
"dist"
],
"keywords": [
"html",
"xml",
"parser",
"posthtml",
"posthtmltree"
],
"dependencies": {
"htmlparser2": "^7.1.1"
},
"devDependencies": {
"@antfu/eslint-config-ts": "^0.4.3",
"@commitlint/cli": "^11.0.0",
"@commitlint/config-angular": "^11.0.0",
"@types/node": "^14.14.25",
"ava": "^3.13.0",
"c8": "^7.5.0",
"clinton": "^0.14.0",
"conventional-changelog-cli": "^2.0.34",
"esbuild-register": "^2.0.0",
"eslint": "^7.19.0",
"esm": "^3.2.25",
"husky": "^4.3.8",
"lint-staged": "^10.5.3",
"rewire": "^5.0.0",
"rimraf": "^3.0.0",
"ts-node": "^9.0.0",
"tsup": "^3.7.1",
"typescript": "^4.0.5",
"xo": "^0.37.1"
},
"types": "dist/index.d.ts"
}

View File

@@ -0,0 +1,125 @@
# posthtml-parser
[![npm version](https://badge.fury.io/js/posthtml-parser.svg)](http://badge.fury.io/js/posthtml-parser)
[![Build Status](https://travis-ci.org/posthtml/posthtml-parser.svg?branch=master)](https://travis-ci.org/posthtml/posthtml-parser?branch=master)
[![Coverage Status](https://coveralls.io/repos/posthtml/posthtml-parser/badge.svg?branch=master)](https://coveralls.io/r/posthtml/posthtml-parser?branch=master)
Parse HTML/XML to [PostHTML AST](https://github.com/posthtml/posthtml-parser#posthtml-ast-format).
More about [PostHTML](https://github.com/posthtml/posthtml#readme)
## Install
[NPM](http://npmjs.com) install
```
$ npm install posthtml-parser
```
## Usage
#### Input HTML
```html
<a class="animals" href="#">
<span class="animals__cat" style="background: url(cat.png)">Cat</span>
</a>
```
```js
import { parser } from 'posthtml-parser'
import fs from 'fs'
const html = fs.readFileSync('path/to/input.html', 'utf-8')
console.log(parser(html)) // Logs a PostHTML AST
```
#### input HTML
```html
<a class="animals" href="#">
<span class="animals__cat" style="background: url(cat.png)">Cat</span>
</a>
```
#### Result PostHTMLTree
```js
[{
tag: 'a',
attrs: {
class: 'animals',
href: '#'
},
content: [
'\n ',
{
tag: 'span',
attrs: {
class: 'animals__cat',
style: 'background: url(cat.png)'
},
content: ['Cat']
},
'\n'
]
}]
```
## PostHTML AST Format
Any parser being used with PostHTML should return a standard PostHTML [Abstract Syntax Tree](https://www.wikiwand.com/en/Abstract_syntax_tree) (AST). Fortunately, this is a very easy format to produce and understand. The AST is an array that can contain strings and objects. Any strings represent plain text content to be written to the output. Any objects represent HTML tags.
Tag objects generally look something like this:
```js
{
tag: 'div',
attrs: {
class: 'foo'
},
content: ['hello world!']
}
```
Tag objects can contain three keys. The `tag` key takes the name of the tag as the value. This can include custom tags. The optional `attrs` key takes an object with key/value pairs representing the attributes of the html tag. A boolean attribute has an empty string as its value. Finally, the optional `content` key takes an array as its value, which is a PostHTML AST. In this manner, the AST is a tree that should be walked recursively.
## Options
### `directives`
Type: `Array`
Default: `[{name: '!doctype', start: '<', end: '>'}]`
Description: *Adds processing of custom directives. Note: The property ```name``` in custom directives can be ```String``` or ```RegExp``` type*
### `xmlMode`
Type: `Boolean`
Default: `false`
Description: *Indicates whether special tags (`<script>` and `<style>`) should get special treatment and if "empty" tags (eg. `<br>`) can have children. If false, the content of special tags will be text only. For feeds and other XML content (documents that don't consist of HTML), set this to true.*
### `decodeEntities`
Type: `Boolean`
Default: `false`
Description: *If set to true, entities within the document will be decoded.*
### `lowerCaseTags`
Type: `Boolean`
Default: `false`
Description: *If set to true, all tags will be lowercased. If `xmlMode` is disabled.*
### `lowerCaseAttributeNames`
Type: `Boolean`
Default: `false`
Description: *If set to true, all attribute names will be lowercased. This has noticeable impact on speed.*
### `recognizeCDATA`
Type: `Boolean`
Default: `false`
Description: *If set to true, CDATA sections will be recognized as text even if the `xmlMode` option is not enabled. NOTE: If `xmlMode` is set to `true` then CDATA sections will always be recognized as text.*
### `recognizeSelfClosing`
Type: `Boolean`
Default: `false`
Description: *If set to true, self-closing tags will trigger the `onclosetag` event even if `xmlMode` is not set to `true`. NOTE: If `xmlMode` is set to `true` then self-closing tags will always be recognized.*
### `sourceLocations`
Type: `Boolean`
Default: `false`
Description: *If set to true, AST nodes will have a `location` property containing the `start` and `end` line and column position of the node.*
## License
[MIT](LICENSE)