nuxt-ignis 0.5.0-rc.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.data/content/contents.sqlite +0 -0
- package/.env +1 -1
- package/.nuxt/components.d.ts +414 -232
- package/.nuxt/content/components.ts +206 -108
- package/.nuxt/dev/index.mjs +1092 -726
- package/.nuxt/dev/index.mjs.map +1 -1
- package/.nuxt/dist/server/client.manifest.mjs +1 -18
- package/.nuxt/dist/server/client.precomputed.mjs +1 -0
- package/.nuxt/eslint-typegen.d.ts +115 -7
- package/.nuxt/eslint.config.d.mts +3 -3
- package/.nuxt/eslint.config.mjs +11 -11
- package/.nuxt/imports.d.ts +63 -59
- package/.nuxt/manifest/latest.json +1 -1
- package/.nuxt/manifest/meta/dev.json +1 -1
- package/.nuxt/mdc-highlighter.mjs +4 -0
- package/.nuxt/mdc-image-component.mjs +1 -1
- package/.nuxt/module/nuxt-robots.d.ts +12 -12
- package/.nuxt/module/nuxt-seo-utils.d.ts +10 -10
- package/.nuxt/module/nuxt-site-config.d.ts +11 -8
- package/.nuxt/module/nuxt-sitemap.d.ts +17 -17
- package/.nuxt/nitro.json +5 -5
- package/.nuxt/nuxt.d.ts +13 -9
- package/.nuxt/nuxt.json +2 -2
- package/.nuxt/nuxt.node.d.ts +13 -8
- package/.nuxt/tsconfig.app.json +197 -173
- package/.nuxt/tsconfig.json +199 -172
- package/.nuxt/tsconfig.node.json +108 -91
- package/.nuxt/tsconfig.server.json +131 -127
- package/.nuxt/tsconfig.shared.json +61 -56
- package/.nuxt/types/build.d.ts +2 -1
- package/.nuxt/types/components.d.ts +482 -300
- package/.nuxt/types/i18n-plugin.d.ts +2 -2
- package/.nuxt/types/imports.d.ts +689 -679
- package/.nuxt/types/modules.d.ts +36 -16
- package/.nuxt/types/nitro-imports.d.ts +250 -250
- package/.nuxt/types/nitro-nuxt.d.ts +4 -1
- package/.nuxt/types/nitro-routes.d.ts +20 -20
- package/.nuxt/types/plugins.d.ts +37 -37
- package/.nuxt/types/ui.d.ts +3 -3
- package/.nuxt/ui/drawer.ts +23 -0
- package/.nuxt/ui/progress.ts +3 -3
- package/.nuxt/ui-image-component.ts +1 -1
- package/.output/nitro.json +3 -3
- package/.output/public/_fonts/31PZhXd_YTCmsoiPQZc-xVtAWAkLogRFRj5mWplmKFE-6WsTw05QKugcwLySGc_b9CIheG8j8LRyo47qPL430Mk.woff2 +0 -0
- package/.output/public/_fonts/9FWLUGCSCYLRIRMtCzLrt4Go7DMFXOeN_pyCOJD_44Y-Yh2wNaqrq_e759vVlc3tX81lMwRu9ktkQJX_Svgs-VI.woff2 +0 -0
- package/.output/public/_fonts/BQnDL9FFy0Q_jvURlmv87luvmXLSMbSuXsfZv_R2Rkk-y5MVrLtP4J_1al8rz8R-MDaUOMAHckAWCwDrKhw25fY.woff2 +0 -0
- package/.output/public/_fonts/JSrPAbQHsQEdUrIE5Ts6fIQ2ymsa4i7HhiCpui6ulCc-_AoyGWssOn06OMh3ZY_GddBBPRny4Igxin4fT_1K6F4.woff2 +0 -0
- package/.output/public/_fonts/Jtqhy44WKYEjGWTSusP5YJfJv7Wf74QqgkBOI9u_77s-Rl_Bht5SvmaotE20bkavBEAJEEGEa0hcz3d_8yOeXmw.woff +0 -0
- package/.output/public/_fonts/M-60tFLmAJxdPjHsK-2ILWom5zPbu37lb3Qex2waL14-A9y4QcXALPi_RvQsmRsSFUxrT3_J213W4zPFIXetlbw.woff2 +0 -0
- package/.output/public/_fonts/T-ozk-QJ_Ck37B2RHPl2i-s_gAGGo7suFgagWoJ8bO4-maDXQ_nEXKAaLHm4Joud3DJR9EVzS7QXWMWK8YOTIcs.woff2 +0 -0
- package/.output/public/_fonts/TTYbISAfwy-y4uVGS9AH32sK7b2xJsoCESo64ryf8LU-y87nRMqBGo42rUOW9tWZa06o4oTa0USJrAMMoKDamgs.woff2 +0 -0
- package/.output/public/_fonts/Y_5DOsLit49q2i2tbcNxnyUen9__GPCX8mwAi03q1aA-pBCjVKDT5tBT3BJckh9uzNkfUWeUIBPz9Y8T55vcj8E.woff2 +0 -0
- package/.output/public/_fonts/ZHaz3DhCHNWhsElqYfuM71rfBBDgjuU2sd34vaYJwQg-71NZaZSGjxzAGjCMnCc2zS5rS_EGA0xHKPGCggWuXik.woff +0 -0
- package/.output/public/_fonts/h9PwCjip_BNPVO50hT4v29USWFv6H3ZlYx_IestfqgY-sYfLVuZXl9E1aYbn1S0pAr4zfdQ_WT7iBZhrgQY6N-4.woff2 +0 -0
- package/.output/public/_fonts/l00UCz_-QvI_NO8AGcu7ooAcrFDlxYUdxCSCh6gBwd4-vPjTZ3ztgw27A2TnHeCycxPvUtXWEVpG33_97ra6su8.woff2 +0 -0
- package/.output/public/_fonts/nuenOq7ZFSZ65QudJO7uQ0sOjDqow2WjfXrQh4S9gEc-uF81rxcswER5srfhzyLfPoGlKNAIt2C_BvkXFOc19rw.woff2 +0 -0
- package/.output/public/_fonts/pWMvGwciZ-EfQsfR2ueelhC7Jnt5K-8Px8PjPK0mDII-eT9iD0iZ9WWhTJs6V5GxXr0iaUwx_WxgGGriOiGb81o.woff2 +0 -0
- package/.output/public/_fonts/y3mP_zJcojQwJn30TpF_XxDzgeM6Nbk7MaRg1Ne0YcI-lFx13nqMCMgk_S70gRmwEHXlE5BLp1B4W82RpFihpMs.woff2 +0 -0
- package/.output/public/_fonts/zr3WxpLd5PmlBr7e4PWGkhZv6XTg70Pi4sCbC-CEV0Q-v2yL98XOiD3FkbiYlYYeAeTSVSkgAckeOp55Q5kHJmU.woff2 +0 -0
- package/.output/public/_ignis-config.json +1789 -1
- package/.output/public/_nuxt/0gZNo08M.js +1 -0
- package/.output/public/_nuxt/4etphg87.js +1 -0
- package/.output/public/_nuxt/7oEH3i-J.js +1 -0
- package/.output/public/_nuxt/B0GskE-x.js +1 -0
- package/.output/public/_nuxt/B2rRIZLd.js +1 -0
- package/.output/public/_nuxt/B3Twp4np.js +1 -0
- package/.output/public/_nuxt/B4dafB1u.js +1 -0
- package/.output/public/_nuxt/B5v-AhRa.js +1 -0
- package/.output/public/_nuxt/BGIWR6zS.js +1 -0
- package/.output/public/_nuxt/BPF61Z69.js +1 -0
- package/.output/public/_nuxt/BX7sSsxl.js +1 -0
- package/.output/public/_nuxt/BcGXkrpD.js +1 -0
- package/.output/public/_nuxt/Bdmjn2k2.js +1 -0
- package/.output/public/_nuxt/BkwIJBVH.js +1 -0
- package/.output/public/_nuxt/{DXBpKbsa.js → Bs7HqoDE.js} +47 -42
- package/.output/public/_nuxt/BxBcowlq.js +1 -0
- package/.output/public/_nuxt/BxjWLNqQ.js +1 -0
- package/.output/public/_nuxt/CJT046op.js +1 -0
- package/.output/public/_nuxt/CNoaFijS.js +1 -0
- package/.output/public/_nuxt/COOHDsMA.js +1 -0
- package/.output/public/_nuxt/CT_jQ1c7.js +1 -0
- package/.output/public/_nuxt/CzjEkwvT.js +1 -0
- package/.output/public/_nuxt/D0gc1iwv.js +35 -0
- package/.output/public/_nuxt/DHbdVh9f.js +94 -0
- package/.output/public/_nuxt/DPk_8xPF.js +1 -0
- package/.output/public/_nuxt/DS02jnv_.js +1 -0
- package/.output/public/_nuxt/DcZxay5W.js +1 -0
- package/.output/public/_nuxt/Dj4M1E-R.js +1 -0
- package/.output/public/_nuxt/DrlW3O6H.js +1 -0
- package/.output/public/_nuxt/DzHDVFEa.js +1 -0
- package/.output/public/_nuxt/Kgt6q5rz.js +1 -0
- package/.output/public/_nuxt/_RaG-8ca.js +1 -0
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/458d3dfb-5eef-4d52-b92b-109ceaa7a1ab.json +1 -0
- package/.output/public/_nuxt/entry.CtpkPzPO.css +1 -0
- package/.output/public/_nuxt/error-404.DzDu4Ean.css +1 -0
- package/.output/public/_nuxt/error-500.BdNqqJx7.css +1 -0
- package/.output/public/_nuxt/nE6m0q_v.js +1 -0
- package/.output/public/_nuxt/vueform.CkWb7x1C.css +1 -0
- package/.output/public/_nuxt/wTHp3vgs.js +1 -0
- package/.output/public/_nuxt/zBYuFSAQ.js +1 -0
- package/.output/public/nuxt-spec.png +0 -0
- package/.output/server/chunks/_/error-500.mjs +1 -1
- package/.output/server/chunks/_/error-500.mjs.map +1 -1
- package/.output/server/chunks/_/nitro.mjs +624 -580
- package/.output/server/chunks/_/nitro.mjs.map +1 -1
- package/.output/server/chunks/build/client.precomputed.mjs +4 -0
- package/.output/server/chunks/build/client.precomputed.mjs.map +1 -0
- package/.output/server/chunks/routes/renderer.mjs +10 -33
- package/.output/server/chunks/routes/renderer.mjs.map +1 -1
- package/.output/server/index.mjs.map +1 -1
- package/.output/server/node_modules/@babel/parser/lib/index.js +212 -145
- package/.output/server/node_modules/@babel/parser/package.json +3 -3
- package/.output/server/node_modules/@poppinss/utils/package.json +1 -1
- package/.output/server/node_modules/@shikijs/core/package.json +2 -2
- package/.output/server/node_modules/@shikijs/engine-javascript/package.json +2 -2
- package/.output/server/node_modules/@shikijs/engine-oniguruma/package.json +2 -2
- package/.output/server/node_modules/@shikijs/langs/dist/javascript.mjs +1 -1
- package/.output/server/node_modules/@shikijs/langs/dist/typescript.mjs +1 -1
- package/.output/server/node_modules/@shikijs/langs/package.json +11 -3
- package/.output/server/node_modules/@shikijs/themes/package.json +3 -3
- package/.output/server/node_modules/@shikijs/transformers/package.json +3 -3
- package/.output/server/node_modules/@shikijs/types/package.json +1 -1
- package/.output/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +131 -96
- package/.output/server/node_modules/@vue/compiler-core/package.json +4 -4
- package/.output/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +4 -1
- package/.output/server/node_modules/@vue/compiler-dom/package.json +3 -3
- package/.output/server/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +10 -1
- package/.output/server/node_modules/@vue/compiler-ssr/package.json +3 -3
- package/.output/server/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js +4 -3
- package/.output/server/node_modules/@vue/reactivity/package.json +2 -2
- package/.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js +25 -27
- package/.output/server/node_modules/@vue/runtime-core/package.json +3 -3
- package/.output/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +40 -14
- package/.output/server/node_modules/@vue/runtime-dom/package.json +4 -4
- package/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js +1 -1
- package/.output/server/node_modules/@vue/server-renderer/package.json +4 -4
- package/.output/server/node_modules/@vue/shared/dist/shared.cjs.prod.js +1 -1
- package/.output/server/node_modules/@vue/shared/package.json +1 -1
- package/.output/server/node_modules/debug/package.json +1 -1
- package/.output/server/node_modules/detect-libc/lib/detect-libc.js +59 -13
- package/.output/server/node_modules/detect-libc/lib/elf.js +39 -0
- package/.output/server/node_modules/detect-libc/lib/filesystem.js +18 -8
- package/.output/server/node_modules/detect-libc/package.json +5 -2
- package/.output/server/node_modules/devalue/package.json +1 -1
- package/.output/server/node_modules/devalue/src/parse.js +7 -1
- package/.output/server/node_modules/devalue/src/uneval.js +9 -8
- package/.output/server/node_modules/fast-xml-parser/package.json +1 -1
- package/.output/server/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +297 -287
- package/.output/server/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +3 -2
- package/.output/server/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js +4 -4
- package/.output/server/node_modules/image-meta/dist/index.mjs +85 -4
- package/.output/server/node_modules/image-meta/package.json +12 -12
- package/.output/server/node_modules/is-arrayish/package.json +1 -1
- package/.output/server/node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs +2 -2
- package/.output/server/node_modules/node-fetch-native/dist/node.mjs +10 -10
- package/.output/server/node_modules/node-fetch-native/package.json +13 -13
- package/.output/server/node_modules/node-mock-http/dist/index.mjs +1 -1
- package/.output/server/node_modules/node-mock-http/package.json +6 -6
- package/.output/server/node_modules/oauth4webapi/build/index.js +10 -8
- package/.output/server/node_modules/oauth4webapi/package.json +12 -12
- package/.output/server/node_modules/openid-client/build/index.js +1 -1
- package/.output/server/node_modules/openid-client/package.json +7 -7
- package/.output/server/node_modules/secure-json-parse/index.js +35 -0
- package/.output/server/node_modules/secure-json-parse/package.json +2 -3
- package/.output/server/node_modules/semver/classes/semver.js +19 -5
- package/.output/server/node_modules/semver/internal/identifiers.js +4 -0
- package/.output/server/node_modules/semver/package.json +3 -3
- package/.output/server/node_modules/shiki/package.json +9 -9
- package/.output/server/node_modules/simple-swizzle/package.json +1 -1
- package/.output/server/node_modules/unhead/dist/parser.mjs +508 -0
- package/.output/server/node_modules/unhead/dist/server.mjs +6 -513
- package/.output/server/node_modules/unhead/package.json +5 -1
- package/.output/server/node_modules/unist-util-is/lib/index.js +10 -5
- package/.output/server/node_modules/unist-util-is/package.json +12 -9
- package/.output/server/node_modules/unist-util-visit-parents/lib/index.js +8 -7
- package/.output/server/node_modules/unist-util-visit-parents/package.json +18 -13
- package/.output/server/node_modules/vue/dist/vue.cjs.js +1 -1
- package/.output/server/node_modules/vue/dist/vue.cjs.prod.js +1 -1
- package/.output/server/node_modules/vue/package.json +6 -6
- package/.output/server/node_modules/vue-bundle-renderer/dist/runtime.mjs +158 -53
- package/.output/server/node_modules/vue-bundle-renderer/package.json +16 -11
- package/.output/server/node_modules/vue-router/dist/devtools-BLCumUwL.mjs +1218 -0
- package/.output/server/node_modules/vue-router/dist/vue-router.mjs +1459 -3688
- package/.output/server/node_modules/vue-router/package.json +43 -38
- package/.output/server/node_modules/vue-router/vue-router.node.mjs +2 -0
- package/.output/server/node_modules/yaml/dist/stringify/stringifyString.js +1 -1
- package/.output/server/node_modules/yaml/package.json +2 -1
- package/.output/server/package.json +39 -39
- package/README.md +4 -0
- package/app/app.vue +2 -2
- package/app/assets/css/ignis-open-props.css +4 -5
- package/app/components/CurrentTime.vue +8 -1
- package/app/components/ignis/{IgnisInfo.vue → IgnisContent.vue} +3 -3
- package/app/components/ignis/{IgnisConfig.vue → IgnisContentConfig.vue} +5 -1
- package/app/components/ignis/IgnisContentFeatures.vue +102 -0
- package/app/components/ignis/{IgnisWelcome.vue → IgnisContentWelcome.vue} +2 -2
- package/app/components/ignis/IgnisFooter.vue +11 -3
- package/app/pages/_ignis-config.vue +1 -1
- package/app/pages/_ignis-info.vue +1 -1
- package/app/pages/_ignis-welcome.vue +1 -1
- package/app/pages/index.vue +2 -2
- package/bin/cli.js +66 -0
- package/bin/set-app-vue.js +20 -0
- package/bin/set-css.js +5 -8
- package/bin/set-eslint.js +5 -8
- package/bin/setup.js +211 -45
- package/features.ts +17 -8
- package/nuxt.config.ts +10 -5
- package/package.json +19 -21
- package/public/_ignis-config.json +1789 -1
- package/test/config/css-multiple.txt +30 -24
- package/test/config/css-nuxt-ui.txt +34 -28
- package/test/config/css-open-props.txt +1812 -1805
- package/test/config/css-single.txt +28 -22
- package/test/config/css-tailwind.txt +55 -48
- package/test/config/custom-lang.txt +27 -21
- package/test/config/db-neon.txt +28 -22
- package/test/config/db-supabase.txt +31 -25
- package/test/config/default.txt +27 -21
- package/test/config/equipment-1-composable.txt +33 -27
- package/test/config/equipment-2-plugins.txt +34 -28
- package/test/config/equipment-all.txt +38 -32
- package/test/config/forms-formkit.txt +32 -26
- package/test/config/forms-vueform.txt +28 -22
- package/test/config/i18n.txt +36 -30
- package/test/config/no-default-css.txt +24 -18
- package/test/config/open-props.txt +1811 -1804
- package/test/config/seo-ssr-false.txt +35 -29
- package/test/config/ui-nuxt-ui.txt +33 -27
- package/test/config/ui-tailwind.txt +54 -47
- package/test/features.test.ts +33 -33
- package/.nuxt/dist/server/client.manifest.json +0 -18
- package/.nuxt/i18n.options.mjs +0 -165
- package/.nuxt/nuxt-i18n-logger.mjs +0 -1
- package/.output/public/_nuxt/1soVlS0z.js +0 -1
- package/.output/public/_nuxt/B7rsWaa2.js +0 -1
- package/.output/public/_nuxt/BA2WKEAc.js +0 -1
- package/.output/public/_nuxt/BE_a_Zhd.js +0 -1
- package/.output/public/_nuxt/BFreiu22.js +0 -1
- package/.output/public/_nuxt/BLcTglbc.js +0 -1
- package/.output/public/_nuxt/Bhd4_yFT.js +0 -1
- package/.output/public/_nuxt/Bi2eMDmd.js +0 -1
- package/.output/public/_nuxt/BiUZ9mZX.js +0 -1
- package/.output/public/_nuxt/Bm30MqE0.js +0 -1
- package/.output/public/_nuxt/Bnm5Nral.js +0 -1
- package/.output/public/_nuxt/BrY1radz.js +0 -35
- package/.output/public/_nuxt/Bs3IGOdt.js +0 -1
- package/.output/public/_nuxt/ByaiRTkI.js +0 -1
- package/.output/public/_nuxt/CA578xwz.js +0 -1
- package/.output/public/_nuxt/CDttUXKg.js +0 -1
- package/.output/public/_nuxt/CSN71QT8.js +0 -1
- package/.output/public/_nuxt/CmzFGS1a.js +0 -90
- package/.output/public/_nuxt/CqCaqSd2.js +0 -1
- package/.output/public/_nuxt/D8v-efI7.js +0 -1
- package/.output/public/_nuxt/DR4hWRk7.js +0 -1
- package/.output/public/_nuxt/DRroQ-Xq.js +0 -1
- package/.output/public/_nuxt/DStnBfJS.js +0 -1
- package/.output/public/_nuxt/DXTYyv-V.js +0 -1
- package/.output/public/_nuxt/DXbccJ2T.js +0 -1
- package/.output/public/_nuxt/DeS1g0YT.js +0 -1
- package/.output/public/_nuxt/Deb6R53f.js +0 -1
- package/.output/public/_nuxt/DiDHllLr.js +0 -1
- package/.output/public/_nuxt/DyCICqRh.js +0 -1
- package/.output/public/_nuxt/DzT4wm3Y.js +0 -1
- package/.output/public/_nuxt/E8nje24C.js +0 -1
- package/.output/public/_nuxt/builds/meta/9a624d26-216d-4e69-b3a7-54b68357876f.json +0 -1
- package/.output/public/_nuxt/dJ-vStNn.js +0 -1
- package/.output/public/_nuxt/entry.jMyW6Sg0.css +0 -1
- package/.output/public/_nuxt/error-404.BGUbR0Uk.css +0 -1
- package/.output/public/_nuxt/error-500.CQfkKpQ2.css +0 -1
- package/.output/public/_nuxt/sHsV3x2B.js +0 -1
- package/.output/public/_nuxt/sQEqbbg2.js +0 -1
- package/.output/public/_nuxt/vueform.ChEauysg.css +0 -1
- package/.output/server/chunks/build/client.manifest.mjs +0 -511
- package/.output/server/chunks/build/client.manifest.mjs.map +0 -1
- package/.output/server/node_modules/vue-router/dist/vue-router.node.mjs +0 -2
- package/app/components/ignis/IgnisFeatureList.vue +0 -111
- /package/app/components/ignis/{IgnisFeature.vue → IgnisContentFeaturesDetail.vue} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { a as createUnhead } from './shared/unhead.DH45uomy.mjs';
|
|
2
2
|
import { T as TagsWithInnerContent, S as SelfClosingTags } from './shared/unhead.yem5I2v_.mjs';
|
|
3
|
+
import { parseHtmlForUnheadExtraction } from './parser.mjs';
|
|
3
4
|
import 'hookable';
|
|
4
5
|
import './shared/unhead.BpRRHAhY.mjs';
|
|
5
6
|
import './shared/unhead.DZbvapt-.mjs';
|
|
@@ -67,519 +68,6 @@ function createHead(options = {}) {
|
|
|
67
68
|
return unhead;
|
|
68
69
|
}
|
|
69
70
|
|
|
70
|
-
const TAG_HTML = 0;
|
|
71
|
-
const TAG_HEAD = 1;
|
|
72
|
-
const TAG_TITLE = 4;
|
|
73
|
-
const TAG_META = 5;
|
|
74
|
-
const TAG_BODY = 44;
|
|
75
|
-
const TAG_SCRIPT = 52;
|
|
76
|
-
const TAG_STYLE = 53;
|
|
77
|
-
const TAG_LINK = 54;
|
|
78
|
-
const TAG_BASE = 56;
|
|
79
|
-
const TagIdMap = {
|
|
80
|
-
html: TAG_HTML,
|
|
81
|
-
head: TAG_HEAD,
|
|
82
|
-
title: TAG_TITLE,
|
|
83
|
-
meta: TAG_META,
|
|
84
|
-
body: TAG_BODY,
|
|
85
|
-
script: TAG_SCRIPT,
|
|
86
|
-
style: TAG_STYLE,
|
|
87
|
-
link: TAG_LINK,
|
|
88
|
-
base: TAG_BASE
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const LT_CHAR = 60;
|
|
92
|
-
const GT_CHAR = 62;
|
|
93
|
-
const SLASH_CHAR = 47;
|
|
94
|
-
const EQUALS_CHAR = 61;
|
|
95
|
-
const QUOTE_CHAR = 34;
|
|
96
|
-
const APOS_CHAR = 39;
|
|
97
|
-
const EXCLAMATION_CHAR = 33;
|
|
98
|
-
const BACKSLASH_CHAR = 92;
|
|
99
|
-
const DASH_CHAR = 45;
|
|
100
|
-
const SPACE_CHAR = 32;
|
|
101
|
-
const TAB_CHAR = 9;
|
|
102
|
-
const NEWLINE_CHAR = 10;
|
|
103
|
-
const CARRIAGE_RETURN_CHAR = 13;
|
|
104
|
-
const EMPTY_ATTRIBUTES = Object.freeze({});
|
|
105
|
-
function isWhitespace(charCode) {
|
|
106
|
-
return charCode === SPACE_CHAR || charCode === TAB_CHAR || charCode === NEWLINE_CHAR || charCode === CARRIAGE_RETURN_CHAR;
|
|
107
|
-
}
|
|
108
|
-
function processCommentOrDoctype(htmlChunk, position) {
|
|
109
|
-
let i = position;
|
|
110
|
-
const chunkLength = htmlChunk.length;
|
|
111
|
-
if (i + 3 < chunkLength && htmlChunk.charCodeAt(i + 2) === DASH_CHAR && htmlChunk.charCodeAt(i + 3) === DASH_CHAR) {
|
|
112
|
-
i += 4;
|
|
113
|
-
while (i < chunkLength - 2) {
|
|
114
|
-
if (htmlChunk.charCodeAt(i) === DASH_CHAR && htmlChunk.charCodeAt(i + 1) === DASH_CHAR && htmlChunk.charCodeAt(i + 2) === GT_CHAR) {
|
|
115
|
-
i += 3;
|
|
116
|
-
return {
|
|
117
|
-
complete: true,
|
|
118
|
-
newPosition: i,
|
|
119
|
-
remainingText: ""
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
i++;
|
|
123
|
-
}
|
|
124
|
-
return {
|
|
125
|
-
complete: false,
|
|
126
|
-
newPosition: position,
|
|
127
|
-
remainingText: htmlChunk.substring(position)
|
|
128
|
-
};
|
|
129
|
-
} else {
|
|
130
|
-
i += 2;
|
|
131
|
-
while (i < chunkLength) {
|
|
132
|
-
if (htmlChunk.charCodeAt(i) === GT_CHAR) {
|
|
133
|
-
i++;
|
|
134
|
-
return {
|
|
135
|
-
complete: true,
|
|
136
|
-
newPosition: i,
|
|
137
|
-
remainingText: ""
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
i++;
|
|
141
|
-
}
|
|
142
|
-
return {
|
|
143
|
-
complete: false,
|
|
144
|
-
newPosition: i,
|
|
145
|
-
remainingText: htmlChunk.substring(position, i)
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
function parseAttributes(attrStr) {
|
|
150
|
-
if (!attrStr)
|
|
151
|
-
return EMPTY_ATTRIBUTES;
|
|
152
|
-
const result = {};
|
|
153
|
-
const len = attrStr.length;
|
|
154
|
-
let i = 0;
|
|
155
|
-
const WHITESPACE = 0;
|
|
156
|
-
const NAME = 1;
|
|
157
|
-
const AFTER_NAME = 2;
|
|
158
|
-
const BEFORE_VALUE = 3;
|
|
159
|
-
const QUOTED_VALUE = 4;
|
|
160
|
-
const UNQUOTED_VALUE = 5;
|
|
161
|
-
let state = WHITESPACE;
|
|
162
|
-
let nameStart = 0;
|
|
163
|
-
let nameEnd = 0;
|
|
164
|
-
let valueStart = 0;
|
|
165
|
-
let quoteChar = 0;
|
|
166
|
-
let name = "";
|
|
167
|
-
while (i < len) {
|
|
168
|
-
const charCode = attrStr.charCodeAt(i);
|
|
169
|
-
const isSpace = isWhitespace(charCode);
|
|
170
|
-
switch (state) {
|
|
171
|
-
case WHITESPACE:
|
|
172
|
-
if (!isSpace) {
|
|
173
|
-
state = NAME;
|
|
174
|
-
nameStart = i;
|
|
175
|
-
nameEnd = 0;
|
|
176
|
-
}
|
|
177
|
-
break;
|
|
178
|
-
case NAME:
|
|
179
|
-
if (charCode === EQUALS_CHAR || isSpace) {
|
|
180
|
-
nameEnd = i;
|
|
181
|
-
name = attrStr.substring(nameStart, nameEnd).toLowerCase();
|
|
182
|
-
state = charCode === EQUALS_CHAR ? BEFORE_VALUE : AFTER_NAME;
|
|
183
|
-
}
|
|
184
|
-
break;
|
|
185
|
-
case AFTER_NAME:
|
|
186
|
-
if (charCode === EQUALS_CHAR) {
|
|
187
|
-
state = BEFORE_VALUE;
|
|
188
|
-
} else if (!isSpace) {
|
|
189
|
-
result[name] = "";
|
|
190
|
-
state = NAME;
|
|
191
|
-
nameStart = i;
|
|
192
|
-
nameEnd = 0;
|
|
193
|
-
}
|
|
194
|
-
break;
|
|
195
|
-
case BEFORE_VALUE:
|
|
196
|
-
if (charCode === QUOTE_CHAR || charCode === APOS_CHAR) {
|
|
197
|
-
quoteChar = charCode;
|
|
198
|
-
state = QUOTED_VALUE;
|
|
199
|
-
valueStart = i + 1;
|
|
200
|
-
} else if (!isSpace) {
|
|
201
|
-
state = UNQUOTED_VALUE;
|
|
202
|
-
valueStart = i;
|
|
203
|
-
}
|
|
204
|
-
break;
|
|
205
|
-
case QUOTED_VALUE:
|
|
206
|
-
if (charCode === BACKSLASH_CHAR && i + 1 < len) {
|
|
207
|
-
i++;
|
|
208
|
-
} else if (charCode === quoteChar) {
|
|
209
|
-
result[name] = attrStr.substring(valueStart, i);
|
|
210
|
-
state = WHITESPACE;
|
|
211
|
-
}
|
|
212
|
-
break;
|
|
213
|
-
case UNQUOTED_VALUE:
|
|
214
|
-
if (isSpace || charCode === GT_CHAR) {
|
|
215
|
-
result[name] = attrStr.substring(valueStart, i);
|
|
216
|
-
state = WHITESPACE;
|
|
217
|
-
}
|
|
218
|
-
break;
|
|
219
|
-
}
|
|
220
|
-
i++;
|
|
221
|
-
}
|
|
222
|
-
if (state === QUOTED_VALUE || state === UNQUOTED_VALUE) {
|
|
223
|
-
if (name) {
|
|
224
|
-
result[name] = attrStr.substring(valueStart, i);
|
|
225
|
-
}
|
|
226
|
-
} else if (state === NAME || state === AFTER_NAME || state === BEFORE_VALUE) {
|
|
227
|
-
nameEnd = nameEnd || i;
|
|
228
|
-
const currentName = attrStr.substring(nameStart, nameEnd).toLowerCase();
|
|
229
|
-
if (currentName) {
|
|
230
|
-
result[currentName] = "";
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
return result;
|
|
234
|
-
}
|
|
235
|
-
function parseHtmlForIndexes(html) {
|
|
236
|
-
const indexes = {
|
|
237
|
-
htmlTagStart: html.indexOf("<html"),
|
|
238
|
-
htmlTagEnd: -1,
|
|
239
|
-
headTagEnd: html.indexOf("</head>"),
|
|
240
|
-
bodyTagStart: html.indexOf("<body"),
|
|
241
|
-
bodyTagEnd: -1,
|
|
242
|
-
bodyCloseTagStart: html.indexOf("</body>")
|
|
243
|
-
};
|
|
244
|
-
if (indexes.htmlTagStart >= 0) {
|
|
245
|
-
const htmlTagEndPos = html.indexOf(">", indexes.htmlTagStart);
|
|
246
|
-
if (htmlTagEndPos >= 0) {
|
|
247
|
-
indexes.htmlTagEnd = htmlTagEndPos + 1;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
if (indexes.bodyTagStart >= 0) {
|
|
251
|
-
const bodyTagEndPos = html.indexOf(">", indexes.bodyTagStart);
|
|
252
|
-
if (bodyTagEndPos >= 0) {
|
|
253
|
-
indexes.bodyTagEnd = bodyTagEndPos + 1;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
return { html, input: {}, indexes };
|
|
257
|
-
}
|
|
258
|
-
function parseHtmlForUnheadExtraction(html) {
|
|
259
|
-
const input = {};
|
|
260
|
-
const htmlParts = [];
|
|
261
|
-
let position = 0;
|
|
262
|
-
let inHead = false;
|
|
263
|
-
let foundBodyStart = false;
|
|
264
|
-
let lastCopyPosition = 0;
|
|
265
|
-
let currentOutputLength = 0;
|
|
266
|
-
const indexes = {
|
|
267
|
-
htmlTagStart: -1,
|
|
268
|
-
htmlTagEnd: -1,
|
|
269
|
-
headTagEnd: -1,
|
|
270
|
-
bodyTagStart: -1,
|
|
271
|
-
bodyTagEnd: -1,
|
|
272
|
-
bodyCloseTagStart: -1
|
|
273
|
-
};
|
|
274
|
-
const headElementsToExtract = /* @__PURE__ */ new Set([TAG_TITLE, TAG_META, TAG_LINK, TAG_SCRIPT, TAG_STYLE, TAG_BASE]);
|
|
275
|
-
function copyAccumulatedText() {
|
|
276
|
-
if (lastCopyPosition < position) {
|
|
277
|
-
const textToAdd = html.substring(lastCopyPosition, position);
|
|
278
|
-
htmlParts.push(textToAdd);
|
|
279
|
-
currentOutputLength += textToAdd.length;
|
|
280
|
-
lastCopyPosition = position;
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
function addText(text) {
|
|
284
|
-
htmlParts.push(text);
|
|
285
|
-
currentOutputLength += text.length;
|
|
286
|
-
}
|
|
287
|
-
while (position < html.length && !foundBodyStart) {
|
|
288
|
-
const currentCharCode = html.charCodeAt(position);
|
|
289
|
-
if (currentCharCode !== LT_CHAR) {
|
|
290
|
-
position++;
|
|
291
|
-
continue;
|
|
292
|
-
}
|
|
293
|
-
if (position + 1 >= html.length) {
|
|
294
|
-
copyAccumulatedText();
|
|
295
|
-
addText(html[position]);
|
|
296
|
-
break;
|
|
297
|
-
}
|
|
298
|
-
const nextCharCode = html.charCodeAt(position + 1);
|
|
299
|
-
if (nextCharCode === EXCLAMATION_CHAR) {
|
|
300
|
-
const result = processCommentOrDoctype(html, position);
|
|
301
|
-
if (result.complete) {
|
|
302
|
-
copyAccumulatedText();
|
|
303
|
-
addText(html.substring(position, result.newPosition));
|
|
304
|
-
position = result.newPosition;
|
|
305
|
-
lastCopyPosition = position;
|
|
306
|
-
} else {
|
|
307
|
-
copyAccumulatedText();
|
|
308
|
-
addText(html.substring(position));
|
|
309
|
-
break;
|
|
310
|
-
}
|
|
311
|
-
continue;
|
|
312
|
-
}
|
|
313
|
-
if (nextCharCode === SLASH_CHAR) {
|
|
314
|
-
let tagEnd2 = position + 2;
|
|
315
|
-
while (tagEnd2 < html.length && html.charCodeAt(tagEnd2) !== GT_CHAR) {
|
|
316
|
-
tagEnd2++;
|
|
317
|
-
}
|
|
318
|
-
if (tagEnd2 >= html.length) {
|
|
319
|
-
copyAccumulatedText();
|
|
320
|
-
addText(html.substring(position));
|
|
321
|
-
break;
|
|
322
|
-
}
|
|
323
|
-
const tagName2 = html.substring(position + 2, tagEnd2).toLowerCase().trim();
|
|
324
|
-
const tagId2 = TagIdMap[tagName2] ?? -1;
|
|
325
|
-
if (tagId2 === TAG_HEAD) {
|
|
326
|
-
inHead = false;
|
|
327
|
-
copyAccumulatedText();
|
|
328
|
-
const headCloseStart = currentOutputLength;
|
|
329
|
-
addText(html.substring(position, tagEnd2 + 1));
|
|
330
|
-
indexes.headTagEnd = headCloseStart;
|
|
331
|
-
} else {
|
|
332
|
-
copyAccumulatedText();
|
|
333
|
-
addText(html.substring(position, tagEnd2 + 1));
|
|
334
|
-
}
|
|
335
|
-
position = tagEnd2 + 1;
|
|
336
|
-
lastCopyPosition = position;
|
|
337
|
-
continue;
|
|
338
|
-
}
|
|
339
|
-
const tagStart = position + 1;
|
|
340
|
-
let tagNameEnd = tagStart;
|
|
341
|
-
while (tagNameEnd < html.length) {
|
|
342
|
-
const c = html.charCodeAt(tagNameEnd);
|
|
343
|
-
if (isWhitespace(c) || c === SLASH_CHAR || c === GT_CHAR) {
|
|
344
|
-
break;
|
|
345
|
-
}
|
|
346
|
-
tagNameEnd++;
|
|
347
|
-
}
|
|
348
|
-
if (tagNameEnd >= html.length) {
|
|
349
|
-
copyAccumulatedText();
|
|
350
|
-
addText(html.substring(position));
|
|
351
|
-
break;
|
|
352
|
-
}
|
|
353
|
-
const tagName = html.substring(tagStart, tagNameEnd).toLowerCase();
|
|
354
|
-
const tagId = TagIdMap[tagName] ?? -1;
|
|
355
|
-
let tagEnd = tagNameEnd;
|
|
356
|
-
let inQuote = false;
|
|
357
|
-
let quoteChar = 0;
|
|
358
|
-
let foundEnd = false;
|
|
359
|
-
let isSelfClosing = false;
|
|
360
|
-
while (tagEnd < html.length && !foundEnd) {
|
|
361
|
-
const c = html.charCodeAt(tagEnd);
|
|
362
|
-
if (inQuote) {
|
|
363
|
-
if (c === quoteChar) {
|
|
364
|
-
inQuote = false;
|
|
365
|
-
}
|
|
366
|
-
} else if (c === QUOTE_CHAR || c === APOS_CHAR) {
|
|
367
|
-
inQuote = true;
|
|
368
|
-
quoteChar = c;
|
|
369
|
-
} else if (c === SLASH_CHAR && tagEnd + 1 < html.length && html.charCodeAt(tagEnd + 1) === GT_CHAR) {
|
|
370
|
-
isSelfClosing = true;
|
|
371
|
-
tagEnd += 2;
|
|
372
|
-
foundEnd = true;
|
|
373
|
-
continue;
|
|
374
|
-
} else if (c === GT_CHAR) {
|
|
375
|
-
tagEnd++;
|
|
376
|
-
foundEnd = true;
|
|
377
|
-
continue;
|
|
378
|
-
}
|
|
379
|
-
tagEnd++;
|
|
380
|
-
}
|
|
381
|
-
if (!foundEnd) {
|
|
382
|
-
copyAccumulatedText();
|
|
383
|
-
addText(html.substring(position));
|
|
384
|
-
break;
|
|
385
|
-
}
|
|
386
|
-
const attributesStr = html.substring(tagNameEnd, tagEnd - (isSelfClosing ? 2 : 1)).trim();
|
|
387
|
-
const attributes = parseAttributes(attributesStr);
|
|
388
|
-
if (tagId === TAG_HTML) {
|
|
389
|
-
copyAccumulatedText();
|
|
390
|
-
indexes.htmlTagStart = currentOutputLength;
|
|
391
|
-
if (Object.keys(attributes).length > 0) {
|
|
392
|
-
input.htmlAttrs = attributes;
|
|
393
|
-
addText(`<${tagName}>`);
|
|
394
|
-
} else {
|
|
395
|
-
addText(html.substring(position, tagEnd));
|
|
396
|
-
}
|
|
397
|
-
indexes.htmlTagEnd = currentOutputLength;
|
|
398
|
-
} else if (tagId === TAG_BODY) {
|
|
399
|
-
copyAccumulatedText();
|
|
400
|
-
indexes.bodyTagStart = currentOutputLength;
|
|
401
|
-
if (Object.keys(attributes).length > 0) {
|
|
402
|
-
input.bodyAttrs = attributes;
|
|
403
|
-
addText(`<${tagName}>`);
|
|
404
|
-
} else {
|
|
405
|
-
addText(html.substring(position, tagEnd));
|
|
406
|
-
}
|
|
407
|
-
indexes.bodyTagEnd = currentOutputLength;
|
|
408
|
-
foundBodyStart = true;
|
|
409
|
-
position = tagEnd;
|
|
410
|
-
lastCopyPosition = position;
|
|
411
|
-
break;
|
|
412
|
-
} else if (tagId === TAG_HEAD) {
|
|
413
|
-
inHead = true;
|
|
414
|
-
copyAccumulatedText();
|
|
415
|
-
addText(html.substring(position, tagEnd));
|
|
416
|
-
} else if (inHead && headElementsToExtract.has(tagId)) {
|
|
417
|
-
if (tagId === TAG_TITLE) {
|
|
418
|
-
if (!isSelfClosing) {
|
|
419
|
-
const titleEnd = findClosingTag(html, tagEnd, tagName);
|
|
420
|
-
if (titleEnd !== -1) {
|
|
421
|
-
const titleContent = html.substring(tagEnd, titleEnd).trim();
|
|
422
|
-
if (titleContent && !input.title) {
|
|
423
|
-
input.title = titleContent;
|
|
424
|
-
}
|
|
425
|
-
position = findTagEnd(html, titleEnd, tagName);
|
|
426
|
-
lastCopyPosition = position;
|
|
427
|
-
continue;
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
} else if (tagId === TAG_SCRIPT) {
|
|
431
|
-
const scriptAttrs = { ...attributes };
|
|
432
|
-
if (!isSelfClosing) {
|
|
433
|
-
const scriptEnd = findClosingTag(html, tagEnd, tagName);
|
|
434
|
-
if (scriptEnd !== -1) {
|
|
435
|
-
const scriptContent = html.substring(tagEnd, scriptEnd);
|
|
436
|
-
scriptAttrs.innerHTML = scriptContent || "";
|
|
437
|
-
position = findTagEnd(html, scriptEnd, tagName);
|
|
438
|
-
} else {
|
|
439
|
-
scriptAttrs.innerHTML = "";
|
|
440
|
-
position = tagEnd;
|
|
441
|
-
}
|
|
442
|
-
} else {
|
|
443
|
-
scriptAttrs.innerHTML = "";
|
|
444
|
-
position = tagEnd;
|
|
445
|
-
}
|
|
446
|
-
lastCopyPosition = position;
|
|
447
|
-
(input.script ||= []).push(scriptAttrs);
|
|
448
|
-
continue;
|
|
449
|
-
} else if (tagId === TAG_STYLE) {
|
|
450
|
-
const styleAttrs = { ...attributes };
|
|
451
|
-
if (!isSelfClosing) {
|
|
452
|
-
const styleEnd = findClosingTag(html, tagEnd, tagName);
|
|
453
|
-
if (styleEnd !== -1) {
|
|
454
|
-
const styleContent = html.substring(tagEnd, styleEnd);
|
|
455
|
-
styleAttrs.textContent = styleContent || "";
|
|
456
|
-
position = findTagEnd(html, styleEnd, tagName);
|
|
457
|
-
} else {
|
|
458
|
-
styleAttrs.textContent = "";
|
|
459
|
-
position = tagEnd;
|
|
460
|
-
}
|
|
461
|
-
} else {
|
|
462
|
-
styleAttrs.textContent = "";
|
|
463
|
-
position = tagEnd;
|
|
464
|
-
}
|
|
465
|
-
lastCopyPosition = position;
|
|
466
|
-
(input.style ||= []).push(styleAttrs);
|
|
467
|
-
continue;
|
|
468
|
-
} else if (tagId === TAG_META) {
|
|
469
|
-
(input.meta ||= []).push(attributes);
|
|
470
|
-
position = tagEnd;
|
|
471
|
-
lastCopyPosition = position;
|
|
472
|
-
continue;
|
|
473
|
-
} else if (tagId === TAG_LINK) {
|
|
474
|
-
(input.link ||= []).push(attributes);
|
|
475
|
-
position = tagEnd;
|
|
476
|
-
lastCopyPosition = position;
|
|
477
|
-
continue;
|
|
478
|
-
} else if (tagId === TAG_BASE && !input.base) {
|
|
479
|
-
input.base = attributes;
|
|
480
|
-
position = tagEnd;
|
|
481
|
-
lastCopyPosition = position;
|
|
482
|
-
continue;
|
|
483
|
-
}
|
|
484
|
-
} else {
|
|
485
|
-
copyAccumulatedText();
|
|
486
|
-
addText(html.substring(position, tagEnd));
|
|
487
|
-
}
|
|
488
|
-
position = tagEnd;
|
|
489
|
-
lastCopyPosition = position;
|
|
490
|
-
}
|
|
491
|
-
const remainingHtml = html.substring(position);
|
|
492
|
-
const bodyCloseIndex = remainingHtml.indexOf("</body>");
|
|
493
|
-
if (bodyCloseIndex !== -1) {
|
|
494
|
-
indexes.bodyCloseTagStart = currentOutputLength + bodyCloseIndex;
|
|
495
|
-
}
|
|
496
|
-
copyAccumulatedText();
|
|
497
|
-
addText(remainingHtml);
|
|
498
|
-
return { html: htmlParts.join(""), input, indexes };
|
|
499
|
-
}
|
|
500
|
-
function findClosingTag(html, startPos, tagName) {
|
|
501
|
-
const tagId = TagIdMap[tagName];
|
|
502
|
-
const isScriptOrStyle = tagId === TAG_SCRIPT || tagId === TAG_STYLE;
|
|
503
|
-
if (!isScriptOrStyle) {
|
|
504
|
-
const closingTag2 = `</${tagName}`;
|
|
505
|
-
const index = html.indexOf(closingTag2, startPos);
|
|
506
|
-
return index === -1 ? -1 : index;
|
|
507
|
-
}
|
|
508
|
-
const closingTag = `</${tagName}`;
|
|
509
|
-
let pos = startPos;
|
|
510
|
-
let inSingleQuote = false;
|
|
511
|
-
let inDoubleQuote = false;
|
|
512
|
-
let inBacktick = false;
|
|
513
|
-
let lastCharWasBackslash = false;
|
|
514
|
-
while (pos < html.length) {
|
|
515
|
-
const currentCharCode = html.charCodeAt(pos);
|
|
516
|
-
if (!lastCharWasBackslash) {
|
|
517
|
-
if (currentCharCode === APOS_CHAR && !inDoubleQuote && !inBacktick) {
|
|
518
|
-
inSingleQuote = !inSingleQuote;
|
|
519
|
-
} else if (currentCharCode === QUOTE_CHAR && !inSingleQuote && !inBacktick) {
|
|
520
|
-
inDoubleQuote = !inDoubleQuote;
|
|
521
|
-
} else if (currentCharCode === 96 && !inSingleQuote && !inDoubleQuote) {
|
|
522
|
-
inBacktick = !inBacktick;
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
lastCharWasBackslash = currentCharCode === BACKSLASH_CHAR && !lastCharWasBackslash;
|
|
526
|
-
const inQuotes = inSingleQuote || inDoubleQuote || inBacktick;
|
|
527
|
-
if (!inQuotes && html.startsWith(closingTag, pos)) {
|
|
528
|
-
const afterTagPos = pos + closingTag.length;
|
|
529
|
-
if (afterTagPos >= html.length) {
|
|
530
|
-
return pos;
|
|
531
|
-
}
|
|
532
|
-
const nextChar = html.charCodeAt(afterTagPos);
|
|
533
|
-
if (nextChar === GT_CHAR || isWhitespace(nextChar)) {
|
|
534
|
-
return pos;
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
pos++;
|
|
538
|
-
}
|
|
539
|
-
return -1;
|
|
540
|
-
}
|
|
541
|
-
function findTagEnd(html, closingTagStart, tagName) {
|
|
542
|
-
let pos = closingTagStart + tagName.length + 2;
|
|
543
|
-
while (pos < html.length && html.charCodeAt(pos) !== GT_CHAR) {
|
|
544
|
-
pos++;
|
|
545
|
-
}
|
|
546
|
-
return pos < html.length ? pos + 1 : pos;
|
|
547
|
-
}
|
|
548
|
-
function applyHeadToHtml(template, headHtml) {
|
|
549
|
-
const { html, indexes } = template;
|
|
550
|
-
const parts = [];
|
|
551
|
-
let lastIndex = 0;
|
|
552
|
-
if (indexes.htmlTagStart >= 0) {
|
|
553
|
-
parts.push(html.substring(lastIndex, indexes.htmlTagStart));
|
|
554
|
-
parts.push(`<html${headHtml.htmlAttrs}>`);
|
|
555
|
-
lastIndex = indexes.htmlTagEnd;
|
|
556
|
-
}
|
|
557
|
-
if (indexes.headTagEnd >= 0) {
|
|
558
|
-
parts.push(html.substring(lastIndex, indexes.headTagEnd));
|
|
559
|
-
parts.push(headHtml.headTags);
|
|
560
|
-
parts.push("</head>");
|
|
561
|
-
lastIndex = indexes.headTagEnd + 7;
|
|
562
|
-
}
|
|
563
|
-
if (indexes.bodyTagStart >= 0) {
|
|
564
|
-
parts.push(html.substring(lastIndex, indexes.bodyTagStart));
|
|
565
|
-
if (headHtml.bodyTagsOpen) {
|
|
566
|
-
parts.push(`<body${headHtml.bodyAttrs}>
|
|
567
|
-
${headHtml.bodyTagsOpen}`);
|
|
568
|
-
} else {
|
|
569
|
-
parts.push(`<body${headHtml.bodyAttrs}>`);
|
|
570
|
-
}
|
|
571
|
-
lastIndex = indexes.bodyTagEnd;
|
|
572
|
-
}
|
|
573
|
-
if (indexes.bodyCloseTagStart >= 0) {
|
|
574
|
-
parts.push(html.substring(lastIndex, indexes.bodyCloseTagStart));
|
|
575
|
-
parts.push(headHtml.bodyTags);
|
|
576
|
-
parts.push(html.substring(indexes.bodyCloseTagStart));
|
|
577
|
-
} else {
|
|
578
|
-
parts.push(html.substring(lastIndex));
|
|
579
|
-
}
|
|
580
|
-
return parts.join("");
|
|
581
|
-
}
|
|
582
|
-
|
|
583
71
|
function extractUnheadInputFromHtml(html) {
|
|
584
72
|
return parseHtmlForUnheadExtraction(html);
|
|
585
73
|
}
|
|
@@ -654,6 +142,7 @@ function ssrRenderTags(tags, options) {
|
|
|
654
142
|
};
|
|
655
143
|
}
|
|
656
144
|
|
|
145
|
+
// @__NO_SIDE_EFFECTS__
|
|
657
146
|
async function renderSSRHead(head, options) {
|
|
658
147
|
const beforeRenderCtx = { shouldRender: true };
|
|
659
148
|
await head.hooks.callHook("ssr:beforeRender", beforeRenderCtx);
|
|
@@ -674,13 +163,17 @@ async function renderSSRHead(head, options) {
|
|
|
674
163
|
return renderCtx.html;
|
|
675
164
|
}
|
|
676
165
|
|
|
166
|
+
// @__NO_SIDE_EFFECTS__
|
|
677
167
|
async function transformHtmlTemplate(head, html, options) {
|
|
168
|
+
const { parseHtmlForUnheadExtraction, applyHeadToHtml } = await import('./parser.mjs');
|
|
678
169
|
const template = parseHtmlForUnheadExtraction(html);
|
|
679
170
|
head.push(template.input, { _index: 0 });
|
|
680
171
|
const headHtml = await renderSSRHead(head, options);
|
|
681
172
|
return applyHeadToHtml(template, headHtml);
|
|
682
173
|
}
|
|
174
|
+
// @__NO_SIDE_EFFECTS__
|
|
683
175
|
async function transformHtmlTemplateRaw(head, html, options) {
|
|
176
|
+
const { parseHtmlForIndexes, applyHeadToHtml } = await import('./parser.mjs');
|
|
684
177
|
const headHtml = await renderSSRHead(head, options);
|
|
685
178
|
const template = parseHtmlForIndexes(html);
|
|
686
179
|
return applyHeadToHtml(template, headHtml);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unhead",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.19",
|
|
5
5
|
"description": "Full-stack <head> manager built for any framework.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Harlan Wilton",
|
|
@@ -56,6 +56,10 @@
|
|
|
56
56
|
"./scripts": {
|
|
57
57
|
"types": "./dist/scripts.d.ts",
|
|
58
58
|
"default": "./dist/scripts.mjs"
|
|
59
|
+
},
|
|
60
|
+
"./parser": {
|
|
61
|
+
"types": "./dist/parser.d.ts",
|
|
62
|
+
"default": "./dist/parser.mjs"
|
|
59
63
|
}
|
|
60
64
|
},
|
|
61
65
|
"main": "dist/index.mjs",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @
|
|
3
|
-
* @typedef {import('unist').Parent} Parent
|
|
2
|
+
* @import {Node, Parent} from 'unist'
|
|
4
3
|
*/
|
|
5
4
|
|
|
6
5
|
/**
|
|
@@ -28,7 +27,7 @@
|
|
|
28
27
|
*
|
|
29
28
|
* Note: `Node` is included as it is common but is not indexable.
|
|
30
29
|
*
|
|
31
|
-
* @typedef {Array<Props | TestFunction | string> | Props | TestFunction | string | null | undefined} Test
|
|
30
|
+
* @typedef {Array<Props | TestFunction | string> | ReadonlyArray<Props | TestFunction | string> | Props | TestFunction | string | null | undefined} Test
|
|
32
31
|
* Check for an arbitrary node.
|
|
33
32
|
*
|
|
34
33
|
* @callback TestFunction
|
|
@@ -67,6 +66,8 @@ export const is =
|
|
|
67
66
|
// Note: overloads in JSDoc can’t yet use different `@template`s.
|
|
68
67
|
/**
|
|
69
68
|
* @type {(
|
|
69
|
+
* (<Condition extends ReadonlyArray<string>>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition[number]}) &
|
|
70
|
+
* (<Condition extends Array<string>>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition[number]}) &
|
|
70
71
|
* (<Condition extends string>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &
|
|
71
72
|
* (<Condition extends Props>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &
|
|
72
73
|
* (<Condition extends TestFunction>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &
|
|
@@ -163,7 +164,11 @@ export const convert =
|
|
|
163
164
|
}
|
|
164
165
|
|
|
165
166
|
if (typeof test === 'object') {
|
|
166
|
-
return Array.isArray(test)
|
|
167
|
+
return Array.isArray(test)
|
|
168
|
+
? anyFactory(test)
|
|
169
|
+
: // Cast because `ReadonlyArray` goes into the above but `isArray`
|
|
170
|
+
// narrows to `Array`.
|
|
171
|
+
propertiesFactory(/** @type {Props} */ (test))
|
|
167
172
|
}
|
|
168
173
|
|
|
169
174
|
if (typeof test === 'string') {
|
|
@@ -210,7 +215,7 @@ function anyFactory(tests) {
|
|
|
210
215
|
* @param {Props} check
|
|
211
216
|
* @returns {Check}
|
|
212
217
|
*/
|
|
213
|
-
function
|
|
218
|
+
function propertiesFactory(check) {
|
|
214
219
|
const checkAsRecord = /** @type {Record<string, unknown>} */ (check)
|
|
215
220
|
|
|
216
221
|
return castFactory(all)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unist-util-is",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"description": "unist utility to check if a node passes a test",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"exports": "./index.js",
|
|
34
34
|
"files": [
|
|
35
35
|
"lib/",
|
|
36
|
+
"index.d.ts.map",
|
|
36
37
|
"index.d.ts",
|
|
37
38
|
"index.js"
|
|
38
39
|
],
|
|
@@ -41,20 +42,20 @@
|
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
44
|
"@types/mdast": "^4.0.0",
|
|
44
|
-
"@types/node": "^
|
|
45
|
-
"c8": "^
|
|
46
|
-
"prettier": "^
|
|
47
|
-
"remark-cli": "^
|
|
48
|
-
"remark-preset-wooorm": "^
|
|
49
|
-
"tsd": "^0.
|
|
45
|
+
"@types/node": "^24.0.0",
|
|
46
|
+
"c8": "^10.0.0",
|
|
47
|
+
"prettier": "^3.0.0",
|
|
48
|
+
"remark-cli": "^12.0.0",
|
|
49
|
+
"remark-preset-wooorm": "^11.0.0",
|
|
50
|
+
"tsd": "^0.33.0",
|
|
50
51
|
"type-coverage": "^2.0.0",
|
|
51
52
|
"typescript": "^5.0.0",
|
|
52
|
-
"xo": "^0.
|
|
53
|
+
"xo": "^0.58.0"
|
|
53
54
|
},
|
|
54
55
|
"scripts": {
|
|
55
56
|
"prepack": "npm run build && npm run format",
|
|
56
57
|
"build": "tsc --build --clean && tsc --build && tsd && type-coverage",
|
|
57
|
-
"format": "remark . -qfo && prettier . -w --
|
|
58
|
+
"format": "remark . -qfo && prettier . -w --log-level warn && xo --fix",
|
|
58
59
|
"test-api": "node --conditions development test/index.js",
|
|
59
60
|
"test-coverage": "c8 --100 --reporter lcov npm run test-api",
|
|
60
61
|
"test": "npm run build && npm run format && npm run test-coverage"
|
|
@@ -91,6 +92,8 @@
|
|
|
91
92
|
"rules": {
|
|
92
93
|
"@typescript-eslint/consistent-type-definitions": "off",
|
|
93
94
|
"@typescript-eslint/no-unnecessary-type-arguments": "off",
|
|
95
|
+
"@typescript-eslint/no-unsafe-argument": "off",
|
|
96
|
+
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
94
97
|
"import/no-extraneous-dependencies": "off"
|
|
95
98
|
}
|
|
96
99
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @
|
|
3
|
-
* @typedef {import('unist').Parent} UnistParent
|
|
2
|
+
* @import {Node as UnistNode, Parent as UnistParent} from 'unist'
|
|
4
3
|
*/
|
|
5
4
|
|
|
6
5
|
/**
|
|
@@ -48,8 +47,10 @@
|
|
|
48
47
|
|
|
49
48
|
/**
|
|
50
49
|
* @typedef {(
|
|
51
|
-
* Check extends
|
|
52
|
-
* ? MatchesOne<Value,
|
|
50
|
+
* Check extends ReadonlyArray<infer T>
|
|
51
|
+
* ? MatchesOne<Value, T>
|
|
52
|
+
* : Check extends Array<infer T>
|
|
53
|
+
* ? MatchesOne<Value, T>
|
|
53
54
|
* : MatchesOne<Value, Check>
|
|
54
55
|
* )} Matches
|
|
55
56
|
* Check whether a node matches a check in the type system.
|
|
@@ -319,9 +320,9 @@ export function visitParents(tree, test, visitor, reverse) {
|
|
|
319
320
|
typeof value.tagName === 'string'
|
|
320
321
|
? value.tagName
|
|
321
322
|
: // `xast`
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
323
|
+
typeof value.name === 'string'
|
|
324
|
+
? value.name
|
|
325
|
+
: undefined
|
|
325
326
|
|
|
326
327
|
Object.defineProperty(visit, 'name', {
|
|
327
328
|
value:
|