@pleaseai/agent 0.1.16 → 0.1.18
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/.output/nitro.json +15 -0
- package/.output/public/_nuxt/1IbcHhBU.js +1 -0
- package/.output/public/_nuxt/BTF_RZdZ.js +1 -0
- package/.output/public/_nuxt/Bh-tMwKs.js +30 -0
- package/.output/public/_nuxt/BsKcI3-e.js +1 -0
- package/.output/public/_nuxt/BzSBlrMF.js +1 -0
- package/.output/public/_nuxt/C3iS5Uhb.js +1 -0
- package/.output/public/_nuxt/D32OC87-.js +1 -0
- package/.output/public/_nuxt/DYb-jmio.js +7 -0
- package/.output/public/_nuxt/DeqoUPGn.js +1 -0
- package/.output/public/_nuxt/DoaBpHko.js +1 -0
- package/.output/public/_nuxt/builds/latest.json +1 -0
- package/.output/public/_nuxt/builds/meta/abed174c-7c58-4767-9723-7e8af63d9c0f.json +1 -0
- package/.output/public/_nuxt/cCUm7iY-.js +1 -0
- package/.output/public/_nuxt/d0DDPc3x.js +1 -0
- package/.output/public/_nuxt/entry.uBXQoLs_.css +1 -0
- package/.output/public/_nuxt/error-404.CpAx3mXP.css +1 -0
- package/.output/public/_nuxt/error-500.VGk_v7xu.css +1 -0
- package/.output/public/_nuxt/nOjN_vKW.js +1 -0
- package/.output/server/chunks/_/error-500.mjs +19 -0
- package/.output/server/chunks/_/error-500.mjs.map +1 -0
- package/.output/server/chunks/_/icons.mjs +5939 -0
- package/.output/server/chunks/_/icons.mjs.map +1 -0
- package/.output/server/chunks/build/Alert-BgLL0z9r.mjs +477 -0
- package/.output/server/chunks/build/Alert-BgLL0z9r.mjs.map +1 -0
- package/.output/server/chunks/build/Badge-BnQthhyg.mjs +782 -0
- package/.output/server/chunks/build/Badge-BnQthhyg.mjs.map +1 -0
- package/.output/server/chunks/build/Card-m9yESRg-.mjs +421 -0
- package/.output/server/chunks/build/Card-m9yESRg-.mjs.map +1 -0
- package/.output/server/chunks/build/Separator-D2l1Gitd.mjs +341 -0
- package/.output/server/chunks/build/Separator-D2l1Gitd.mjs.map +1 -0
- package/.output/server/chunks/build/_id_-B-peNi7y.mjs +358 -0
- package/.output/server/chunks/build/_id_-B-peNi7y.mjs.map +1 -0
- package/.output/server/chunks/build/_identifier_-u8aQI-B5.mjs +594 -0
- package/.output/server/chunks/build/_identifier_-u8aQI-B5.mjs.map +1 -0
- 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/build/dashboard-DRFqbhzu.mjs +13978 -0
- package/.output/server/chunks/build/dashboard-DRFqbhzu.mjs.map +1 -0
- package/.output/server/chunks/build/error-404-Boq1zV4r.mjs +113 -0
- package/.output/server/chunks/build/error-404-Boq1zV4r.mjs.map +1 -0
- package/.output/server/chunks/build/error-404-styles.O8g5ZWuT.mjs +8 -0
- package/.output/server/chunks/build/error-404-styles.O8g5ZWuT.mjs.map +1 -0
- package/.output/server/chunks/build/error-500-BAbnx-7I.mjs +96 -0
- package/.output/server/chunks/build/error-500-BAbnx-7I.mjs.map +1 -0
- package/.output/server/chunks/build/error-500-styles.kmF6Dijn.mjs +8 -0
- package/.output/server/chunks/build/error-500-styles.kmF6Dijn.mjs.map +1 -0
- package/.output/server/chunks/build/format-Cs0yxEHy.mjs +75 -0
- package/.output/server/chunks/build/format-Cs0yxEHy.mjs.map +1 -0
- package/.output/server/chunks/build/index-BAy5ojFe.mjs +5480 -0
- package/.output/server/chunks/build/index-BAy5ojFe.mjs.map +1 -0
- package/.output/server/chunks/build/login-DPXKXUwG.mjs +982 -0
- package/.output/server/chunks/build/login-DPXKXUwG.mjs.map +1 -0
- package/.output/server/chunks/build/server.mjs +53540 -0
- package/.output/server/chunks/build/server.mjs.map +1 -0
- package/.output/server/chunks/build/styles.mjs +10 -0
- package/.output/server/chunks/build/styles.mjs.map +1 -0
- package/.output/server/chunks/routes/api/auth/_...all_.mjs +35 -0
- package/.output/server/chunks/routes/api/auth/_...all_.mjs.map +1 -0
- package/.output/server/chunks/routes/api/v1/_identifier_.get.mjs +112 -0
- package/.output/server/chunks/routes/api/v1/_identifier_.get.mjs.map +1 -0
- package/.output/server/chunks/routes/api/v1/refresh.post.mjs +41 -0
- package/.output/server/chunks/routes/api/v1/refresh.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/v1/sessions/_sessionId/messages.get.mjs +53 -0
- package/.output/server/chunks/routes/api/v1/sessions/_sessionId/messages.get.mjs.map +1 -0
- package/.output/server/chunks/routes/api/v1/state.get.mjs +90 -0
- package/.output/server/chunks/routes/api/v1/state.get.mjs.map +1 -0
- package/.output/server/chunks/routes/api/webhooks/github.post.mjs +190 -0
- package/.output/server/chunks/routes/api/webhooks/github.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/webhooks/slack.post.mjs +71 -0
- package/.output/server/chunks/routes/api/webhooks/slack.post.mjs.map +1 -0
- package/.output/server/chunks/routes/renderer.mjs +483 -0
- package/.output/server/chunks/routes/renderer.mjs.map +1 -0
- package/.output/server/chunks/virtual/_virtual_spa-template.mjs +4 -0
- package/.output/server/chunks/virtual/_virtual_spa-template.mjs.map +1 -0
- package/.output/server/index.mjs +9922 -0
- package/.output/server/index.mjs.map +1 -0
- package/.output/server/node_modules/.nitro/eventemitter3@4.0.7/index.js +336 -0
- package/.output/server/node_modules/.nitro/eventemitter3@4.0.7/package.json +56 -0
- package/.output/server/node_modules/.nitro/eventemitter3@5.0.4/index.js +336 -0
- package/.output/server/node_modules/.nitro/eventemitter3@5.0.4/package.json +62 -0
- package/.output/server/node_modules/@anthropic-ai/claude-agent-sdk/cli.js +14798 -0
- package/.output/server/node_modules/@anthropic-ai/claude-agent-sdk/package.json +58 -0
- package/.output/server/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs +61 -0
- package/.output/server/node_modules/@anthropic-ai/claude-agent-sdk/vendor/ripgrep/COPYING +3 -0
- package/.output/server/node_modules/@anthropic-ai/claude-agent-sdk/vendor/ripgrep/arm64-darwin/rg +0 -0
- package/.output/server/node_modules/@anthropic-ai/claude-agent-sdk/vendor/ripgrep/arm64-linux/rg +0 -0
- package/.output/server/node_modules/@anthropic-ai/claude-agent-sdk/vendor/ripgrep/arm64-win32/rg.exe +0 -0
- package/.output/server/node_modules/@anthropic-ai/claude-agent-sdk/vendor/ripgrep/x64-darwin/rg +0 -0
- package/.output/server/node_modules/@anthropic-ai/claude-agent-sdk/vendor/ripgrep/x64-linux/rg +0 -0
- package/.output/server/node_modules/@anthropic-ai/claude-agent-sdk/vendor/ripgrep/x64-win32/rg.exe +0 -0
- package/.output/server/node_modules/@babel/parser/lib/index.js +14582 -0
- package/.output/server/node_modules/@babel/parser/package.json +50 -0
- package/.output/server/node_modules/@better-auth/core/dist/api/index.mjs +34 -0
- package/.output/server/node_modules/@better-auth/core/dist/async_hooks/index.mjs +22 -0
- package/.output/server/node_modules/@better-auth/core/dist/context/endpoint-context.mjs +32 -0
- package/.output/server/node_modules/@better-auth/core/dist/context/global.mjs +38 -0
- package/.output/server/node_modules/@better-auth/core/dist/context/index.mjs +6 -0
- package/.output/server/node_modules/@better-auth/core/dist/context/request-state.mjs +50 -0
- package/.output/server/node_modules/@better-auth/core/dist/context/transaction.mjs +96 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/adapter/factory.mjs +725 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/adapter/get-default-field-name.mjs +39 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/adapter/get-default-model-name.mjs +33 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/adapter/get-field-attributes.mjs +40 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/adapter/get-field-name.mjs +34 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/adapter/get-id-field.mjs +68 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/adapter/get-model-name.mjs +24 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/adapter/index.mjs +27 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/adapter/utils.mjs +39 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/get-tables.mjs +267 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/index.mjs +9 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/schema/account.mjs +20 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/schema/rate-limit.mjs +12 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/schema/session.mjs +15 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/schema/shared.mjs +12 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/schema/user.mjs +14 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/schema/verification.mjs +13 -0
- package/.output/server/node_modules/@better-auth/core/dist/env/color-depth.mjs +89 -0
- package/.output/server/node_modules/@better-auth/core/dist/env/env-impl.mjs +83 -0
- package/.output/server/node_modules/@better-auth/core/dist/env/index.mjs +5 -0
- package/.output/server/node_modules/@better-auth/core/dist/env/logger.mjs +82 -0
- package/.output/server/node_modules/@better-auth/core/dist/error/codes.mjs +57 -0
- package/.output/server/node_modules/@better-auth/core/dist/error/index.mjs +30 -0
- package/.output/server/node_modules/@better-auth/core/dist/index.mjs +1 -0
- package/.output/server/node_modules/@better-auth/core/dist/oauth2/client-credentials-token.mjs +67 -0
- package/.output/server/node_modules/@better-auth/core/dist/oauth2/create-authorization-url.mjs +44 -0
- package/.output/server/node_modules/@better-auth/core/dist/oauth2/index.mjs +8 -0
- package/.output/server/node_modules/@better-auth/core/dist/oauth2/refresh-access-token.mjs +76 -0
- package/.output/server/node_modules/@better-auth/core/dist/oauth2/utils.mjs +28 -0
- package/.output/server/node_modules/@better-auth/core/dist/oauth2/validate-authorization-code.mjs +83 -0
- package/.output/server/node_modules/@better-auth/core/dist/oauth2/verify.mjs +96 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/apple.mjs +105 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/atlassian.mjs +84 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/cognito.mjs +166 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/discord.mjs +65 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/dropbox.mjs +76 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/facebook.mjs +121 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/figma.mjs +87 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/github.mjs +97 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/gitlab.mjs +83 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/google.mjs +113 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/huggingface.mjs +76 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/index.mjs +79 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/kakao.mjs +73 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/kick.mjs +72 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/line.mjs +114 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/linear.mjs +89 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/linkedin.mjs +77 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/microsoft-entra-id.mjs +140 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/naver.mjs +68 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/notion.mjs +76 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/paybin.mjs +86 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/paypal.mjs +145 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/polar.mjs +74 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/railway.mjs +78 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/reddit.mjs +84 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/roblox.mjs +60 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/salesforce.mjs +92 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/slack.mjs +69 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/spotify.mjs +72 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/tiktok.mjs +63 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/twitch.mjs +79 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/twitter.mjs +88 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/vercel.mjs +62 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/vk.mjs +84 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/zoom.mjs +73 -0
- package/.output/server/node_modules/@better-auth/core/dist/utils/db.mjs +17 -0
- package/.output/server/node_modules/@better-auth/core/dist/utils/deprecate.mjs +18 -0
- package/.output/server/node_modules/@better-auth/core/dist/utils/error-codes.mjs +12 -0
- package/.output/server/node_modules/@better-auth/core/dist/utils/fetch-metadata.mjs +8 -0
- package/.output/server/node_modules/@better-auth/core/dist/utils/id.mjs +10 -0
- package/.output/server/node_modules/@better-auth/core/dist/utils/ip.mjs +119 -0
- package/.output/server/node_modules/@better-auth/core/dist/utils/json.mjs +45 -0
- package/.output/server/node_modules/@better-auth/core/dist/utils/string.mjs +8 -0
- package/.output/server/node_modules/@better-auth/core/dist/utils/url.mjs +33 -0
- package/.output/server/node_modules/@better-auth/core/package.json +169 -0
- package/.output/server/node_modules/@better-auth/kysely-adapter/dist/bun-sqlite-dialect-C8OaCWSL.mjs +156 -0
- package/.output/server/node_modules/@better-auth/kysely-adapter/dist/d1-sqlite-dialect-sYHNqBte.mjs +117 -0
- package/.output/server/node_modules/@better-auth/kysely-adapter/dist/index.mjs +381 -0
- package/.output/server/node_modules/@better-auth/kysely-adapter/dist/node-sqlite-dialect.mjs +156 -0
- package/.output/server/node_modules/@better-auth/kysely-adapter/package.json +62 -0
- package/.output/server/node_modules/@better-auth/memory-adapter/dist/index.mjs +218 -0
- package/.output/server/node_modules/@better-auth/memory-adapter/package.json +54 -0
- package/.output/server/node_modules/@better-auth/telemetry/dist/node.mjs +489 -0
- package/.output/server/node_modules/@better-auth/telemetry/package.json +62 -0
- package/.output/server/node_modules/@better-auth/utils/dist/base32.mjs +101 -0
- package/.output/server/node_modules/@better-auth/utils/dist/base64.mjs +77 -0
- package/.output/server/node_modules/@better-auth/utils/dist/binary.mjs +14 -0
- package/.output/server/node_modules/@better-auth/utils/dist/hash.mjs +29 -0
- package/.output/server/node_modules/@better-auth/utils/dist/hex.mjs +38 -0
- package/.output/server/node_modules/@better-auth/utils/dist/hmac.mjs +56 -0
- package/.output/server/node_modules/@better-auth/utils/dist/index.mjs +8 -0
- package/.output/server/node_modules/@better-auth/utils/dist/otp.mjs +88 -0
- package/.output/server/node_modules/@better-auth/utils/dist/random.mjs +53 -0
- package/.output/server/node_modules/@better-auth/utils/package.json +84 -0
- package/.output/server/node_modules/@better-fetch/fetch/dist/index.js +709 -0
- package/.output/server/node_modules/@better-fetch/fetch/package.json +46 -0
- package/.output/server/node_modules/@chat-adapter/github/dist/index.js +1080 -0
- package/.output/server/node_modules/@chat-adapter/github/package.json +59 -0
- package/.output/server/node_modules/@chat-adapter/shared/dist/index.js +245 -0
- package/.output/server/node_modules/@chat-adapter/shared/package.json +49 -0
- package/.output/server/node_modules/@chat-adapter/slack/dist/index.js +3442 -0
- package/.output/server/node_modules/@chat-adapter/slack/package.json +56 -0
- package/.output/server/node_modules/@iconify/utils/lib/colors/index.js +292 -0
- package/.output/server/node_modules/@iconify/utils/lib/colors/keywords.js +702 -0
- package/.output/server/node_modules/@iconify/utils/lib/css/common.js +76 -0
- package/.output/server/node_modules/@iconify/utils/lib/css/format.js +40 -0
- package/.output/server/node_modules/@iconify/utils/lib/css/icon.js +52 -0
- package/.output/server/node_modules/@iconify/utils/lib/css/icons.js +133 -0
- package/.output/server/node_modules/@iconify/utils/lib/customisations/bool.js +20 -0
- package/.output/server/node_modules/@iconify/utils/lib/customisations/defaults.js +15 -0
- package/.output/server/node_modules/@iconify/utils/lib/customisations/flip.js +18 -0
- package/.output/server/node_modules/@iconify/utils/lib/customisations/merge.js +18 -0
- package/.output/server/node_modules/@iconify/utils/lib/customisations/rotate.js +31 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/cleanup.js +80 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/convert.js +102 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/data.js +29 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/format.js +60 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/parse.js +50 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/base.js +204 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/create.js +35 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/numbers.js +134 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/similar.js +167 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/tree.js +81 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/replace/find.js +94 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/replace/replace.js +28 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/test/components.js +78 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/test/missing.js +68 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/test/name.js +47 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/test/parse.js +105 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/test/similar.js +38 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/test/tree.js +94 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/test/variations.js +64 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon/defaults.js +26 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon/merge.js +18 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon/name.js +58 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon/square.js +34 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon/transformations.js +13 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/convert-info.js +126 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/expand.js +21 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/get-icon.js +27 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/get-icons.js +38 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/minify.js +93 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/parse.js +48 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/tree.js +24 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/validate-basic.js +44 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/validate.js +125 -0
- package/.output/server/node_modules/@iconify/utils/lib/index.js +53 -0
- package/.output/server/node_modules/@iconify/utils/lib/loader/custom.js +32 -0
- package/.output/server/node_modules/@iconify/utils/lib/loader/loader.js +28 -0
- package/.output/server/node_modules/@iconify/utils/lib/loader/modern.js +42 -0
- package/.output/server/node_modules/@iconify/utils/lib/loader/utils.js +63 -0
- package/.output/server/node_modules/@iconify/utils/lib/misc/objects.js +27 -0
- package/.output/server/node_modules/@iconify/utils/lib/misc/strings.js +27 -0
- package/.output/server/node_modules/@iconify/utils/lib/misc/title.js +10 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/build.js +115 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/defs.js +32 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/encode-svg-for-css.js +15 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/html.js +10 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/id.js +42 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/inner-html.js +23 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/parse.js +69 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/pretty.js +55 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/size.js +28 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/trim.js +8 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/url.js +23 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/viewbox.js +9 -0
- package/.output/server/node_modules/@iconify/utils/package.json +118 -0
- package/.output/server/node_modules/@libsql/client/lib-esm/hrana.js +341 -0
- package/.output/server/node_modules/@libsql/client/lib-esm/http.js +232 -0
- package/.output/server/node_modules/@libsql/client/lib-esm/node.js +23 -0
- package/.output/server/node_modules/@libsql/client/lib-esm/sql_cache.js +87 -0
- package/.output/server/node_modules/@libsql/client/lib-esm/sqlite3.js +476 -0
- package/.output/server/node_modules/@libsql/client/lib-esm/ws.js +359 -0
- package/.output/server/node_modules/@libsql/client/package.json +123 -0
- package/.output/server/node_modules/@libsql/core/lib-esm/api.js +29 -0
- package/.output/server/node_modules/@libsql/core/lib-esm/config.js +138 -0
- package/.output/server/node_modules/@libsql/core/lib-esm/uri.js +120 -0
- package/.output/server/node_modules/@libsql/core/lib-esm/util.js +55 -0
- package/.output/server/node_modules/@libsql/core/package.json +91 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/batch.js +271 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/byte_queue.js +45 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/client.js +13 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/cursor.js +2 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/describe.js +8 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/encoding/index.js +4 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/encoding/json/decode.js +59 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/encoding/json/encode.js +72 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/encoding/protobuf/decode.js +150 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/encoding/protobuf/encode.js +95 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/encoding/protobuf/util.js +6 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/errors.js +102 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/http/client.js +126 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/http/cursor.js +138 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/http/json_decode.js +62 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/http/json_encode.js +55 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/http/protobuf_decode.js +44 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/http/protobuf_encode.js +78 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/http/stream.js +368 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/id_alloc.js +47 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/index.js +42 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/libsql_url.js +75 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/queue.js +26 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/queue_microtask.js +13 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/result.js +48 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/shared/json_decode.js +106 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/shared/json_encode.js +71 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/shared/protobuf_decode.js +115 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/shared/protobuf_encode.js +85 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/sql.js +46 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/stmt.js +76 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/stream.js +57 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/util.js +4 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/value.js +83 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/ws/client.js +318 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/ws/cursor.js +80 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/ws/json_decode.js +74 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/ws/json_encode.js +77 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/ws/protobuf_decode.js +60 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/ws/protobuf_encode.js +115 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/ws/stream.js +211 -0
- package/.output/server/node_modules/@libsql/hrana-client/package.json +60 -0
- package/.output/server/node_modules/@libsql/isomorphic-ws/package.json +53 -0
- package/.output/server/node_modules/@libsql/isomorphic-ws/web.mjs +11 -0
- package/.output/server/node_modules/@libsql/linux-x64-gnu/index.node +0 -0
- package/.output/server/node_modules/@libsql/linux-x64-gnu/package.json +36 -0
- package/.output/server/node_modules/@neon-rs/load/dist/index.js +102 -0
- package/.output/server/node_modules/@neon-rs/load/package.json +37 -0
- package/.output/server/node_modules/@noble/ciphers/_arx.js +258 -0
- package/.output/server/node_modules/@noble/ciphers/_poly1305.js +319 -0
- package/.output/server/node_modules/@noble/ciphers/chacha.js +385 -0
- package/.output/server/node_modules/@noble/ciphers/package.json +81 -0
- package/.output/server/node_modules/@noble/ciphers/utils.js +343 -0
- package/.output/server/node_modules/@noble/hashes/_md.js +147 -0
- package/.output/server/node_modules/@noble/hashes/_u64.js +67 -0
- package/.output/server/node_modules/@noble/hashes/hkdf.js +84 -0
- package/.output/server/node_modules/@noble/hashes/hmac.js +90 -0
- package/.output/server/node_modules/@noble/hashes/package.json +93 -0
- package/.output/server/node_modules/@noble/hashes/pbkdf2.js +97 -0
- package/.output/server/node_modules/@noble/hashes/scrypt.js +216 -0
- package/.output/server/node_modules/@noble/hashes/sha2.js +397 -0
- package/.output/server/node_modules/@noble/hashes/sha3.js +254 -0
- package/.output/server/node_modules/@noble/hashes/utils.js +242 -0
- package/.output/server/node_modules/@octokit/auth-app/dist-node/index.js +490 -0
- package/.output/server/node_modules/@octokit/auth-app/package.json +59 -0
- package/.output/server/node_modules/@octokit/auth-oauth-app/dist-bundle/index.js +94 -0
- package/.output/server/node_modules/@octokit/auth-oauth-app/package.json +56 -0
- package/.output/server/node_modules/@octokit/auth-oauth-device/dist-bundle/index.js +138 -0
- package/.output/server/node_modules/@octokit/auth-oauth-device/package.json +53 -0
- package/.output/server/node_modules/@octokit/auth-oauth-user/dist-bundle/index.js +208 -0
- package/.output/server/node_modules/@octokit/auth-oauth-user/package.json +56 -0
- package/.output/server/node_modules/@octokit/auth-token/dist-bundle/index.js +55 -0
- package/.output/server/node_modules/@octokit/auth-token/package.json +50 -0
- package/.output/server/node_modules/@octokit/core/dist-src/index.js +141 -0
- package/.output/server/node_modules/@octokit/core/dist-src/version.js +4 -0
- package/.output/server/node_modules/@octokit/core/package.json +67 -0
- package/.output/server/node_modules/@octokit/endpoint/dist-bundle/index.js +346 -0
- package/.output/server/node_modules/@octokit/endpoint/package.json +50 -0
- package/.output/server/node_modules/@octokit/graphql/dist-bundle/index.js +129 -0
- package/.output/server/node_modules/@octokit/graphql/package.json +55 -0
- package/.output/server/node_modules/@octokit/oauth-authorization-url/dist-src/index.js +42 -0
- package/.output/server/node_modules/@octokit/oauth-authorization-url/package.json +43 -0
- package/.output/server/node_modules/@octokit/oauth-methods/dist-bundle/index.js +317 -0
- package/.output/server/node_modules/@octokit/oauth-methods/package.json +54 -0
- package/.output/server/node_modules/@octokit/plugin-paginate-rest/dist-bundle/index.js +415 -0
- package/.output/server/node_modules/@octokit/plugin-paginate-rest/package.json +59 -0
- package/.output/server/node_modules/@octokit/plugin-request-log/dist-src/index.js +26 -0
- package/.output/server/node_modules/@octokit/plugin-request-log/dist-src/version.js +4 -0
- package/.output/server/node_modules/@octokit/plugin-request-log/package.json +51 -0
- package/.output/server/node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/endpoints-to-methods.js +126 -0
- package/.output/server/node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/generated/endpoints.js +2294 -0
- package/.output/server/node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/index.js +22 -0
- package/.output/server/node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/version.js +5 -0
- package/.output/server/node_modules/@octokit/plugin-rest-endpoint-methods/package.json +58 -0
- package/.output/server/node_modules/@octokit/request/dist-bundle/index.js +203 -0
- package/.output/server/node_modules/@octokit/request/package.json +57 -0
- package/.output/server/node_modules/@octokit/request-error/dist-src/index.js +41 -0
- package/.output/server/node_modules/@octokit/request-error/package.json +50 -0
- package/.output/server/node_modules/@octokit/rest/dist-src/index.js +15 -0
- package/.output/server/node_modules/@octokit/rest/dist-src/version.js +4 -0
- package/.output/server/node_modules/@octokit/rest/package.json +76 -0
- package/.output/server/node_modules/@octokit/webhooks/dist-bundle/index.js +871 -0
- package/.output/server/node_modules/@octokit/webhooks/package.json +54 -0
- package/.output/server/node_modules/@octokit/webhooks-methods/dist-node/index.js +65 -0
- package/.output/server/node_modules/@octokit/webhooks-methods/package.json +53 -0
- package/.output/server/node_modules/@slack/logger/dist/index.js +94 -0
- package/.output/server/node_modules/@slack/logger/package.json +43 -0
- package/.output/server/node_modules/@slack/types/dist/block-kit/block-elements.js +4 -0
- package/.output/server/node_modules/@slack/types/dist/block-kit/blocks.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/block-kit/composition-objects.js +4 -0
- package/.output/server/node_modules/@slack/types/dist/block-kit/extensions.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/calls.js +6 -0
- package/.output/server/node_modules/@slack/types/dist/chunk.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/dialog.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/app.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/assistant.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/call.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/channel.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/dnd.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/email.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/emoji.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/file.js +4 -0
- package/.output/server/node_modules/@slack/types/dist/events/function.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/grid-migration.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/group.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/im.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/index.js +43 -0
- package/.output/server/node_modules/@slack/types/dist/events/invite.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/link-shared.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/member.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/message-metadata.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/message.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/pin.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/reaction.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/shared-channel.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/star.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/steps-from-apps.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/subteam.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/team.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/token.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/user.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/index.js +28 -0
- package/.output/server/node_modules/@slack/types/dist/message-attachments.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/message-metadata.js +27 -0
- package/.output/server/node_modules/@slack/types/dist/views.js +3 -0
- package/.output/server/node_modules/@slack/types/package.json +47 -0
- package/.output/server/node_modules/@slack/web-api/dist/WebClient.js +818 -0
- package/.output/server/node_modules/@slack/web-api/dist/chat-stream.js +170 -0
- package/.output/server/node_modules/@slack/web-api/dist/errors.js +80 -0
- package/.output/server/node_modules/@slack/web-api/dist/file-upload.js +358 -0
- package/.output/server/node_modules/@slack/web-api/dist/helpers.js +14 -0
- package/.output/server/node_modules/@slack/web-api/dist/index.js +39 -0
- package/.output/server/node_modules/@slack/web-api/dist/instrument.js +75 -0
- package/.output/server/node_modules/@slack/web-api/dist/logger.js +29 -0
- package/.output/server/node_modules/@slack/web-api/dist/methods.js +1647 -0
- package/.output/server/node_modules/@slack/web-api/dist/retry-policies.js +34 -0
- package/.output/server/node_modules/@slack/web-api/dist/types/request/index.js +3 -0
- package/.output/server/node_modules/@slack/web-api/dist/types/response/index.js +3 -0
- package/.output/server/node_modules/@slack/web-api/package.json +76 -0
- package/.output/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +6763 -0
- package/.output/server/node_modules/@vue/compiler-core/package.json +58 -0
- package/.output/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +689 -0
- package/.output/server/node_modules/@vue/compiler-dom/package.json +57 -0
- package/.output/server/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +1413 -0
- package/.output/server/node_modules/@vue/compiler-ssr/package.json +34 -0
- package/.output/server/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js +1877 -0
- package/.output/server/node_modules/@vue/reactivity/package.json +55 -0
- package/.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js +6828 -0
- package/.output/server/node_modules/@vue/runtime-core/package.json +52 -0
- package/.output/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +1795 -0
- package/.output/server/node_modules/@vue/runtime-dom/package.json +60 -0
- package/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js +883 -0
- package/.output/server/node_modules/@vue/server-renderer/package.json +55 -0
- package/.output/server/node_modules/@vue/shared/dist/shared.cjs.prod.js +604 -0
- package/.output/server/node_modules/@vue/shared/package.json +47 -0
- package/.output/server/node_modules/@workflow/serde/dist/index.js +30 -0
- package/.output/server/node_modules/@workflow/serde/package.json +35 -0
- package/.output/server/node_modules/asynckit/index.js +6 -0
- package/.output/server/node_modules/asynckit/lib/abort.js +29 -0
- package/.output/server/node_modules/asynckit/lib/async.js +34 -0
- package/.output/server/node_modules/asynckit/lib/defer.js +26 -0
- package/.output/server/node_modules/asynckit/lib/iterate.js +75 -0
- package/.output/server/node_modules/asynckit/lib/state.js +37 -0
- package/.output/server/node_modules/asynckit/lib/terminator.js +29 -0
- package/.output/server/node_modules/asynckit/package.json +63 -0
- package/.output/server/node_modules/asynckit/parallel.js +43 -0
- package/.output/server/node_modules/asynckit/serial.js +17 -0
- package/.output/server/node_modules/asynckit/serialOrdered.js +75 -0
- package/.output/server/node_modules/axios/dist/node/axios.cjs +5643 -0
- package/.output/server/node_modules/axios/package.json +226 -0
- package/.output/server/node_modules/bail/index.js +12 -0
- package/.output/server/node_modules/bail/package.json +73 -0
- package/.output/server/node_modules/before-after-hook/index.js +45 -0
- package/.output/server/node_modules/before-after-hook/lib/add.js +46 -0
- package/.output/server/node_modules/before-after-hook/lib/register.js +27 -0
- package/.output/server/node_modules/before-after-hook/lib/remove.js +19 -0
- package/.output/server/node_modules/before-after-hook/package.json +54 -0
- package/.output/server/node_modules/better-auth/dist/_virtual/_rolldown/runtime.mjs +36 -0
- package/.output/server/node_modules/better-auth/dist/adapters/kysely-adapter/index.mjs +3 -0
- package/.output/server/node_modules/better-auth/dist/api/index.mjs +208 -0
- package/.output/server/node_modules/better-auth/dist/api/middlewares/index.mjs +3 -0
- package/.output/server/node_modules/better-auth/dist/api/middlewares/origin-check.mjs +140 -0
- package/.output/server/node_modules/better-auth/dist/api/rate-limiter/index.mjs +204 -0
- package/.output/server/node_modules/better-auth/dist/api/routes/account.mjs +496 -0
- package/.output/server/node_modules/better-auth/dist/api/routes/callback.mjs +179 -0
- package/.output/server/node_modules/better-auth/dist/api/routes/email-verification.mjs +299 -0
- package/.output/server/node_modules/better-auth/dist/api/routes/error.mjs +386 -0
- package/.output/server/node_modules/better-auth/dist/api/routes/index.mjs +14 -0
- package/.output/server/node_modules/better-auth/dist/api/routes/ok.mjs +30 -0
- package/.output/server/node_modules/better-auth/dist/api/routes/password.mjs +199 -0
- package/.output/server/node_modules/better-auth/dist/api/routes/session.mjs +489 -0
- package/.output/server/node_modules/better-auth/dist/api/routes/sign-in.mjs +271 -0
- package/.output/server/node_modules/better-auth/dist/api/routes/sign-out.mjs +33 -0
- package/.output/server/node_modules/better-auth/dist/api/routes/sign-up.mjs +270 -0
- package/.output/server/node_modules/better-auth/dist/api/routes/update-session.mjs +55 -0
- package/.output/server/node_modules/better-auth/dist/api/routes/update-user.mjs +500 -0
- package/.output/server/node_modules/better-auth/dist/api/state/oauth.mjs +8 -0
- package/.output/server/node_modules/better-auth/dist/api/state/should-session-refresh.mjs +16 -0
- package/.output/server/node_modules/better-auth/dist/api/to-auth-endpoints.mjs +197 -0
- package/.output/server/node_modules/better-auth/dist/auth/base.mjs +69 -0
- package/.output/server/node_modules/better-auth/dist/auth/full.mjs +32 -0
- package/.output/server/node_modules/better-auth/dist/auth/trusted-origins.mjs +31 -0
- package/.output/server/node_modules/better-auth/dist/client/broadcast-channel.mjs +46 -0
- package/.output/server/node_modules/better-auth/dist/client/config.mjs +108 -0
- package/.output/server/node_modules/better-auth/dist/client/fetch-plugins.mjs +18 -0
- package/.output/server/node_modules/better-auth/dist/client/focus-manager.mjs +32 -0
- package/.output/server/node_modules/better-auth/dist/client/index.mjs +22 -0
- package/.output/server/node_modules/better-auth/dist/client/online-manager.mjs +35 -0
- package/.output/server/node_modules/better-auth/dist/client/parser.mjs +73 -0
- package/.output/server/node_modules/better-auth/dist/client/plugins/index.mjs +31 -0
- package/.output/server/node_modules/better-auth/dist/client/plugins/infer-plugin.mjs +11 -0
- package/.output/server/node_modules/better-auth/dist/client/proxy.mjs +80 -0
- package/.output/server/node_modules/better-auth/dist/client/query.mjs +99 -0
- package/.output/server/node_modules/better-auth/dist/client/session-atom.mjs +32 -0
- package/.output/server/node_modules/better-auth/dist/client/session-refresh.mjs +137 -0
- package/.output/server/node_modules/better-auth/dist/client/vanilla.mjs +20 -0
- package/.output/server/node_modules/better-auth/dist/client/vue/index.mjs +38 -0
- package/.output/server/node_modules/better-auth/dist/client/vue/vue-store.mjs +26 -0
- package/.output/server/node_modules/better-auth/dist/context/create-context.mjs +229 -0
- package/.output/server/node_modules/better-auth/dist/context/helpers.mjs +95 -0
- package/.output/server/node_modules/better-auth/dist/context/init.mjs +22 -0
- package/.output/server/node_modules/better-auth/dist/context/secret-utils.mjs +56 -0
- package/.output/server/node_modules/better-auth/dist/cookies/cookie-utils.mjs +109 -0
- package/.output/server/node_modules/better-auth/dist/cookies/index.mjs +264 -0
- package/.output/server/node_modules/better-auth/dist/cookies/session-store.mjs +200 -0
- package/.output/server/node_modules/better-auth/dist/crypto/buffer.mjs +18 -0
- package/.output/server/node_modules/better-auth/dist/crypto/index.mjs +72 -0
- package/.output/server/node_modules/better-auth/dist/crypto/jwt.mjs +144 -0
- package/.output/server/node_modules/better-auth/dist/crypto/password.mjs +36 -0
- package/.output/server/node_modules/better-auth/dist/crypto/random.mjs +8 -0
- package/.output/server/node_modules/better-auth/dist/db/adapter-base.mjs +28 -0
- package/.output/server/node_modules/better-auth/dist/db/adapter-kysely.mjs +21 -0
- package/.output/server/node_modules/better-auth/dist/db/field-converter.mjs +21 -0
- package/.output/server/node_modules/better-auth/dist/db/get-migration.mjs +341 -0
- package/.output/server/node_modules/better-auth/dist/db/get-schema.mjs +39 -0
- package/.output/server/node_modules/better-auth/dist/db/index.mjs +35 -0
- package/.output/server/node_modules/better-auth/dist/db/internal-adapter.mjs +638 -0
- package/.output/server/node_modules/better-auth/dist/db/schema.mjs +127 -0
- package/.output/server/node_modules/better-auth/dist/db/to-zod.mjs +26 -0
- package/.output/server/node_modules/better-auth/dist/db/verification-token-storage.mjs +28 -0
- package/.output/server/node_modules/better-auth/dist/db/with-hooks.mjs +159 -0
- package/.output/server/node_modules/better-auth/dist/index.mjs +27 -0
- package/.output/server/node_modules/better-auth/dist/oauth2/link-account.mjs +143 -0
- package/.output/server/node_modules/better-auth/dist/oauth2/state.mjs +51 -0
- package/.output/server/node_modules/better-auth/dist/oauth2/utils.mjs +32 -0
- package/.output/server/node_modules/better-auth/dist/plugins/access/access.mjs +46 -0
- package/.output/server/node_modules/better-auth/dist/plugins/access/index.mjs +3 -0
- package/.output/server/node_modules/better-auth/dist/plugins/additional-fields/client.mjs +11 -0
- package/.output/server/node_modules/better-auth/dist/plugins/admin/access/index.mjs +3 -0
- package/.output/server/node_modules/better-auth/dist/plugins/admin/access/statement.mjs +54 -0
- package/.output/server/node_modules/better-auth/dist/plugins/admin/admin.mjs +95 -0
- package/.output/server/node_modules/better-auth/dist/plugins/admin/client.mjs +36 -0
- package/.output/server/node_modules/better-auth/dist/plugins/admin/error-codes.mjs +30 -0
- package/.output/server/node_modules/better-auth/dist/plugins/admin/has-permission.mjs +16 -0
- package/.output/server/node_modules/better-auth/dist/plugins/admin/index.mjs +3 -0
- package/.output/server/node_modules/better-auth/dist/plugins/admin/routes.mjs +847 -0
- package/.output/server/node_modules/better-auth/dist/plugins/admin/schema.mjs +34 -0
- package/.output/server/node_modules/better-auth/dist/plugins/anonymous/client.mjs +22 -0
- package/.output/server/node_modules/better-auth/dist/plugins/anonymous/error-codes.mjs +16 -0
- package/.output/server/node_modules/better-auth/dist/plugins/anonymous/index.mjs +160 -0
- package/.output/server/node_modules/better-auth/dist/plugins/anonymous/schema.mjs +11 -0
- package/.output/server/node_modules/better-auth/dist/plugins/bearer/index.mjs +83 -0
- package/.output/server/node_modules/better-auth/dist/plugins/captcha/constants.mjs +22 -0
- package/.output/server/node_modules/better-auth/dist/plugins/captcha/error-codes.mjs +16 -0
- package/.output/server/node_modules/better-auth/dist/plugins/captcha/index.mjs +63 -0
- package/.output/server/node_modules/better-auth/dist/plugins/captcha/utils.mjs +11 -0
- package/.output/server/node_modules/better-auth/dist/plugins/captcha/verify-handlers/captchafox.mjs +28 -0
- package/.output/server/node_modules/better-auth/dist/plugins/captcha/verify-handlers/cloudflare-turnstile.mjs +26 -0
- package/.output/server/node_modules/better-auth/dist/plugins/captcha/verify-handlers/google-recaptcha.mjs +30 -0
- package/.output/server/node_modules/better-auth/dist/plugins/captcha/verify-handlers/h-captcha.mjs +28 -0
- package/.output/server/node_modules/better-auth/dist/plugins/captcha/verify-handlers/index.mjs +6 -0
- package/.output/server/node_modules/better-auth/dist/plugins/custom-session/client.mjs +11 -0
- package/.output/server/node_modules/better-auth/dist/plugins/custom-session/index.mjs +78 -0
- package/.output/server/node_modules/better-auth/dist/plugins/device-authorization/client.mjs +18 -0
- package/.output/server/node_modules/better-auth/dist/plugins/device-authorization/error-codes.mjs +21 -0
- package/.output/server/node_modules/better-auth/dist/plugins/device-authorization/index.mjs +50 -0
- package/.output/server/node_modules/better-auth/dist/plugins/device-authorization/routes.mjs +510 -0
- package/.output/server/node_modules/better-auth/dist/plugins/device-authorization/schema.mjs +57 -0
- package/.output/server/node_modules/better-auth/dist/plugins/email-otp/client.mjs +18 -0
- package/.output/server/node_modules/better-auth/dist/plugins/email-otp/error-codes.mjs +12 -0
- package/.output/server/node_modules/better-auth/dist/plugins/email-otp/index.mjs +146 -0
- package/.output/server/node_modules/better-auth/dist/plugins/email-otp/otp-token.mjs +29 -0
- package/.output/server/node_modules/better-auth/dist/plugins/email-otp/routes.mjs +803 -0
- package/.output/server/node_modules/better-auth/dist/plugins/email-otp/utils.mjs +17 -0
- package/.output/server/node_modules/better-auth/dist/plugins/generic-oauth/client.mjs +14 -0
- package/.output/server/node_modules/better-auth/dist/plugins/generic-oauth/error-codes.mjs +17 -0
- package/.output/server/node_modules/better-auth/dist/plugins/generic-oauth/index.mjs +145 -0
- package/.output/server/node_modules/better-auth/dist/plugins/generic-oauth/providers/auth0.mjs +45 -0
- package/.output/server/node_modules/better-auth/dist/plugins/generic-oauth/providers/gumroad.mjs +60 -0
- package/.output/server/node_modules/better-auth/dist/plugins/generic-oauth/providers/hubspot.mjs +60 -0
- package/.output/server/node_modules/better-auth/dist/plugins/generic-oauth/providers/index.mjs +11 -0
- package/.output/server/node_modules/better-auth/dist/plugins/generic-oauth/providers/keycloak.mjs +45 -0
- package/.output/server/node_modules/better-auth/dist/plugins/generic-oauth/providers/line.mjs +91 -0
- package/.output/server/node_modules/better-auth/dist/plugins/generic-oauth/providers/microsoft-entra-id.mjs +66 -0
- package/.output/server/node_modules/better-auth/dist/plugins/generic-oauth/providers/okta.mjs +45 -0
- package/.output/server/node_modules/better-auth/dist/plugins/generic-oauth/providers/patreon.mjs +59 -0
- package/.output/server/node_modules/better-auth/dist/plugins/generic-oauth/providers/slack.mjs +61 -0
- package/.output/server/node_modules/better-auth/dist/plugins/generic-oauth/routes.mjs +411 -0
- package/.output/server/node_modules/better-auth/dist/plugins/haveibeenpwned/index.mjs +57 -0
- package/.output/server/node_modules/better-auth/dist/plugins/index.mjs +50 -0
- package/.output/server/node_modules/better-auth/dist/plugins/jwt/adapter.mjs +27 -0
- package/.output/server/node_modules/better-auth/dist/plugins/jwt/client.mjs +19 -0
- package/.output/server/node_modules/better-auth/dist/plugins/jwt/index.mjs +202 -0
- package/.output/server/node_modules/better-auth/dist/plugins/jwt/schema.mjs +23 -0
- package/.output/server/node_modules/better-auth/dist/plugins/jwt/sign.mjs +67 -0
- package/.output/server/node_modules/better-auth/dist/plugins/jwt/utils.mjs +64 -0
- package/.output/server/node_modules/better-auth/dist/plugins/jwt/verify.mjs +48 -0
- package/.output/server/node_modules/better-auth/dist/plugins/last-login-method/client.mjs +32 -0
- package/.output/server/node_modules/better-auth/dist/plugins/last-login-method/index.mjs +78 -0
- package/.output/server/node_modules/better-auth/dist/plugins/magic-link/client.mjs +11 -0
- package/.output/server/node_modules/better-auth/dist/plugins/magic-link/index.mjs +177 -0
- package/.output/server/node_modules/better-auth/dist/plugins/magic-link/utils.mjs +12 -0
- package/.output/server/node_modules/better-auth/dist/plugins/mcp/authorize.mjs +133 -0
- package/.output/server/node_modules/better-auth/dist/plugins/mcp/index.mjs +718 -0
- package/.output/server/node_modules/better-auth/dist/plugins/multi-session/client.mjs +20 -0
- package/.output/server/node_modules/better-auth/dist/plugins/multi-session/error-codes.mjs +8 -0
- package/.output/server/node_modules/better-auth/dist/plugins/multi-session/index.mjs +171 -0
- package/.output/server/node_modules/better-auth/dist/plugins/oauth-proxy/index.mjs +306 -0
- package/.output/server/node_modules/better-auth/dist/plugins/oauth-proxy/utils.mjs +51 -0
- package/.output/server/node_modules/better-auth/dist/plugins/oidc-provider/authorize.mjs +203 -0
- package/.output/server/node_modules/better-auth/dist/plugins/oidc-provider/client.mjs +11 -0
- package/.output/server/node_modules/better-auth/dist/plugins/oidc-provider/error.mjs +27 -0
- package/.output/server/node_modules/better-auth/dist/plugins/oidc-provider/index.mjs +1093 -0
- package/.output/server/node_modules/better-auth/dist/plugins/oidc-provider/schema.mjs +132 -0
- package/.output/server/node_modules/better-auth/dist/plugins/oidc-provider/utils/prompt.mjs +19 -0
- package/.output/server/node_modules/better-auth/dist/plugins/oidc-provider/utils.mjs +15 -0
- package/.output/server/node_modules/better-auth/dist/plugins/one-tap/client.mjs +188 -0
- package/.output/server/node_modules/better-auth/dist/plugins/one-tap/index.mjs +95 -0
- package/.output/server/node_modules/better-auth/dist/plugins/one-time-token/client.mjs +11 -0
- package/.output/server/node_modules/better-auth/dist/plugins/one-time-token/index.mjs +82 -0
- package/.output/server/node_modules/better-auth/dist/plugins/one-time-token/utils.mjs +12 -0
- package/.output/server/node_modules/better-auth/dist/plugins/open-api/generator.mjs +315 -0
- package/.output/server/node_modules/better-auth/dist/plugins/open-api/index.mjs +67 -0
- package/.output/server/node_modules/better-auth/dist/plugins/open-api/logo.mjs +15 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/access/index.mjs +3 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/access/statement.mjs +81 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/adapter.mjs +624 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/call.mjs +19 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/client.mjs +107 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/error-codes.mjs +66 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/has-permission.mjs +36 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/index.mjs +5 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/organization.mjs +428 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/permission.mjs +16 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/routes/crud-access-control.mjs +678 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/routes/crud-invites.mjs +551 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/routes/crud-members.mjs +466 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/routes/crud-org.mjs +423 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/routes/crud-team.mjs +676 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/schema.mjs +68 -0
- package/.output/server/node_modules/better-auth/dist/plugins/phone-number/client.mjs +20 -0
- package/.output/server/node_modules/better-auth/dist/plugins/phone-number/error-codes.mjs +21 -0
- package/.output/server/node_modules/better-auth/dist/plugins/phone-number/index.mjs +49 -0
- package/.output/server/node_modules/better-auth/dist/plugins/phone-number/routes.mjs +472 -0
- package/.output/server/node_modules/better-auth/dist/plugins/phone-number/schema.mjs +20 -0
- package/.output/server/node_modules/better-auth/dist/plugins/siwe/client.mjs +11 -0
- package/.output/server/node_modules/better-auth/dist/plugins/siwe/index.mjs +204 -0
- package/.output/server/node_modules/better-auth/dist/plugins/siwe/schema.mjs +32 -0
- package/.output/server/node_modules/better-auth/dist/plugins/test-utils/auth-helpers.mjs +31 -0
- package/.output/server/node_modules/better-auth/dist/plugins/test-utils/cookie-builder.mjs +58 -0
- package/.output/server/node_modules/better-auth/dist/plugins/test-utils/db-helpers.mjs +69 -0
- package/.output/server/node_modules/better-auth/dist/plugins/test-utils/factories.mjs +42 -0
- package/.output/server/node_modules/better-auth/dist/plugins/test-utils/index.mjs +89 -0
- package/.output/server/node_modules/better-auth/dist/plugins/test-utils/otp-sink.mjs +23 -0
- package/.output/server/node_modules/better-auth/dist/plugins/two-factor/backup-codes/index.mjs +277 -0
- package/.output/server/node_modules/better-auth/dist/plugins/two-factor/client.mjs +37 -0
- package/.output/server/node_modules/better-auth/dist/plugins/two-factor/constant.mjs +8 -0
- package/.output/server/node_modules/better-auth/dist/plugins/two-factor/error-code.mjs +18 -0
- package/.output/server/node_modules/better-auth/dist/plugins/two-factor/index.mjs +234 -0
- package/.output/server/node_modules/better-auth/dist/plugins/two-factor/otp/index.mjs +199 -0
- package/.output/server/node_modules/better-auth/dist/plugins/two-factor/schema.mjs +36 -0
- package/.output/server/node_modules/better-auth/dist/plugins/two-factor/totp/index.mjs +157 -0
- package/.output/server/node_modules/better-auth/dist/plugins/two-factor/utils.mjs +12 -0
- package/.output/server/node_modules/better-auth/dist/plugins/two-factor/verify-two-factor.mjs +85 -0
- package/.output/server/node_modules/better-auth/dist/plugins/username/client.mjs +18 -0
- package/.output/server/node_modules/better-auth/dist/plugins/username/error-codes.mjs +17 -0
- package/.output/server/node_modules/better-auth/dist/plugins/username/index.mjs +234 -0
- package/.output/server/node_modules/better-auth/dist/plugins/username/schema.mjs +26 -0
- package/.output/server/node_modules/better-auth/dist/state.mjs +107 -0
- package/.output/server/node_modules/better-auth/dist/utils/boolean.mjs +8 -0
- package/.output/server/node_modules/better-auth/dist/utils/constants.mjs +6 -0
- package/.output/server/node_modules/better-auth/dist/utils/date.mjs +8 -0
- package/.output/server/node_modules/better-auth/dist/utils/get-request-ip.mjs +23 -0
- package/.output/server/node_modules/better-auth/dist/utils/hashing.mjs +21 -0
- package/.output/server/node_modules/better-auth/dist/utils/hide-metadata.mjs +6 -0
- package/.output/server/node_modules/better-auth/dist/utils/index.mjs +6 -0
- package/.output/server/node_modules/better-auth/dist/utils/is-api-error.mjs +11 -0
- package/.output/server/node_modules/better-auth/dist/utils/is-atom.mjs +8 -0
- package/.output/server/node_modules/better-auth/dist/utils/is-promise.mjs +8 -0
- package/.output/server/node_modules/better-auth/dist/utils/middleware-response.mjs +9 -0
- package/.output/server/node_modules/better-auth/dist/utils/password.mjs +26 -0
- package/.output/server/node_modules/better-auth/dist/utils/plugin-helper.mjs +17 -0
- package/.output/server/node_modules/better-auth/dist/utils/shim.mjs +24 -0
- package/.output/server/node_modules/better-auth/dist/utils/time.mjs +100 -0
- package/.output/server/node_modules/better-auth/dist/utils/url.mjs +198 -0
- package/.output/server/node_modules/better-auth/dist/utils/wildcard.mjs +108 -0
- package/.output/server/node_modules/better-auth/package.json +617 -0
- package/.output/server/node_modules/better-call/dist/context.mjs +103 -0
- package/.output/server/node_modules/better-call/dist/cookies.mjs +84 -0
- package/.output/server/node_modules/better-call/dist/crypto.mjs +36 -0
- package/.output/server/node_modules/better-call/dist/endpoint.mjs +70 -0
- package/.output/server/node_modules/better-call/dist/error.mjs +133 -0
- package/.output/server/node_modules/better-call/dist/index.mjs +10 -0
- package/.output/server/node_modules/better-call/dist/middleware.mjs +52 -0
- package/.output/server/node_modules/better-call/dist/openapi.mjs +189 -0
- package/.output/server/node_modules/better-call/dist/router.mjs +117 -0
- package/.output/server/node_modules/better-call/dist/to-response.mjs +96 -0
- package/.output/server/node_modules/better-call/dist/utils.mjs +82 -0
- package/.output/server/node_modules/better-call/dist/validator.mjs +57 -0
- package/.output/server/node_modules/better-call/package.json +96 -0
- package/.output/server/node_modules/call-bind-apply-helpers/actualApply.js +10 -0
- package/.output/server/node_modules/call-bind-apply-helpers/functionApply.js +4 -0
- package/.output/server/node_modules/call-bind-apply-helpers/functionCall.js +4 -0
- package/.output/server/node_modules/call-bind-apply-helpers/index.js +15 -0
- package/.output/server/node_modules/call-bind-apply-helpers/package.json +85 -0
- package/.output/server/node_modules/call-bind-apply-helpers/reflectApply.js +4 -0
- package/.output/server/node_modules/ccount/index.js +27 -0
- package/.output/server/node_modules/ccount/package.json +71 -0
- package/.output/server/node_modules/character-entities/index.js +2132 -0
- package/.output/server/node_modules/character-entities/package.json +78 -0
- package/.output/server/node_modules/chat/dist/chunk-JW7GYSMH.js +1106 -0
- package/.output/server/node_modules/chat/dist/index.js +3466 -0
- package/.output/server/node_modules/chat/package.json +72 -0
- package/.output/server/node_modules/combined-stream/lib/combined_stream.js +208 -0
- package/.output/server/node_modules/combined-stream/package.json +25 -0
- package/.output/server/node_modules/consola/dist/chunks/prompt.mjs +280 -0
- package/.output/server/node_modules/consola/dist/core.mjs +512 -0
- package/.output/server/node_modules/consola/dist/index.mjs +651 -0
- package/.output/server/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs +72 -0
- package/.output/server/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs +288 -0
- package/.output/server/node_modules/consola/package.json +136 -0
- package/.output/server/node_modules/cross-fetch/dist/node-ponyfill.js +22 -0
- package/.output/server/node_modules/cross-fetch/package.json +129 -0
- package/.output/server/node_modules/debug/package.json +64 -0
- package/.output/server/node_modules/debug/src/browser.js +272 -0
- package/.output/server/node_modules/debug/src/common.js +292 -0
- package/.output/server/node_modules/debug/src/index.js +10 -0
- package/.output/server/node_modules/debug/src/node.js +263 -0
- package/.output/server/node_modules/decode-named-character-reference/index.js +19 -0
- package/.output/server/node_modules/decode-named-character-reference/package.json +90 -0
- package/.output/server/node_modules/defu/dist/defu.mjs +69 -0
- package/.output/server/node_modules/defu/package.json +43 -0
- package/.output/server/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
- package/.output/server/node_modules/delayed-stream/package.json +27 -0
- package/.output/server/node_modules/detect-libc/lib/detect-libc.js +279 -0
- package/.output/server/node_modules/detect-libc/lib/filesystem.js +41 -0
- package/.output/server/node_modules/detect-libc/lib/process.js +19 -0
- package/.output/server/node_modules/detect-libc/package.json +40 -0
- package/.output/server/node_modules/devalue/index.js +4 -0
- package/.output/server/node_modules/devalue/package.json +37 -0
- package/.output/server/node_modules/devalue/src/base64.js +110 -0
- package/.output/server/node_modules/devalue/src/constants.js +7 -0
- package/.output/server/node_modules/devalue/src/parse.js +265 -0
- package/.output/server/node_modules/devalue/src/stringify.js +350 -0
- package/.output/server/node_modules/devalue/src/uneval.js +490 -0
- package/.output/server/node_modules/devalue/src/utils.js +148 -0
- package/.output/server/node_modules/devlop/lib/default.js +9 -0
- package/.output/server/node_modules/devlop/package.json +80 -0
- package/.output/server/node_modules/dunder-proto/get.js +30 -0
- package/.output/server/node_modules/dunder-proto/package.json +76 -0
- package/.output/server/node_modules/entities/dist/commonjs/decode-codepoint.js +77 -0
- package/.output/server/node_modules/entities/dist/commonjs/decode.js +568 -0
- package/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-html.js +7 -0
- package/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-xml.js +7 -0
- package/.output/server/node_modules/entities/dist/commonjs/internal/bin-trie-flags.js +21 -0
- package/.output/server/node_modules/entities/dist/commonjs/internal/decode-shared.js +31 -0
- package/.output/server/node_modules/entities/dist/commonjs/package.json +3 -0
- package/.output/server/node_modules/entities/package.json +120 -0
- package/.output/server/node_modules/es-define-property/index.js +14 -0
- package/.output/server/node_modules/es-define-property/package.json +81 -0
- package/.output/server/node_modules/es-errors/eval.js +4 -0
- package/.output/server/node_modules/es-errors/index.js +4 -0
- package/.output/server/node_modules/es-errors/package.json +80 -0
- package/.output/server/node_modules/es-errors/range.js +4 -0
- package/.output/server/node_modules/es-errors/ref.js +4 -0
- package/.output/server/node_modules/es-errors/syntax.js +4 -0
- package/.output/server/node_modules/es-errors/type.js +4 -0
- package/.output/server/node_modules/es-errors/uri.js +4 -0
- package/.output/server/node_modules/es-object-atoms/index.js +4 -0
- package/.output/server/node_modules/es-object-atoms/package.json +80 -0
- package/.output/server/node_modules/es-set-tostringtag/index.js +35 -0
- package/.output/server/node_modules/es-set-tostringtag/package.json +78 -0
- package/.output/server/node_modules/escape-string-regexp/index.js +11 -0
- package/.output/server/node_modules/escape-string-regexp/package.json +40 -0
- package/.output/server/node_modules/estree-walker/dist/umd/estree-walker.js +344 -0
- package/.output/server/node_modules/estree-walker/package.json +37 -0
- package/.output/server/node_modules/extend/index.js +117 -0
- package/.output/server/node_modules/extend/package.json +42 -0
- package/.output/server/node_modules/fast-content-type-parse/index.js +169 -0
- package/.output/server/node_modules/fast-content-type-parse/package.json +74 -0
- package/.output/server/node_modules/follow-redirects/debug.js +15 -0
- package/.output/server/node_modules/follow-redirects/index.js +686 -0
- package/.output/server/node_modules/follow-redirects/package.json +58 -0
- package/.output/server/node_modules/form-data/lib/form_data.js +494 -0
- package/.output/server/node_modules/form-data/lib/populate.js +10 -0
- package/.output/server/node_modules/form-data/package.json +82 -0
- package/.output/server/node_modules/function-bind/implementation.js +84 -0
- package/.output/server/node_modules/function-bind/index.js +5 -0
- package/.output/server/node_modules/function-bind/package.json +87 -0
- package/.output/server/node_modules/get-intrinsic/index.js +378 -0
- package/.output/server/node_modules/get-intrinsic/package.json +97 -0
- package/.output/server/node_modules/get-proto/Object.getPrototypeOf.js +6 -0
- package/.output/server/node_modules/get-proto/Reflect.getPrototypeOf.js +4 -0
- package/.output/server/node_modules/get-proto/index.js +27 -0
- package/.output/server/node_modules/get-proto/package.json +81 -0
- package/.output/server/node_modules/gopd/gOPD.js +4 -0
- package/.output/server/node_modules/gopd/index.js +15 -0
- package/.output/server/node_modules/gopd/package.json +77 -0
- package/.output/server/node_modules/has-symbols/index.js +14 -0
- package/.output/server/node_modules/has-symbols/package.json +111 -0
- package/.output/server/node_modules/has-symbols/shams.js +45 -0
- package/.output/server/node_modules/has-tostringtag/package.json +108 -0
- package/.output/server/node_modules/has-tostringtag/shams.js +8 -0
- package/.output/server/node_modules/hasown/index.js +8 -0
- package/.output/server/node_modules/hasown/package.json +92 -0
- package/.output/server/node_modules/hookable/dist/index.mjs +266 -0
- package/.output/server/node_modules/hookable/package.json +53 -0
- package/.output/server/node_modules/is-electron/index.js +21 -0
- package/.output/server/node_modules/is-electron/package.json +34 -0
- package/.output/server/node_modules/is-plain-obj/index.js +8 -0
- package/.output/server/node_modules/is-plain-obj/package.json +41 -0
- package/.output/server/node_modules/is-stream/index.js +28 -0
- package/.output/server/node_modules/is-stream/package.json +42 -0
- package/.output/server/node_modules/jose/dist/webapi/index.js +32 -0
- package/.output/server/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +27 -0
- package/.output/server/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +27 -0
- package/.output/server/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +159 -0
- package/.output/server/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +167 -0
- package/.output/server/node_modules/jose/dist/webapi/jwe/general/decrypt.js +31 -0
- package/.output/server/node_modules/jose/dist/webapi/jwe/general/encrypt.js +182 -0
- package/.output/server/node_modules/jose/dist/webapi/jwk/embedded.js +17 -0
- package/.output/server/node_modules/jose/dist/webapi/jwk/thumbprint.js +68 -0
- package/.output/server/node_modules/jose/dist/webapi/jwks/local.js +119 -0
- package/.output/server/node_modules/jose/dist/webapi/jwks/remote.js +179 -0
- package/.output/server/node_modules/jose/dist/webapi/jws/compact/sign.js +18 -0
- package/.output/server/node_modules/jose/dist/webapi/jws/compact/verify.js +21 -0
- package/.output/server/node_modules/jose/dist/webapi/jws/flattened/sign.js +89 -0
- package/.output/server/node_modules/jose/dist/webapi/jws/flattened/verify.js +110 -0
- package/.output/server/node_modules/jose/dist/webapi/jws/general/sign.js +70 -0
- package/.output/server/node_modules/jose/dist/webapi/jws/general/verify.js +24 -0
- package/.output/server/node_modules/jose/dist/webapi/jwt/decrypt.js +23 -0
- package/.output/server/node_modules/jose/dist/webapi/jwt/encrypt.js +101 -0
- package/.output/server/node_modules/jose/dist/webapi/jwt/sign.js +52 -0
- package/.output/server/node_modules/jose/dist/webapi/jwt/unsecured.js +63 -0
- package/.output/server/node_modules/jose/dist/webapi/jwt/verify.js +15 -0
- package/.output/server/node_modules/jose/dist/webapi/key/export.js +11 -0
- package/.output/server/node_modules/jose/dist/webapi/key/generate_key_pair.js +97 -0
- package/.output/server/node_modules/jose/dist/webapi/key/generate_secret.js +40 -0
- package/.output/server/node_modules/jose/dist/webapi/key/import.js +57 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/aesgcmkw.js +15 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/aeskw.js +25 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/asn1.js +243 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/base64.js +22 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/buffer_utils.js +43 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/check_key_type.js +122 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/content_encryption.js +217 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/crypto_key.js +136 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/deflate.js +44 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/ecdhes.js +52 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/helpers.js +19 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/invalid_key_input.js +27 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/is_key_like.js +17 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/jwk_to_key.js +107 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +238 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/key_management.js +186 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/key_to_jwk.js +31 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/normalize_key.js +166 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/pbes2kw.js +39 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/rsaes.js +24 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/signing.js +68 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/type_checks.js +40 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/validate_algorithms.js +10 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/validate_crit.js +33 -0
- package/.output/server/node_modules/jose/dist/webapi/util/base64url.js +30 -0
- package/.output/server/node_modules/jose/dist/webapi/util/decode_jwt.js +32 -0
- package/.output/server/node_modules/jose/dist/webapi/util/decode_protected_header.js +34 -0
- package/.output/server/node_modules/jose/dist/webapi/util/errors.js +99 -0
- package/.output/server/node_modules/jose/package.json +200 -0
- package/.output/server/node_modules/js-base64/base64.mjs +301 -0
- package/.output/server/node_modules/js-base64/package.json +43 -0
- package/.output/server/node_modules/js-yaml/dist/js-yaml.mjs +3856 -0
- package/.output/server/node_modules/js-yaml/package.json +66 -0
- package/.output/server/node_modules/json-with-bigint/json-with-bigint.js +154 -0
- package/.output/server/node_modules/json-with-bigint/package.json +31 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/database-introspector.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/dialect-adapter-base.js +21 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/dialect-adapter.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/dialect.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/mssql/mssql-adapter.js +25 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/mssql/mssql-dialect-config.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/mssql/mssql-dialect.js +62 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/mssql/mssql-driver.js +356 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/mssql/mssql-introspector.js +107 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/mssql/mssql-query-compiler.js +80 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/mysql/mysql-adapter.js +25 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/mysql/mysql-dialect-config.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/mysql/mysql-dialect.js +53 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/mysql/mysql-driver.js +177 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/mysql/mysql-introspector.js +76 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/mysql/mysql-query-compiler.js +68 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/postgres/postgres-adapter.js +22 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/postgres/postgres-dialect-config.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/postgres/postgres-dialect.js +53 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/postgres/postgres-driver.js +131 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/postgres/postgres-introspector.js +97 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/postgres/postgres-query-compiler.js +8 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/sqlite/sqlite-adapter.js +20 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/sqlite/sqlite-dialect-config.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/sqlite/sqlite-dialect.js +48 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/sqlite/sqlite-driver.js +110 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/sqlite/sqlite-introspector.js +91 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/sqlite/sqlite-query-compiler.js +34 -0
- package/.output/server/node_modules/kysely/dist/esm/driver/connection-provider.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/driver/database-connection.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/driver/default-connection-provider.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/driver/driver.js +19 -0
- package/.output/server/node_modules/kysely/dist/esm/driver/dummy-driver.js +80 -0
- package/.output/server/node_modules/kysely/dist/esm/driver/runtime-driver.js +162 -0
- package/.output/server/node_modules/kysely/dist/esm/driver/single-connection-provider.js +26 -0
- package/.output/server/node_modules/kysely/dist/esm/dynamic/dynamic-reference-builder.js +32 -0
- package/.output/server/node_modules/kysely/dist/esm/dynamic/dynamic-table-builder.js +41 -0
- package/.output/server/node_modules/kysely/dist/esm/dynamic/dynamic.js +129 -0
- package/.output/server/node_modules/kysely/dist/esm/expression/expression-builder.js +125 -0
- package/.output/server/node_modules/kysely/dist/esm/expression/expression-wrapper.js +128 -0
- package/.output/server/node_modules/kysely/dist/esm/expression/expression.js +12 -0
- package/.output/server/node_modules/kysely/dist/esm/index.js +212 -0
- package/.output/server/node_modules/kysely/dist/esm/kysely.js +917 -0
- package/.output/server/node_modules/kysely/dist/esm/migration/file-migration-provider.js +49 -0
- package/.output/server/node_modules/kysely/dist/esm/migration/migrator.js +608 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/add-column-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/add-constraint-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/add-index-node.js +29 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/aggregate-function-node.js +56 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/alias-node.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/alter-column-node.js +18 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/alter-table-node.js +30 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/and-node.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/binary-operation-node.js +18 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/case-node.js +40 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/cast-node.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/check-constraint-node.js +20 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/collate-node.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/column-definition-node.js +40 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/column-node.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/column-update-node.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/common-table-expression-name-node.js +21 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/common-table-expression-node.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/constraint-node.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/create-index-node.js +29 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/create-schema-node.js +24 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/create-table-node.js +54 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/create-type-node.js +24 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/create-view-node.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/data-type-node.js +83 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/default-insert-value-node.js +15 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/default-value-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/delete-query-node.js +50 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/drop-column-node.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/drop-constraint-node.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/drop-index-node.js +24 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/drop-schema-node.js +24 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/drop-table-node.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/drop-type-node.js +22 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/drop-view-node.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/explain-node.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/fetch-node.js +18 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/foreign-key-constraint-node.js +28 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/from-node.js +22 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/function-node.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/generated-node.js +29 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/group-by-item-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/group-by-node.js +22 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/having-node.js +26 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/identifier-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/insert-query-node.js +29 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/join-node.js +35 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/json-operator-chain-node.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/json-path-leg-node.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/json-path-node.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/json-reference-node.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/limit-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/list-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/matched-node.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/merge-query-node.js +43 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/modify-column-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/offset-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/on-conflict-node.js +66 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/on-duplicate-key-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/on-node.js +26 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/operation-node-source.js +5 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/operation-node-transformer.js +926 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/operation-node-visitor.js +112 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/operation-node.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/operator-node.js +100 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/or-action-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/or-node.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/order-by-item-node.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/order-by-node.js +22 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/output-node.js +24 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/over-node.js +33 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/parens-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/partition-by-item-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/partition-by-node.js +22 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/primary-key-constraint-node.js +30 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/primitive-value-list-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/query-node.js +100 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/raw-node.js +26 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/reference-node.js +25 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/references-node.js +36 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/refresh-materialized-view-node.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/rename-column-node.js +18 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/rename-constraint-node.js +18 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/returning-node.js +24 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/schemable-identifier-node.js +24 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/select-all-node.js +15 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/select-modifier-node.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/select-query-node.js +127 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/selection-node.js +30 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/set-operation-node.js +18 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/simple-reference-expression-node.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/table-node.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/top-node.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/tuple-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/unary-operation-node.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/unique-constraint-node.js +28 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/update-query-node.js +48 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/using-node.js +22 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/value-list-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/value-node.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/values-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/when-node.js +22 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/where-node.js +26 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/with-node.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/package.json +1 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/binary-operation-parser.js +68 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/data-type-parser.js +12 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/default-value-parser.js +8 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/expression-parser.js +26 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/fetch-parser.js +15 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/group-by-parser.js +9 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/identifier-parser.js +20 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/insert-values-parser.js +62 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/join-parser.js +28 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/merge-parser.js +28 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/on-commit-action-parse.js +8 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/on-modify-action-parser.js +8 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/order-by-parser.js +67 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/parse-utils.js +33 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/partition-by-parser.js +6 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/reference-parser.js +95 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/savepoint-parser.js +9 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/select-parser.js +47 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/set-operation-parser.js +14 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/table-parser.js +49 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/top-parser.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/unary-operation-parser.js +13 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/update-set-parser.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/value-parser.js +33 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/with-parser.js +31 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/camel-case/camel-case-plugin.js +119 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/camel-case/camel-case-transformer.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/camel-case/camel-case.js +108 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/deduplicate-joins/deduplicate-joins-plugin.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/deduplicate-joins/deduplicate-joins-transformer.js +39 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/handle-empty-in-lists/handle-empty-in-lists-plugin.js +159 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/handle-empty-in-lists/handle-empty-in-lists-transformer.js +26 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/handle-empty-in-lists/handle-empty-in-lists.js +63 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/immediate-value/immediate-value-plugin.js +19 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/immediate-value/immediate-value-transformer.js +20 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/kysely-plugin.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/noop-plugin.js +9 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/parse-json-results/parse-json-results-plugin.js +104 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/with-schema/with-schema-plugin.js +14 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/with-schema/with-schema-transformer.js +197 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/aggregate-function-builder.js +238 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/case-builder.js +73 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/cte-builder.js +34 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/delete-query-builder.js +501 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/delete-result.js +7 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/function-module.js +60 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/having-interface.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/insert-query-builder.js +1157 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/insert-result.js +50 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/join-builder.js +48 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/json-path-builder.js +195 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/merge-query-builder.js +624 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/merge-result.js +7 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/no-result-error.js +14 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/on-conflict-builder.js +254 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/order-by-interface.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/order-by-item-builder.js +72 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/output-interface.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/over-builder.js +37 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/returning-interface.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/select-query-builder.js +374 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/update-query-builder.js +510 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/update-result.js +18 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/where-interface.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/query-compiler/compiled-query.js +14 -0
- package/.output/server/node_modules/kysely/dist/esm/query-compiler/default-query-compiler.js +1395 -0
- package/.output/server/node_modules/kysely/dist/esm/query-compiler/query-compiler.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/query-creator.js +619 -0
- package/.output/server/node_modules/kysely/dist/esm/query-executor/default-query-executor.js +37 -0
- package/.output/server/node_modules/kysely/dist/esm/query-executor/noop-query-executor.js +34 -0
- package/.output/server/node_modules/kysely/dist/esm/query-executor/query-executor-base.js +59 -0
- package/.output/server/node_modules/kysely/dist/esm/query-executor/query-executor-provider.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/query-executor/query-executor.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/raw-builder/raw-builder.js +84 -0
- package/.output/server/node_modules/kysely/dist/esm/raw-builder/sql.js +82 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/alter-column-builder.js +70 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/alter-table-add-foreign-key-constraint-builder.js +64 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/alter-table-add-index-builder.js +162 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/alter-table-builder.js +263 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/alter-table-drop-constraint-builder.js +56 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/alter-table-executor.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/check-constraint-builder.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/column-definition-builder.js +597 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/create-index-builder.js +199 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/create-schema-builder.js +31 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/create-table-builder.js +408 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/create-type-builder.js +40 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/create-view-builder.js +95 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/drop-index-builder.js +54 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/drop-schema-builder.js +41 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/drop-table-builder.js +41 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/drop-type-builder.js +33 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/drop-view-builder.js +49 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/foreign-key-constraint-builder.js +45 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/primary-key-constraint-builder.js +34 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/refresh-materialized-view-builder.js +72 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/schema.js +325 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/unique-constraint-builder.js +42 -0
- package/.output/server/node_modules/kysely/dist/esm/util/column-type.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/util/compilable.js +5 -0
- package/.output/server/node_modules/kysely/dist/esm/util/deferred.js +25 -0
- package/.output/server/node_modules/kysely/dist/esm/util/explainable.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/util/infer-result.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/util/log-once.js +13 -0
- package/.output/server/node_modules/kysely/dist/esm/util/log.js +56 -0
- package/.output/server/node_modules/kysely/dist/esm/util/object-utils.js +141 -0
- package/.output/server/node_modules/kysely/dist/esm/util/performance-now.js +10 -0
- package/.output/server/node_modules/kysely/dist/esm/util/provide-controlled-connection.js +22 -0
- package/.output/server/node_modules/kysely/dist/esm/util/query-id.js +14 -0
- package/.output/server/node_modules/kysely/dist/esm/util/random-string.js +75 -0
- package/.output/server/node_modules/kysely/dist/esm/util/require-all-props.js +39 -0
- package/.output/server/node_modules/kysely/dist/esm/util/stack-trace-utils.js +14 -0
- package/.output/server/node_modules/kysely/dist/esm/util/streamable.js +2 -0
- package/.output/server/node_modules/kysely/package.json +144 -0
- package/.output/server/node_modules/libsql/auth.js +22 -0
- package/.output/server/node_modules/libsql/index.js +441 -0
- package/.output/server/node_modules/libsql/package.json +92 -0
- package/.output/server/node_modules/libsql/sqlite-error.js +21 -0
- package/.output/server/node_modules/liquidjs/dist/liquid.node.js +4992 -0
- package/.output/server/node_modules/liquidjs/package.json +168 -0
- package/.output/server/node_modules/longest-streak/index.js +36 -0
- package/.output/server/node_modules/longest-streak/package.json +73 -0
- package/.output/server/node_modules/markdown-table/index.js +393 -0
- package/.output/server/node_modules/markdown-table/package.json +77 -0
- package/.output/server/node_modules/math-intrinsics/abs.js +4 -0
- package/.output/server/node_modules/math-intrinsics/floor.js +4 -0
- package/.output/server/node_modules/math-intrinsics/isNaN.js +6 -0
- package/.output/server/node_modules/math-intrinsics/max.js +4 -0
- package/.output/server/node_modules/math-intrinsics/min.js +4 -0
- package/.output/server/node_modules/math-intrinsics/package.json +86 -0
- package/.output/server/node_modules/math-intrinsics/pow.js +4 -0
- package/.output/server/node_modules/math-intrinsics/round.js +4 -0
- package/.output/server/node_modules/math-intrinsics/sign.js +11 -0
- package/.output/server/node_modules/mdast-util-find-and-replace/index.js +11 -0
- package/.output/server/node_modules/mdast-util-find-and-replace/lib/index.js +261 -0
- package/.output/server/node_modules/mdast-util-find-and-replace/package.json +85 -0
- package/.output/server/node_modules/mdast-util-from-markdown/index.js +2 -0
- package/.output/server/node_modules/mdast-util-from-markdown/lib/index.js +1177 -0
- package/.output/server/node_modules/mdast-util-from-markdown/package.json +99 -0
- package/.output/server/node_modules/mdast-util-gfm/index.js +2 -0
- package/.output/server/node_modules/mdast-util-gfm/lib/index.js +63 -0
- package/.output/server/node_modules/mdast-util-gfm/package.json +125 -0
- package/.output/server/node_modules/mdast-util-gfm-autolink-literal/index.js +4 -0
- package/.output/server/node_modules/mdast-util-gfm-autolink-literal/lib/index.js +280 -0
- package/.output/server/node_modules/mdast-util-gfm-autolink-literal/package.json +106 -0
- package/.output/server/node_modules/mdast-util-gfm-footnote/index.js +2 -0
- package/.output/server/node_modules/mdast-util-gfm-footnote/lib/index.js +212 -0
- package/.output/server/node_modules/mdast-util-gfm-footnote/package.json +111 -0
- package/.output/server/node_modules/mdast-util-gfm-strikethrough/index.js +5 -0
- package/.output/server/node_modules/mdast-util-gfm-strikethrough/lib/index.js +106 -0
- package/.output/server/node_modules/mdast-util-gfm-strikethrough/package.json +99 -0
- package/.output/server/node_modules/mdast-util-gfm-table/index.js +2 -0
- package/.output/server/node_modules/mdast-util-gfm-table/lib/index.js +300 -0
- package/.output/server/node_modules/mdast-util-gfm-table/package.json +101 -0
- package/.output/server/node_modules/mdast-util-gfm-task-list-item/index.js +4 -0
- package/.output/server/node_modules/mdast-util-gfm-task-list-item/lib/index.js +141 -0
- package/.output/server/node_modules/mdast-util-gfm-task-list-item/package.json +90 -0
- package/.output/server/node_modules/mdast-util-phrasing/index.js +1 -0
- package/.output/server/node_modules/mdast-util-phrasing/lib/index.js +45 -0
- package/.output/server/node_modules/mdast-util-phrasing/package.json +78 -0
- package/.output/server/node_modules/mdast-util-to-markdown/index.js +3 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/configure.js +79 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/blockquote.js +29 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/break.js +30 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/code.js +75 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/definition.js +76 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/emphasis.js +69 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/heading.js +75 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/html.js +20 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/image-reference.js +63 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/image.js +82 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/index.js +45 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/inline-code.js +76 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/link-reference.js +63 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/link.js +114 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/list-item.js +62 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/list.js +100 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/paragraph.js +20 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/root.js +23 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/strong.js +69 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/text.js +15 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js +21 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/index.js +187 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/join.js +39 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/unsafe.js +146 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/association.js +33 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.js +21 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.js +38 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/check-bullet.js +21 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.js +21 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/check-fence.js +21 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js +21 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/check-quote.js +21 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js +21 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/check-rule.js +21 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/check-strong.js +21 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/compile-pattern.js +24 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/container-flow.js +84 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js +125 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.js +11 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/encode-info.js +82 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js +22 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js +34 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js +34 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/indent-lines.js +35 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js +41 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/safe.js +174 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/track.js +55 -0
- package/.output/server/node_modules/mdast-util-to-markdown/package.json +132 -0
- package/.output/server/node_modules/mdast-util-to-string/index.js +5 -0
- package/.output/server/node_modules/mdast-util-to-string/lib/index.js +108 -0
- package/.output/server/node_modules/mdast-util-to-string/package.json +78 -0
- package/.output/server/node_modules/micromark/index.js +60 -0
- package/.output/server/node_modules/micromark/lib/compile.js +1060 -0
- package/.output/server/node_modules/micromark/lib/constructs.js +85 -0
- package/.output/server/node_modules/micromark/lib/create-tokenizer.js +611 -0
- package/.output/server/node_modules/micromark/lib/initialize/content.js +79 -0
- package/.output/server/node_modules/micromark/lib/initialize/document.js +362 -0
- package/.output/server/node_modules/micromark/lib/initialize/flow.js +58 -0
- package/.output/server/node_modules/micromark/lib/initialize/text.js +212 -0
- package/.output/server/node_modules/micromark/lib/parse.js +56 -0
- package/.output/server/node_modules/micromark/lib/postprocess.js +18 -0
- package/.output/server/node_modules/micromark/lib/preprocess.js +115 -0
- package/.output/server/node_modules/micromark/package.json +100 -0
- package/.output/server/node_modules/micromark-core-commonmark/index.js +22 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/attention.js +241 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/autolink.js +233 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/blank-line.js +61 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/block-quote.js +143 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/character-escape.js +64 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/character-reference.js +149 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/code-fenced.js +460 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/code-indented.js +177 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/code-text.js +225 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/content.js +163 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/definition.js +254 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/hard-break-escape.js +60 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/heading-atx.js +195 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/html-flow.js +876 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/html-text.js +678 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/label-end.js +560 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/label-start-image.js +102 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/label-start-link.js +55 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/line-ending.js +33 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/list.js +213 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/setext-underline.js +185 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/thematic-break.js +102 -0
- package/.output/server/node_modules/micromark-core-commonmark/package.json +74 -0
- package/.output/server/node_modules/micromark-extension-gfm/index.js +69 -0
- package/.output/server/node_modules/micromark-extension-gfm/package.json +107 -0
- package/.output/server/node_modules/micromark-extension-gfm-autolink-literal/index.js +2 -0
- package/.output/server/node_modules/micromark-extension-gfm-autolink-literal/lib/html.js +60 -0
- package/.output/server/node_modules/micromark-extension-gfm-autolink-literal/lib/syntax.js +854 -0
- package/.output/server/node_modules/micromark-extension-gfm-autolink-literal/package.json +116 -0
- package/.output/server/node_modules/micromark-extension-gfm-footnote/index.js +3 -0
- package/.output/server/node_modules/micromark-extension-gfm-footnote/lib/html.js +154 -0
- package/.output/server/node_modules/micromark-extension-gfm-footnote/lib/syntax.js +485 -0
- package/.output/server/node_modules/micromark-extension-gfm-footnote/package.json +132 -0
- package/.output/server/node_modules/micromark-extension-gfm-strikethrough/index.js +3 -0
- package/.output/server/node_modules/micromark-extension-gfm-strikethrough/lib/html.js +26 -0
- package/.output/server/node_modules/micromark-extension-gfm-strikethrough/lib/syntax.js +142 -0
- package/.output/server/node_modules/micromark-extension-gfm-strikethrough/package.json +129 -0
- package/.output/server/node_modules/micromark-extension-gfm-table/index.js +2 -0
- package/.output/server/node_modules/micromark-extension-gfm-table/lib/edit-map.js +202 -0
- package/.output/server/node_modules/micromark-extension-gfm-table/lib/html.js +130 -0
- package/.output/server/node_modules/micromark-extension-gfm-table/lib/infer.js +52 -0
- package/.output/server/node_modules/micromark-extension-gfm-table/lib/syntax.js +819 -0
- package/.output/server/node_modules/micromark-extension-gfm-table/package.json +128 -0
- package/.output/server/node_modules/micromark-extension-gfm-tagfilter/index.js +1 -0
- package/.output/server/node_modules/micromark-extension-gfm-tagfilter/lib/index.js +51 -0
- package/.output/server/node_modules/micromark-extension-gfm-tagfilter/package.json +82 -0
- package/.output/server/node_modules/micromark-extension-gfm-task-list-item/index.js +2 -0
- package/.output/server/node_modules/micromark-extension-gfm-task-list-item/lib/html.js +29 -0
- package/.output/server/node_modules/micromark-extension-gfm-task-list-item/lib/syntax.js +158 -0
- package/.output/server/node_modules/micromark-extension-gfm-task-list-item/package.json +131 -0
- package/.output/server/node_modules/micromark-factory-destination/index.js +206 -0
- package/.output/server/node_modules/micromark-factory-destination/package.json +57 -0
- package/.output/server/node_modules/micromark-factory-label/index.js +148 -0
- package/.output/server/node_modules/micromark-factory-label/package.json +60 -0
- package/.output/server/node_modules/micromark-factory-space/index.js +64 -0
- package/.output/server/node_modules/micromark-factory-space/package.json +55 -0
- package/.output/server/node_modules/micromark-factory-title/index.js +158 -0
- package/.output/server/node_modules/micromark-factory-title/package.json +58 -0
- package/.output/server/node_modules/micromark-factory-whitespace/index.js +44 -0
- package/.output/server/node_modules/micromark-factory-whitespace/package.json +57 -0
- package/.output/server/node_modules/micromark-util-character/index.js +246 -0
- package/.output/server/node_modules/micromark-util-character/package.json +57 -0
- package/.output/server/node_modules/micromark-util-chunked/index.js +81 -0
- package/.output/server/node_modules/micromark-util-chunked/package.json +57 -0
- package/.output/server/node_modules/micromark-util-classify-character/index.js +27 -0
- package/.output/server/node_modules/micromark-util-classify-character/package.json +59 -0
- package/.output/server/node_modules/micromark-util-combine-extensions/index.js +143 -0
- package/.output/server/node_modules/micromark-util-combine-extensions/package.json +52 -0
- package/.output/server/node_modules/micromark-util-decode-numeric-character-reference/index.js +32 -0
- package/.output/server/node_modules/micromark-util-decode-numeric-character-reference/package.json +59 -0
- package/.output/server/node_modules/micromark-util-decode-string/index.js +45 -0
- package/.output/server/node_modules/micromark-util-decode-string/package.json +63 -0
- package/.output/server/node_modules/micromark-util-encode/index.js +33 -0
- package/.output/server/node_modules/micromark-util-encode/package.json +47 -0
- package/.output/server/node_modules/micromark-util-html-tag-name/index.js +93 -0
- package/.output/server/node_modules/micromark-util-html-tag-name/package.json +47 -0
- package/.output/server/node_modules/micromark-util-normalize-identifier/index.js +33 -0
- package/.output/server/node_modules/micromark-util-normalize-identifier/package.json +58 -0
- package/.output/server/node_modules/micromark-util-resolve-all/index.js +32 -0
- package/.output/server/node_modules/micromark-util-resolve-all/package.json +48 -0
- package/.output/server/node_modules/micromark-util-sanitize-uri/index.js +107 -0
- package/.output/server/node_modules/micromark-util-sanitize-uri/package.json +59 -0
- package/.output/server/node_modules/micromark-util-subtokenize/index.js +228 -0
- package/.output/server/node_modules/micromark-util-subtokenize/lib/splice-buffer.js +251 -0
- package/.output/server/node_modules/micromark-util-subtokenize/package.json +60 -0
- package/.output/server/node_modules/mime-db/db.json +8519 -0
- package/.output/server/node_modules/mime-db/index.js +12 -0
- package/.output/server/node_modules/mime-db/package.json +60 -0
- package/.output/server/node_modules/mime-types/index.js +188 -0
- package/.output/server/node_modules/mime-types/package.json +44 -0
- package/.output/server/node_modules/ms/index.js +162 -0
- package/.output/server/node_modules/ms/package.json +38 -0
- package/.output/server/node_modules/nanostores/atom/index.js +94 -0
- package/.output/server/node_modules/nanostores/clean-stores/index.js +18 -0
- package/.output/server/node_modules/nanostores/computed/index.js +65 -0
- package/.output/server/node_modules/nanostores/deep-map/index.js +30 -0
- package/.output/server/node_modules/nanostores/deep-map/path.js +64 -0
- package/.output/server/node_modules/nanostores/effect/index.js +21 -0
- package/.output/server/node_modules/nanostores/index.js +24 -0
- package/.output/server/node_modules/nanostores/keep-mount/index.js +3 -0
- package/.output/server/node_modules/nanostores/lifecycle/index.js +160 -0
- package/.output/server/node_modules/nanostores/listen-keys/index.js +14 -0
- package/.output/server/node_modules/nanostores/map/index.js +23 -0
- package/.output/server/node_modules/nanostores/map-creator/index.js +38 -0
- package/.output/server/node_modules/nanostores/package.json +34 -0
- package/.output/server/node_modules/nanostores/task/index.js +35 -0
- package/.output/server/node_modules/nanostores/warn/index.js +12 -0
- package/.output/server/node_modules/node-fetch/lib/index.js +1787 -0
- package/.output/server/node_modules/node-fetch/package.json +89 -0
- package/.output/server/node_modules/p-finally/index.js +15 -0
- package/.output/server/node_modules/p-finally/package.json +42 -0
- package/.output/server/node_modules/p-queue/dist/index.js +279 -0
- package/.output/server/node_modules/p-queue/dist/lower-bound.js +21 -0
- package/.output/server/node_modules/p-queue/dist/priority-queue.js +32 -0
- package/.output/server/node_modules/p-queue/package.json +92 -0
- package/.output/server/node_modules/p-retry/index.js +85 -0
- package/.output/server/node_modules/p-retry/package.json +51 -0
- package/.output/server/node_modules/p-timeout/index.js +57 -0
- package/.output/server/node_modules/p-timeout/package.json +45 -0
- package/.output/server/node_modules/perfect-debounce/dist/index.mjs +89 -0
- package/.output/server/node_modules/perfect-debounce/package.json +41 -0
- package/.output/server/node_modules/promise-limit/index.js +88 -0
- package/.output/server/node_modules/promise-limit/package.json +39 -0
- package/.output/server/node_modules/proxy-from-env/index.js +108 -0
- package/.output/server/node_modules/proxy-from-env/package.json +34 -0
- package/.output/server/node_modules/remark-gfm/index.js +2 -0
- package/.output/server/node_modules/remark-gfm/lib/index.js +41 -0
- package/.output/server/node_modules/remark-gfm/package.json +125 -0
- package/.output/server/node_modules/remark-parse/index.js +2 -0
- package/.output/server/node_modules/remark-parse/lib/index.js +43 -0
- package/.output/server/node_modules/remark-parse/package.json +72 -0
- package/.output/server/node_modules/remark-stringify/index.js +2 -0
- package/.output/server/node_modules/remark-stringify/lib/index.js +42 -0
- package/.output/server/node_modules/remark-stringify/package.json +71 -0
- package/.output/server/node_modules/remend/dist/index.js +22 -0
- package/.output/server/node_modules/remend/package.json +41 -0
- package/.output/server/node_modules/retry/index.js +1 -0
- package/.output/server/node_modules/retry/lib/retry.js +100 -0
- package/.output/server/node_modules/retry/lib/retry_operation.js +162 -0
- package/.output/server/node_modules/retry/package.json +36 -0
- package/.output/server/node_modules/rou3/dist/index.mjs +265 -0
- package/.output/server/node_modules/rou3/package.json +47 -0
- package/.output/server/node_modules/source-map-js/lib/array-set.js +121 -0
- package/.output/server/node_modules/source-map-js/lib/base64-vlq.js +140 -0
- package/.output/server/node_modules/source-map-js/lib/base64.js +67 -0
- package/.output/server/node_modules/source-map-js/lib/binary-search.js +111 -0
- package/.output/server/node_modules/source-map-js/lib/mapping-list.js +79 -0
- package/.output/server/node_modules/source-map-js/lib/quick-sort.js +132 -0
- package/.output/server/node_modules/source-map-js/lib/source-map-consumer.js +1188 -0
- package/.output/server/node_modules/source-map-js/lib/source-map-generator.js +444 -0
- package/.output/server/node_modules/source-map-js/lib/source-node.js +413 -0
- package/.output/server/node_modules/source-map-js/lib/util.js +594 -0
- package/.output/server/node_modules/source-map-js/package.json +71 -0
- package/.output/server/node_modules/source-map-js/source-map.js +8 -0
- package/.output/server/node_modules/supports-color/index.js +202 -0
- package/.output/server/node_modules/supports-color/package.json +64 -0
- package/.output/server/node_modules/tailwindcss/dist/chunk-X4GG3EDV.mjs +1 -0
- package/.output/server/node_modules/tailwindcss/dist/colors.mjs +1 -0
- package/.output/server/node_modules/tailwindcss/package.json +89 -0
- package/.output/server/node_modules/toad-cache/dist/toad-cache.mjs +852 -0
- package/.output/server/node_modules/toad-cache/package.json +82 -0
- package/.output/server/node_modules/tr46/index.js +193 -0
- package/.output/server/node_modules/tr46/lib/mappingTable.json +1 -0
- package/.output/server/node_modules/tr46/package.json +31 -0
- package/.output/server/node_modules/trough/index.js +9 -0
- package/.output/server/node_modules/trough/lib/index.js +206 -0
- package/.output/server/node_modules/trough/package.json +77 -0
- package/.output/server/node_modules/ufo/dist/index.mjs +645 -0
- package/.output/server/node_modules/ufo/package.json +48 -0
- package/.output/server/node_modules/unhead/dist/index.mjs +9 -0
- package/.output/server/node_modules/unhead/dist/parser.mjs +508 -0
- package/.output/server/node_modules/unhead/dist/plugins.mjs +101 -0
- package/.output/server/node_modules/unhead/dist/scripts.mjs +30 -0
- package/.output/server/node_modules/unhead/dist/server.mjs +180 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.0eF0fa-Y.mjs +236 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.B5FWS6X0.mjs +207 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.BYvz9V1x.mjs +43 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.BnoAbrHA.mjs +269 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.CbpEuj3y.mjs +71 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.Chhckluj.mjs +166 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.Ct24BOby.mjs +182 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.DQc16pHI.mjs +196 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead._ybhDo-G.mjs +44 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.yem5I2v_.mjs +38 -0
- package/.output/server/node_modules/unhead/dist/utils.mjs +5 -0
- package/.output/server/node_modules/unhead/package.json +105 -0
- package/.output/server/node_modules/unified/index.js +2 -0
- package/.output/server/node_modules/unified/lib/callable-instance.js +44 -0
- package/.output/server/node_modules/unified/lib/index.js +1323 -0
- package/.output/server/node_modules/unified/package.json +120 -0
- package/.output/server/node_modules/unist-util-is/index.js +7 -0
- package/.output/server/node_modules/unist-util-is/lib/index.js +296 -0
- package/.output/server/node_modules/unist-util-is/package.json +103 -0
- package/.output/server/node_modules/unist-util-stringify-position/index.js +1 -0
- package/.output/server/node_modules/unist-util-stringify-position/lib/index.js +84 -0
- package/.output/server/node_modules/unist-util-stringify-position/package.json +80 -0
- package/.output/server/node_modules/unist-util-visit/index.js +2 -0
- package/.output/server/node_modules/unist-util-visit/lib/index.js +312 -0
- package/.output/server/node_modules/unist-util-visit/package.json +108 -0
- package/.output/server/node_modules/unist-util-visit-parents/index.js +2 -0
- package/.output/server/node_modules/unist-util-visit-parents/lib/color.node.js +7 -0
- package/.output/server/node_modules/unist-util-visit-parents/lib/index.js +399 -0
- package/.output/server/node_modules/unist-util-visit-parents/package.json +106 -0
- package/.output/server/node_modules/universal-github-app-jwt/index.js +42 -0
- package/.output/server/node_modules/universal-github-app-jwt/lib/crypto-node.js +15 -0
- package/.output/server/node_modules/universal-github-app-jwt/lib/get-token.js +66 -0
- package/.output/server/node_modules/universal-github-app-jwt/lib/utils.js +85 -0
- package/.output/server/node_modules/universal-github-app-jwt/package.json +62 -0
- package/.output/server/node_modules/universal-user-agent/index.js +13 -0
- package/.output/server/node_modules/universal-user-agent/package.json +28 -0
- package/.output/server/node_modules/vfile/index.js +2 -0
- package/.output/server/node_modules/vfile/lib/index.js +643 -0
- package/.output/server/node_modules/vfile/lib/minpath.js +1 -0
- package/.output/server/node_modules/vfile/lib/minproc.js +1 -0
- package/.output/server/node_modules/vfile/lib/minurl.js +2 -0
- package/.output/server/node_modules/vfile/lib/minurl.shared.js +31 -0
- package/.output/server/node_modules/vfile/package.json +134 -0
- package/.output/server/node_modules/vfile-message/index.js +5 -0
- package/.output/server/node_modules/vfile-message/lib/index.js +314 -0
- package/.output/server/node_modules/vfile-message/package.json +80 -0
- package/.output/server/node_modules/vue/dist/vue.cjs.js +80 -0
- package/.output/server/node_modules/vue/dist/vue.cjs.prod.js +66 -0
- package/.output/server/node_modules/vue/index.js +7 -0
- package/.output/server/node_modules/vue/index.mjs +1 -0
- package/.output/server/node_modules/vue/package.json +112 -0
- package/.output/server/node_modules/vue/server-renderer/index.mjs +1 -0
- package/.output/server/node_modules/vue-bundle-renderer/dist/runtime.mjs +301 -0
- package/.output/server/node_modules/vue-bundle-renderer/package.json +55 -0
- package/.output/server/node_modules/webidl-conversions/lib/index.js +189 -0
- package/.output/server/node_modules/webidl-conversions/package.json +23 -0
- package/.output/server/node_modules/whatwg-url/lib/URL-impl.js +200 -0
- package/.output/server/node_modules/whatwg-url/lib/URL.js +196 -0
- package/.output/server/node_modules/whatwg-url/lib/public-api.js +11 -0
- package/.output/server/node_modules/whatwg-url/lib/url-state-machine.js +1297 -0
- package/.output/server/node_modules/whatwg-url/lib/utils.js +20 -0
- package/.output/server/node_modules/whatwg-url/package.json +32 -0
- package/.output/server/node_modules/zod/index.js +4 -0
- package/.output/server/node_modules/zod/package.json +135 -0
- package/.output/server/node_modules/zod/v4/classic/checks.js +1 -0
- package/.output/server/node_modules/zod/v4/classic/coerce.js +17 -0
- package/.output/server/node_modules/zod/v4/classic/compat.js +31 -0
- package/.output/server/node_modules/zod/v4/classic/errors.js +48 -0
- package/.output/server/node_modules/zod/v4/classic/external.js +20 -0
- package/.output/server/node_modules/zod/v4/classic/from-json-schema.js +584 -0
- package/.output/server/node_modules/zod/v4/classic/iso.js +30 -0
- package/.output/server/node_modules/zod/v4/classic/package.json +6 -0
- package/.output/server/node_modules/zod/v4/classic/parse.js +15 -0
- package/.output/server/node_modules/zod/v4/classic/schemas.js +1157 -0
- package/.output/server/node_modules/zod/v4/core/api.js +1082 -0
- package/.output/server/node_modules/zod/v4/core/checks.js +575 -0
- package/.output/server/node_modules/zod/v4/core/core.js +76 -0
- package/.output/server/node_modules/zod/v4/core/doc.js +35 -0
- package/.output/server/node_modules/zod/v4/core/errors.js +182 -0
- package/.output/server/node_modules/zod/v4/core/index.js +16 -0
- package/.output/server/node_modules/zod/v4/core/json-schema-generator.js +95 -0
- package/.output/server/node_modules/zod/v4/core/json-schema-processors.js +605 -0
- package/.output/server/node_modules/zod/v4/core/json-schema.js +1 -0
- package/.output/server/node_modules/zod/v4/core/package.json +6 -0
- package/.output/server/node_modules/zod/v4/core/parse.js +93 -0
- package/.output/server/node_modules/zod/v4/core/regexes.js +133 -0
- package/.output/server/node_modules/zod/v4/core/registries.js +51 -0
- package/.output/server/node_modules/zod/v4/core/schemas.js +2093 -0
- package/.output/server/node_modules/zod/v4/core/to-json-schema.js +437 -0
- package/.output/server/node_modules/zod/v4/core/util.js +651 -0
- package/.output/server/node_modules/zod/v4/core/versions.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/ar.js +106 -0
- package/.output/server/node_modules/zod/v4/locales/az.js +105 -0
- package/.output/server/node_modules/zod/v4/locales/be.js +156 -0
- package/.output/server/node_modules/zod/v4/locales/bg.js +120 -0
- package/.output/server/node_modules/zod/v4/locales/ca.js +107 -0
- package/.output/server/node_modules/zod/v4/locales/cs.js +111 -0
- package/.output/server/node_modules/zod/v4/locales/da.js +115 -0
- package/.output/server/node_modules/zod/v4/locales/de.js +108 -0
- package/.output/server/node_modules/zod/v4/locales/en.js +109 -0
- package/.output/server/node_modules/zod/v4/locales/eo.js +109 -0
- package/.output/server/node_modules/zod/v4/locales/es.js +132 -0
- package/.output/server/node_modules/zod/v4/locales/fa.js +114 -0
- package/.output/server/node_modules/zod/v4/locales/fi.js +112 -0
- package/.output/server/node_modules/zod/v4/locales/fr-CA.js +107 -0
- package/.output/server/node_modules/zod/v4/locales/fr.js +108 -0
- package/.output/server/node_modules/zod/v4/locales/he.js +214 -0
- package/.output/server/node_modules/zod/v4/locales/hu.js +108 -0
- package/.output/server/node_modules/zod/v4/locales/hy.js +147 -0
- package/.output/server/node_modules/zod/v4/locales/id.js +106 -0
- package/.output/server/node_modules/zod/v4/locales/index.js +49 -0
- package/.output/server/node_modules/zod/v4/locales/is.js +109 -0
- package/.output/server/node_modules/zod/v4/locales/it.js +108 -0
- package/.output/server/node_modules/zod/v4/locales/ja.js +107 -0
- package/.output/server/node_modules/zod/v4/locales/ka.js +112 -0
- package/.output/server/node_modules/zod/v4/locales/kh.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/km.js +110 -0
- package/.output/server/node_modules/zod/v4/locales/ko.js +111 -0
- package/.output/server/node_modules/zod/v4/locales/lt.js +203 -0
- package/.output/server/node_modules/zod/v4/locales/mk.js +109 -0
- package/.output/server/node_modules/zod/v4/locales/ms.js +107 -0
- package/.output/server/node_modules/zod/v4/locales/nl.js +110 -0
- package/.output/server/node_modules/zod/v4/locales/no.js +108 -0
- package/.output/server/node_modules/zod/v4/locales/ota.js +109 -0
- package/.output/server/node_modules/zod/v4/locales/package.json +6 -0
- package/.output/server/node_modules/zod/v4/locales/pl.js +109 -0
- package/.output/server/node_modules/zod/v4/locales/ps.js +114 -0
- package/.output/server/node_modules/zod/v4/locales/pt.js +108 -0
- package/.output/server/node_modules/zod/v4/locales/ru.js +156 -0
- package/.output/server/node_modules/zod/v4/locales/sl.js +109 -0
- package/.output/server/node_modules/zod/v4/locales/sv.js +110 -0
- package/.output/server/node_modules/zod/v4/locales/ta.js +110 -0
- package/.output/server/node_modules/zod/v4/locales/th.js +110 -0
- package/.output/server/node_modules/zod/v4/locales/tr.js +105 -0
- package/.output/server/node_modules/zod/v4/locales/ua.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/uk.js +108 -0
- package/.output/server/node_modules/zod/v4/locales/ur.js +110 -0
- package/.output/server/node_modules/zod/v4/locales/uz.js +109 -0
- package/.output/server/node_modules/zod/v4/locales/vi.js +108 -0
- package/.output/server/node_modules/zod/v4/locales/yo.js +107 -0
- package/.output/server/node_modules/zod/v4/locales/zh-CN.js +109 -0
- package/.output/server/node_modules/zod/v4/locales/zh-TW.js +107 -0
- package/.output/server/node_modules/zwitch/index.js +118 -0
- package/.output/server/node_modules/zwitch/package.json +72 -0
- package/.output/server/package.json +190 -0
- package/README.md +122 -97
- package/dist/index.js +8329 -8305
- package/package.json +7 -2
|
@@ -0,0 +1,4992 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* liquidjs@10.25.0, https://github.com/harttle/liquidjs
|
|
3
|
+
* (c) 2016-2026 harttle
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
|
+
|
|
10
|
+
var stream = require('stream');
|
|
11
|
+
var path = require('path');
|
|
12
|
+
var fs$1 = require('fs');
|
|
13
|
+
|
|
14
|
+
class Token {
|
|
15
|
+
constructor(kind, input, begin, end, file) {
|
|
16
|
+
this.kind = kind;
|
|
17
|
+
this.input = input;
|
|
18
|
+
this.begin = begin;
|
|
19
|
+
this.end = end;
|
|
20
|
+
this.file = file;
|
|
21
|
+
}
|
|
22
|
+
getText() {
|
|
23
|
+
return this.input.slice(this.begin, this.end);
|
|
24
|
+
}
|
|
25
|
+
getPosition() {
|
|
26
|
+
let [row, col] = [1, 1];
|
|
27
|
+
for (let i = 0; i < this.begin; i++) {
|
|
28
|
+
if (this.input[i] === '\n') {
|
|
29
|
+
row++;
|
|
30
|
+
col = 1;
|
|
31
|
+
}
|
|
32
|
+
else
|
|
33
|
+
col++;
|
|
34
|
+
}
|
|
35
|
+
return [row, col];
|
|
36
|
+
}
|
|
37
|
+
size() {
|
|
38
|
+
return this.end - this.begin;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
class Drop {
|
|
43
|
+
liquidMethodMissing(key, context) {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const toString$1 = Object.prototype.toString;
|
|
49
|
+
const toLowerCase = String.prototype.toLowerCase;
|
|
50
|
+
const hasOwnProperty = Object.hasOwnProperty;
|
|
51
|
+
function isString(value) {
|
|
52
|
+
return typeof value === 'string';
|
|
53
|
+
}
|
|
54
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
55
|
+
function isFunction(value) {
|
|
56
|
+
return typeof value === 'function';
|
|
57
|
+
}
|
|
58
|
+
function isPromise(val) {
|
|
59
|
+
return val && isFunction(val.then);
|
|
60
|
+
}
|
|
61
|
+
function isIterator(val) {
|
|
62
|
+
return val && isFunction(val.next) && isFunction(val.throw) && isFunction(val.return);
|
|
63
|
+
}
|
|
64
|
+
function escapeRegex(str) {
|
|
65
|
+
return str.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
66
|
+
}
|
|
67
|
+
function promisify(fn) {
|
|
68
|
+
return function (...args) {
|
|
69
|
+
return new Promise((resolve, reject) => {
|
|
70
|
+
fn(...args, (err, result) => {
|
|
71
|
+
err ? reject(err) : resolve(result);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function stringify(value) {
|
|
77
|
+
value = toValue(value);
|
|
78
|
+
if (isString(value))
|
|
79
|
+
return value;
|
|
80
|
+
if (isNil(value))
|
|
81
|
+
return '';
|
|
82
|
+
if (isArray(value))
|
|
83
|
+
return value.map(x => stringify(x)).join('');
|
|
84
|
+
return String(value);
|
|
85
|
+
}
|
|
86
|
+
function toEnumerable(val) {
|
|
87
|
+
val = toValue(val);
|
|
88
|
+
if (isArray(val))
|
|
89
|
+
return val;
|
|
90
|
+
if (isString(val) && val.length > 0)
|
|
91
|
+
return [val];
|
|
92
|
+
if (isIterable(val))
|
|
93
|
+
return Array.from(val);
|
|
94
|
+
if (isObject(val))
|
|
95
|
+
return Object.keys(val).map((key) => [key, val[key]]);
|
|
96
|
+
return [];
|
|
97
|
+
}
|
|
98
|
+
function toArray(val) {
|
|
99
|
+
val = toValue(val);
|
|
100
|
+
if (isNil(val))
|
|
101
|
+
return [];
|
|
102
|
+
if (isArray(val))
|
|
103
|
+
return val;
|
|
104
|
+
return [val];
|
|
105
|
+
}
|
|
106
|
+
function toValue(value) {
|
|
107
|
+
return (value instanceof Drop && isFunction(value.valueOf)) ? value.valueOf() : value;
|
|
108
|
+
}
|
|
109
|
+
function toNumber(value) {
|
|
110
|
+
return +toValue(value) || 0;
|
|
111
|
+
}
|
|
112
|
+
function isNumber(value) {
|
|
113
|
+
return typeof value === 'number';
|
|
114
|
+
}
|
|
115
|
+
function toLiquid(value) {
|
|
116
|
+
if (value && isFunction(value.toLiquid))
|
|
117
|
+
return toLiquid(value.toLiquid());
|
|
118
|
+
return value;
|
|
119
|
+
}
|
|
120
|
+
function isNil(value) {
|
|
121
|
+
return value == null;
|
|
122
|
+
}
|
|
123
|
+
function isUndefined(value) {
|
|
124
|
+
return value === undefined;
|
|
125
|
+
}
|
|
126
|
+
function isArray(value) {
|
|
127
|
+
// be compatible with IE 8
|
|
128
|
+
return toString$1.call(value) === '[object Array]';
|
|
129
|
+
}
|
|
130
|
+
function isArrayLike(value) {
|
|
131
|
+
return value && isNumber(value.length);
|
|
132
|
+
}
|
|
133
|
+
function isIterable(value) {
|
|
134
|
+
return isObject(value) && Symbol.iterator in value;
|
|
135
|
+
}
|
|
136
|
+
/*
|
|
137
|
+
* Iterates over own enumerable string keyed properties of an object and invokes iteratee for each property.
|
|
138
|
+
* The iteratee is invoked with three arguments: (value, key, object).
|
|
139
|
+
* Iteratee functions may exit iteration early by explicitly returning false.
|
|
140
|
+
* @param {Object} object The object to iterate over.
|
|
141
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
142
|
+
* @return {Object} Returns object.
|
|
143
|
+
*/
|
|
144
|
+
function forOwn(obj, iteratee) {
|
|
145
|
+
obj = obj || {};
|
|
146
|
+
for (const k in obj) {
|
|
147
|
+
if (hasOwnProperty.call(obj, k)) {
|
|
148
|
+
if (iteratee(obj[k], k, obj) === false)
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return obj;
|
|
153
|
+
}
|
|
154
|
+
function last(arr) {
|
|
155
|
+
return arr[arr.length - 1];
|
|
156
|
+
}
|
|
157
|
+
/*
|
|
158
|
+
* Checks if value is the language type of Object.
|
|
159
|
+
* (e.g. arrays, functions, objects, regexes, new Number(0), and new String(''))
|
|
160
|
+
* @param {any} value The value to check.
|
|
161
|
+
* @return {Boolean} Returns true if value is an object, else false.
|
|
162
|
+
*/
|
|
163
|
+
function isObject(value) {
|
|
164
|
+
const type = typeof value;
|
|
165
|
+
return value !== null && (type === 'object' || type === 'function');
|
|
166
|
+
}
|
|
167
|
+
function range(start, stop, step = 1) {
|
|
168
|
+
const arr = [];
|
|
169
|
+
for (let i = start; i < stop; i += step) {
|
|
170
|
+
arr.push(i);
|
|
171
|
+
}
|
|
172
|
+
return arr;
|
|
173
|
+
}
|
|
174
|
+
function padStart(str, length, ch = ' ') {
|
|
175
|
+
return pad(str, length, ch, (str, ch) => ch + str);
|
|
176
|
+
}
|
|
177
|
+
function padEnd(str, length, ch = ' ') {
|
|
178
|
+
return pad(str, length, ch, (str, ch) => str + ch);
|
|
179
|
+
}
|
|
180
|
+
function pad(str, length, ch, add) {
|
|
181
|
+
str = String(str);
|
|
182
|
+
let n = length - str.length;
|
|
183
|
+
while (n-- > 0)
|
|
184
|
+
str = add(str, ch);
|
|
185
|
+
return str;
|
|
186
|
+
}
|
|
187
|
+
function identify(val) {
|
|
188
|
+
return val;
|
|
189
|
+
}
|
|
190
|
+
function changeCase(str) {
|
|
191
|
+
const hasLowerCase = [...str].some(ch => ch >= 'a' && ch <= 'z');
|
|
192
|
+
return hasLowerCase ? str.toUpperCase() : str.toLowerCase();
|
|
193
|
+
}
|
|
194
|
+
function ellipsis(str, N) {
|
|
195
|
+
return str.length > N ? str.slice(0, N - 3) + '...' : str;
|
|
196
|
+
}
|
|
197
|
+
// compare string in case-insensitive way, undefined values to the tail
|
|
198
|
+
function caseInsensitiveCompare(a, b) {
|
|
199
|
+
if (a == null && b == null)
|
|
200
|
+
return 0;
|
|
201
|
+
if (a == null)
|
|
202
|
+
return 1;
|
|
203
|
+
if (b == null)
|
|
204
|
+
return -1;
|
|
205
|
+
a = toLowerCase.call(a);
|
|
206
|
+
b = toLowerCase.call(b);
|
|
207
|
+
if (a < b)
|
|
208
|
+
return -1;
|
|
209
|
+
if (a > b)
|
|
210
|
+
return 1;
|
|
211
|
+
return 0;
|
|
212
|
+
}
|
|
213
|
+
function argumentsToValue(fn) {
|
|
214
|
+
return function (...args) { return fn.call(this, ...args.map(toValue)); };
|
|
215
|
+
}
|
|
216
|
+
function argumentsToNumber(fn) {
|
|
217
|
+
return function (...args) { return fn.call(this, ...args.map(toNumber)); };
|
|
218
|
+
}
|
|
219
|
+
function escapeRegExp(text) {
|
|
220
|
+
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
|
221
|
+
}
|
|
222
|
+
/** Return an array containing unique elements from _array_. Works with nested arrays and objects. */
|
|
223
|
+
function* strictUniq(array) {
|
|
224
|
+
const seen = new Set();
|
|
225
|
+
for (const element of array) {
|
|
226
|
+
const key = JSON.stringify(element);
|
|
227
|
+
if (!seen.has(key)) {
|
|
228
|
+
seen.add(key);
|
|
229
|
+
yield element;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* targeting ES5, extends Error won't create a proper prototype chain, need a trait to keep track of classes
|
|
236
|
+
*/
|
|
237
|
+
const TRAIT = '__liquidClass__';
|
|
238
|
+
class LiquidError extends Error {
|
|
239
|
+
constructor(err, token) {
|
|
240
|
+
/**
|
|
241
|
+
* note: for ES5 targeting, `this` will be replaced by return value of Error(),
|
|
242
|
+
* thus everything on `this` will be lost, avoid calling `LiquidError` methods here
|
|
243
|
+
*/
|
|
244
|
+
super(typeof err === 'string' ? err : err.message);
|
|
245
|
+
this.context = '';
|
|
246
|
+
if (typeof err !== 'string')
|
|
247
|
+
Object.defineProperty(this, 'originalError', { value: err, enumerable: false });
|
|
248
|
+
Object.defineProperty(this, 'token', { value: token, enumerable: false });
|
|
249
|
+
Object.defineProperty(this, TRAIT, { value: 'LiquidError', enumerable: false });
|
|
250
|
+
}
|
|
251
|
+
update() {
|
|
252
|
+
Object.defineProperty(this, 'context', { value: mkContext(this.token), enumerable: false });
|
|
253
|
+
this.message = mkMessage(this.message, this.token);
|
|
254
|
+
this.stack = this.message + '\n' + this.context +
|
|
255
|
+
'\n' + this.stack;
|
|
256
|
+
if (this.originalError)
|
|
257
|
+
this.stack += '\nFrom ' + this.originalError.stack;
|
|
258
|
+
}
|
|
259
|
+
static is(obj) {
|
|
260
|
+
return obj?.[TRAIT] === 'LiquidError';
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
class TokenizationError extends LiquidError {
|
|
264
|
+
constructor(message, token) {
|
|
265
|
+
super(message, token);
|
|
266
|
+
this.name = 'TokenizationError';
|
|
267
|
+
super.update();
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
class ParseError extends LiquidError {
|
|
271
|
+
constructor(err, token) {
|
|
272
|
+
super(err, token);
|
|
273
|
+
this.name = 'ParseError';
|
|
274
|
+
this.message = err.message;
|
|
275
|
+
super.update();
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
class RenderError extends LiquidError {
|
|
279
|
+
constructor(err, tpl) {
|
|
280
|
+
super(err, tpl.token);
|
|
281
|
+
this.name = 'RenderError';
|
|
282
|
+
this.message = err.message;
|
|
283
|
+
super.update();
|
|
284
|
+
}
|
|
285
|
+
static is(obj) {
|
|
286
|
+
return obj.name === 'RenderError';
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
class LiquidErrors extends LiquidError {
|
|
290
|
+
constructor(errors) {
|
|
291
|
+
super(errors[0], errors[0].token);
|
|
292
|
+
this.errors = errors;
|
|
293
|
+
this.name = 'LiquidErrors';
|
|
294
|
+
const s = errors.length > 1 ? 's' : '';
|
|
295
|
+
this.message = `${errors.length} error${s} found`;
|
|
296
|
+
super.update();
|
|
297
|
+
}
|
|
298
|
+
static is(obj) {
|
|
299
|
+
return obj.name === 'LiquidErrors';
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
class UndefinedVariableError extends LiquidError {
|
|
303
|
+
constructor(err, token) {
|
|
304
|
+
super(err, token);
|
|
305
|
+
this.name = 'UndefinedVariableError';
|
|
306
|
+
this.message = err.message;
|
|
307
|
+
super.update();
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
// only used internally; raised where we don't have token information,
|
|
311
|
+
// so it can't be an UndefinedVariableError.
|
|
312
|
+
class InternalUndefinedVariableError extends Error {
|
|
313
|
+
constructor(variableName) {
|
|
314
|
+
super(`undefined variable: ${variableName}`);
|
|
315
|
+
this.name = 'InternalUndefinedVariableError';
|
|
316
|
+
this.variableName = variableName;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
class AssertionError extends Error {
|
|
320
|
+
constructor(message) {
|
|
321
|
+
super(message);
|
|
322
|
+
this.name = 'AssertionError';
|
|
323
|
+
this.message = message + '';
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
function mkContext(token) {
|
|
327
|
+
const [line, col] = token.getPosition();
|
|
328
|
+
const lines = token.input.split('\n');
|
|
329
|
+
const begin = Math.max(line - 2, 1);
|
|
330
|
+
const end = Math.min(line + 3, lines.length);
|
|
331
|
+
const context = range(begin, end + 1)
|
|
332
|
+
.map(lineNumber => {
|
|
333
|
+
const rowIndicator = (lineNumber === line) ? '>> ' : ' ';
|
|
334
|
+
const num = padStart(String(lineNumber), String(end).length);
|
|
335
|
+
let text = `${rowIndicator}${num}| `;
|
|
336
|
+
const colIndicator = lineNumber === line
|
|
337
|
+
? '\n' + padStart('^', col + text.length)
|
|
338
|
+
: '';
|
|
339
|
+
text += lines[lineNumber - 1];
|
|
340
|
+
text += colIndicator;
|
|
341
|
+
return text;
|
|
342
|
+
})
|
|
343
|
+
.join('\n');
|
|
344
|
+
return context;
|
|
345
|
+
}
|
|
346
|
+
function mkMessage(msg, token) {
|
|
347
|
+
if (token.file)
|
|
348
|
+
msg += `, file:${token.file}`;
|
|
349
|
+
const [line, col] = token.getPosition();
|
|
350
|
+
msg += `, line:${line}, col:${col}`;
|
|
351
|
+
return msg;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// **DO NOT CHANGE THIS FILE**
|
|
355
|
+
//
|
|
356
|
+
// This file is generated by bin/character-gen.js
|
|
357
|
+
// bitmask character types to boost performance
|
|
358
|
+
const TYPES = [0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 4, 4, 4, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 2, 8, 0, 0, 0, 0, 8, 0, 0, 0, 64, 0, 65, 0, 0, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 0, 0, 2, 2, 2, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0];
|
|
359
|
+
const WORD = 1;
|
|
360
|
+
const BLANK = 4;
|
|
361
|
+
const QUOTE = 8;
|
|
362
|
+
const INLINE_BLANK = 16;
|
|
363
|
+
const NUMBER = 32;
|
|
364
|
+
const SIGN = 64;
|
|
365
|
+
const PUNCTUATION = 128;
|
|
366
|
+
function isWord(char) {
|
|
367
|
+
const code = char.charCodeAt(0);
|
|
368
|
+
return code >= 128 ? !TYPES[code] : !!(TYPES[code] & WORD);
|
|
369
|
+
}
|
|
370
|
+
TYPES[160] = TYPES[5760] = TYPES[6158] = TYPES[8192] = TYPES[8193] = TYPES[8194] = TYPES[8195] = TYPES[8196] = TYPES[8197] = TYPES[8198] = TYPES[8199] = TYPES[8200] = TYPES[8201] = TYPES[8202] = TYPES[8232] = TYPES[8233] = TYPES[8239] = TYPES[8287] = TYPES[12288] = BLANK;
|
|
371
|
+
TYPES[8220] = TYPES[8221] = PUNCTUATION;
|
|
372
|
+
|
|
373
|
+
function assert(predicate, message) {
|
|
374
|
+
if (!predicate) {
|
|
375
|
+
const msg = typeof message === 'function'
|
|
376
|
+
? message()
|
|
377
|
+
: (message || `expect ${predicate} to be true`);
|
|
378
|
+
throw new AssertionError(msg);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
function assertEmpty(predicate, message = `unexpected ${JSON.stringify(predicate)}`) {
|
|
382
|
+
assert(!predicate, message);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
class NullDrop extends Drop {
|
|
386
|
+
equals(value) {
|
|
387
|
+
return isNil(toValue(value));
|
|
388
|
+
}
|
|
389
|
+
gt() {
|
|
390
|
+
return false;
|
|
391
|
+
}
|
|
392
|
+
geq() {
|
|
393
|
+
return false;
|
|
394
|
+
}
|
|
395
|
+
lt() {
|
|
396
|
+
return false;
|
|
397
|
+
}
|
|
398
|
+
leq() {
|
|
399
|
+
return false;
|
|
400
|
+
}
|
|
401
|
+
valueOf() {
|
|
402
|
+
return null;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
class EmptyDrop extends Drop {
|
|
407
|
+
equals(value) {
|
|
408
|
+
if (value instanceof EmptyDrop)
|
|
409
|
+
return false;
|
|
410
|
+
value = toValue(value);
|
|
411
|
+
if (isString(value) || isArray(value))
|
|
412
|
+
return value.length === 0;
|
|
413
|
+
if (isObject(value))
|
|
414
|
+
return Object.keys(value).length === 0;
|
|
415
|
+
return false;
|
|
416
|
+
}
|
|
417
|
+
gt() {
|
|
418
|
+
return false;
|
|
419
|
+
}
|
|
420
|
+
geq() {
|
|
421
|
+
return false;
|
|
422
|
+
}
|
|
423
|
+
lt() {
|
|
424
|
+
return false;
|
|
425
|
+
}
|
|
426
|
+
leq() {
|
|
427
|
+
return false;
|
|
428
|
+
}
|
|
429
|
+
valueOf() {
|
|
430
|
+
return '';
|
|
431
|
+
}
|
|
432
|
+
static is(value) {
|
|
433
|
+
return value instanceof EmptyDrop;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
class BlankDrop extends EmptyDrop {
|
|
438
|
+
equals(value) {
|
|
439
|
+
if (value === false)
|
|
440
|
+
return true;
|
|
441
|
+
if (isNil(toValue(value)))
|
|
442
|
+
return true;
|
|
443
|
+
if (isString(value))
|
|
444
|
+
return /^\s*$/.test(value);
|
|
445
|
+
return super.equals(value);
|
|
446
|
+
}
|
|
447
|
+
static is(value) {
|
|
448
|
+
return value instanceof BlankDrop;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
class ForloopDrop extends Drop {
|
|
453
|
+
constructor(length, collection, variable) {
|
|
454
|
+
super();
|
|
455
|
+
this.i = 0;
|
|
456
|
+
this.length = length;
|
|
457
|
+
this.name = `${variable}-${collection}`;
|
|
458
|
+
}
|
|
459
|
+
next() {
|
|
460
|
+
this.i++;
|
|
461
|
+
}
|
|
462
|
+
index0() {
|
|
463
|
+
return this.i;
|
|
464
|
+
}
|
|
465
|
+
index() {
|
|
466
|
+
return this.i + 1;
|
|
467
|
+
}
|
|
468
|
+
first() {
|
|
469
|
+
return this.i === 0;
|
|
470
|
+
}
|
|
471
|
+
last() {
|
|
472
|
+
return this.i === this.length - 1;
|
|
473
|
+
}
|
|
474
|
+
rindex() {
|
|
475
|
+
return this.length - this.i;
|
|
476
|
+
}
|
|
477
|
+
rindex0() {
|
|
478
|
+
return this.length - this.i - 1;
|
|
479
|
+
}
|
|
480
|
+
valueOf() {
|
|
481
|
+
return JSON.stringify(this);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
class SimpleEmitter {
|
|
486
|
+
constructor() {
|
|
487
|
+
this.buffer = '';
|
|
488
|
+
}
|
|
489
|
+
write(html) {
|
|
490
|
+
this.buffer += stringify(html);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
class StreamedEmitter {
|
|
495
|
+
constructor() {
|
|
496
|
+
this.buffer = '';
|
|
497
|
+
this.stream = new stream.PassThrough();
|
|
498
|
+
}
|
|
499
|
+
write(html) {
|
|
500
|
+
this.stream.write(stringify(html));
|
|
501
|
+
}
|
|
502
|
+
error(err) {
|
|
503
|
+
this.stream.emit('error', err);
|
|
504
|
+
}
|
|
505
|
+
end() {
|
|
506
|
+
this.stream.end();
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
class KeepingTypeEmitter {
|
|
511
|
+
constructor() {
|
|
512
|
+
this.buffer = '';
|
|
513
|
+
}
|
|
514
|
+
write(html) {
|
|
515
|
+
html = toValue(html);
|
|
516
|
+
// This will only preserve the type if the value is isolated.
|
|
517
|
+
// I.E:
|
|
518
|
+
// {{ my-port }} -> 42
|
|
519
|
+
// {{ my-host }}:{{ my-port }} -> 'host:42'
|
|
520
|
+
if (typeof html !== 'string' && this.buffer === '') {
|
|
521
|
+
this.buffer = html;
|
|
522
|
+
}
|
|
523
|
+
else {
|
|
524
|
+
this.buffer = stringify(this.buffer) + stringify(html);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
class BlockDrop extends Drop {
|
|
530
|
+
constructor(
|
|
531
|
+
// the block render from layout template
|
|
532
|
+
superBlockRender = () => '') {
|
|
533
|
+
super();
|
|
534
|
+
this.superBlockRender = superBlockRender;
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Provide parent access in child block by
|
|
538
|
+
* {{ block.super }}
|
|
539
|
+
*/
|
|
540
|
+
*super() {
|
|
541
|
+
const emitter = new SimpleEmitter();
|
|
542
|
+
yield this.superBlockRender(emitter);
|
|
543
|
+
return emitter.buffer;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
function isComparable(arg) {
|
|
548
|
+
return (arg &&
|
|
549
|
+
isFunction(arg.equals) &&
|
|
550
|
+
isFunction(arg.gt) &&
|
|
551
|
+
isFunction(arg.geq) &&
|
|
552
|
+
isFunction(arg.lt) &&
|
|
553
|
+
isFunction(arg.leq));
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
const nil = new NullDrop();
|
|
557
|
+
const literalValues = {
|
|
558
|
+
'true': true,
|
|
559
|
+
'false': false,
|
|
560
|
+
'nil': nil,
|
|
561
|
+
'null': nil,
|
|
562
|
+
'empty': new EmptyDrop(),
|
|
563
|
+
'blank': new BlankDrop()
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
function createTrie(input) {
|
|
567
|
+
const trie = {};
|
|
568
|
+
for (const [name, data] of Object.entries(input)) {
|
|
569
|
+
let node = trie;
|
|
570
|
+
for (let i = 0; i < name.length; i++) {
|
|
571
|
+
const c = name[i];
|
|
572
|
+
node[c] = node[c] || {};
|
|
573
|
+
if (i === name.length - 1 && isWord(name[i])) {
|
|
574
|
+
node[c].needBoundary = true;
|
|
575
|
+
}
|
|
576
|
+
node = node[c];
|
|
577
|
+
}
|
|
578
|
+
node.data = data;
|
|
579
|
+
node.end = true;
|
|
580
|
+
}
|
|
581
|
+
return trie;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
// convert an async iterator to a Promise
|
|
585
|
+
async function toPromise(val) {
|
|
586
|
+
if (!isIterator(val))
|
|
587
|
+
return val;
|
|
588
|
+
let value;
|
|
589
|
+
let done = false;
|
|
590
|
+
let next = 'next';
|
|
591
|
+
do {
|
|
592
|
+
const state = val[next](value);
|
|
593
|
+
done = state.done;
|
|
594
|
+
value = state.value;
|
|
595
|
+
next = 'next';
|
|
596
|
+
try {
|
|
597
|
+
if (isIterator(value))
|
|
598
|
+
value = toPromise(value);
|
|
599
|
+
if (isPromise(value))
|
|
600
|
+
value = await value;
|
|
601
|
+
}
|
|
602
|
+
catch (err) {
|
|
603
|
+
next = 'throw';
|
|
604
|
+
value = err;
|
|
605
|
+
}
|
|
606
|
+
} while (!done);
|
|
607
|
+
return value;
|
|
608
|
+
}
|
|
609
|
+
// convert an async iterator to a value in a synchronous manner
|
|
610
|
+
function toValueSync(val) {
|
|
611
|
+
if (!isIterator(val))
|
|
612
|
+
return val;
|
|
613
|
+
let value;
|
|
614
|
+
let done = false;
|
|
615
|
+
let next = 'next';
|
|
616
|
+
do {
|
|
617
|
+
const state = val[next](value);
|
|
618
|
+
done = state.done;
|
|
619
|
+
value = state.value;
|
|
620
|
+
next = 'next';
|
|
621
|
+
if (isIterator(value)) {
|
|
622
|
+
try {
|
|
623
|
+
value = toValueSync(value);
|
|
624
|
+
}
|
|
625
|
+
catch (err) {
|
|
626
|
+
next = 'throw';
|
|
627
|
+
value = err;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
} while (!done);
|
|
631
|
+
return value;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
const rFormat = /%([-_0^#:]+)?(\d+)?([EO])?(.)/;
|
|
635
|
+
// prototype extensions
|
|
636
|
+
function daysInMonth(d) {
|
|
637
|
+
const feb = isLeapYear(d) ? 29 : 28;
|
|
638
|
+
return [31, feb, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
639
|
+
}
|
|
640
|
+
function getDayOfYear(d) {
|
|
641
|
+
let num = 0;
|
|
642
|
+
for (let i = 0; i < d.getMonth(); ++i) {
|
|
643
|
+
num += daysInMonth(d)[i];
|
|
644
|
+
}
|
|
645
|
+
return num + d.getDate();
|
|
646
|
+
}
|
|
647
|
+
function getWeekOfYear(d, startDay) {
|
|
648
|
+
// Skip to startDay of this week
|
|
649
|
+
const now = getDayOfYear(d) + (startDay - d.getDay());
|
|
650
|
+
// Find the first startDay of the year
|
|
651
|
+
const jan1 = new Date(d.getFullYear(), 0, 1);
|
|
652
|
+
const then = (7 - jan1.getDay() + startDay);
|
|
653
|
+
return String(Math.floor((now - then) / 7) + 1);
|
|
654
|
+
}
|
|
655
|
+
function isLeapYear(d) {
|
|
656
|
+
const year = d.getFullYear();
|
|
657
|
+
return !!((year & 3) === 0 && (year % 100 || (year % 400 === 0 && year)));
|
|
658
|
+
}
|
|
659
|
+
function ordinal(d) {
|
|
660
|
+
const date = d.getDate();
|
|
661
|
+
if ([11, 12, 13].includes(date))
|
|
662
|
+
return 'th';
|
|
663
|
+
switch (date % 10) {
|
|
664
|
+
case 1: return 'st';
|
|
665
|
+
case 2: return 'nd';
|
|
666
|
+
case 3: return 'rd';
|
|
667
|
+
default: return 'th';
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
function century(d) {
|
|
671
|
+
return parseInt(d.getFullYear().toString().substring(0, 2), 10);
|
|
672
|
+
}
|
|
673
|
+
// default to 0
|
|
674
|
+
const padWidths = {
|
|
675
|
+
d: 2,
|
|
676
|
+
e: 2,
|
|
677
|
+
H: 2,
|
|
678
|
+
I: 2,
|
|
679
|
+
j: 3,
|
|
680
|
+
k: 2,
|
|
681
|
+
l: 2,
|
|
682
|
+
L: 3,
|
|
683
|
+
m: 2,
|
|
684
|
+
M: 2,
|
|
685
|
+
S: 2,
|
|
686
|
+
U: 2,
|
|
687
|
+
W: 2
|
|
688
|
+
};
|
|
689
|
+
const padSpaceChars = new Set('aAbBceklpP');
|
|
690
|
+
function getTimezoneOffset(d, opts) {
|
|
691
|
+
const nOffset = Math.abs(d.getTimezoneOffset());
|
|
692
|
+
const h = Math.floor(nOffset / 60);
|
|
693
|
+
const m = nOffset % 60;
|
|
694
|
+
return (d.getTimezoneOffset() > 0 ? '-' : '+') +
|
|
695
|
+
padStart(h, 2, '0') +
|
|
696
|
+
(opts.flags[':'] ? ':' : '') +
|
|
697
|
+
padStart(m, 2, '0');
|
|
698
|
+
}
|
|
699
|
+
const formatCodes = {
|
|
700
|
+
a: (d) => d.getShortWeekdayName(),
|
|
701
|
+
A: (d) => d.getLongWeekdayName(),
|
|
702
|
+
b: (d) => d.getShortMonthName(),
|
|
703
|
+
B: (d) => d.getLongMonthName(),
|
|
704
|
+
c: (d) => d.toLocaleString(),
|
|
705
|
+
C: (d) => century(d),
|
|
706
|
+
d: (d) => d.getDate(),
|
|
707
|
+
e: (d) => d.getDate(),
|
|
708
|
+
H: (d) => d.getHours(),
|
|
709
|
+
I: (d) => String(d.getHours() % 12 || 12),
|
|
710
|
+
j: (d) => getDayOfYear(d),
|
|
711
|
+
k: (d) => d.getHours(),
|
|
712
|
+
l: (d) => String(d.getHours() % 12 || 12),
|
|
713
|
+
L: (d) => d.getMilliseconds(),
|
|
714
|
+
m: (d) => d.getMonth() + 1,
|
|
715
|
+
M: (d) => d.getMinutes(),
|
|
716
|
+
N: (d, opts) => {
|
|
717
|
+
const width = Number(opts.width) || 9;
|
|
718
|
+
const str = String(d.getMilliseconds()).slice(0, width);
|
|
719
|
+
return padEnd(str, width, '0');
|
|
720
|
+
},
|
|
721
|
+
p: (d) => (d.getHours() < 12 ? 'AM' : 'PM'),
|
|
722
|
+
P: (d) => (d.getHours() < 12 ? 'am' : 'pm'),
|
|
723
|
+
q: (d) => ordinal(d),
|
|
724
|
+
s: (d) => Math.round(d.getTime() / 1000),
|
|
725
|
+
S: (d) => d.getSeconds(),
|
|
726
|
+
u: (d) => d.getDay() || 7,
|
|
727
|
+
U: (d) => getWeekOfYear(d, 0),
|
|
728
|
+
w: (d) => d.getDay(),
|
|
729
|
+
W: (d) => getWeekOfYear(d, 1),
|
|
730
|
+
x: (d) => d.toLocaleDateString(),
|
|
731
|
+
X: (d) => d.toLocaleTimeString(),
|
|
732
|
+
y: (d) => d.getFullYear().toString().slice(2, 4),
|
|
733
|
+
Y: (d) => d.getFullYear(),
|
|
734
|
+
z: getTimezoneOffset,
|
|
735
|
+
Z: (d, opts) => d.getTimeZoneName() || getTimezoneOffset(d, opts),
|
|
736
|
+
't': () => '\t',
|
|
737
|
+
'n': () => '\n',
|
|
738
|
+
'%': () => '%'
|
|
739
|
+
};
|
|
740
|
+
formatCodes.h = formatCodes.b;
|
|
741
|
+
function strftime(d, formatStr) {
|
|
742
|
+
let output = '';
|
|
743
|
+
let remaining = formatStr;
|
|
744
|
+
let match;
|
|
745
|
+
while ((match = rFormat.exec(remaining))) {
|
|
746
|
+
output += remaining.slice(0, match.index);
|
|
747
|
+
remaining = remaining.slice(match.index + match[0].length);
|
|
748
|
+
output += format(d, match);
|
|
749
|
+
}
|
|
750
|
+
return output + remaining;
|
|
751
|
+
}
|
|
752
|
+
function format(d, match) {
|
|
753
|
+
const [input, flagStr = '', width, modifier, conversion] = match;
|
|
754
|
+
const convert = formatCodes[conversion];
|
|
755
|
+
if (!convert)
|
|
756
|
+
return input;
|
|
757
|
+
const flags = {};
|
|
758
|
+
for (const flag of flagStr)
|
|
759
|
+
flags[flag] = true;
|
|
760
|
+
let ret = String(convert(d, { flags, width, modifier }));
|
|
761
|
+
let padChar = padSpaceChars.has(conversion) ? ' ' : '0';
|
|
762
|
+
let padWidth = width || padWidths[conversion] || 0;
|
|
763
|
+
if (flags['^'])
|
|
764
|
+
ret = ret.toUpperCase();
|
|
765
|
+
else if (flags['#'])
|
|
766
|
+
ret = changeCase(ret);
|
|
767
|
+
if (flags['_'])
|
|
768
|
+
padChar = ' ';
|
|
769
|
+
else if (flags['0'])
|
|
770
|
+
padChar = '0';
|
|
771
|
+
if (flags['-'])
|
|
772
|
+
padWidth = 0;
|
|
773
|
+
return padStart(ret, padWidth, padChar);
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
function getDateTimeFormat() {
|
|
777
|
+
return (typeof Intl !== 'undefined' ? Intl.DateTimeFormat : undefined);
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
// one minute in milliseconds
|
|
781
|
+
const OneMinute = 60000;
|
|
782
|
+
/**
|
|
783
|
+
* Need support both ISO8601 and RFC2822 as in major browsers & NodeJS
|
|
784
|
+
* RFC2822: https://datatracker.ietf.org/doc/html/rfc2822#section-3.3
|
|
785
|
+
*/
|
|
786
|
+
const TIMEZONE_PATTERN = /([zZ]|([+-])(\d{2}):?(\d{2}))$/;
|
|
787
|
+
const monthNames = [
|
|
788
|
+
'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August',
|
|
789
|
+
'September', 'October', 'November', 'December'
|
|
790
|
+
];
|
|
791
|
+
const monthNamesShort = monthNames.map(name => name.slice(0, 3));
|
|
792
|
+
const dayNames = [
|
|
793
|
+
'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'
|
|
794
|
+
];
|
|
795
|
+
const dayNamesShort = dayNames.map(name => name.slice(0, 3));
|
|
796
|
+
/**
|
|
797
|
+
* A date implementation with timezone info, just like Ruby date
|
|
798
|
+
*
|
|
799
|
+
* Implementation:
|
|
800
|
+
* - create a Date offset by it's timezone difference, avoiding overriding a bunch of methods
|
|
801
|
+
* - rewrite getTimezoneOffset() to trick strftime
|
|
802
|
+
*/
|
|
803
|
+
class LiquidDate {
|
|
804
|
+
constructor(init, locale, timezone) {
|
|
805
|
+
this.locale = locale;
|
|
806
|
+
this.DateTimeFormat = getDateTimeFormat();
|
|
807
|
+
this.date = new Date(init);
|
|
808
|
+
this.timezoneFixed = timezone !== undefined;
|
|
809
|
+
if (timezone === undefined) {
|
|
810
|
+
timezone = this.date.getTimezoneOffset();
|
|
811
|
+
}
|
|
812
|
+
this.timezoneOffset = isString(timezone) ? LiquidDate.getTimezoneOffset(timezone, this.date) : timezone;
|
|
813
|
+
this.timezoneName = isString(timezone) ? timezone : '';
|
|
814
|
+
const diff = (this.date.getTimezoneOffset() - this.timezoneOffset) * OneMinute;
|
|
815
|
+
const time = this.date.getTime() + diff;
|
|
816
|
+
this.displayDate = new Date(time);
|
|
817
|
+
}
|
|
818
|
+
getTime() {
|
|
819
|
+
return this.displayDate.getTime();
|
|
820
|
+
}
|
|
821
|
+
getMilliseconds() {
|
|
822
|
+
return this.displayDate.getMilliseconds();
|
|
823
|
+
}
|
|
824
|
+
getSeconds() {
|
|
825
|
+
return this.displayDate.getSeconds();
|
|
826
|
+
}
|
|
827
|
+
getMinutes() {
|
|
828
|
+
return this.displayDate.getMinutes();
|
|
829
|
+
}
|
|
830
|
+
getHours() {
|
|
831
|
+
return this.displayDate.getHours();
|
|
832
|
+
}
|
|
833
|
+
getDay() {
|
|
834
|
+
return this.displayDate.getDay();
|
|
835
|
+
}
|
|
836
|
+
getDate() {
|
|
837
|
+
return this.displayDate.getDate();
|
|
838
|
+
}
|
|
839
|
+
getMonth() {
|
|
840
|
+
return this.displayDate.getMonth();
|
|
841
|
+
}
|
|
842
|
+
getFullYear() {
|
|
843
|
+
return this.displayDate.getFullYear();
|
|
844
|
+
}
|
|
845
|
+
toLocaleString(locale, init) {
|
|
846
|
+
if (init?.timeZone) {
|
|
847
|
+
return this.date.toLocaleString(locale, init);
|
|
848
|
+
}
|
|
849
|
+
return this.displayDate.toLocaleString(locale, init);
|
|
850
|
+
}
|
|
851
|
+
toLocaleTimeString(locale) {
|
|
852
|
+
return this.displayDate.toLocaleTimeString(locale);
|
|
853
|
+
}
|
|
854
|
+
toLocaleDateString(locale) {
|
|
855
|
+
return this.displayDate.toLocaleDateString(locale);
|
|
856
|
+
}
|
|
857
|
+
getTimezoneOffset() {
|
|
858
|
+
return this.timezoneOffset;
|
|
859
|
+
}
|
|
860
|
+
getTimeZoneName() {
|
|
861
|
+
if (this.timezoneFixed)
|
|
862
|
+
return this.timezoneName;
|
|
863
|
+
if (!this.DateTimeFormat)
|
|
864
|
+
return;
|
|
865
|
+
return this.DateTimeFormat().resolvedOptions().timeZone;
|
|
866
|
+
}
|
|
867
|
+
getLongMonthName() {
|
|
868
|
+
return this.format({ month: 'long' }) ?? monthNames[this.getMonth()];
|
|
869
|
+
}
|
|
870
|
+
getShortMonthName() {
|
|
871
|
+
return this.format({ month: 'short' }) ?? monthNamesShort[this.getMonth()];
|
|
872
|
+
}
|
|
873
|
+
getLongWeekdayName() {
|
|
874
|
+
return this.format({ weekday: 'long' }) ?? dayNames[this.displayDate.getDay()];
|
|
875
|
+
}
|
|
876
|
+
getShortWeekdayName() {
|
|
877
|
+
return this.format({ weekday: 'short' }) ?? dayNamesShort[this.displayDate.getDay()];
|
|
878
|
+
}
|
|
879
|
+
valid() {
|
|
880
|
+
return !isNaN(this.getTime());
|
|
881
|
+
}
|
|
882
|
+
format(options) {
|
|
883
|
+
return this.DateTimeFormat && this.DateTimeFormat(this.locale, options).format(this.displayDate);
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* Create a Date object fixed to it's declared Timezone. Both
|
|
887
|
+
* - 2021-08-06T02:29:00.000Z and
|
|
888
|
+
* - 2021-08-06T02:29:00.000+08:00
|
|
889
|
+
* will always be displayed as
|
|
890
|
+
* - 2021-08-06 02:29:00
|
|
891
|
+
* regardless timezoneOffset in JavaScript realm
|
|
892
|
+
*
|
|
893
|
+
* The implementation hack:
|
|
894
|
+
* Instead of calling `.getMonth()`/`.getUTCMonth()` respect to `preserveTimezones`,
|
|
895
|
+
* we create a different Date to trick strftime, it's both simpler and more performant.
|
|
896
|
+
* Given that a template is expected to be parsed fewer times than rendered.
|
|
897
|
+
*/
|
|
898
|
+
static createDateFixedToTimezone(dateString, locale) {
|
|
899
|
+
const m = dateString.match(TIMEZONE_PATTERN);
|
|
900
|
+
// representing a UTC timestamp
|
|
901
|
+
if (m && m[1] === 'Z') {
|
|
902
|
+
return new LiquidDate(+new Date(dateString), locale, 0);
|
|
903
|
+
}
|
|
904
|
+
// has a timezone specified
|
|
905
|
+
if (m && m[2] && m[3] && m[4]) {
|
|
906
|
+
const [, , sign, hours, minutes] = m;
|
|
907
|
+
const offset = (sign === '+' ? -1 : 1) * (parseInt(hours, 10) * 60 + parseInt(minutes, 10));
|
|
908
|
+
return new LiquidDate(+new Date(dateString), locale, offset);
|
|
909
|
+
}
|
|
910
|
+
return new LiquidDate(dateString, locale);
|
|
911
|
+
}
|
|
912
|
+
static getTimezoneOffset(timezoneName, date) {
|
|
913
|
+
const localDateString = date.toLocaleString('en-US', { timeZone: timezoneName });
|
|
914
|
+
const utcDateString = date.toLocaleString('en-US', { timeZone: 'UTC' });
|
|
915
|
+
const localDate = new Date(localDateString);
|
|
916
|
+
const utcDate = new Date(utcDateString);
|
|
917
|
+
return (+utcDate - +localDate) / (60 * 1000);
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
class Limiter {
|
|
922
|
+
constructor(resource, limit) {
|
|
923
|
+
this.base = 0;
|
|
924
|
+
this.message = `${resource} limit exceeded`;
|
|
925
|
+
this.limit = limit;
|
|
926
|
+
}
|
|
927
|
+
use(count) {
|
|
928
|
+
count = +count || 0;
|
|
929
|
+
assert(this.base + count <= this.limit, this.message);
|
|
930
|
+
this.base += count;
|
|
931
|
+
}
|
|
932
|
+
check(count) {
|
|
933
|
+
count = +count || 0;
|
|
934
|
+
assert(count <= this.limit, this.message);
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
class DelimitedToken extends Token {
|
|
939
|
+
constructor(kind, [contentBegin, contentEnd], input, begin, end, trimLeft, trimRight, file) {
|
|
940
|
+
super(kind, input, begin, end, file);
|
|
941
|
+
this.trimLeft = false;
|
|
942
|
+
this.trimRight = false;
|
|
943
|
+
const tl = input[contentBegin] === '-';
|
|
944
|
+
const tr = input[contentEnd - 1] === '-';
|
|
945
|
+
let l = tl ? contentBegin + 1 : contentBegin;
|
|
946
|
+
let r = tr ? contentEnd - 1 : contentEnd;
|
|
947
|
+
while (l < r && (TYPES[input.charCodeAt(l)] & BLANK))
|
|
948
|
+
l++;
|
|
949
|
+
while (r > l && (TYPES[input.charCodeAt(r - 1)] & BLANK))
|
|
950
|
+
r--;
|
|
951
|
+
this.contentRange = [l, r];
|
|
952
|
+
this.trimLeft = tl || trimLeft;
|
|
953
|
+
this.trimRight = tr || trimRight;
|
|
954
|
+
}
|
|
955
|
+
get content() {
|
|
956
|
+
return this.input.slice(this.contentRange[0], this.contentRange[1]);
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
class TagToken extends DelimitedToken {
|
|
961
|
+
constructor(input, begin, end, options, file) {
|
|
962
|
+
const { trimTagLeft, trimTagRight, tagDelimiterLeft, tagDelimiterRight } = options;
|
|
963
|
+
const [valueBegin, valueEnd] = [begin + tagDelimiterLeft.length, end - tagDelimiterRight.length];
|
|
964
|
+
super(exports.TokenKind.Tag, [valueBegin, valueEnd], input, begin, end, trimTagLeft, trimTagRight, file);
|
|
965
|
+
this.tokenizer = new Tokenizer(input, options.operators, file, this.contentRange);
|
|
966
|
+
this.name = this.tokenizer.readTagName();
|
|
967
|
+
this.tokenizer.assert(this.name, `illegal tag syntax, tag name expected`);
|
|
968
|
+
this.tokenizer.skipBlank();
|
|
969
|
+
this.args = this.tokenizer.input.slice(this.tokenizer.p, this.contentRange[1]);
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
class OutputToken extends DelimitedToken {
|
|
974
|
+
constructor(input, begin, end, options, file) {
|
|
975
|
+
const { trimOutputLeft, trimOutputRight, outputDelimiterLeft, outputDelimiterRight } = options;
|
|
976
|
+
const valueRange = [begin + outputDelimiterLeft.length, end - outputDelimiterRight.length];
|
|
977
|
+
super(exports.TokenKind.Output, valueRange, input, begin, end, trimOutputLeft, trimOutputRight, file);
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
class HTMLToken extends Token {
|
|
982
|
+
constructor(input, begin, end, file) {
|
|
983
|
+
super(exports.TokenKind.HTML, input, begin, end, file);
|
|
984
|
+
this.input = input;
|
|
985
|
+
this.begin = begin;
|
|
986
|
+
this.end = end;
|
|
987
|
+
this.file = file;
|
|
988
|
+
this.trimLeft = 0;
|
|
989
|
+
this.trimRight = 0;
|
|
990
|
+
}
|
|
991
|
+
getContent() {
|
|
992
|
+
return this.input.slice(this.begin + this.trimLeft, this.end - this.trimRight);
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
class NumberToken extends Token {
|
|
997
|
+
constructor(input, begin, end, file) {
|
|
998
|
+
super(exports.TokenKind.Number, input, begin, end, file);
|
|
999
|
+
this.input = input;
|
|
1000
|
+
this.begin = begin;
|
|
1001
|
+
this.end = end;
|
|
1002
|
+
this.file = file;
|
|
1003
|
+
this.content = Number(this.getText());
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
class IdentifierToken extends Token {
|
|
1008
|
+
constructor(input, begin, end, file) {
|
|
1009
|
+
super(exports.TokenKind.Word, input, begin, end, file);
|
|
1010
|
+
this.input = input;
|
|
1011
|
+
this.begin = begin;
|
|
1012
|
+
this.end = end;
|
|
1013
|
+
this.file = file;
|
|
1014
|
+
this.content = this.getText();
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
class LiteralToken extends Token {
|
|
1019
|
+
constructor(input, begin, end, file) {
|
|
1020
|
+
super(exports.TokenKind.Literal, input, begin, end, file);
|
|
1021
|
+
this.input = input;
|
|
1022
|
+
this.begin = begin;
|
|
1023
|
+
this.end = end;
|
|
1024
|
+
this.file = file;
|
|
1025
|
+
this.literal = this.getText();
|
|
1026
|
+
this.content = literalValues[this.literal];
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
const operatorPrecedences = {
|
|
1031
|
+
'==': 2,
|
|
1032
|
+
'!=': 2,
|
|
1033
|
+
'>': 2,
|
|
1034
|
+
'<': 2,
|
|
1035
|
+
'>=': 2,
|
|
1036
|
+
'<=': 2,
|
|
1037
|
+
'contains': 2,
|
|
1038
|
+
'not': 1,
|
|
1039
|
+
'and': 0,
|
|
1040
|
+
'or': 0
|
|
1041
|
+
};
|
|
1042
|
+
const operatorTypes = {
|
|
1043
|
+
'==': 0 /* OperatorType.Binary */,
|
|
1044
|
+
'!=': 0 /* OperatorType.Binary */,
|
|
1045
|
+
'>': 0 /* OperatorType.Binary */,
|
|
1046
|
+
'<': 0 /* OperatorType.Binary */,
|
|
1047
|
+
'>=': 0 /* OperatorType.Binary */,
|
|
1048
|
+
'<=': 0 /* OperatorType.Binary */,
|
|
1049
|
+
'contains': 0 /* OperatorType.Binary */,
|
|
1050
|
+
'not': 1 /* OperatorType.Unary */,
|
|
1051
|
+
'and': 0 /* OperatorType.Binary */,
|
|
1052
|
+
'or': 0 /* OperatorType.Binary */
|
|
1053
|
+
};
|
|
1054
|
+
class OperatorToken extends Token {
|
|
1055
|
+
constructor(input, begin, end, file) {
|
|
1056
|
+
super(exports.TokenKind.Operator, input, begin, end, file);
|
|
1057
|
+
this.input = input;
|
|
1058
|
+
this.begin = begin;
|
|
1059
|
+
this.end = end;
|
|
1060
|
+
this.file = file;
|
|
1061
|
+
this.operator = this.getText();
|
|
1062
|
+
}
|
|
1063
|
+
getPrecedence() {
|
|
1064
|
+
const key = this.getText();
|
|
1065
|
+
return key in operatorPrecedences ? operatorPrecedences[key] : 1;
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
class PropertyAccessToken extends Token {
|
|
1070
|
+
constructor(variable, props, input, begin, end, file) {
|
|
1071
|
+
super(exports.TokenKind.PropertyAccess, input, begin, end, file);
|
|
1072
|
+
this.variable = variable;
|
|
1073
|
+
this.props = props;
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
class FilterToken extends Token {
|
|
1078
|
+
constructor(name, args, input, begin, end, file) {
|
|
1079
|
+
super(exports.TokenKind.Filter, input, begin, end, file);
|
|
1080
|
+
this.name = name;
|
|
1081
|
+
this.args = args;
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
class HashToken extends Token {
|
|
1086
|
+
constructor(input, begin, end, name, value, file) {
|
|
1087
|
+
super(exports.TokenKind.Hash, input, begin, end, file);
|
|
1088
|
+
this.input = input;
|
|
1089
|
+
this.begin = begin;
|
|
1090
|
+
this.end = end;
|
|
1091
|
+
this.name = name;
|
|
1092
|
+
this.value = value;
|
|
1093
|
+
this.file = file;
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
const rHex = /[\da-fA-F]/;
|
|
1098
|
+
const rOct = /[0-7]/;
|
|
1099
|
+
const escapeChar = {
|
|
1100
|
+
b: '\b',
|
|
1101
|
+
f: '\f',
|
|
1102
|
+
n: '\n',
|
|
1103
|
+
r: '\r',
|
|
1104
|
+
t: '\t',
|
|
1105
|
+
v: '\x0B'
|
|
1106
|
+
};
|
|
1107
|
+
function hexVal(c) {
|
|
1108
|
+
const code = c.charCodeAt(0);
|
|
1109
|
+
if (code >= 97)
|
|
1110
|
+
return code - 87;
|
|
1111
|
+
if (code >= 65)
|
|
1112
|
+
return code - 55;
|
|
1113
|
+
return code - 48;
|
|
1114
|
+
}
|
|
1115
|
+
function parseStringLiteral(str) {
|
|
1116
|
+
let ret = '';
|
|
1117
|
+
for (let i = 1; i < str.length - 1; i++) {
|
|
1118
|
+
if (str[i] !== '\\') {
|
|
1119
|
+
ret += str[i];
|
|
1120
|
+
continue;
|
|
1121
|
+
}
|
|
1122
|
+
if (escapeChar[str[i + 1]] !== undefined) {
|
|
1123
|
+
ret += escapeChar[str[++i]];
|
|
1124
|
+
}
|
|
1125
|
+
else if (str[i + 1] === 'u') {
|
|
1126
|
+
let val = 0;
|
|
1127
|
+
let j = i + 2;
|
|
1128
|
+
while (j <= i + 5 && rHex.test(str[j])) {
|
|
1129
|
+
val = val * 16 + hexVal(str[j++]);
|
|
1130
|
+
}
|
|
1131
|
+
i = j - 1;
|
|
1132
|
+
ret += String.fromCharCode(val);
|
|
1133
|
+
}
|
|
1134
|
+
else if (!rOct.test(str[i + 1])) {
|
|
1135
|
+
ret += str[++i];
|
|
1136
|
+
}
|
|
1137
|
+
else {
|
|
1138
|
+
let j = i + 1;
|
|
1139
|
+
let val = 0;
|
|
1140
|
+
while (j <= i + 3 && rOct.test(str[j])) {
|
|
1141
|
+
val = val * 8 + hexVal(str[j++]);
|
|
1142
|
+
}
|
|
1143
|
+
i = j - 1;
|
|
1144
|
+
ret += String.fromCharCode(val);
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
return ret;
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
class QuotedToken extends Token {
|
|
1151
|
+
constructor(input, begin, end, file) {
|
|
1152
|
+
super(exports.TokenKind.Quoted, input, begin, end, file);
|
|
1153
|
+
this.input = input;
|
|
1154
|
+
this.begin = begin;
|
|
1155
|
+
this.end = end;
|
|
1156
|
+
this.file = file;
|
|
1157
|
+
this.content = parseStringLiteral(this.getText());
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
class RangeToken extends Token {
|
|
1162
|
+
constructor(input, begin, end, lhs, rhs, file) {
|
|
1163
|
+
super(exports.TokenKind.Range, input, begin, end, file);
|
|
1164
|
+
this.input = input;
|
|
1165
|
+
this.begin = begin;
|
|
1166
|
+
this.end = end;
|
|
1167
|
+
this.lhs = lhs;
|
|
1168
|
+
this.rhs = rhs;
|
|
1169
|
+
this.file = file;
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
/**
|
|
1174
|
+
* LiquidTagToken is different from TagToken by not having delimiters `{%` or `%}`
|
|
1175
|
+
*/
|
|
1176
|
+
class LiquidTagToken extends DelimitedToken {
|
|
1177
|
+
constructor(input, begin, end, options, file) {
|
|
1178
|
+
super(exports.TokenKind.Tag, [begin, end], input, begin, end, false, false, file);
|
|
1179
|
+
this.tokenizer = new Tokenizer(input, options.operators, file, this.contentRange);
|
|
1180
|
+
this.name = this.tokenizer.readTagName();
|
|
1181
|
+
this.tokenizer.assert(this.name, 'illegal liquid tag syntax');
|
|
1182
|
+
this.tokenizer.skipBlank();
|
|
1183
|
+
}
|
|
1184
|
+
get args() {
|
|
1185
|
+
return this.tokenizer.input.slice(this.tokenizer.p, this.contentRange[1]);
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
/**
|
|
1190
|
+
* value expression with optional filters
|
|
1191
|
+
* e.g.
|
|
1192
|
+
* {% assign foo="bar" | append: "coo" %}
|
|
1193
|
+
*/
|
|
1194
|
+
class FilteredValueToken extends Token {
|
|
1195
|
+
constructor(initial, filters, input, begin, end, file) {
|
|
1196
|
+
super(exports.TokenKind.FilteredValue, input, begin, end, file);
|
|
1197
|
+
this.initial = initial;
|
|
1198
|
+
this.filters = filters;
|
|
1199
|
+
this.input = input;
|
|
1200
|
+
this.begin = begin;
|
|
1201
|
+
this.end = end;
|
|
1202
|
+
this.file = file;
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
const polyfill = {
|
|
1207
|
+
now: () => Date.now()
|
|
1208
|
+
};
|
|
1209
|
+
function getPerformance() {
|
|
1210
|
+
return (typeof global === 'object' && global.performance) ||
|
|
1211
|
+
(typeof window === 'object' && window.performance) ||
|
|
1212
|
+
polyfill;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
class Render {
|
|
1216
|
+
renderTemplatesToNodeStream(templates, ctx) {
|
|
1217
|
+
const emitter = new StreamedEmitter();
|
|
1218
|
+
Promise.resolve().then(() => toPromise(this.renderTemplates(templates, ctx, emitter)))
|
|
1219
|
+
.then(() => emitter.end(), err => emitter.error(err));
|
|
1220
|
+
return emitter.stream;
|
|
1221
|
+
}
|
|
1222
|
+
*renderTemplates(templates, ctx, emitter) {
|
|
1223
|
+
if (!emitter) {
|
|
1224
|
+
emitter = ctx.opts.keepOutputType ? new KeepingTypeEmitter() : new SimpleEmitter();
|
|
1225
|
+
}
|
|
1226
|
+
const errors = [];
|
|
1227
|
+
for (const tpl of templates) {
|
|
1228
|
+
ctx.renderLimit.check(getPerformance().now());
|
|
1229
|
+
try {
|
|
1230
|
+
// if tpl.render supports emitter, it'll return empty `html`
|
|
1231
|
+
const html = yield tpl.render(ctx, emitter);
|
|
1232
|
+
// if not, it'll return an `html`, write to the emitter for it
|
|
1233
|
+
html && emitter.write(html);
|
|
1234
|
+
if (ctx.breakCalled || ctx.continueCalled)
|
|
1235
|
+
break;
|
|
1236
|
+
}
|
|
1237
|
+
catch (e) {
|
|
1238
|
+
const err = LiquidError.is(e) ? e : new RenderError(e, tpl);
|
|
1239
|
+
if (ctx.opts.catchAllErrors)
|
|
1240
|
+
errors.push(err);
|
|
1241
|
+
else
|
|
1242
|
+
throw err;
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
if (errors.length) {
|
|
1246
|
+
throw new LiquidErrors(errors);
|
|
1247
|
+
}
|
|
1248
|
+
return emitter.buffer;
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
class Expression {
|
|
1253
|
+
constructor(tokens) {
|
|
1254
|
+
this.postfix = [...toPostfix(tokens)];
|
|
1255
|
+
}
|
|
1256
|
+
*evaluate(ctx, lenient) {
|
|
1257
|
+
assert(ctx, 'unable to evaluate: context not defined');
|
|
1258
|
+
const operands = [];
|
|
1259
|
+
for (const token of this.postfix) {
|
|
1260
|
+
if (isOperatorToken(token)) {
|
|
1261
|
+
const r = operands.pop();
|
|
1262
|
+
let result;
|
|
1263
|
+
if (operatorTypes[token.operator] === 1 /* OperatorType.Unary */) {
|
|
1264
|
+
result = yield ctx.opts.operators[token.operator](r, ctx);
|
|
1265
|
+
}
|
|
1266
|
+
else {
|
|
1267
|
+
const l = operands.pop();
|
|
1268
|
+
result = yield ctx.opts.operators[token.operator](l, r, ctx);
|
|
1269
|
+
}
|
|
1270
|
+
operands.push(result);
|
|
1271
|
+
}
|
|
1272
|
+
else {
|
|
1273
|
+
operands.push(yield evalToken(token, ctx, lenient));
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
return operands[0];
|
|
1277
|
+
}
|
|
1278
|
+
valid() {
|
|
1279
|
+
return !!this.postfix.length;
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
function* evalToken(token, ctx, lenient = false) {
|
|
1283
|
+
if (!token)
|
|
1284
|
+
return;
|
|
1285
|
+
if ('content' in token)
|
|
1286
|
+
return token.content;
|
|
1287
|
+
if (isPropertyAccessToken(token))
|
|
1288
|
+
return yield evalPropertyAccessToken(token, ctx, lenient);
|
|
1289
|
+
if (isRangeToken(token))
|
|
1290
|
+
return yield evalRangeToken(token, ctx);
|
|
1291
|
+
}
|
|
1292
|
+
function* evalPropertyAccessToken(token, ctx, lenient) {
|
|
1293
|
+
const props = [];
|
|
1294
|
+
for (const prop of token.props) {
|
|
1295
|
+
props.push((yield evalToken(prop, ctx, false)));
|
|
1296
|
+
}
|
|
1297
|
+
try {
|
|
1298
|
+
if (token.variable) {
|
|
1299
|
+
const variable = yield evalToken(token.variable, ctx, lenient);
|
|
1300
|
+
return yield ctx._getFromScope(variable, props);
|
|
1301
|
+
}
|
|
1302
|
+
else {
|
|
1303
|
+
return yield ctx._get(props);
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
catch (e) {
|
|
1307
|
+
if (lenient && e.name === 'InternalUndefinedVariableError')
|
|
1308
|
+
return null;
|
|
1309
|
+
throw (new UndefinedVariableError(e, token));
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
function evalQuotedToken(token) {
|
|
1313
|
+
return token.content;
|
|
1314
|
+
}
|
|
1315
|
+
function* evalRangeToken(token, ctx) {
|
|
1316
|
+
const low = yield evalToken(token.lhs, ctx);
|
|
1317
|
+
const high = yield evalToken(token.rhs, ctx);
|
|
1318
|
+
ctx.memoryLimit.use(high - low + 1);
|
|
1319
|
+
return range(+low, +high + 1);
|
|
1320
|
+
}
|
|
1321
|
+
function* toPostfix(tokens) {
|
|
1322
|
+
const ops = [];
|
|
1323
|
+
for (const token of tokens) {
|
|
1324
|
+
if (isOperatorToken(token)) {
|
|
1325
|
+
while (ops.length && ops[ops.length - 1].getPrecedence() > token.getPrecedence()) {
|
|
1326
|
+
yield ops.pop();
|
|
1327
|
+
}
|
|
1328
|
+
ops.push(token);
|
|
1329
|
+
}
|
|
1330
|
+
else
|
|
1331
|
+
yield token;
|
|
1332
|
+
}
|
|
1333
|
+
while (ops.length) {
|
|
1334
|
+
yield ops.pop();
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
function isTruthy(val, ctx) {
|
|
1339
|
+
return !isFalsy(val, ctx);
|
|
1340
|
+
}
|
|
1341
|
+
function isFalsy(val, ctx) {
|
|
1342
|
+
val = toValue(val);
|
|
1343
|
+
if (ctx.opts.jsTruthy) {
|
|
1344
|
+
return !val;
|
|
1345
|
+
}
|
|
1346
|
+
else {
|
|
1347
|
+
return val === false || undefined === val || val === null;
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
const defaultOperators = {
|
|
1352
|
+
'==': equals,
|
|
1353
|
+
'!=': (l, r) => !equals(l, r),
|
|
1354
|
+
'>': (l, r) => {
|
|
1355
|
+
if (isComparable(l))
|
|
1356
|
+
return l.gt(r);
|
|
1357
|
+
if (isComparable(r))
|
|
1358
|
+
return r.lt(l);
|
|
1359
|
+
return toValue(l) > toValue(r);
|
|
1360
|
+
},
|
|
1361
|
+
'<': (l, r) => {
|
|
1362
|
+
if (isComparable(l))
|
|
1363
|
+
return l.lt(r);
|
|
1364
|
+
if (isComparable(r))
|
|
1365
|
+
return r.gt(l);
|
|
1366
|
+
return toValue(l) < toValue(r);
|
|
1367
|
+
},
|
|
1368
|
+
'>=': (l, r) => {
|
|
1369
|
+
if (isComparable(l))
|
|
1370
|
+
return l.geq(r);
|
|
1371
|
+
if (isComparable(r))
|
|
1372
|
+
return r.leq(l);
|
|
1373
|
+
return toValue(l) >= toValue(r);
|
|
1374
|
+
},
|
|
1375
|
+
'<=': (l, r) => {
|
|
1376
|
+
if (isComparable(l))
|
|
1377
|
+
return l.leq(r);
|
|
1378
|
+
if (isComparable(r))
|
|
1379
|
+
return r.geq(l);
|
|
1380
|
+
return toValue(l) <= toValue(r);
|
|
1381
|
+
},
|
|
1382
|
+
'contains': (l, r) => {
|
|
1383
|
+
l = toValue(l);
|
|
1384
|
+
if (isArray(l))
|
|
1385
|
+
return l.some((i) => equals(i, r));
|
|
1386
|
+
if (isFunction(l?.indexOf))
|
|
1387
|
+
return l.indexOf(toValue(r)) > -1;
|
|
1388
|
+
return false;
|
|
1389
|
+
},
|
|
1390
|
+
'not': (v, ctx) => isFalsy(toValue(v), ctx),
|
|
1391
|
+
'and': (l, r, ctx) => isTruthy(toValue(l), ctx) && isTruthy(toValue(r), ctx),
|
|
1392
|
+
'or': (l, r, ctx) => isTruthy(toValue(l), ctx) || isTruthy(toValue(r), ctx)
|
|
1393
|
+
};
|
|
1394
|
+
function equals(lhs, rhs) {
|
|
1395
|
+
if (isComparable(lhs))
|
|
1396
|
+
return lhs.equals(rhs);
|
|
1397
|
+
if (isComparable(rhs))
|
|
1398
|
+
return rhs.equals(lhs);
|
|
1399
|
+
lhs = toValue(lhs);
|
|
1400
|
+
rhs = toValue(rhs);
|
|
1401
|
+
if (isArray(lhs)) {
|
|
1402
|
+
return isArray(rhs) && arrayEquals(lhs, rhs);
|
|
1403
|
+
}
|
|
1404
|
+
return lhs === rhs;
|
|
1405
|
+
}
|
|
1406
|
+
function arrayEquals(lhs, rhs) {
|
|
1407
|
+
if (lhs.length !== rhs.length)
|
|
1408
|
+
return false;
|
|
1409
|
+
return !lhs.some((value, i) => !equals(value, rhs[i]));
|
|
1410
|
+
}
|
|
1411
|
+
function arrayIncludes(arr, item) {
|
|
1412
|
+
return arr.some(value => equals(value, item));
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
class Node {
|
|
1416
|
+
constructor(key, value, next, prev) {
|
|
1417
|
+
this.key = key;
|
|
1418
|
+
this.value = value;
|
|
1419
|
+
this.next = next;
|
|
1420
|
+
this.prev = prev;
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
class LRU {
|
|
1424
|
+
constructor(limit, size = 0) {
|
|
1425
|
+
this.limit = limit;
|
|
1426
|
+
this.size = size;
|
|
1427
|
+
this.cache = {};
|
|
1428
|
+
this.head = new Node('HEAD', null, null, null);
|
|
1429
|
+
this.tail = new Node('TAIL', null, null, null);
|
|
1430
|
+
this.head.next = this.tail;
|
|
1431
|
+
this.tail.prev = this.head;
|
|
1432
|
+
}
|
|
1433
|
+
write(key, value) {
|
|
1434
|
+
if (this.cache[key]) {
|
|
1435
|
+
this.cache[key].value = value;
|
|
1436
|
+
}
|
|
1437
|
+
else {
|
|
1438
|
+
const node = new Node(key, value, this.head.next, this.head);
|
|
1439
|
+
this.head.next.prev = node;
|
|
1440
|
+
this.head.next = node;
|
|
1441
|
+
this.cache[key] = node;
|
|
1442
|
+
this.size++;
|
|
1443
|
+
this.ensureLimit();
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
read(key) {
|
|
1447
|
+
if (!this.cache[key])
|
|
1448
|
+
return;
|
|
1449
|
+
const { value } = this.cache[key];
|
|
1450
|
+
this.remove(key);
|
|
1451
|
+
this.write(key, value);
|
|
1452
|
+
return value;
|
|
1453
|
+
}
|
|
1454
|
+
remove(key) {
|
|
1455
|
+
const node = this.cache[key];
|
|
1456
|
+
node.prev.next = node.next;
|
|
1457
|
+
node.next.prev = node.prev;
|
|
1458
|
+
delete this.cache[key];
|
|
1459
|
+
this.size--;
|
|
1460
|
+
}
|
|
1461
|
+
clear() {
|
|
1462
|
+
this.head.next = this.tail;
|
|
1463
|
+
this.tail.prev = this.head;
|
|
1464
|
+
this.size = 0;
|
|
1465
|
+
this.cache = {};
|
|
1466
|
+
}
|
|
1467
|
+
ensureLimit() {
|
|
1468
|
+
if (this.size > this.limit)
|
|
1469
|
+
this.remove(this.tail.prev.key);
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1473
|
+
const requireResolve = (partial) => require.resolve(partial, { paths: ['.'] });
|
|
1474
|
+
|
|
1475
|
+
const statAsync = promisify(fs$1.stat);
|
|
1476
|
+
const readFileAsync = promisify(fs$1.readFile);
|
|
1477
|
+
async function exists(filepath) {
|
|
1478
|
+
try {
|
|
1479
|
+
await statAsync(filepath);
|
|
1480
|
+
return true;
|
|
1481
|
+
}
|
|
1482
|
+
catch (err) {
|
|
1483
|
+
return false;
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
function readFile(filepath) {
|
|
1487
|
+
return readFileAsync(filepath, 'utf8');
|
|
1488
|
+
}
|
|
1489
|
+
function existsSync(filepath) {
|
|
1490
|
+
try {
|
|
1491
|
+
fs$1.statSync(filepath);
|
|
1492
|
+
return true;
|
|
1493
|
+
}
|
|
1494
|
+
catch (err) {
|
|
1495
|
+
return false;
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
function readFileSync(filepath) {
|
|
1499
|
+
return fs$1.readFileSync(filepath, 'utf8');
|
|
1500
|
+
}
|
|
1501
|
+
function resolve(root, file, ext) {
|
|
1502
|
+
if (!path.extname(file))
|
|
1503
|
+
file += ext;
|
|
1504
|
+
return path.resolve(root, file);
|
|
1505
|
+
}
|
|
1506
|
+
function fallback(file) {
|
|
1507
|
+
try {
|
|
1508
|
+
return requireResolve(file);
|
|
1509
|
+
}
|
|
1510
|
+
catch (e) { }
|
|
1511
|
+
}
|
|
1512
|
+
function dirname(filepath) {
|
|
1513
|
+
return path.dirname(filepath);
|
|
1514
|
+
}
|
|
1515
|
+
function contains(root, file) {
|
|
1516
|
+
root = path.resolve(root);
|
|
1517
|
+
root = root.endsWith(path.sep) ? root : root + path.sep;
|
|
1518
|
+
return file.startsWith(root);
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
var fs = /*#__PURE__*/Object.freeze({
|
|
1522
|
+
__proto__: null,
|
|
1523
|
+
exists: exists,
|
|
1524
|
+
readFile: readFile,
|
|
1525
|
+
existsSync: existsSync,
|
|
1526
|
+
readFileSync: readFileSync,
|
|
1527
|
+
resolve: resolve,
|
|
1528
|
+
fallback: fallback,
|
|
1529
|
+
dirname: dirname,
|
|
1530
|
+
contains: contains,
|
|
1531
|
+
sep: path.sep
|
|
1532
|
+
});
|
|
1533
|
+
|
|
1534
|
+
function defaultFilter(value, defaultValue, ...args) {
|
|
1535
|
+
value = toValue(value);
|
|
1536
|
+
if (isArray(value) || isString(value))
|
|
1537
|
+
return value.length ? value : defaultValue;
|
|
1538
|
+
if (value === false && (new Map(args)).get('allow_false'))
|
|
1539
|
+
return false;
|
|
1540
|
+
return isFalsy(value, this.context) ? defaultValue : value;
|
|
1541
|
+
}
|
|
1542
|
+
function json(value, space = 0) {
|
|
1543
|
+
return JSON.stringify(value, null, space);
|
|
1544
|
+
}
|
|
1545
|
+
function inspect(value, space = 0) {
|
|
1546
|
+
const ancestors = [];
|
|
1547
|
+
return JSON.stringify(value, function (_key, value) {
|
|
1548
|
+
if (typeof value !== 'object' || value === null)
|
|
1549
|
+
return value;
|
|
1550
|
+
// `this` is the object that value is contained in, i.e., its direct parent.
|
|
1551
|
+
while (ancestors.length > 0 && ancestors[ancestors.length - 1] !== this)
|
|
1552
|
+
ancestors.pop();
|
|
1553
|
+
if (ancestors.includes(value))
|
|
1554
|
+
return '[Circular]';
|
|
1555
|
+
ancestors.push(value);
|
|
1556
|
+
return value;
|
|
1557
|
+
}, space);
|
|
1558
|
+
}
|
|
1559
|
+
function to_integer(value) {
|
|
1560
|
+
return Number(value);
|
|
1561
|
+
}
|
|
1562
|
+
const raw = {
|
|
1563
|
+
raw: true,
|
|
1564
|
+
handler: identify
|
|
1565
|
+
};
|
|
1566
|
+
var misc = {
|
|
1567
|
+
default: defaultFilter,
|
|
1568
|
+
raw,
|
|
1569
|
+
jsonify: json,
|
|
1570
|
+
to_integer,
|
|
1571
|
+
json,
|
|
1572
|
+
inspect
|
|
1573
|
+
};
|
|
1574
|
+
|
|
1575
|
+
const escapeMap = {
|
|
1576
|
+
'&': '&',
|
|
1577
|
+
'<': '<',
|
|
1578
|
+
'>': '>',
|
|
1579
|
+
'"': '"',
|
|
1580
|
+
"'": '''
|
|
1581
|
+
};
|
|
1582
|
+
const unescapeMap = {
|
|
1583
|
+
'&': '&',
|
|
1584
|
+
'<': '<',
|
|
1585
|
+
'>': '>',
|
|
1586
|
+
'"': '"',
|
|
1587
|
+
''': "'"
|
|
1588
|
+
};
|
|
1589
|
+
function escape(str) {
|
|
1590
|
+
str = stringify(str);
|
|
1591
|
+
this.context.memoryLimit.use(str.length);
|
|
1592
|
+
return str.replace(/&|<|>|"|'/g, m => escapeMap[m]);
|
|
1593
|
+
}
|
|
1594
|
+
function xml_escape(str) {
|
|
1595
|
+
return escape.call(this, str);
|
|
1596
|
+
}
|
|
1597
|
+
function unescape(str) {
|
|
1598
|
+
str = stringify(str);
|
|
1599
|
+
this.context.memoryLimit.use(str.length);
|
|
1600
|
+
return str.replace(/&(amp|lt|gt|#34|#39);/g, m => unescapeMap[m]);
|
|
1601
|
+
}
|
|
1602
|
+
function escape_once(str) {
|
|
1603
|
+
return escape.call(this, unescape.call(this, str));
|
|
1604
|
+
}
|
|
1605
|
+
function newline_to_br(v) {
|
|
1606
|
+
const str = stringify(v);
|
|
1607
|
+
this.context.memoryLimit.use(str.length);
|
|
1608
|
+
return str.replace(/\r?\n/gm, '<br />\n');
|
|
1609
|
+
}
|
|
1610
|
+
function strip_html(v) {
|
|
1611
|
+
const str = stringify(v);
|
|
1612
|
+
this.context.memoryLimit.use(str.length);
|
|
1613
|
+
return str.replace(/<script[\s\S]*?<\/script>|<style[\s\S]*?<\/style>|<.*?>|<!--[\s\S]*?-->/g, '');
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
var htmlFilters = /*#__PURE__*/Object.freeze({
|
|
1617
|
+
__proto__: null,
|
|
1618
|
+
escape: escape,
|
|
1619
|
+
xml_escape: xml_escape,
|
|
1620
|
+
escape_once: escape_once,
|
|
1621
|
+
newline_to_br: newline_to_br,
|
|
1622
|
+
strip_html: strip_html
|
|
1623
|
+
});
|
|
1624
|
+
|
|
1625
|
+
class MapFS {
|
|
1626
|
+
constructor(mapping) {
|
|
1627
|
+
this.mapping = mapping;
|
|
1628
|
+
this.sep = '/';
|
|
1629
|
+
}
|
|
1630
|
+
async exists(filepath) {
|
|
1631
|
+
return this.existsSync(filepath);
|
|
1632
|
+
}
|
|
1633
|
+
existsSync(filepath) {
|
|
1634
|
+
return !isNil(this.mapping[filepath]);
|
|
1635
|
+
}
|
|
1636
|
+
async readFile(filepath) {
|
|
1637
|
+
return this.readFileSync(filepath);
|
|
1638
|
+
}
|
|
1639
|
+
readFileSync(filepath) {
|
|
1640
|
+
const content = this.mapping[filepath];
|
|
1641
|
+
if (isNil(content))
|
|
1642
|
+
throw new Error(`ENOENT: ${filepath}`);
|
|
1643
|
+
return content;
|
|
1644
|
+
}
|
|
1645
|
+
dirname(filepath) {
|
|
1646
|
+
const segments = filepath.split(this.sep);
|
|
1647
|
+
segments.pop();
|
|
1648
|
+
return segments.join(this.sep);
|
|
1649
|
+
}
|
|
1650
|
+
resolve(dir, file, ext) {
|
|
1651
|
+
file += ext;
|
|
1652
|
+
if (dir === '.')
|
|
1653
|
+
return file;
|
|
1654
|
+
const segments = dir.split(/\/+/);
|
|
1655
|
+
for (const segment of file.split(this.sep)) {
|
|
1656
|
+
if (segment === '.' || segment === '')
|
|
1657
|
+
continue;
|
|
1658
|
+
else if (segment === '..') {
|
|
1659
|
+
if (segments.length > 1 || segments[0] !== '')
|
|
1660
|
+
segments.pop();
|
|
1661
|
+
}
|
|
1662
|
+
else
|
|
1663
|
+
segments.push(segment);
|
|
1664
|
+
}
|
|
1665
|
+
return segments.join(this.sep);
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
const defaultOptions = {
|
|
1670
|
+
root: ['.'],
|
|
1671
|
+
layouts: ['.'],
|
|
1672
|
+
partials: ['.'],
|
|
1673
|
+
relativeReference: true,
|
|
1674
|
+
jekyllInclude: false,
|
|
1675
|
+
keyValueSeparator: ':',
|
|
1676
|
+
cache: undefined,
|
|
1677
|
+
extname: '',
|
|
1678
|
+
fs: fs,
|
|
1679
|
+
dynamicPartials: true,
|
|
1680
|
+
jsTruthy: false,
|
|
1681
|
+
dateFormat: '%A, %B %-e, %Y at %-l:%M %P %z',
|
|
1682
|
+
locale: '',
|
|
1683
|
+
trimTagRight: false,
|
|
1684
|
+
trimTagLeft: false,
|
|
1685
|
+
trimOutputRight: false,
|
|
1686
|
+
trimOutputLeft: false,
|
|
1687
|
+
greedy: true,
|
|
1688
|
+
tagDelimiterLeft: '{%',
|
|
1689
|
+
tagDelimiterRight: '%}',
|
|
1690
|
+
outputDelimiterLeft: '{{',
|
|
1691
|
+
outputDelimiterRight: '}}',
|
|
1692
|
+
preserveTimezones: false,
|
|
1693
|
+
strictFilters: false,
|
|
1694
|
+
strictVariables: false,
|
|
1695
|
+
ownPropertyOnly: true,
|
|
1696
|
+
lenientIf: false,
|
|
1697
|
+
globals: {},
|
|
1698
|
+
keepOutputType: false,
|
|
1699
|
+
operators: defaultOperators,
|
|
1700
|
+
memoryLimit: Infinity,
|
|
1701
|
+
parseLimit: Infinity,
|
|
1702
|
+
renderLimit: Infinity
|
|
1703
|
+
};
|
|
1704
|
+
function normalize(options) {
|
|
1705
|
+
if (options.hasOwnProperty('root')) {
|
|
1706
|
+
if (!options.hasOwnProperty('partials'))
|
|
1707
|
+
options.partials = options.root;
|
|
1708
|
+
if (!options.hasOwnProperty('layouts'))
|
|
1709
|
+
options.layouts = options.root;
|
|
1710
|
+
}
|
|
1711
|
+
if (options.hasOwnProperty('cache')) {
|
|
1712
|
+
let cache;
|
|
1713
|
+
if (typeof options.cache === 'number')
|
|
1714
|
+
cache = options.cache > 0 ? new LRU(options.cache) : undefined;
|
|
1715
|
+
else if (typeof options.cache === 'object')
|
|
1716
|
+
cache = options.cache;
|
|
1717
|
+
else
|
|
1718
|
+
cache = options.cache ? new LRU(1024) : undefined;
|
|
1719
|
+
options.cache = cache;
|
|
1720
|
+
}
|
|
1721
|
+
options = { ...defaultOptions, ...(options.jekyllInclude ? { dynamicPartials: false } : {}), ...options };
|
|
1722
|
+
if ((!options.fs.dirname || !options.fs.sep) && options.relativeReference) {
|
|
1723
|
+
console.warn('[LiquidJS] `fs.dirname` and `fs.sep` are required for relativeReference, set relativeReference to `false` to suppress this warning');
|
|
1724
|
+
options.relativeReference = false;
|
|
1725
|
+
}
|
|
1726
|
+
options.root = normalizeDirectoryList(options.root);
|
|
1727
|
+
options.partials = normalizeDirectoryList(options.partials);
|
|
1728
|
+
options.layouts = normalizeDirectoryList(options.layouts);
|
|
1729
|
+
options.outputEscape = options.outputEscape && getOutputEscapeFunction(options.outputEscape);
|
|
1730
|
+
if (!options.locale) {
|
|
1731
|
+
options.locale = getDateTimeFormat()?.().resolvedOptions().locale ?? 'en-US';
|
|
1732
|
+
}
|
|
1733
|
+
if (options.templates) {
|
|
1734
|
+
options.fs = new MapFS(options.templates);
|
|
1735
|
+
options.relativeReference = true;
|
|
1736
|
+
options.root = options.partials = options.layouts = '.';
|
|
1737
|
+
}
|
|
1738
|
+
return options;
|
|
1739
|
+
}
|
|
1740
|
+
function getOutputEscapeFunction(nameOrFunction) {
|
|
1741
|
+
if (nameOrFunction === 'escape')
|
|
1742
|
+
return escape;
|
|
1743
|
+
if (nameOrFunction === 'json')
|
|
1744
|
+
return misc.json;
|
|
1745
|
+
assert(isFunction(nameOrFunction), '`outputEscape` need to be of type string or function');
|
|
1746
|
+
return nameOrFunction;
|
|
1747
|
+
}
|
|
1748
|
+
function normalizeDirectoryList(value) {
|
|
1749
|
+
let list = [];
|
|
1750
|
+
if (isArray(value))
|
|
1751
|
+
list = value;
|
|
1752
|
+
if (isString(value))
|
|
1753
|
+
list = [value];
|
|
1754
|
+
return list;
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
function whiteSpaceCtrl(tokens, options) {
|
|
1758
|
+
let inRaw = false;
|
|
1759
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
1760
|
+
const token = tokens[i];
|
|
1761
|
+
if (!isDelimitedToken(token))
|
|
1762
|
+
continue;
|
|
1763
|
+
if (!inRaw && token.trimLeft) {
|
|
1764
|
+
trimLeft(tokens[i - 1], options.greedy);
|
|
1765
|
+
}
|
|
1766
|
+
if (isTagToken(token)) {
|
|
1767
|
+
if (token.name === 'raw')
|
|
1768
|
+
inRaw = true;
|
|
1769
|
+
else if (token.name === 'endraw')
|
|
1770
|
+
inRaw = false;
|
|
1771
|
+
}
|
|
1772
|
+
if (!inRaw && token.trimRight) {
|
|
1773
|
+
trimRight(tokens[i + 1], options.greedy);
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
function trimLeft(token, greedy) {
|
|
1778
|
+
if (!token || !isHTMLToken(token))
|
|
1779
|
+
return;
|
|
1780
|
+
const mask = greedy ? BLANK : INLINE_BLANK;
|
|
1781
|
+
while (TYPES[token.input.charCodeAt(token.end - 1 - token.trimRight)] & mask)
|
|
1782
|
+
token.trimRight++;
|
|
1783
|
+
}
|
|
1784
|
+
function trimRight(token, greedy) {
|
|
1785
|
+
if (!token || !isHTMLToken(token))
|
|
1786
|
+
return;
|
|
1787
|
+
const mask = greedy ? BLANK : INLINE_BLANK;
|
|
1788
|
+
while (TYPES[token.input.charCodeAt(token.begin + token.trimLeft)] & mask)
|
|
1789
|
+
token.trimLeft++;
|
|
1790
|
+
if (token.input.charAt(token.begin + token.trimLeft) === '\n')
|
|
1791
|
+
token.trimLeft++;
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1794
|
+
class Tokenizer {
|
|
1795
|
+
constructor(input, operators = defaultOptions.operators, file, range) {
|
|
1796
|
+
this.input = input;
|
|
1797
|
+
this.file = file;
|
|
1798
|
+
this.rawBeginAt = -1;
|
|
1799
|
+
this.p = range ? range[0] : 0;
|
|
1800
|
+
this.N = range ? range[1] : input.length;
|
|
1801
|
+
this.opTrie = createTrie(operators);
|
|
1802
|
+
this.literalTrie = createTrie(literalValues);
|
|
1803
|
+
}
|
|
1804
|
+
readExpression() {
|
|
1805
|
+
return new Expression(this.readExpressionTokens());
|
|
1806
|
+
}
|
|
1807
|
+
*readExpressionTokens() {
|
|
1808
|
+
while (this.p < this.N) {
|
|
1809
|
+
const operator = this.readOperator();
|
|
1810
|
+
if (operator) {
|
|
1811
|
+
yield operator;
|
|
1812
|
+
continue;
|
|
1813
|
+
}
|
|
1814
|
+
const operand = this.readValue();
|
|
1815
|
+
if (operand) {
|
|
1816
|
+
yield operand;
|
|
1817
|
+
continue;
|
|
1818
|
+
}
|
|
1819
|
+
return;
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
readOperator() {
|
|
1823
|
+
this.skipBlank();
|
|
1824
|
+
const end = this.matchTrie(this.opTrie);
|
|
1825
|
+
if (end === -1)
|
|
1826
|
+
return;
|
|
1827
|
+
return new OperatorToken(this.input, this.p, (this.p = end), this.file);
|
|
1828
|
+
}
|
|
1829
|
+
matchTrie(trie) {
|
|
1830
|
+
let node = trie;
|
|
1831
|
+
let i = this.p;
|
|
1832
|
+
let info;
|
|
1833
|
+
while (node[this.input[i]] && i < this.N) {
|
|
1834
|
+
node = node[this.input[i++]];
|
|
1835
|
+
if (node['end'])
|
|
1836
|
+
info = node;
|
|
1837
|
+
}
|
|
1838
|
+
if (!info)
|
|
1839
|
+
return -1;
|
|
1840
|
+
if (info['needBoundary'] && isWord(this.peek(i - this.p)))
|
|
1841
|
+
return -1;
|
|
1842
|
+
return i;
|
|
1843
|
+
}
|
|
1844
|
+
readFilteredValue() {
|
|
1845
|
+
const begin = this.p;
|
|
1846
|
+
const initial = this.readExpression();
|
|
1847
|
+
this.assert(initial.valid(), `invalid value expression: ${this.snapshot()}`);
|
|
1848
|
+
const filters = this.readFilters();
|
|
1849
|
+
return new FilteredValueToken(initial, filters, this.input, begin, this.p, this.file);
|
|
1850
|
+
}
|
|
1851
|
+
readFilters() {
|
|
1852
|
+
const filters = [];
|
|
1853
|
+
while (true) {
|
|
1854
|
+
const filter = this.readFilter();
|
|
1855
|
+
if (!filter)
|
|
1856
|
+
return filters;
|
|
1857
|
+
filters.push(filter);
|
|
1858
|
+
}
|
|
1859
|
+
}
|
|
1860
|
+
readFilter() {
|
|
1861
|
+
this.skipBlank();
|
|
1862
|
+
if (this.end())
|
|
1863
|
+
return null;
|
|
1864
|
+
this.assert(this.read() === '|', `expected "|" before filter`);
|
|
1865
|
+
const name = this.readIdentifier();
|
|
1866
|
+
if (!name.size()) {
|
|
1867
|
+
this.assert(this.end(), `expected filter name`);
|
|
1868
|
+
return null;
|
|
1869
|
+
}
|
|
1870
|
+
const args = [];
|
|
1871
|
+
this.skipBlank();
|
|
1872
|
+
if (this.peek() === ':') {
|
|
1873
|
+
do {
|
|
1874
|
+
++this.p;
|
|
1875
|
+
const arg = this.readFilterArg();
|
|
1876
|
+
arg && args.push(arg);
|
|
1877
|
+
this.skipBlank();
|
|
1878
|
+
this.assert(this.end() || this.peek() === ',' || this.peek() === '|', () => `unexpected character ${this.snapshot()}`);
|
|
1879
|
+
} while (this.peek() === ',');
|
|
1880
|
+
}
|
|
1881
|
+
else if (this.peek() === '|' || this.end()) ;
|
|
1882
|
+
else {
|
|
1883
|
+
throw this.error('expected ":" after filter name');
|
|
1884
|
+
}
|
|
1885
|
+
return new FilterToken(name.getText(), args, this.input, name.begin, this.p, this.file);
|
|
1886
|
+
}
|
|
1887
|
+
readFilterArg() {
|
|
1888
|
+
const key = this.readValue();
|
|
1889
|
+
if (!key)
|
|
1890
|
+
return;
|
|
1891
|
+
this.skipBlank();
|
|
1892
|
+
if (this.peek() !== ':')
|
|
1893
|
+
return key;
|
|
1894
|
+
++this.p;
|
|
1895
|
+
const value = this.readValue();
|
|
1896
|
+
return [key.getText(), value];
|
|
1897
|
+
}
|
|
1898
|
+
readTopLevelTokens(options = defaultOptions) {
|
|
1899
|
+
const tokens = [];
|
|
1900
|
+
while (this.p < this.N) {
|
|
1901
|
+
const token = this.readTopLevelToken(options);
|
|
1902
|
+
tokens.push(token);
|
|
1903
|
+
}
|
|
1904
|
+
whiteSpaceCtrl(tokens, options);
|
|
1905
|
+
return tokens;
|
|
1906
|
+
}
|
|
1907
|
+
readTopLevelToken(options) {
|
|
1908
|
+
const { tagDelimiterLeft, outputDelimiterLeft } = options;
|
|
1909
|
+
if (this.rawBeginAt > -1)
|
|
1910
|
+
return this.readEndrawOrRawContent(options);
|
|
1911
|
+
if (this.match(tagDelimiterLeft))
|
|
1912
|
+
return this.readTagToken(options);
|
|
1913
|
+
if (this.match(outputDelimiterLeft))
|
|
1914
|
+
return this.readOutputToken(options);
|
|
1915
|
+
return this.readHTMLToken([tagDelimiterLeft, outputDelimiterLeft]);
|
|
1916
|
+
}
|
|
1917
|
+
readHTMLToken(stopStrings) {
|
|
1918
|
+
const begin = this.p;
|
|
1919
|
+
while (this.p < this.N) {
|
|
1920
|
+
if (stopStrings.some(str => this.match(str)))
|
|
1921
|
+
break;
|
|
1922
|
+
++this.p;
|
|
1923
|
+
}
|
|
1924
|
+
return new HTMLToken(this.input, begin, this.p, this.file);
|
|
1925
|
+
}
|
|
1926
|
+
readTagToken(options) {
|
|
1927
|
+
const { file, input } = this;
|
|
1928
|
+
const begin = this.p;
|
|
1929
|
+
if (this.readToDelimiter(options.tagDelimiterRight) === -1) {
|
|
1930
|
+
throw this.error(`tag ${this.snapshot(begin)} not closed`, begin);
|
|
1931
|
+
}
|
|
1932
|
+
const token = new TagToken(input, begin, this.p, options, file);
|
|
1933
|
+
if (token.name === 'raw')
|
|
1934
|
+
this.rawBeginAt = begin;
|
|
1935
|
+
return token;
|
|
1936
|
+
}
|
|
1937
|
+
readToDelimiter(delimiter, respectQuoted = false) {
|
|
1938
|
+
this.skipBlank();
|
|
1939
|
+
while (this.p < this.N) {
|
|
1940
|
+
if (respectQuoted && (this.peekType() & QUOTE)) {
|
|
1941
|
+
this.readQuoted();
|
|
1942
|
+
continue;
|
|
1943
|
+
}
|
|
1944
|
+
++this.p;
|
|
1945
|
+
if (this.rmatch(delimiter))
|
|
1946
|
+
return this.p;
|
|
1947
|
+
}
|
|
1948
|
+
return -1;
|
|
1949
|
+
}
|
|
1950
|
+
readOutputToken(options = defaultOptions) {
|
|
1951
|
+
const { file, input } = this;
|
|
1952
|
+
const { outputDelimiterRight } = options;
|
|
1953
|
+
const begin = this.p;
|
|
1954
|
+
if (this.readToDelimiter(outputDelimiterRight, true) === -1) {
|
|
1955
|
+
throw this.error(`output ${this.snapshot(begin)} not closed`, begin);
|
|
1956
|
+
}
|
|
1957
|
+
return new OutputToken(input, begin, this.p, options, file);
|
|
1958
|
+
}
|
|
1959
|
+
readEndrawOrRawContent(options) {
|
|
1960
|
+
const { tagDelimiterLeft, tagDelimiterRight } = options;
|
|
1961
|
+
const begin = this.p;
|
|
1962
|
+
let leftPos = this.readTo(tagDelimiterLeft) - tagDelimiterLeft.length;
|
|
1963
|
+
while (this.p < this.N) {
|
|
1964
|
+
if (this.readIdentifier().getText() !== 'endraw') {
|
|
1965
|
+
leftPos = this.readTo(tagDelimiterLeft) - tagDelimiterLeft.length;
|
|
1966
|
+
continue;
|
|
1967
|
+
}
|
|
1968
|
+
while (this.p <= this.N) {
|
|
1969
|
+
if (this.rmatch(tagDelimiterRight)) {
|
|
1970
|
+
const end = this.p;
|
|
1971
|
+
if (begin === leftPos) {
|
|
1972
|
+
this.rawBeginAt = -1;
|
|
1973
|
+
return new TagToken(this.input, begin, end, options, this.file);
|
|
1974
|
+
}
|
|
1975
|
+
else {
|
|
1976
|
+
this.p = leftPos;
|
|
1977
|
+
return new HTMLToken(this.input, begin, leftPos, this.file);
|
|
1978
|
+
}
|
|
1979
|
+
}
|
|
1980
|
+
if (this.rmatch(tagDelimiterLeft))
|
|
1981
|
+
break;
|
|
1982
|
+
this.p++;
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1985
|
+
throw this.error(`raw ${this.snapshot(this.rawBeginAt)} not closed`, begin);
|
|
1986
|
+
}
|
|
1987
|
+
readLiquidTagTokens(options = defaultOptions) {
|
|
1988
|
+
const tokens = [];
|
|
1989
|
+
while (this.p < this.N) {
|
|
1990
|
+
const token = this.readLiquidTagToken(options);
|
|
1991
|
+
token && tokens.push(token);
|
|
1992
|
+
}
|
|
1993
|
+
return tokens;
|
|
1994
|
+
}
|
|
1995
|
+
readLiquidTagToken(options) {
|
|
1996
|
+
this.skipBlank();
|
|
1997
|
+
if (this.end())
|
|
1998
|
+
return;
|
|
1999
|
+
const begin = this.p;
|
|
2000
|
+
this.readToDelimiter('\n');
|
|
2001
|
+
const end = this.p;
|
|
2002
|
+
return new LiquidTagToken(this.input, begin, end, options, this.file);
|
|
2003
|
+
}
|
|
2004
|
+
error(msg, pos = this.p) {
|
|
2005
|
+
return new TokenizationError(msg, new IdentifierToken(this.input, pos, this.N, this.file));
|
|
2006
|
+
}
|
|
2007
|
+
assert(pred, msg, pos) {
|
|
2008
|
+
if (!pred)
|
|
2009
|
+
throw this.error(typeof msg === 'function' ? msg() : msg, pos);
|
|
2010
|
+
}
|
|
2011
|
+
snapshot(begin = this.p) {
|
|
2012
|
+
return JSON.stringify(ellipsis(this.input.slice(begin, this.N), 32));
|
|
2013
|
+
}
|
|
2014
|
+
/**
|
|
2015
|
+
* @deprecated use #readIdentifier instead
|
|
2016
|
+
*/
|
|
2017
|
+
readWord() {
|
|
2018
|
+
return this.readIdentifier();
|
|
2019
|
+
}
|
|
2020
|
+
readIdentifier() {
|
|
2021
|
+
this.skipBlank();
|
|
2022
|
+
const begin = this.p;
|
|
2023
|
+
while (!this.end() && isWord(this.peek()))
|
|
2024
|
+
++this.p;
|
|
2025
|
+
return new IdentifierToken(this.input, begin, this.p, this.file);
|
|
2026
|
+
}
|
|
2027
|
+
readNonEmptyIdentifier() {
|
|
2028
|
+
const id = this.readIdentifier();
|
|
2029
|
+
return id.size() ? id : undefined;
|
|
2030
|
+
}
|
|
2031
|
+
readTagName() {
|
|
2032
|
+
this.skipBlank();
|
|
2033
|
+
// Handle inline comment tags
|
|
2034
|
+
if (this.input[this.p] === '#')
|
|
2035
|
+
return this.input.slice(this.p, ++this.p);
|
|
2036
|
+
return this.readIdentifier().getText();
|
|
2037
|
+
}
|
|
2038
|
+
readHashes(jekyllStyle) {
|
|
2039
|
+
const hashes = [];
|
|
2040
|
+
while (true) {
|
|
2041
|
+
const hash = this.readHash(jekyllStyle);
|
|
2042
|
+
if (!hash)
|
|
2043
|
+
return hashes;
|
|
2044
|
+
hashes.push(hash);
|
|
2045
|
+
}
|
|
2046
|
+
}
|
|
2047
|
+
readHash(jekyllStyle) {
|
|
2048
|
+
this.skipBlank();
|
|
2049
|
+
if (this.peek() === ',')
|
|
2050
|
+
++this.p;
|
|
2051
|
+
const begin = this.p;
|
|
2052
|
+
const name = this.readNonEmptyIdentifier();
|
|
2053
|
+
if (!name)
|
|
2054
|
+
return;
|
|
2055
|
+
let value;
|
|
2056
|
+
this.skipBlank();
|
|
2057
|
+
const sep = isString(jekyllStyle) ? jekyllStyle : (jekyllStyle ? '=' : ':');
|
|
2058
|
+
if (this.peek() === sep) {
|
|
2059
|
+
++this.p;
|
|
2060
|
+
value = this.readValue();
|
|
2061
|
+
}
|
|
2062
|
+
return new HashToken(this.input, begin, this.p, name, value, this.file);
|
|
2063
|
+
}
|
|
2064
|
+
remaining() {
|
|
2065
|
+
return this.input.slice(this.p, this.N);
|
|
2066
|
+
}
|
|
2067
|
+
advance(step = 1) {
|
|
2068
|
+
this.p += step;
|
|
2069
|
+
}
|
|
2070
|
+
end() {
|
|
2071
|
+
return this.p >= this.N;
|
|
2072
|
+
}
|
|
2073
|
+
read() {
|
|
2074
|
+
return this.input[this.p++];
|
|
2075
|
+
}
|
|
2076
|
+
readTo(end) {
|
|
2077
|
+
while (this.p < this.N) {
|
|
2078
|
+
++this.p;
|
|
2079
|
+
if (this.rmatch(end))
|
|
2080
|
+
return this.p;
|
|
2081
|
+
}
|
|
2082
|
+
return -1;
|
|
2083
|
+
}
|
|
2084
|
+
readValue() {
|
|
2085
|
+
this.skipBlank();
|
|
2086
|
+
const begin = this.p;
|
|
2087
|
+
const variable = this.readLiteral() || this.readQuoted() || this.readRange() || this.readNumber();
|
|
2088
|
+
const props = this.readProperties(!variable);
|
|
2089
|
+
if (!props.length)
|
|
2090
|
+
return variable;
|
|
2091
|
+
return new PropertyAccessToken(variable, props, this.input, begin, this.p);
|
|
2092
|
+
}
|
|
2093
|
+
readScopeValue() {
|
|
2094
|
+
this.skipBlank();
|
|
2095
|
+
const begin = this.p;
|
|
2096
|
+
const props = this.readProperties();
|
|
2097
|
+
if (!props.length)
|
|
2098
|
+
return undefined;
|
|
2099
|
+
return new PropertyAccessToken(undefined, props, this.input, begin, this.p);
|
|
2100
|
+
}
|
|
2101
|
+
readProperties(isBegin = true) {
|
|
2102
|
+
const props = [];
|
|
2103
|
+
while (true) {
|
|
2104
|
+
if (this.peek() === '[') {
|
|
2105
|
+
this.p++;
|
|
2106
|
+
const prop = this.readValue() || new IdentifierToken(this.input, this.p, this.p, this.file);
|
|
2107
|
+
this.assert(this.readTo(']') !== -1, '[ not closed');
|
|
2108
|
+
props.push(prop);
|
|
2109
|
+
continue;
|
|
2110
|
+
}
|
|
2111
|
+
if (isBegin && !props.length) {
|
|
2112
|
+
const prop = this.readNonEmptyIdentifier();
|
|
2113
|
+
if (prop) {
|
|
2114
|
+
props.push(prop);
|
|
2115
|
+
continue;
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
if (this.peek() === '.' && this.peek(1) !== '.') { // skip range syntax
|
|
2119
|
+
this.p++;
|
|
2120
|
+
const prop = this.readNonEmptyIdentifier();
|
|
2121
|
+
if (!prop)
|
|
2122
|
+
break;
|
|
2123
|
+
props.push(prop);
|
|
2124
|
+
continue;
|
|
2125
|
+
}
|
|
2126
|
+
break;
|
|
2127
|
+
}
|
|
2128
|
+
return props;
|
|
2129
|
+
}
|
|
2130
|
+
readNumber() {
|
|
2131
|
+
this.skipBlank();
|
|
2132
|
+
let decimalFound = false;
|
|
2133
|
+
let digitFound = false;
|
|
2134
|
+
let n = 0;
|
|
2135
|
+
if (this.peekType() & SIGN)
|
|
2136
|
+
n++;
|
|
2137
|
+
while (this.p + n <= this.N) {
|
|
2138
|
+
if (this.peekType(n) & NUMBER) {
|
|
2139
|
+
digitFound = true;
|
|
2140
|
+
n++;
|
|
2141
|
+
}
|
|
2142
|
+
else if (this.peek(n) === '.' && this.peek(n + 1) !== '.') {
|
|
2143
|
+
if (decimalFound || !digitFound)
|
|
2144
|
+
return;
|
|
2145
|
+
decimalFound = true;
|
|
2146
|
+
n++;
|
|
2147
|
+
}
|
|
2148
|
+
else
|
|
2149
|
+
break;
|
|
2150
|
+
}
|
|
2151
|
+
if (digitFound && !isWord(this.peek(n))) {
|
|
2152
|
+
const num = new NumberToken(this.input, this.p, this.p + n, this.file);
|
|
2153
|
+
this.advance(n);
|
|
2154
|
+
return num;
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
2157
|
+
readLiteral() {
|
|
2158
|
+
this.skipBlank();
|
|
2159
|
+
const end = this.matchTrie(this.literalTrie);
|
|
2160
|
+
if (end === -1)
|
|
2161
|
+
return;
|
|
2162
|
+
const literal = new LiteralToken(this.input, this.p, end, this.file);
|
|
2163
|
+
this.p = end;
|
|
2164
|
+
return literal;
|
|
2165
|
+
}
|
|
2166
|
+
readRange() {
|
|
2167
|
+
this.skipBlank();
|
|
2168
|
+
const begin = this.p;
|
|
2169
|
+
if (this.peek() !== '(')
|
|
2170
|
+
return;
|
|
2171
|
+
++this.p;
|
|
2172
|
+
const lhs = this.readValueOrThrow();
|
|
2173
|
+
this.skipBlank();
|
|
2174
|
+
this.assert(this.read() === '.' && this.read() === '.', 'invalid range syntax');
|
|
2175
|
+
const rhs = this.readValueOrThrow();
|
|
2176
|
+
this.skipBlank();
|
|
2177
|
+
this.assert(this.read() === ')', 'invalid range syntax');
|
|
2178
|
+
return new RangeToken(this.input, begin, this.p, lhs, rhs, this.file);
|
|
2179
|
+
}
|
|
2180
|
+
readValueOrThrow() {
|
|
2181
|
+
const value = this.readValue();
|
|
2182
|
+
this.assert(value, () => `unexpected token ${this.snapshot()}, value expected`);
|
|
2183
|
+
return value;
|
|
2184
|
+
}
|
|
2185
|
+
readQuoted() {
|
|
2186
|
+
this.skipBlank();
|
|
2187
|
+
const begin = this.p;
|
|
2188
|
+
if (!(this.peekType() & QUOTE))
|
|
2189
|
+
return;
|
|
2190
|
+
++this.p;
|
|
2191
|
+
let escaped = false;
|
|
2192
|
+
while (this.p < this.N) {
|
|
2193
|
+
++this.p;
|
|
2194
|
+
if (this.input[this.p - 1] === this.input[begin] && !escaped)
|
|
2195
|
+
break;
|
|
2196
|
+
if (escaped)
|
|
2197
|
+
escaped = false;
|
|
2198
|
+
else if (this.input[this.p - 1] === '\\')
|
|
2199
|
+
escaped = true;
|
|
2200
|
+
}
|
|
2201
|
+
return new QuotedToken(this.input, begin, this.p, this.file);
|
|
2202
|
+
}
|
|
2203
|
+
*readFileNameTemplate(options) {
|
|
2204
|
+
const { outputDelimiterLeft } = options;
|
|
2205
|
+
const htmlStopStrings = [',', ' ', '\r', '\n', '\t', outputDelimiterLeft];
|
|
2206
|
+
const htmlStopStringSet = new Set(htmlStopStrings);
|
|
2207
|
+
// break on ',' and ' ', outputDelimiterLeft only stops HTML token
|
|
2208
|
+
while (this.p < this.N && !htmlStopStringSet.has(this.peek())) {
|
|
2209
|
+
yield this.match(outputDelimiterLeft)
|
|
2210
|
+
? this.readOutputToken(options)
|
|
2211
|
+
: this.readHTMLToken(htmlStopStrings);
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
match(word) {
|
|
2215
|
+
for (let i = 0; i < word.length; i++) {
|
|
2216
|
+
if (word[i] !== this.input[this.p + i])
|
|
2217
|
+
return false;
|
|
2218
|
+
}
|
|
2219
|
+
return true;
|
|
2220
|
+
}
|
|
2221
|
+
rmatch(pattern) {
|
|
2222
|
+
for (let i = 0; i < pattern.length; i++) {
|
|
2223
|
+
if (pattern[pattern.length - 1 - i] !== this.input[this.p - 1 - i])
|
|
2224
|
+
return false;
|
|
2225
|
+
}
|
|
2226
|
+
return true;
|
|
2227
|
+
}
|
|
2228
|
+
peekType(n = 0) {
|
|
2229
|
+
return this.p + n >= this.N ? 0 : TYPES[this.input.charCodeAt(this.p + n)];
|
|
2230
|
+
}
|
|
2231
|
+
peek(n = 0) {
|
|
2232
|
+
return this.p + n >= this.N ? '' : this.input[this.p + n];
|
|
2233
|
+
}
|
|
2234
|
+
skipBlank() {
|
|
2235
|
+
while (this.peekType() & BLANK)
|
|
2236
|
+
++this.p;
|
|
2237
|
+
}
|
|
2238
|
+
}
|
|
2239
|
+
|
|
2240
|
+
class ParseStream {
|
|
2241
|
+
constructor(tokens, parseToken) {
|
|
2242
|
+
this.handlers = {};
|
|
2243
|
+
this.stopRequested = false;
|
|
2244
|
+
this.tokens = tokens;
|
|
2245
|
+
this.parseToken = parseToken;
|
|
2246
|
+
}
|
|
2247
|
+
on(name, cb) {
|
|
2248
|
+
this.handlers[name] = cb;
|
|
2249
|
+
return this;
|
|
2250
|
+
}
|
|
2251
|
+
trigger(event, arg) {
|
|
2252
|
+
const h = this.handlers[event];
|
|
2253
|
+
return h ? (h.call(this, arg), true) : false;
|
|
2254
|
+
}
|
|
2255
|
+
start() {
|
|
2256
|
+
this.trigger('start');
|
|
2257
|
+
let token;
|
|
2258
|
+
while (!this.stopRequested && (token = this.tokens.shift())) {
|
|
2259
|
+
if (this.trigger('token', token))
|
|
2260
|
+
continue;
|
|
2261
|
+
if (isTagToken(token) && this.trigger(`tag:${token.name}`, token)) {
|
|
2262
|
+
continue;
|
|
2263
|
+
}
|
|
2264
|
+
const template = this.parseToken(token, this.tokens);
|
|
2265
|
+
this.trigger('template', template);
|
|
2266
|
+
}
|
|
2267
|
+
if (!this.stopRequested)
|
|
2268
|
+
this.trigger('end');
|
|
2269
|
+
return this;
|
|
2270
|
+
}
|
|
2271
|
+
stop() {
|
|
2272
|
+
this.stopRequested = true;
|
|
2273
|
+
return this;
|
|
2274
|
+
}
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2277
|
+
class TemplateImpl {
|
|
2278
|
+
constructor(token) {
|
|
2279
|
+
this.token = token;
|
|
2280
|
+
}
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
class Tag extends TemplateImpl {
|
|
2284
|
+
constructor(token, remainTokens, liquid) {
|
|
2285
|
+
super(token);
|
|
2286
|
+
this.name = token.name;
|
|
2287
|
+
this.liquid = liquid;
|
|
2288
|
+
this.tokenizer = token.tokenizer;
|
|
2289
|
+
}
|
|
2290
|
+
}
|
|
2291
|
+
|
|
2292
|
+
/**
|
|
2293
|
+
* Key-Value Pairs Representing Tag Arguments
|
|
2294
|
+
* Example:
|
|
2295
|
+
* For the markup `, foo:'bar', coo:2 reversed %}`,
|
|
2296
|
+
* hash['foo'] === 'bar'
|
|
2297
|
+
* hash['coo'] === 2
|
|
2298
|
+
* hash['reversed'] === undefined
|
|
2299
|
+
*/
|
|
2300
|
+
class Hash {
|
|
2301
|
+
constructor(input, jekyllStyle) {
|
|
2302
|
+
this.hash = {};
|
|
2303
|
+
const tokenizer = input instanceof Tokenizer ? input : new Tokenizer(input, {});
|
|
2304
|
+
for (const hash of tokenizer.readHashes(jekyllStyle)) {
|
|
2305
|
+
this.hash[hash.name.content] = hash.value;
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
*render(ctx) {
|
|
2309
|
+
const hash = {};
|
|
2310
|
+
for (const key of Object.keys(this.hash)) {
|
|
2311
|
+
hash[key] = this.hash[key] === undefined ? true : yield evalToken(this.hash[key], ctx);
|
|
2312
|
+
}
|
|
2313
|
+
return hash;
|
|
2314
|
+
}
|
|
2315
|
+
}
|
|
2316
|
+
|
|
2317
|
+
function createTagClass(options) {
|
|
2318
|
+
return class extends Tag {
|
|
2319
|
+
constructor(token, tokens, liquid) {
|
|
2320
|
+
super(token, tokens, liquid);
|
|
2321
|
+
if (isFunction(options.parse)) {
|
|
2322
|
+
options.parse.call(this, token, tokens);
|
|
2323
|
+
}
|
|
2324
|
+
}
|
|
2325
|
+
*render(ctx, emitter) {
|
|
2326
|
+
const hash = (yield new Hash(this.token.args, ctx.opts.keyValueSeparator).render(ctx));
|
|
2327
|
+
return yield options.render.call(this, ctx, emitter, hash);
|
|
2328
|
+
}
|
|
2329
|
+
};
|
|
2330
|
+
}
|
|
2331
|
+
|
|
2332
|
+
function isKeyValuePair(arr) {
|
|
2333
|
+
return isArray(arr);
|
|
2334
|
+
}
|
|
2335
|
+
|
|
2336
|
+
class Filter {
|
|
2337
|
+
constructor(token, options, liquid) {
|
|
2338
|
+
this.token = token;
|
|
2339
|
+
this.name = token.name;
|
|
2340
|
+
this.handler = isFunction(options)
|
|
2341
|
+
? options
|
|
2342
|
+
: (isFunction(options?.handler) ? options.handler : identify);
|
|
2343
|
+
this.raw = !isFunction(options) && !!options?.raw;
|
|
2344
|
+
this.args = token.args;
|
|
2345
|
+
this.liquid = liquid;
|
|
2346
|
+
}
|
|
2347
|
+
*render(value, context) {
|
|
2348
|
+
const argv = [];
|
|
2349
|
+
for (const arg of this.args) {
|
|
2350
|
+
if (isKeyValuePair(arg))
|
|
2351
|
+
argv.push([arg[0], yield evalToken(arg[1], context)]);
|
|
2352
|
+
else
|
|
2353
|
+
argv.push(yield evalToken(arg, context));
|
|
2354
|
+
}
|
|
2355
|
+
return yield this.handler.apply({ context, token: this.token, liquid: this.liquid }, [value, ...argv]);
|
|
2356
|
+
}
|
|
2357
|
+
}
|
|
2358
|
+
|
|
2359
|
+
class Value {
|
|
2360
|
+
/**
|
|
2361
|
+
* @param str the value to be valuated, eg.: "foobar" | truncate: 3
|
|
2362
|
+
*/
|
|
2363
|
+
constructor(input, liquid) {
|
|
2364
|
+
this.filters = [];
|
|
2365
|
+
const token = typeof input === 'string'
|
|
2366
|
+
? new Tokenizer(input, liquid.options.operators).readFilteredValue()
|
|
2367
|
+
: input;
|
|
2368
|
+
this.initial = token.initial;
|
|
2369
|
+
this.filters = token.filters.map(token => new Filter(token, this.getFilter(liquid, token.name), liquid));
|
|
2370
|
+
}
|
|
2371
|
+
*value(ctx, lenient) {
|
|
2372
|
+
lenient = lenient || (ctx.opts.lenientIf && this.filters.length > 0 && this.filters[0].name === 'default');
|
|
2373
|
+
let val = yield this.initial.evaluate(ctx, lenient);
|
|
2374
|
+
for (const filter of this.filters) {
|
|
2375
|
+
val = yield filter.render(val, ctx);
|
|
2376
|
+
}
|
|
2377
|
+
return val;
|
|
2378
|
+
}
|
|
2379
|
+
getFilter(liquid, name) {
|
|
2380
|
+
const impl = liquid.filters[name];
|
|
2381
|
+
assert(impl || !liquid.options.strictFilters, () => `undefined filter: ${name}`);
|
|
2382
|
+
return impl;
|
|
2383
|
+
}
|
|
2384
|
+
}
|
|
2385
|
+
|
|
2386
|
+
class Output extends TemplateImpl {
|
|
2387
|
+
constructor(token, liquid) {
|
|
2388
|
+
super(token);
|
|
2389
|
+
const tokenizer = new Tokenizer(token.input, liquid.options.operators, token.file, token.contentRange);
|
|
2390
|
+
this.value = new Value(tokenizer.readFilteredValue(), liquid);
|
|
2391
|
+
const filters = this.value.filters;
|
|
2392
|
+
const outputEscape = liquid.options.outputEscape;
|
|
2393
|
+
if (!filters[filters.length - 1]?.raw && outputEscape) {
|
|
2394
|
+
const token = new FilterToken(toString.call(outputEscape), [], '', 0, 0);
|
|
2395
|
+
filters.push(new Filter(token, outputEscape, liquid));
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2398
|
+
*render(ctx, emitter) {
|
|
2399
|
+
const val = yield this.value.value(ctx, false);
|
|
2400
|
+
emitter.write(val);
|
|
2401
|
+
}
|
|
2402
|
+
*arguments() {
|
|
2403
|
+
yield this.value;
|
|
2404
|
+
}
|
|
2405
|
+
}
|
|
2406
|
+
|
|
2407
|
+
class HTML extends TemplateImpl {
|
|
2408
|
+
constructor(token) {
|
|
2409
|
+
super(token);
|
|
2410
|
+
this.str = token.getContent();
|
|
2411
|
+
}
|
|
2412
|
+
*render(ctx, emitter) {
|
|
2413
|
+
emitter.write(this.str);
|
|
2414
|
+
}
|
|
2415
|
+
}
|
|
2416
|
+
|
|
2417
|
+
/**
|
|
2418
|
+
* A variable's segments and location, which can be coerced to a string.
|
|
2419
|
+
*/
|
|
2420
|
+
class Variable {
|
|
2421
|
+
constructor(segments, location) {
|
|
2422
|
+
this.segments = segments;
|
|
2423
|
+
this.location = location;
|
|
2424
|
+
}
|
|
2425
|
+
toString() {
|
|
2426
|
+
return segmentsString(this.segments, true);
|
|
2427
|
+
}
|
|
2428
|
+
/** Return this variable's segments as an array, possibly with nested arrays for nested paths. */
|
|
2429
|
+
toArray() {
|
|
2430
|
+
function* _visit(...segments) {
|
|
2431
|
+
for (const segment of segments) {
|
|
2432
|
+
if (segment instanceof Variable) {
|
|
2433
|
+
yield Array.from(_visit(...segment.segments));
|
|
2434
|
+
}
|
|
2435
|
+
else {
|
|
2436
|
+
yield segment;
|
|
2437
|
+
}
|
|
2438
|
+
}
|
|
2439
|
+
}
|
|
2440
|
+
return Array.from(_visit(...this.segments));
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
/**
|
|
2444
|
+
* Group variables by the string representation of their root segment.
|
|
2445
|
+
*/
|
|
2446
|
+
class VariableMap {
|
|
2447
|
+
constructor() {
|
|
2448
|
+
this.map = new Map();
|
|
2449
|
+
}
|
|
2450
|
+
get(key) {
|
|
2451
|
+
const k = segmentsString([key.segments[0]]);
|
|
2452
|
+
if (!this.map.has(k)) {
|
|
2453
|
+
this.map.set(k, []);
|
|
2454
|
+
}
|
|
2455
|
+
return this.map.get(k);
|
|
2456
|
+
}
|
|
2457
|
+
has(key) {
|
|
2458
|
+
return this.map.has(segmentsString([key.segments[0]]));
|
|
2459
|
+
}
|
|
2460
|
+
push(variable) {
|
|
2461
|
+
this.get(variable).push(variable);
|
|
2462
|
+
}
|
|
2463
|
+
asObject() {
|
|
2464
|
+
return Object.fromEntries(this.map);
|
|
2465
|
+
}
|
|
2466
|
+
}
|
|
2467
|
+
const defaultStaticAnalysisOptions = {
|
|
2468
|
+
partials: true
|
|
2469
|
+
};
|
|
2470
|
+
function* _analyze(templates, partials, sync) {
|
|
2471
|
+
const variables = new VariableMap();
|
|
2472
|
+
const globals = new VariableMap();
|
|
2473
|
+
const locals = new VariableMap();
|
|
2474
|
+
const rootScope = new DummyScope(new Set());
|
|
2475
|
+
// Names of partial templates that we've already analyzed.
|
|
2476
|
+
const seen = new Set();
|
|
2477
|
+
function updateVariables(variable, scope) {
|
|
2478
|
+
variables.push(variable);
|
|
2479
|
+
const aliased = scope.alias(variable);
|
|
2480
|
+
if (aliased !== undefined) {
|
|
2481
|
+
const root = aliased.segments[0];
|
|
2482
|
+
// TODO: What if a a template renders a rendered template? Do we need scope.parent?
|
|
2483
|
+
if (isString(root) && !rootScope.has(root)) {
|
|
2484
|
+
globals.push(aliased);
|
|
2485
|
+
}
|
|
2486
|
+
}
|
|
2487
|
+
else {
|
|
2488
|
+
const root = variable.segments[0];
|
|
2489
|
+
if (isString(root) && !scope.has(root)) {
|
|
2490
|
+
globals.push(variable);
|
|
2491
|
+
}
|
|
2492
|
+
}
|
|
2493
|
+
// Recurse for nested Variables
|
|
2494
|
+
for (const segment of variable.segments) {
|
|
2495
|
+
if (segment instanceof Variable) {
|
|
2496
|
+
updateVariables(segment, scope);
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
}
|
|
2500
|
+
function* visit(template, scope) {
|
|
2501
|
+
if (template.arguments) {
|
|
2502
|
+
for (const arg of template.arguments()) {
|
|
2503
|
+
for (const variable of extractVariables(arg)) {
|
|
2504
|
+
updateVariables(variable, scope);
|
|
2505
|
+
}
|
|
2506
|
+
}
|
|
2507
|
+
}
|
|
2508
|
+
if (template.localScope) {
|
|
2509
|
+
for (const ident of template.localScope()) {
|
|
2510
|
+
scope.add(ident.content);
|
|
2511
|
+
scope.deleteAlias(ident.content);
|
|
2512
|
+
const [row, col] = ident.getPosition();
|
|
2513
|
+
locals.push(new Variable([ident.content], { row, col, file: ident.file }));
|
|
2514
|
+
}
|
|
2515
|
+
}
|
|
2516
|
+
if (template.children) {
|
|
2517
|
+
if (template.partialScope) {
|
|
2518
|
+
const partial = template.partialScope();
|
|
2519
|
+
if (partial === undefined) {
|
|
2520
|
+
// Layouts, for example, can have children that are not partials.
|
|
2521
|
+
for (const child of (yield template.children(partials, sync))) {
|
|
2522
|
+
yield visit(child, scope);
|
|
2523
|
+
}
|
|
2524
|
+
return;
|
|
2525
|
+
}
|
|
2526
|
+
if (seen.has(partial.name))
|
|
2527
|
+
return;
|
|
2528
|
+
const partialScopeNames = new Set();
|
|
2529
|
+
const partialScope = partial.isolated
|
|
2530
|
+
? new DummyScope(partialScopeNames)
|
|
2531
|
+
: scope.push(partialScopeNames);
|
|
2532
|
+
for (const name of partial.scope) {
|
|
2533
|
+
if (isString(name)) {
|
|
2534
|
+
partialScopeNames.add(name);
|
|
2535
|
+
}
|
|
2536
|
+
else {
|
|
2537
|
+
const [alias, argument] = name;
|
|
2538
|
+
partialScopeNames.add(alias);
|
|
2539
|
+
const variables = Array.from(extractVariables(argument));
|
|
2540
|
+
if (variables.length) {
|
|
2541
|
+
partialScope.setAlias(alias, variables[0].segments);
|
|
2542
|
+
}
|
|
2543
|
+
}
|
|
2544
|
+
}
|
|
2545
|
+
for (const child of (yield template.children(partials, sync))) {
|
|
2546
|
+
yield visit(child, partialScope);
|
|
2547
|
+
seen.add(partial.name);
|
|
2548
|
+
}
|
|
2549
|
+
partialScope.pop();
|
|
2550
|
+
}
|
|
2551
|
+
else {
|
|
2552
|
+
if (template.blockScope) {
|
|
2553
|
+
scope.push(new Set(template.blockScope()));
|
|
2554
|
+
}
|
|
2555
|
+
for (const child of (yield template.children(partials, sync))) {
|
|
2556
|
+
yield visit(child, scope);
|
|
2557
|
+
}
|
|
2558
|
+
if (template.blockScope) {
|
|
2559
|
+
scope.pop();
|
|
2560
|
+
}
|
|
2561
|
+
}
|
|
2562
|
+
}
|
|
2563
|
+
}
|
|
2564
|
+
for (const template of templates) {
|
|
2565
|
+
yield visit(template, rootScope);
|
|
2566
|
+
}
|
|
2567
|
+
return {
|
|
2568
|
+
variables: variables.asObject(),
|
|
2569
|
+
globals: globals.asObject(),
|
|
2570
|
+
locals: locals.asObject()
|
|
2571
|
+
};
|
|
2572
|
+
}
|
|
2573
|
+
/**
|
|
2574
|
+
* Statically analyze a template and report variable usage.
|
|
2575
|
+
*/
|
|
2576
|
+
function analyze(template, options = {}) {
|
|
2577
|
+
const opts = { ...defaultStaticAnalysisOptions, ...options };
|
|
2578
|
+
return toPromise(_analyze(template, opts.partials, false));
|
|
2579
|
+
}
|
|
2580
|
+
/**
|
|
2581
|
+
* Statically analyze a template and report variable usage.
|
|
2582
|
+
*/
|
|
2583
|
+
function analyzeSync(template, options = {}) {
|
|
2584
|
+
const opts = { ...defaultStaticAnalysisOptions, ...options };
|
|
2585
|
+
return toValueSync(_analyze(template, opts.partials, true));
|
|
2586
|
+
}
|
|
2587
|
+
/**
|
|
2588
|
+
* A stack to manage scopes while traversing templates during static analysis.
|
|
2589
|
+
*/
|
|
2590
|
+
class DummyScope {
|
|
2591
|
+
constructor(globals) {
|
|
2592
|
+
this.stack = [{ names: globals, aliases: new Map() }];
|
|
2593
|
+
}
|
|
2594
|
+
/** Return true if `name` is in scope. */
|
|
2595
|
+
has(name) {
|
|
2596
|
+
for (const scope of this.stack) {
|
|
2597
|
+
if (scope.names.has(name)) {
|
|
2598
|
+
return true;
|
|
2599
|
+
}
|
|
2600
|
+
}
|
|
2601
|
+
return false;
|
|
2602
|
+
}
|
|
2603
|
+
push(scope) {
|
|
2604
|
+
this.stack.push({ names: scope, aliases: new Map() });
|
|
2605
|
+
return this;
|
|
2606
|
+
}
|
|
2607
|
+
pop() {
|
|
2608
|
+
return this.stack.pop()?.names;
|
|
2609
|
+
}
|
|
2610
|
+
// Add a name to the template scope.
|
|
2611
|
+
add(name) {
|
|
2612
|
+
this.stack[0].names.add(name);
|
|
2613
|
+
}
|
|
2614
|
+
/** Return the variable that `variable` aliases, or `variable` if it doesn't alias anything. */
|
|
2615
|
+
alias(variable) {
|
|
2616
|
+
const root = variable.segments[0];
|
|
2617
|
+
if (!isString(root))
|
|
2618
|
+
return undefined;
|
|
2619
|
+
const alias = this.getAlias(root);
|
|
2620
|
+
if (alias === undefined)
|
|
2621
|
+
return undefined;
|
|
2622
|
+
return new Variable([...alias, ...variable.segments.slice(1)], variable.location);
|
|
2623
|
+
}
|
|
2624
|
+
// TODO: `from` could be a path with multiple segments, like `include.x`.
|
|
2625
|
+
setAlias(from, to) {
|
|
2626
|
+
this.stack[this.stack.length - 1].aliases.set(from, to);
|
|
2627
|
+
}
|
|
2628
|
+
deleteAlias(name) {
|
|
2629
|
+
this.stack[this.stack.length - 1].aliases.delete(name);
|
|
2630
|
+
}
|
|
2631
|
+
getAlias(name) {
|
|
2632
|
+
for (const scope of this.stack) {
|
|
2633
|
+
if (scope.aliases.has(name)) {
|
|
2634
|
+
return scope.aliases.get(name);
|
|
2635
|
+
}
|
|
2636
|
+
// If a scope has defined `name`, then it masks aliases in parent scopes.
|
|
2637
|
+
if (scope.names.has(name)) {
|
|
2638
|
+
return undefined;
|
|
2639
|
+
}
|
|
2640
|
+
}
|
|
2641
|
+
return undefined;
|
|
2642
|
+
}
|
|
2643
|
+
}
|
|
2644
|
+
function* extractVariables(value) {
|
|
2645
|
+
if (isValueToken(value)) {
|
|
2646
|
+
yield* extractValueTokenVariables(value);
|
|
2647
|
+
}
|
|
2648
|
+
else if (value instanceof Value) {
|
|
2649
|
+
yield* extractFilteredValueVariables(value);
|
|
2650
|
+
}
|
|
2651
|
+
}
|
|
2652
|
+
function* extractFilteredValueVariables(value) {
|
|
2653
|
+
for (const token of value.initial.postfix) {
|
|
2654
|
+
if (isValueToken(token)) {
|
|
2655
|
+
yield* extractValueTokenVariables(token);
|
|
2656
|
+
}
|
|
2657
|
+
}
|
|
2658
|
+
for (const filter of value.filters) {
|
|
2659
|
+
for (const arg of filter.args) {
|
|
2660
|
+
if (isKeyValuePair(arg) && arg[1]) {
|
|
2661
|
+
yield* extractValueTokenVariables(arg[1]);
|
|
2662
|
+
}
|
|
2663
|
+
else if (isValueToken(arg)) {
|
|
2664
|
+
yield* extractValueTokenVariables(arg);
|
|
2665
|
+
}
|
|
2666
|
+
}
|
|
2667
|
+
}
|
|
2668
|
+
}
|
|
2669
|
+
function* extractValueTokenVariables(token) {
|
|
2670
|
+
if (isRangeToken(token)) {
|
|
2671
|
+
yield* extractValueTokenVariables(token.lhs);
|
|
2672
|
+
yield* extractValueTokenVariables(token.rhs);
|
|
2673
|
+
}
|
|
2674
|
+
else if (isPropertyAccessToken(token)) {
|
|
2675
|
+
yield extractPropertyAccessVariable(token);
|
|
2676
|
+
}
|
|
2677
|
+
}
|
|
2678
|
+
function extractPropertyAccessVariable(token) {
|
|
2679
|
+
const segments = [];
|
|
2680
|
+
// token is not guaranteed to have `file` set. We'll try to get it from a prop if not.
|
|
2681
|
+
let file = token.file;
|
|
2682
|
+
// Here we're flattening the first segment of a path if it is a nested path.
|
|
2683
|
+
const root = token.props[0];
|
|
2684
|
+
file = file || root.file;
|
|
2685
|
+
if (isQuotedToken(root) || isNumberToken(root) || isWordToken(root)) {
|
|
2686
|
+
segments.push(root.content);
|
|
2687
|
+
}
|
|
2688
|
+
else if (isPropertyAccessToken(root)) {
|
|
2689
|
+
// Flatten paths that start with a nested path.
|
|
2690
|
+
segments.push(...extractPropertyAccessVariable(root).segments);
|
|
2691
|
+
}
|
|
2692
|
+
for (const prop of token.props.slice(1)) {
|
|
2693
|
+
file = file || prop.file;
|
|
2694
|
+
if (isQuotedToken(prop) || isNumberToken(prop) || isWordToken(prop)) {
|
|
2695
|
+
segments.push(prop.content);
|
|
2696
|
+
}
|
|
2697
|
+
else if (isPropertyAccessToken(prop)) {
|
|
2698
|
+
segments.push(extractPropertyAccessVariable(prop));
|
|
2699
|
+
}
|
|
2700
|
+
}
|
|
2701
|
+
const [row, col] = token.getPosition();
|
|
2702
|
+
return new Variable(segments, {
|
|
2703
|
+
row,
|
|
2704
|
+
col,
|
|
2705
|
+
file
|
|
2706
|
+
});
|
|
2707
|
+
}
|
|
2708
|
+
// This is used to detect segments that can be represented with dot notation
|
|
2709
|
+
// when creating a string representation of VariableSegments.
|
|
2710
|
+
const RE_PROPERTY = /^[\u0080-\uFFFFa-zA-Z_][\u0080-\uFFFFa-zA-Z0-9_-]*$/;
|
|
2711
|
+
/**
|
|
2712
|
+
* Return a string representation of segments using dot notation where possible.
|
|
2713
|
+
* @param segments - The property names and array indices that make up a path to a variable.
|
|
2714
|
+
* @param bracketedRoot - If false (the default), don't surround the root segment with square brackets.
|
|
2715
|
+
*/
|
|
2716
|
+
function segmentsString(segments, bracketedRoot = false) {
|
|
2717
|
+
const buf = [];
|
|
2718
|
+
const root = segments[0];
|
|
2719
|
+
if (isString(root)) {
|
|
2720
|
+
if (!bracketedRoot || root.match(RE_PROPERTY)) {
|
|
2721
|
+
buf.push(`${root}`);
|
|
2722
|
+
}
|
|
2723
|
+
else {
|
|
2724
|
+
buf.push(`['${root}']`);
|
|
2725
|
+
}
|
|
2726
|
+
}
|
|
2727
|
+
for (const segment of segments.slice(1)) {
|
|
2728
|
+
if (segment instanceof Variable) {
|
|
2729
|
+
buf.push(`[${segmentsString(segment.segments)}]`);
|
|
2730
|
+
}
|
|
2731
|
+
else if (isString(segment)) {
|
|
2732
|
+
if (segment.match(RE_PROPERTY)) {
|
|
2733
|
+
buf.push(`.${segment}`);
|
|
2734
|
+
}
|
|
2735
|
+
else {
|
|
2736
|
+
buf.push(`['${segment}']`);
|
|
2737
|
+
}
|
|
2738
|
+
}
|
|
2739
|
+
else {
|
|
2740
|
+
buf.push(`[${segment}]`);
|
|
2741
|
+
}
|
|
2742
|
+
}
|
|
2743
|
+
return buf.join('');
|
|
2744
|
+
}
|
|
2745
|
+
|
|
2746
|
+
(function (LookupType) {
|
|
2747
|
+
LookupType["Partials"] = "partials";
|
|
2748
|
+
LookupType["Layouts"] = "layouts";
|
|
2749
|
+
LookupType["Root"] = "root";
|
|
2750
|
+
})(exports.LookupType || (exports.LookupType = {}));
|
|
2751
|
+
class Loader {
|
|
2752
|
+
constructor(options) {
|
|
2753
|
+
this.options = options;
|
|
2754
|
+
if (options.relativeReference) {
|
|
2755
|
+
const sep = options.fs.sep;
|
|
2756
|
+
assert(sep, '`fs.sep` is required for relative reference');
|
|
2757
|
+
const rRelativePath = new RegExp(['.' + sep, '..' + sep, './', '../'].map(prefix => escapeRegex(prefix)).join('|'));
|
|
2758
|
+
this.shouldLoadRelative = (referencedFile) => rRelativePath.test(referencedFile);
|
|
2759
|
+
}
|
|
2760
|
+
else {
|
|
2761
|
+
this.shouldLoadRelative = (_referencedFile) => false;
|
|
2762
|
+
}
|
|
2763
|
+
this.contains = this.options.fs.contains || (() => true);
|
|
2764
|
+
}
|
|
2765
|
+
*lookup(file, type, sync, currentFile) {
|
|
2766
|
+
const { fs } = this.options;
|
|
2767
|
+
const dirs = this.options[type];
|
|
2768
|
+
for (const filepath of this.candidates(file, dirs, currentFile, type !== exports.LookupType.Root)) {
|
|
2769
|
+
if (sync ? fs.existsSync(filepath) : yield fs.exists(filepath))
|
|
2770
|
+
return filepath;
|
|
2771
|
+
}
|
|
2772
|
+
throw this.lookupError(file, dirs);
|
|
2773
|
+
}
|
|
2774
|
+
*candidates(file, dirs, currentFile, enforceRoot) {
|
|
2775
|
+
const { fs, extname } = this.options;
|
|
2776
|
+
const isAllowed = (filepath) => {
|
|
2777
|
+
if (!enforceRoot)
|
|
2778
|
+
return true;
|
|
2779
|
+
for (const dir of dirs) {
|
|
2780
|
+
if (this.contains(dir, filepath))
|
|
2781
|
+
return true;
|
|
2782
|
+
}
|
|
2783
|
+
return false;
|
|
2784
|
+
};
|
|
2785
|
+
if (this.shouldLoadRelative(file) && currentFile) {
|
|
2786
|
+
const referenced = fs.resolve(this.dirname(currentFile), file, extname);
|
|
2787
|
+
if (isAllowed(referenced))
|
|
2788
|
+
yield referenced;
|
|
2789
|
+
}
|
|
2790
|
+
for (const dir of dirs) {
|
|
2791
|
+
const referenced = fs.resolve(dir, file, extname);
|
|
2792
|
+
if (isAllowed(referenced))
|
|
2793
|
+
yield referenced;
|
|
2794
|
+
}
|
|
2795
|
+
if (fs.fallback !== undefined) {
|
|
2796
|
+
const filepath = fs.fallback(file);
|
|
2797
|
+
if (filepath !== undefined && isAllowed(filepath))
|
|
2798
|
+
yield filepath;
|
|
2799
|
+
}
|
|
2800
|
+
}
|
|
2801
|
+
dirname(path) {
|
|
2802
|
+
const fs = this.options.fs;
|
|
2803
|
+
assert(fs.dirname, '`fs.dirname` is required for relative reference');
|
|
2804
|
+
return fs.dirname(path);
|
|
2805
|
+
}
|
|
2806
|
+
lookupError(file, roots) {
|
|
2807
|
+
const err = new Error('ENOENT');
|
|
2808
|
+
err.message = `ENOENT: Failed to lookup "${file}" in "${roots}"`;
|
|
2809
|
+
err.code = 'ENOENT';
|
|
2810
|
+
return err;
|
|
2811
|
+
}
|
|
2812
|
+
}
|
|
2813
|
+
|
|
2814
|
+
class Parser {
|
|
2815
|
+
constructor(liquid) {
|
|
2816
|
+
this.liquid = liquid;
|
|
2817
|
+
this.cache = this.liquid.options.cache;
|
|
2818
|
+
this.fs = this.liquid.options.fs;
|
|
2819
|
+
this.parseFile = this.cache ? this._parseFileCached : this._parseFile;
|
|
2820
|
+
this.loader = new Loader(this.liquid.options);
|
|
2821
|
+
this.parseLimit = new Limiter('parse length', liquid.options.parseLimit);
|
|
2822
|
+
}
|
|
2823
|
+
parse(html, filepath) {
|
|
2824
|
+
html = String(html);
|
|
2825
|
+
this.parseLimit.use(html.length);
|
|
2826
|
+
const tokenizer = new Tokenizer(html, this.liquid.options.operators, filepath);
|
|
2827
|
+
const tokens = tokenizer.readTopLevelTokens(this.liquid.options);
|
|
2828
|
+
return this.parseTokens(tokens);
|
|
2829
|
+
}
|
|
2830
|
+
parseTokens(tokens) {
|
|
2831
|
+
let token;
|
|
2832
|
+
const templates = [];
|
|
2833
|
+
const errors = [];
|
|
2834
|
+
while ((token = tokens.shift())) {
|
|
2835
|
+
try {
|
|
2836
|
+
templates.push(this.parseToken(token, tokens));
|
|
2837
|
+
}
|
|
2838
|
+
catch (err) {
|
|
2839
|
+
if (this.liquid.options.catchAllErrors)
|
|
2840
|
+
errors.push(err);
|
|
2841
|
+
else
|
|
2842
|
+
throw err;
|
|
2843
|
+
}
|
|
2844
|
+
}
|
|
2845
|
+
if (errors.length)
|
|
2846
|
+
throw new LiquidErrors(errors);
|
|
2847
|
+
return templates;
|
|
2848
|
+
}
|
|
2849
|
+
parseToken(token, remainTokens) {
|
|
2850
|
+
try {
|
|
2851
|
+
if (isTagToken(token)) {
|
|
2852
|
+
const TagClass = this.liquid.tags[token.name];
|
|
2853
|
+
assert(TagClass, `tag "${token.name}" not found`);
|
|
2854
|
+
return new TagClass(token, remainTokens, this.liquid, this);
|
|
2855
|
+
}
|
|
2856
|
+
if (isOutputToken(token)) {
|
|
2857
|
+
return new Output(token, this.liquid);
|
|
2858
|
+
}
|
|
2859
|
+
return new HTML(token);
|
|
2860
|
+
}
|
|
2861
|
+
catch (e) {
|
|
2862
|
+
if (LiquidError.is(e))
|
|
2863
|
+
throw e;
|
|
2864
|
+
throw new ParseError(e, token);
|
|
2865
|
+
}
|
|
2866
|
+
}
|
|
2867
|
+
parseStream(tokens) {
|
|
2868
|
+
return new ParseStream(tokens, (token, tokens) => this.parseToken(token, tokens));
|
|
2869
|
+
}
|
|
2870
|
+
*_parseFileCached(file, sync, type = exports.LookupType.Root, currentFile) {
|
|
2871
|
+
const cache = this.cache;
|
|
2872
|
+
const key = this.loader.shouldLoadRelative(file) ? currentFile + ',' + file : type + ':' + file;
|
|
2873
|
+
const tpls = yield cache.read(key);
|
|
2874
|
+
if (tpls)
|
|
2875
|
+
return tpls;
|
|
2876
|
+
const task = this._parseFile(file, sync, type, currentFile);
|
|
2877
|
+
// sync mode: exec the task and cache the result
|
|
2878
|
+
// async mode: cache the task before exec
|
|
2879
|
+
const taskOrTpl = sync ? yield task : toPromise(task);
|
|
2880
|
+
cache.write(key, taskOrTpl);
|
|
2881
|
+
// note: concurrent tasks will be reused, cache for failed task is removed until its end
|
|
2882
|
+
try {
|
|
2883
|
+
return yield taskOrTpl;
|
|
2884
|
+
}
|
|
2885
|
+
catch (err) {
|
|
2886
|
+
cache.remove(key);
|
|
2887
|
+
throw err;
|
|
2888
|
+
}
|
|
2889
|
+
}
|
|
2890
|
+
*_parseFile(file, sync, type = exports.LookupType.Root, currentFile) {
|
|
2891
|
+
const filepath = yield this.loader.lookup(file, type, sync, currentFile);
|
|
2892
|
+
return this.parse(sync ? this.fs.readFileSync(filepath) : yield this.fs.readFile(filepath), filepath);
|
|
2893
|
+
}
|
|
2894
|
+
}
|
|
2895
|
+
|
|
2896
|
+
(function (TokenKind) {
|
|
2897
|
+
TokenKind[TokenKind["Number"] = 1] = "Number";
|
|
2898
|
+
TokenKind[TokenKind["Literal"] = 2] = "Literal";
|
|
2899
|
+
TokenKind[TokenKind["Tag"] = 4] = "Tag";
|
|
2900
|
+
TokenKind[TokenKind["Output"] = 8] = "Output";
|
|
2901
|
+
TokenKind[TokenKind["HTML"] = 16] = "HTML";
|
|
2902
|
+
TokenKind[TokenKind["Filter"] = 32] = "Filter";
|
|
2903
|
+
TokenKind[TokenKind["Hash"] = 64] = "Hash";
|
|
2904
|
+
TokenKind[TokenKind["PropertyAccess"] = 128] = "PropertyAccess";
|
|
2905
|
+
TokenKind[TokenKind["Word"] = 256] = "Word";
|
|
2906
|
+
TokenKind[TokenKind["Range"] = 512] = "Range";
|
|
2907
|
+
TokenKind[TokenKind["Quoted"] = 1024] = "Quoted";
|
|
2908
|
+
TokenKind[TokenKind["Operator"] = 2048] = "Operator";
|
|
2909
|
+
TokenKind[TokenKind["FilteredValue"] = 4096] = "FilteredValue";
|
|
2910
|
+
TokenKind[TokenKind["Delimited"] = 12] = "Delimited";
|
|
2911
|
+
})(exports.TokenKind || (exports.TokenKind = {}));
|
|
2912
|
+
|
|
2913
|
+
function isDelimitedToken(val) {
|
|
2914
|
+
return !!(getKind(val) & exports.TokenKind.Delimited);
|
|
2915
|
+
}
|
|
2916
|
+
function isOperatorToken(val) {
|
|
2917
|
+
return getKind(val) === exports.TokenKind.Operator;
|
|
2918
|
+
}
|
|
2919
|
+
function isHTMLToken(val) {
|
|
2920
|
+
return getKind(val) === exports.TokenKind.HTML;
|
|
2921
|
+
}
|
|
2922
|
+
function isOutputToken(val) {
|
|
2923
|
+
return getKind(val) === exports.TokenKind.Output;
|
|
2924
|
+
}
|
|
2925
|
+
function isTagToken(val) {
|
|
2926
|
+
return getKind(val) === exports.TokenKind.Tag;
|
|
2927
|
+
}
|
|
2928
|
+
function isQuotedToken(val) {
|
|
2929
|
+
return getKind(val) === exports.TokenKind.Quoted;
|
|
2930
|
+
}
|
|
2931
|
+
function isLiteralToken(val) {
|
|
2932
|
+
return getKind(val) === exports.TokenKind.Literal;
|
|
2933
|
+
}
|
|
2934
|
+
function isNumberToken(val) {
|
|
2935
|
+
return getKind(val) === exports.TokenKind.Number;
|
|
2936
|
+
}
|
|
2937
|
+
function isPropertyAccessToken(val) {
|
|
2938
|
+
return getKind(val) === exports.TokenKind.PropertyAccess;
|
|
2939
|
+
}
|
|
2940
|
+
function isWordToken(val) {
|
|
2941
|
+
return getKind(val) === exports.TokenKind.Word;
|
|
2942
|
+
}
|
|
2943
|
+
function isRangeToken(val) {
|
|
2944
|
+
return getKind(val) === exports.TokenKind.Range;
|
|
2945
|
+
}
|
|
2946
|
+
function isValueToken(val) {
|
|
2947
|
+
// valueTokenBitMask = TokenKind.Number | TokenKind.Literal | TokenKind.Quoted | TokenKind.PropertyAccess | TokenKind.Range
|
|
2948
|
+
return (getKind(val) & 1667) > 0;
|
|
2949
|
+
}
|
|
2950
|
+
function getKind(val) {
|
|
2951
|
+
return val ? val.kind : -1;
|
|
2952
|
+
}
|
|
2953
|
+
|
|
2954
|
+
var typeGuards = /*#__PURE__*/Object.freeze({
|
|
2955
|
+
__proto__: null,
|
|
2956
|
+
isDelimitedToken: isDelimitedToken,
|
|
2957
|
+
isOperatorToken: isOperatorToken,
|
|
2958
|
+
isHTMLToken: isHTMLToken,
|
|
2959
|
+
isOutputToken: isOutputToken,
|
|
2960
|
+
isTagToken: isTagToken,
|
|
2961
|
+
isQuotedToken: isQuotedToken,
|
|
2962
|
+
isLiteralToken: isLiteralToken,
|
|
2963
|
+
isNumberToken: isNumberToken,
|
|
2964
|
+
isPropertyAccessToken: isPropertyAccessToken,
|
|
2965
|
+
isWordToken: isWordToken,
|
|
2966
|
+
isRangeToken: isRangeToken,
|
|
2967
|
+
isValueToken: isValueToken
|
|
2968
|
+
});
|
|
2969
|
+
|
|
2970
|
+
/******************************************************************************
|
|
2971
|
+
Copyright (c) Microsoft Corporation.
|
|
2972
|
+
|
|
2973
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
2974
|
+
purpose with or without fee is hereby granted.
|
|
2975
|
+
|
|
2976
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
2977
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
2978
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
2979
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
2980
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
2981
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
2982
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
2983
|
+
***************************************************************************** */
|
|
2984
|
+
|
|
2985
|
+
var __assign = function() {
|
|
2986
|
+
__assign = Object.assign || function __assign(t) {
|
|
2987
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
2988
|
+
s = arguments[i];
|
|
2989
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
2990
|
+
}
|
|
2991
|
+
return t;
|
|
2992
|
+
};
|
|
2993
|
+
return __assign.apply(this, arguments);
|
|
2994
|
+
};
|
|
2995
|
+
|
|
2996
|
+
class Context {
|
|
2997
|
+
constructor(env = {}, opts = defaultOptions, renderOptions = {}, { memoryLimit, renderLimit } = {}) {
|
|
2998
|
+
/**
|
|
2999
|
+
* insert a Context-level empty scope,
|
|
3000
|
+
* for tags like `{% capture %}` `{% assign %}` to operate
|
|
3001
|
+
*/
|
|
3002
|
+
this.scopes = [{}];
|
|
3003
|
+
this.registers = {};
|
|
3004
|
+
this.breakCalled = false;
|
|
3005
|
+
this.continueCalled = false;
|
|
3006
|
+
this.sync = !!renderOptions.sync;
|
|
3007
|
+
this.opts = opts;
|
|
3008
|
+
this.globals = renderOptions.globals ?? opts.globals;
|
|
3009
|
+
this.environments = isObject(env) ? env : Object(env);
|
|
3010
|
+
this.strictVariables = renderOptions.strictVariables ?? this.opts.strictVariables;
|
|
3011
|
+
this.ownPropertyOnly = renderOptions.ownPropertyOnly ?? opts.ownPropertyOnly;
|
|
3012
|
+
this.memoryLimit = memoryLimit ?? new Limiter('memory alloc', renderOptions.memoryLimit ?? opts.memoryLimit);
|
|
3013
|
+
this.renderLimit = renderLimit ?? new Limiter('template render', getPerformance().now() + (renderOptions.renderLimit ?? opts.renderLimit));
|
|
3014
|
+
}
|
|
3015
|
+
getRegister(key) {
|
|
3016
|
+
return (this.registers[key] = this.registers[key] || {});
|
|
3017
|
+
}
|
|
3018
|
+
setRegister(key, value) {
|
|
3019
|
+
return (this.registers[key] = value);
|
|
3020
|
+
}
|
|
3021
|
+
saveRegister(...keys) {
|
|
3022
|
+
return keys.map(key => [key, this.getRegister(key)]);
|
|
3023
|
+
}
|
|
3024
|
+
restoreRegister(keyValues) {
|
|
3025
|
+
return keyValues.forEach(([key, value]) => this.setRegister(key, value));
|
|
3026
|
+
}
|
|
3027
|
+
getAll() {
|
|
3028
|
+
return [this.globals, this.environments, ...this.scopes]
|
|
3029
|
+
.reduce((ctx, val) => __assign(ctx, val), {});
|
|
3030
|
+
}
|
|
3031
|
+
/**
|
|
3032
|
+
* @deprecated use `_get()` or `getSync()` instead
|
|
3033
|
+
*/
|
|
3034
|
+
get(paths) {
|
|
3035
|
+
return this.getSync(paths);
|
|
3036
|
+
}
|
|
3037
|
+
getSync(paths) {
|
|
3038
|
+
return toValueSync(this._get(paths));
|
|
3039
|
+
}
|
|
3040
|
+
*_get(paths) {
|
|
3041
|
+
const scope = this.findScope(paths[0]); // first prop should always be a string
|
|
3042
|
+
return yield this._getFromScope(scope, paths);
|
|
3043
|
+
}
|
|
3044
|
+
/**
|
|
3045
|
+
* @deprecated use `_get()` instead
|
|
3046
|
+
*/
|
|
3047
|
+
getFromScope(scope, paths) {
|
|
3048
|
+
return toValueSync(this._getFromScope(scope, paths));
|
|
3049
|
+
}
|
|
3050
|
+
*_getFromScope(scope, paths, strictVariables = this.strictVariables) {
|
|
3051
|
+
if (isString(paths))
|
|
3052
|
+
paths = paths.split('.');
|
|
3053
|
+
for (let i = 0; i < paths.length; i++) {
|
|
3054
|
+
scope = yield this.readProperty(scope, paths[i]);
|
|
3055
|
+
if (strictVariables && isUndefined(scope)) {
|
|
3056
|
+
throw new InternalUndefinedVariableError(paths.slice(0, i + 1).join('.'));
|
|
3057
|
+
}
|
|
3058
|
+
}
|
|
3059
|
+
return scope;
|
|
3060
|
+
}
|
|
3061
|
+
push(ctx) {
|
|
3062
|
+
return this.scopes.push(ctx);
|
|
3063
|
+
}
|
|
3064
|
+
pop() {
|
|
3065
|
+
return this.scopes.pop();
|
|
3066
|
+
}
|
|
3067
|
+
bottom() {
|
|
3068
|
+
return this.scopes[0];
|
|
3069
|
+
}
|
|
3070
|
+
spawn(scope = {}) {
|
|
3071
|
+
return new Context(scope, this.opts, {
|
|
3072
|
+
sync: this.sync,
|
|
3073
|
+
globals: this.globals,
|
|
3074
|
+
strictVariables: this.strictVariables
|
|
3075
|
+
}, {
|
|
3076
|
+
renderLimit: this.renderLimit,
|
|
3077
|
+
memoryLimit: this.memoryLimit
|
|
3078
|
+
});
|
|
3079
|
+
}
|
|
3080
|
+
findScope(key) {
|
|
3081
|
+
for (let i = this.scopes.length - 1; i >= 0; i--) {
|
|
3082
|
+
const candidate = this.scopes[i];
|
|
3083
|
+
if (key in candidate)
|
|
3084
|
+
return candidate;
|
|
3085
|
+
}
|
|
3086
|
+
if (key in this.environments)
|
|
3087
|
+
return this.environments;
|
|
3088
|
+
return this.globals;
|
|
3089
|
+
}
|
|
3090
|
+
readProperty(obj, key) {
|
|
3091
|
+
obj = toLiquid(obj);
|
|
3092
|
+
key = toValue(key);
|
|
3093
|
+
if (isNil(obj))
|
|
3094
|
+
return obj;
|
|
3095
|
+
if (isArray(obj) && key < 0)
|
|
3096
|
+
return obj[obj.length + +key];
|
|
3097
|
+
const value = readJSProperty(obj, key, this.ownPropertyOnly);
|
|
3098
|
+
if (value === undefined && obj instanceof Drop)
|
|
3099
|
+
return obj.liquidMethodMissing(key, this);
|
|
3100
|
+
if (isFunction(value))
|
|
3101
|
+
return value.call(obj);
|
|
3102
|
+
if (key === 'size')
|
|
3103
|
+
return readSize(obj);
|
|
3104
|
+
else if (key === 'first')
|
|
3105
|
+
return readFirst(obj);
|
|
3106
|
+
else if (key === 'last')
|
|
3107
|
+
return readLast(obj);
|
|
3108
|
+
return value;
|
|
3109
|
+
}
|
|
3110
|
+
}
|
|
3111
|
+
function readJSProperty(obj, key, ownPropertyOnly) {
|
|
3112
|
+
if (ownPropertyOnly && !hasOwnProperty.call(obj, key) && !(obj instanceof Drop))
|
|
3113
|
+
return undefined;
|
|
3114
|
+
return obj[key];
|
|
3115
|
+
}
|
|
3116
|
+
function readFirst(obj) {
|
|
3117
|
+
if (isArray(obj))
|
|
3118
|
+
return obj[0];
|
|
3119
|
+
return obj['first'];
|
|
3120
|
+
}
|
|
3121
|
+
function readLast(obj) {
|
|
3122
|
+
if (isArray(obj))
|
|
3123
|
+
return obj[obj.length - 1];
|
|
3124
|
+
return obj['last'];
|
|
3125
|
+
}
|
|
3126
|
+
function readSize(obj) {
|
|
3127
|
+
if (hasOwnProperty.call(obj, 'size') || obj['size'] !== undefined)
|
|
3128
|
+
return obj['size'];
|
|
3129
|
+
if (isArray(obj) || isString(obj))
|
|
3130
|
+
return obj.length;
|
|
3131
|
+
if (typeof obj === 'object')
|
|
3132
|
+
return Object.keys(obj).length;
|
|
3133
|
+
}
|
|
3134
|
+
|
|
3135
|
+
var BlockMode;
|
|
3136
|
+
(function (BlockMode) {
|
|
3137
|
+
/* store rendered html into blocks */
|
|
3138
|
+
BlockMode[BlockMode["OUTPUT"] = 0] = "OUTPUT";
|
|
3139
|
+
/* output rendered html directly */
|
|
3140
|
+
BlockMode[BlockMode["STORE"] = 1] = "STORE";
|
|
3141
|
+
})(BlockMode || (BlockMode = {}));
|
|
3142
|
+
|
|
3143
|
+
const abs = argumentsToNumber(Math.abs);
|
|
3144
|
+
const at_least = argumentsToNumber(Math.max);
|
|
3145
|
+
const at_most = argumentsToNumber(Math.min);
|
|
3146
|
+
const ceil = argumentsToNumber(Math.ceil);
|
|
3147
|
+
const divided_by = argumentsToNumber((dividend, divisor, integerArithmetic = false) => integerArithmetic ? Math.floor(dividend / divisor) : dividend / divisor);
|
|
3148
|
+
const floor = argumentsToNumber(Math.floor);
|
|
3149
|
+
const minus = argumentsToNumber((v, arg) => v - arg);
|
|
3150
|
+
const plus = argumentsToNumber((lhs, rhs) => lhs + rhs);
|
|
3151
|
+
const modulo = argumentsToNumber((v, arg) => v % arg);
|
|
3152
|
+
const times = argumentsToNumber((v, arg) => v * arg);
|
|
3153
|
+
function round(v, arg = 0) {
|
|
3154
|
+
v = toNumber(v);
|
|
3155
|
+
arg = toNumber(arg);
|
|
3156
|
+
const amp = Math.pow(10, arg);
|
|
3157
|
+
return Math.round(v * amp) / amp;
|
|
3158
|
+
}
|
|
3159
|
+
|
|
3160
|
+
var mathFilters = /*#__PURE__*/Object.freeze({
|
|
3161
|
+
__proto__: null,
|
|
3162
|
+
abs: abs,
|
|
3163
|
+
at_least: at_least,
|
|
3164
|
+
at_most: at_most,
|
|
3165
|
+
ceil: ceil,
|
|
3166
|
+
divided_by: divided_by,
|
|
3167
|
+
floor: floor,
|
|
3168
|
+
minus: minus,
|
|
3169
|
+
plus: plus,
|
|
3170
|
+
modulo: modulo,
|
|
3171
|
+
times: times,
|
|
3172
|
+
round: round
|
|
3173
|
+
});
|
|
3174
|
+
|
|
3175
|
+
const url_decode = (x) => decodeURIComponent(stringify(x)).replace(/\+/g, ' ');
|
|
3176
|
+
const url_encode = (x) => encodeURIComponent(stringify(x)).replace(/%20/g, '+');
|
|
3177
|
+
const cgi_escape = (x) => encodeURIComponent(stringify(x))
|
|
3178
|
+
.replace(/%20/g, '+')
|
|
3179
|
+
.replace(/[!'()*]/g, c => '%' + c.charCodeAt(0).toString(16).toUpperCase());
|
|
3180
|
+
const uri_escape = (x) => encodeURI(stringify(x))
|
|
3181
|
+
.replace(/%5B/g, '[')
|
|
3182
|
+
.replace(/%5D/g, ']');
|
|
3183
|
+
const rSlugifyDefault = /[^\p{M}\p{L}\p{Nd}]+/ug;
|
|
3184
|
+
const rSlugifyReplacers = {
|
|
3185
|
+
'raw': /\s+/g,
|
|
3186
|
+
'default': rSlugifyDefault,
|
|
3187
|
+
'pretty': /[^\p{M}\p{L}\p{Nd}._~!$&'()+,;=@]+/ug,
|
|
3188
|
+
'ascii': /[^A-Za-z0-9]+/g,
|
|
3189
|
+
'latin': rSlugifyDefault,
|
|
3190
|
+
'none': null
|
|
3191
|
+
};
|
|
3192
|
+
function slugify(str, mode = 'default', cased = false) {
|
|
3193
|
+
str = stringify(str);
|
|
3194
|
+
const replacer = rSlugifyReplacers[mode];
|
|
3195
|
+
if (replacer) {
|
|
3196
|
+
if (mode === 'latin')
|
|
3197
|
+
str = removeAccents(str);
|
|
3198
|
+
str = str.replace(replacer, '-').replace(/^-|-$/g, '');
|
|
3199
|
+
}
|
|
3200
|
+
return cased ? str : str.toLowerCase();
|
|
3201
|
+
}
|
|
3202
|
+
function removeAccents(str) {
|
|
3203
|
+
return str.replace(/[àáâãäå]/g, 'a')
|
|
3204
|
+
.replace(/[æ]/g, 'ae')
|
|
3205
|
+
.replace(/[ç]/g, 'c')
|
|
3206
|
+
.replace(/[èéêë]/g, 'e')
|
|
3207
|
+
.replace(/[ìíîï]/g, 'i')
|
|
3208
|
+
.replace(/[ð]/g, 'd')
|
|
3209
|
+
.replace(/[ñ]/g, 'n')
|
|
3210
|
+
.replace(/[òóôõöø]/g, 'o')
|
|
3211
|
+
.replace(/[ùúûü]/g, 'u')
|
|
3212
|
+
.replace(/[ýÿ]/g, 'y')
|
|
3213
|
+
.replace(/[ß]/g, 'ss')
|
|
3214
|
+
.replace(/[œ]/g, 'oe')
|
|
3215
|
+
.replace(/[þ]/g, 'th')
|
|
3216
|
+
.replace(/[ẞ]/g, 'SS')
|
|
3217
|
+
.replace(/[Œ]/g, 'OE')
|
|
3218
|
+
.replace(/[Þ]/g, 'TH');
|
|
3219
|
+
}
|
|
3220
|
+
|
|
3221
|
+
var urlFilters = /*#__PURE__*/Object.freeze({
|
|
3222
|
+
__proto__: null,
|
|
3223
|
+
url_decode: url_decode,
|
|
3224
|
+
url_encode: url_encode,
|
|
3225
|
+
cgi_escape: cgi_escape,
|
|
3226
|
+
uri_escape: uri_escape,
|
|
3227
|
+
slugify: slugify
|
|
3228
|
+
});
|
|
3229
|
+
|
|
3230
|
+
const join = argumentsToValue(function (v, arg) {
|
|
3231
|
+
const array = toArray(v);
|
|
3232
|
+
const sep = isNil(arg) ? ' ' : stringify(arg);
|
|
3233
|
+
const complexity = array.length * (1 + sep.length);
|
|
3234
|
+
this.context.memoryLimit.use(complexity);
|
|
3235
|
+
return array.join(sep);
|
|
3236
|
+
});
|
|
3237
|
+
const last$1 = argumentsToValue((v) => isArrayLike(v) ? last(v) : '');
|
|
3238
|
+
const first = argumentsToValue((v) => isArrayLike(v) ? v[0] : '');
|
|
3239
|
+
const reverse = argumentsToValue(function (v) {
|
|
3240
|
+
const array = toArray(v);
|
|
3241
|
+
this.context.memoryLimit.use(array.length);
|
|
3242
|
+
return [...array].reverse();
|
|
3243
|
+
});
|
|
3244
|
+
function* sort(arr, property) {
|
|
3245
|
+
const values = [];
|
|
3246
|
+
const array = toArray(arr);
|
|
3247
|
+
this.context.memoryLimit.use(array.length);
|
|
3248
|
+
for (const item of array) {
|
|
3249
|
+
values.push([
|
|
3250
|
+
item,
|
|
3251
|
+
property ? yield this.context._getFromScope(item, stringify(property).split('.'), false) : item
|
|
3252
|
+
]);
|
|
3253
|
+
}
|
|
3254
|
+
return values.sort((lhs, rhs) => {
|
|
3255
|
+
const lvalue = lhs[1];
|
|
3256
|
+
const rvalue = rhs[1];
|
|
3257
|
+
return lvalue < rvalue ? -1 : (lvalue > rvalue ? 1 : 0);
|
|
3258
|
+
}).map(tuple => tuple[0]);
|
|
3259
|
+
}
|
|
3260
|
+
function sort_natural(input, property) {
|
|
3261
|
+
const propertyString = stringify(property);
|
|
3262
|
+
const compare = property === undefined
|
|
3263
|
+
? caseInsensitiveCompare
|
|
3264
|
+
: (lhs, rhs) => caseInsensitiveCompare(lhs[propertyString], rhs[propertyString]);
|
|
3265
|
+
const array = toArray(input);
|
|
3266
|
+
this.context.memoryLimit.use(array.length);
|
|
3267
|
+
return [...array].sort(compare);
|
|
3268
|
+
}
|
|
3269
|
+
const size = (v) => (v && v.length) || 0;
|
|
3270
|
+
function* map(arr, property) {
|
|
3271
|
+
const results = [];
|
|
3272
|
+
const array = toArray(arr);
|
|
3273
|
+
this.context.memoryLimit.use(array.length);
|
|
3274
|
+
for (const item of array) {
|
|
3275
|
+
results.push(yield this.context._getFromScope(item, stringify(property), false));
|
|
3276
|
+
}
|
|
3277
|
+
return results;
|
|
3278
|
+
}
|
|
3279
|
+
function* sum(arr, property) {
|
|
3280
|
+
let sum = 0;
|
|
3281
|
+
const array = toArray(arr);
|
|
3282
|
+
for (const item of array) {
|
|
3283
|
+
const data = Number(property ? yield this.context._getFromScope(item, stringify(property), false) : item);
|
|
3284
|
+
sum += Number.isNaN(data) ? 0 : data;
|
|
3285
|
+
}
|
|
3286
|
+
return sum;
|
|
3287
|
+
}
|
|
3288
|
+
function compact(arr) {
|
|
3289
|
+
const array = toArray(arr);
|
|
3290
|
+
this.context.memoryLimit.use(array.length);
|
|
3291
|
+
return array.filter(x => !isNil(toValue(x)));
|
|
3292
|
+
}
|
|
3293
|
+
function concat(v, arg = []) {
|
|
3294
|
+
const lhs = toArray(v);
|
|
3295
|
+
const rhs = toArray(arg);
|
|
3296
|
+
this.context.memoryLimit.use(lhs.length + rhs.length);
|
|
3297
|
+
return lhs.concat(rhs);
|
|
3298
|
+
}
|
|
3299
|
+
function push(v, arg) {
|
|
3300
|
+
return concat.call(this, v, [arg]);
|
|
3301
|
+
}
|
|
3302
|
+
function unshift(v, arg) {
|
|
3303
|
+
const array = toArray(v);
|
|
3304
|
+
this.context.memoryLimit.use(array.length);
|
|
3305
|
+
const clone = [...array];
|
|
3306
|
+
clone.unshift(arg);
|
|
3307
|
+
return clone;
|
|
3308
|
+
}
|
|
3309
|
+
function pop(v) {
|
|
3310
|
+
const clone = [...toArray(v)];
|
|
3311
|
+
clone.pop();
|
|
3312
|
+
return clone;
|
|
3313
|
+
}
|
|
3314
|
+
function shift(v) {
|
|
3315
|
+
const array = toArray(v);
|
|
3316
|
+
this.context.memoryLimit.use(array.length);
|
|
3317
|
+
const clone = [...array];
|
|
3318
|
+
clone.shift();
|
|
3319
|
+
return clone;
|
|
3320
|
+
}
|
|
3321
|
+
function slice(v, begin, length = 1) {
|
|
3322
|
+
v = toValue(v);
|
|
3323
|
+
if (isNil(v))
|
|
3324
|
+
return [];
|
|
3325
|
+
if (!isArray(v))
|
|
3326
|
+
v = stringify(v);
|
|
3327
|
+
begin = begin < 0 ? v.length + begin : begin;
|
|
3328
|
+
this.context.memoryLimit.use(length);
|
|
3329
|
+
return v.slice(begin, begin + length);
|
|
3330
|
+
}
|
|
3331
|
+
function expectedMatcher(expected) {
|
|
3332
|
+
if (this.context.opts.jekyllWhere) {
|
|
3333
|
+
return (v) => EmptyDrop.is(expected) ? equals(v, expected) : (isArray(v) ? arrayIncludes(v, expected) : equals(v, expected));
|
|
3334
|
+
}
|
|
3335
|
+
else if (expected === undefined) {
|
|
3336
|
+
return (v) => isTruthy(v, this.context);
|
|
3337
|
+
}
|
|
3338
|
+
else {
|
|
3339
|
+
return (v) => equals(v, expected);
|
|
3340
|
+
}
|
|
3341
|
+
}
|
|
3342
|
+
function* filter(include, arr, property, expected) {
|
|
3343
|
+
const values = [];
|
|
3344
|
+
arr = toArray(arr);
|
|
3345
|
+
this.context.memoryLimit.use(arr.length);
|
|
3346
|
+
const token = new Tokenizer(stringify(property)).readScopeValue();
|
|
3347
|
+
for (const item of arr) {
|
|
3348
|
+
values.push(yield evalToken(token, this.context.spawn(item)));
|
|
3349
|
+
}
|
|
3350
|
+
const matcher = expectedMatcher.call(this, expected);
|
|
3351
|
+
return arr.filter((_, i) => matcher(values[i]) === include);
|
|
3352
|
+
}
|
|
3353
|
+
function* filter_exp(include, arr, itemName, exp) {
|
|
3354
|
+
const filtered = [];
|
|
3355
|
+
const keyTemplate = new Value(stringify(exp), this.liquid);
|
|
3356
|
+
const array = toArray(arr);
|
|
3357
|
+
this.context.memoryLimit.use(array.length);
|
|
3358
|
+
for (const item of array) {
|
|
3359
|
+
this.context.push({ [itemName]: item });
|
|
3360
|
+
const value = yield keyTemplate.value(this.context);
|
|
3361
|
+
this.context.pop();
|
|
3362
|
+
if (value === include)
|
|
3363
|
+
filtered.push(item);
|
|
3364
|
+
}
|
|
3365
|
+
return filtered;
|
|
3366
|
+
}
|
|
3367
|
+
function* where(arr, property, expected) {
|
|
3368
|
+
return yield* filter.call(this, true, arr, property, expected);
|
|
3369
|
+
}
|
|
3370
|
+
function* reject(arr, property, expected) {
|
|
3371
|
+
return yield* filter.call(this, false, arr, property, expected);
|
|
3372
|
+
}
|
|
3373
|
+
function* where_exp(arr, itemName, exp) {
|
|
3374
|
+
return yield* filter_exp.call(this, true, arr, itemName, exp);
|
|
3375
|
+
}
|
|
3376
|
+
function* reject_exp(arr, itemName, exp) {
|
|
3377
|
+
return yield* filter_exp.call(this, false, arr, itemName, exp);
|
|
3378
|
+
}
|
|
3379
|
+
function* group_by(arr, property) {
|
|
3380
|
+
const map = new Map();
|
|
3381
|
+
arr = toEnumerable(arr);
|
|
3382
|
+
const token = new Tokenizer(stringify(property)).readScopeValue();
|
|
3383
|
+
this.context.memoryLimit.use(arr.length);
|
|
3384
|
+
for (const item of arr) {
|
|
3385
|
+
const key = yield evalToken(token, this.context.spawn(item));
|
|
3386
|
+
if (!map.has(key))
|
|
3387
|
+
map.set(key, []);
|
|
3388
|
+
map.get(key).push(item);
|
|
3389
|
+
}
|
|
3390
|
+
return [...map.entries()].map(([name, items]) => ({ name, items }));
|
|
3391
|
+
}
|
|
3392
|
+
function* group_by_exp(arr, itemName, exp) {
|
|
3393
|
+
const map = new Map();
|
|
3394
|
+
const keyTemplate = new Value(stringify(exp), this.liquid);
|
|
3395
|
+
arr = toEnumerable(arr);
|
|
3396
|
+
this.context.memoryLimit.use(arr.length);
|
|
3397
|
+
for (const item of arr) {
|
|
3398
|
+
this.context.push({ [itemName]: item });
|
|
3399
|
+
const key = yield keyTemplate.value(this.context);
|
|
3400
|
+
this.context.pop();
|
|
3401
|
+
if (!map.has(key))
|
|
3402
|
+
map.set(key, []);
|
|
3403
|
+
map.get(key).push(item);
|
|
3404
|
+
}
|
|
3405
|
+
return [...map.entries()].map(([name, items]) => ({ name, items }));
|
|
3406
|
+
}
|
|
3407
|
+
function* search(arr, property, expected) {
|
|
3408
|
+
const token = new Tokenizer(stringify(property)).readScopeValue();
|
|
3409
|
+
const array = toArray(arr);
|
|
3410
|
+
const matcher = expectedMatcher.call(this, expected);
|
|
3411
|
+
for (let index = 0; index < array.length; index++) {
|
|
3412
|
+
const value = yield evalToken(token, this.context.spawn(array[index]));
|
|
3413
|
+
if (matcher(value))
|
|
3414
|
+
return [index, array[index]];
|
|
3415
|
+
}
|
|
3416
|
+
}
|
|
3417
|
+
function* search_exp(arr, itemName, exp) {
|
|
3418
|
+
const predicate = new Value(stringify(exp), this.liquid);
|
|
3419
|
+
const array = toArray(arr);
|
|
3420
|
+
for (let index = 0; index < array.length; index++) {
|
|
3421
|
+
this.context.push({ [itemName]: array[index] });
|
|
3422
|
+
const value = yield predicate.value(this.context);
|
|
3423
|
+
this.context.pop();
|
|
3424
|
+
if (value)
|
|
3425
|
+
return [index, array[index]];
|
|
3426
|
+
}
|
|
3427
|
+
}
|
|
3428
|
+
function* has(arr, property, expected) {
|
|
3429
|
+
const result = yield* search.call(this, arr, property, expected);
|
|
3430
|
+
return !!result;
|
|
3431
|
+
}
|
|
3432
|
+
function* has_exp(arr, itemName, exp) {
|
|
3433
|
+
const result = yield* search_exp.call(this, arr, itemName, exp);
|
|
3434
|
+
return !!result;
|
|
3435
|
+
}
|
|
3436
|
+
function* find_index(arr, property, expected) {
|
|
3437
|
+
const result = yield* search.call(this, arr, property, expected);
|
|
3438
|
+
return result ? result[0] : undefined;
|
|
3439
|
+
}
|
|
3440
|
+
function* find_index_exp(arr, itemName, exp) {
|
|
3441
|
+
const result = yield* search_exp.call(this, arr, itemName, exp);
|
|
3442
|
+
return result ? result[0] : undefined;
|
|
3443
|
+
}
|
|
3444
|
+
function* find(arr, property, expected) {
|
|
3445
|
+
const result = yield* search.call(this, arr, property, expected);
|
|
3446
|
+
return result ? result[1] : undefined;
|
|
3447
|
+
}
|
|
3448
|
+
function* find_exp(arr, itemName, exp) {
|
|
3449
|
+
const result = yield* search_exp.call(this, arr, itemName, exp);
|
|
3450
|
+
return result ? result[1] : undefined;
|
|
3451
|
+
}
|
|
3452
|
+
function uniq(arr) {
|
|
3453
|
+
arr = toArray(arr);
|
|
3454
|
+
this.context.memoryLimit.use(arr.length);
|
|
3455
|
+
return [...new Set(arr)];
|
|
3456
|
+
}
|
|
3457
|
+
function sample(v, count = 1) {
|
|
3458
|
+
v = toValue(v);
|
|
3459
|
+
if (isNil(v))
|
|
3460
|
+
return [];
|
|
3461
|
+
if (!isArray(v))
|
|
3462
|
+
v = stringify(v);
|
|
3463
|
+
this.context.memoryLimit.use(count);
|
|
3464
|
+
const shuffled = [...v].sort(() => Math.random() - 0.5);
|
|
3465
|
+
if (count === 1)
|
|
3466
|
+
return shuffled[0];
|
|
3467
|
+
return shuffled.slice(0, count);
|
|
3468
|
+
}
|
|
3469
|
+
|
|
3470
|
+
var arrayFilters = /*#__PURE__*/Object.freeze({
|
|
3471
|
+
__proto__: null,
|
|
3472
|
+
join: join,
|
|
3473
|
+
last: last$1,
|
|
3474
|
+
first: first,
|
|
3475
|
+
reverse: reverse,
|
|
3476
|
+
sort: sort,
|
|
3477
|
+
sort_natural: sort_natural,
|
|
3478
|
+
size: size,
|
|
3479
|
+
map: map,
|
|
3480
|
+
sum: sum,
|
|
3481
|
+
compact: compact,
|
|
3482
|
+
concat: concat,
|
|
3483
|
+
push: push,
|
|
3484
|
+
unshift: unshift,
|
|
3485
|
+
pop: pop,
|
|
3486
|
+
shift: shift,
|
|
3487
|
+
slice: slice,
|
|
3488
|
+
where: where,
|
|
3489
|
+
reject: reject,
|
|
3490
|
+
where_exp: where_exp,
|
|
3491
|
+
reject_exp: reject_exp,
|
|
3492
|
+
group_by: group_by,
|
|
3493
|
+
group_by_exp: group_by_exp,
|
|
3494
|
+
has: has,
|
|
3495
|
+
has_exp: has_exp,
|
|
3496
|
+
find_index: find_index,
|
|
3497
|
+
find_index_exp: find_index_exp,
|
|
3498
|
+
find: find,
|
|
3499
|
+
find_exp: find_exp,
|
|
3500
|
+
uniq: uniq,
|
|
3501
|
+
sample: sample
|
|
3502
|
+
});
|
|
3503
|
+
|
|
3504
|
+
function date(v, format, timezoneOffset) {
|
|
3505
|
+
const size = (v?.length ?? 0) + (format?.length ?? 0) + (timezoneOffset?.length ?? 0);
|
|
3506
|
+
this.context.memoryLimit.use(size);
|
|
3507
|
+
const date = parseDate(v, this.context.opts, timezoneOffset);
|
|
3508
|
+
if (!date)
|
|
3509
|
+
return v;
|
|
3510
|
+
format = toValue(format);
|
|
3511
|
+
format = isNil(format) ? this.context.opts.dateFormat : stringify(format);
|
|
3512
|
+
return strftime(date, format);
|
|
3513
|
+
}
|
|
3514
|
+
function date_to_xmlschema(v) {
|
|
3515
|
+
return date.call(this, v, '%Y-%m-%dT%H:%M:%S%:z');
|
|
3516
|
+
}
|
|
3517
|
+
function date_to_rfc822(v) {
|
|
3518
|
+
return date.call(this, v, '%a, %d %b %Y %H:%M:%S %z');
|
|
3519
|
+
}
|
|
3520
|
+
function date_to_string(v, type, style) {
|
|
3521
|
+
return stringify_date.call(this, v, '%b', type, style);
|
|
3522
|
+
}
|
|
3523
|
+
function date_to_long_string(v, type, style) {
|
|
3524
|
+
return stringify_date.call(this, v, '%B', type, style);
|
|
3525
|
+
}
|
|
3526
|
+
function stringify_date(v, month_type, type, style) {
|
|
3527
|
+
const date = parseDate(v, this.context.opts);
|
|
3528
|
+
if (!date)
|
|
3529
|
+
return v;
|
|
3530
|
+
if (type === 'ordinal') {
|
|
3531
|
+
const d = date.getDate();
|
|
3532
|
+
return style === 'US'
|
|
3533
|
+
? strftime(date, `${month_type} ${d}%q, %Y`)
|
|
3534
|
+
: strftime(date, `${d}%q ${month_type} %Y`);
|
|
3535
|
+
}
|
|
3536
|
+
return strftime(date, `%d ${month_type} %Y`);
|
|
3537
|
+
}
|
|
3538
|
+
function parseDate(v, opts, timezoneOffset) {
|
|
3539
|
+
let date;
|
|
3540
|
+
const defaultTimezoneOffset = timezoneOffset ?? opts.timezoneOffset;
|
|
3541
|
+
const locale = opts.locale;
|
|
3542
|
+
v = toValue(v);
|
|
3543
|
+
if (v === 'now' || v === 'today') {
|
|
3544
|
+
date = new LiquidDate(Date.now(), locale, defaultTimezoneOffset);
|
|
3545
|
+
}
|
|
3546
|
+
else if (isNumber(v)) {
|
|
3547
|
+
date = new LiquidDate(v * 1000, locale, defaultTimezoneOffset);
|
|
3548
|
+
}
|
|
3549
|
+
else if (isString(v)) {
|
|
3550
|
+
if (/^\d+$/.test(v)) {
|
|
3551
|
+
date = new LiquidDate(+v * 1000, locale, defaultTimezoneOffset);
|
|
3552
|
+
}
|
|
3553
|
+
else if (opts.preserveTimezones && timezoneOffset === undefined) {
|
|
3554
|
+
date = LiquidDate.createDateFixedToTimezone(v, locale);
|
|
3555
|
+
}
|
|
3556
|
+
else {
|
|
3557
|
+
date = new LiquidDate(v, locale, defaultTimezoneOffset);
|
|
3558
|
+
}
|
|
3559
|
+
}
|
|
3560
|
+
else {
|
|
3561
|
+
date = new LiquidDate(v, locale, defaultTimezoneOffset);
|
|
3562
|
+
}
|
|
3563
|
+
return date.valid() ? date : undefined;
|
|
3564
|
+
}
|
|
3565
|
+
|
|
3566
|
+
var dateFilters = /*#__PURE__*/Object.freeze({
|
|
3567
|
+
__proto__: null,
|
|
3568
|
+
date: date,
|
|
3569
|
+
date_to_xmlschema: date_to_xmlschema,
|
|
3570
|
+
date_to_rfc822: date_to_rfc822,
|
|
3571
|
+
date_to_string: date_to_string,
|
|
3572
|
+
date_to_long_string: date_to_long_string
|
|
3573
|
+
});
|
|
3574
|
+
|
|
3575
|
+
/**
|
|
3576
|
+
* String related filters
|
|
3577
|
+
*
|
|
3578
|
+
* * prefer stringify() to String() since `undefined`, `null` should eval ''
|
|
3579
|
+
*/
|
|
3580
|
+
const rCJKWord = /[\u4E00-\u9FFF\uF900-\uFAFF\u3400-\u4DBF\u3040-\u309F\u30A0-\u30FF\uAC00-\uD7AF]/gu;
|
|
3581
|
+
// Word boundary followed by word characters (for detecting words)
|
|
3582
|
+
const rNonCJKWord = /[^\u4E00-\u9FFF\uF900-\uFAFF\u3400-\u4DBF\u3040-\u309F\u30A0-\u30FF\uAC00-\uD7AF\s]+/gu;
|
|
3583
|
+
function append(v, arg) {
|
|
3584
|
+
assert(arguments.length === 2, 'append expect 2 arguments');
|
|
3585
|
+
const lhs = stringify(v);
|
|
3586
|
+
const rhs = stringify(arg);
|
|
3587
|
+
this.context.memoryLimit.use(lhs.length + rhs.length);
|
|
3588
|
+
return lhs + rhs;
|
|
3589
|
+
}
|
|
3590
|
+
function prepend(v, arg) {
|
|
3591
|
+
assert(arguments.length === 2, 'prepend expect 2 arguments');
|
|
3592
|
+
const lhs = stringify(v);
|
|
3593
|
+
const rhs = stringify(arg);
|
|
3594
|
+
this.context.memoryLimit.use(lhs.length + rhs.length);
|
|
3595
|
+
return rhs + lhs;
|
|
3596
|
+
}
|
|
3597
|
+
function lstrip(v, chars) {
|
|
3598
|
+
const str = stringify(v);
|
|
3599
|
+
this.context.memoryLimit.use(str.length);
|
|
3600
|
+
if (chars) {
|
|
3601
|
+
chars = escapeRegExp(stringify(chars));
|
|
3602
|
+
return str.replace(new RegExp(`^[${chars}]+`, 'g'), '');
|
|
3603
|
+
}
|
|
3604
|
+
return str.replace(/^\s+/, '');
|
|
3605
|
+
}
|
|
3606
|
+
function downcase(v) {
|
|
3607
|
+
const str = stringify(v);
|
|
3608
|
+
this.context.memoryLimit.use(str.length);
|
|
3609
|
+
return str.toLowerCase();
|
|
3610
|
+
}
|
|
3611
|
+
function upcase(v) {
|
|
3612
|
+
const str = stringify(v);
|
|
3613
|
+
this.context.memoryLimit.use(str.length);
|
|
3614
|
+
return stringify(str).toUpperCase();
|
|
3615
|
+
}
|
|
3616
|
+
function remove(v, arg) {
|
|
3617
|
+
const str = stringify(v);
|
|
3618
|
+
this.context.memoryLimit.use(str.length);
|
|
3619
|
+
return str.split(stringify(arg)).join('');
|
|
3620
|
+
}
|
|
3621
|
+
function remove_first(v, l) {
|
|
3622
|
+
const str = stringify(v);
|
|
3623
|
+
this.context.memoryLimit.use(str.length);
|
|
3624
|
+
return str.replace(stringify(l), '');
|
|
3625
|
+
}
|
|
3626
|
+
function remove_last(v, l) {
|
|
3627
|
+
const str = stringify(v);
|
|
3628
|
+
this.context.memoryLimit.use(str.length);
|
|
3629
|
+
const pattern = stringify(l);
|
|
3630
|
+
const index = str.lastIndexOf(pattern);
|
|
3631
|
+
if (index === -1)
|
|
3632
|
+
return str;
|
|
3633
|
+
return str.substring(0, index) + str.substring(index + pattern.length);
|
|
3634
|
+
}
|
|
3635
|
+
function rstrip(str, chars) {
|
|
3636
|
+
str = stringify(str);
|
|
3637
|
+
this.context.memoryLimit.use(str.length);
|
|
3638
|
+
if (chars) {
|
|
3639
|
+
chars = escapeRegExp(stringify(chars));
|
|
3640
|
+
return str.replace(new RegExp(`[${chars}]+$`, 'g'), '');
|
|
3641
|
+
}
|
|
3642
|
+
return str.replace(/\s+$/, '');
|
|
3643
|
+
}
|
|
3644
|
+
function split(v, arg) {
|
|
3645
|
+
const str = stringify(v);
|
|
3646
|
+
this.context.memoryLimit.use(str.length);
|
|
3647
|
+
const arr = str.split(stringify(arg));
|
|
3648
|
+
// align to ruby split, which is the behavior of shopify/liquid
|
|
3649
|
+
// see: https://ruby-doc.org/core-2.4.0/String.html#method-i-split
|
|
3650
|
+
while (arr.length && arr[arr.length - 1] === '')
|
|
3651
|
+
arr.pop();
|
|
3652
|
+
return arr;
|
|
3653
|
+
}
|
|
3654
|
+
function strip(v, chars) {
|
|
3655
|
+
const str = stringify(v);
|
|
3656
|
+
this.context.memoryLimit.use(str.length);
|
|
3657
|
+
if (chars) {
|
|
3658
|
+
chars = escapeRegExp(stringify(chars));
|
|
3659
|
+
return str
|
|
3660
|
+
.replace(new RegExp(`^[${chars}]+`, 'g'), '')
|
|
3661
|
+
.replace(new RegExp(`[${chars}]+$`, 'g'), '');
|
|
3662
|
+
}
|
|
3663
|
+
return str.trim();
|
|
3664
|
+
}
|
|
3665
|
+
function strip_newlines(v) {
|
|
3666
|
+
const str = stringify(v);
|
|
3667
|
+
this.context.memoryLimit.use(str.length);
|
|
3668
|
+
return str.replace(/\r?\n/gm, '');
|
|
3669
|
+
}
|
|
3670
|
+
function capitalize(str) {
|
|
3671
|
+
str = stringify(str);
|
|
3672
|
+
this.context.memoryLimit.use(str.length);
|
|
3673
|
+
return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
|
|
3674
|
+
}
|
|
3675
|
+
function replace(v, pattern, replacement) {
|
|
3676
|
+
const str = stringify(v);
|
|
3677
|
+
this.context.memoryLimit.use(str.length);
|
|
3678
|
+
return str.split(stringify(pattern)).join(replacement);
|
|
3679
|
+
}
|
|
3680
|
+
function replace_first(v, arg1, arg2) {
|
|
3681
|
+
const str = stringify(v);
|
|
3682
|
+
this.context.memoryLimit.use(str.length);
|
|
3683
|
+
return str.replace(stringify(arg1), arg2);
|
|
3684
|
+
}
|
|
3685
|
+
function replace_last(v, arg1, arg2) {
|
|
3686
|
+
const str = stringify(v);
|
|
3687
|
+
this.context.memoryLimit.use(str.length);
|
|
3688
|
+
const pattern = stringify(arg1);
|
|
3689
|
+
const index = str.lastIndexOf(pattern);
|
|
3690
|
+
if (index === -1)
|
|
3691
|
+
return str;
|
|
3692
|
+
const replacement = stringify(arg2);
|
|
3693
|
+
return str.substring(0, index) + replacement + str.substring(index + pattern.length);
|
|
3694
|
+
}
|
|
3695
|
+
function truncate(v, l = 50, o = '...') {
|
|
3696
|
+
const str = stringify(v);
|
|
3697
|
+
this.context.memoryLimit.use(str.length);
|
|
3698
|
+
if (str.length <= l)
|
|
3699
|
+
return v;
|
|
3700
|
+
return str.substring(0, l - o.length) + o;
|
|
3701
|
+
}
|
|
3702
|
+
function truncatewords(v, words = 15, o = '...') {
|
|
3703
|
+
const str = stringify(v);
|
|
3704
|
+
this.context.memoryLimit.use(str.length);
|
|
3705
|
+
const arr = str.split(/\s+/);
|
|
3706
|
+
if (words <= 0)
|
|
3707
|
+
words = 1;
|
|
3708
|
+
let ret = arr.slice(0, words).join(' ');
|
|
3709
|
+
if (arr.length >= words)
|
|
3710
|
+
ret += o;
|
|
3711
|
+
return ret;
|
|
3712
|
+
}
|
|
3713
|
+
function normalize_whitespace(v) {
|
|
3714
|
+
const str = stringify(v);
|
|
3715
|
+
this.context.memoryLimit.use(str.length);
|
|
3716
|
+
return str.replace(/\s+/g, ' ');
|
|
3717
|
+
}
|
|
3718
|
+
function number_of_words(input, mode) {
|
|
3719
|
+
const str = stringify(input);
|
|
3720
|
+
this.context.memoryLimit.use(str.length);
|
|
3721
|
+
input = str.trim();
|
|
3722
|
+
if (!input)
|
|
3723
|
+
return 0;
|
|
3724
|
+
switch (mode) {
|
|
3725
|
+
case 'cjk':
|
|
3726
|
+
// Count CJK characters and words
|
|
3727
|
+
return (input.match(rCJKWord) || []).length + (input.match(rNonCJKWord) || []).length;
|
|
3728
|
+
case 'auto':
|
|
3729
|
+
// Count CJK characters, if none, count words
|
|
3730
|
+
return rCJKWord.test(input)
|
|
3731
|
+
? input.match(rCJKWord).length + (input.match(rNonCJKWord) || []).length
|
|
3732
|
+
: input.split(/\s+/).length;
|
|
3733
|
+
default:
|
|
3734
|
+
// Count words only
|
|
3735
|
+
return input.split(/\s+/).length;
|
|
3736
|
+
}
|
|
3737
|
+
}
|
|
3738
|
+
function array_to_sentence_string(array, connector = 'and') {
|
|
3739
|
+
this.context.memoryLimit.use(array.length);
|
|
3740
|
+
switch (array.length) {
|
|
3741
|
+
case 0:
|
|
3742
|
+
return '';
|
|
3743
|
+
case 1:
|
|
3744
|
+
return array[0];
|
|
3745
|
+
case 2:
|
|
3746
|
+
return `${array[0]} ${connector} ${array[1]}`;
|
|
3747
|
+
default:
|
|
3748
|
+
return `${array.slice(0, -1).join(', ')}, ${connector} ${array[array.length - 1]}`;
|
|
3749
|
+
}
|
|
3750
|
+
}
|
|
3751
|
+
|
|
3752
|
+
var stringFilters = /*#__PURE__*/Object.freeze({
|
|
3753
|
+
__proto__: null,
|
|
3754
|
+
append: append,
|
|
3755
|
+
prepend: prepend,
|
|
3756
|
+
lstrip: lstrip,
|
|
3757
|
+
downcase: downcase,
|
|
3758
|
+
upcase: upcase,
|
|
3759
|
+
remove: remove,
|
|
3760
|
+
remove_first: remove_first,
|
|
3761
|
+
remove_last: remove_last,
|
|
3762
|
+
rstrip: rstrip,
|
|
3763
|
+
split: split,
|
|
3764
|
+
strip: strip,
|
|
3765
|
+
strip_newlines: strip_newlines,
|
|
3766
|
+
capitalize: capitalize,
|
|
3767
|
+
replace: replace,
|
|
3768
|
+
replace_first: replace_first,
|
|
3769
|
+
replace_last: replace_last,
|
|
3770
|
+
truncate: truncate,
|
|
3771
|
+
truncatewords: truncatewords,
|
|
3772
|
+
normalize_whitespace: normalize_whitespace,
|
|
3773
|
+
number_of_words: number_of_words,
|
|
3774
|
+
array_to_sentence_string: array_to_sentence_string
|
|
3775
|
+
});
|
|
3776
|
+
|
|
3777
|
+
function base64Encode(str) {
|
|
3778
|
+
return Buffer.from(str, 'utf8').toString('base64');
|
|
3779
|
+
}
|
|
3780
|
+
function base64Decode(str) {
|
|
3781
|
+
return Buffer.from(str, 'base64').toString('utf8');
|
|
3782
|
+
}
|
|
3783
|
+
|
|
3784
|
+
/**
|
|
3785
|
+
* Base64 related filters
|
|
3786
|
+
*
|
|
3787
|
+
* Implements base64_encode and base64_decode filters for Shopify compatibility
|
|
3788
|
+
*/
|
|
3789
|
+
function base64_encode(value) {
|
|
3790
|
+
const str = stringify(value);
|
|
3791
|
+
this.context.memoryLimit.use(str.length);
|
|
3792
|
+
return base64Encode(str);
|
|
3793
|
+
}
|
|
3794
|
+
function base64_decode(value) {
|
|
3795
|
+
const str = stringify(value);
|
|
3796
|
+
this.context.memoryLimit.use(str.length);
|
|
3797
|
+
return base64Decode(str);
|
|
3798
|
+
}
|
|
3799
|
+
|
|
3800
|
+
var base64Filters = /*#__PURE__*/Object.freeze({
|
|
3801
|
+
__proto__: null,
|
|
3802
|
+
base64_encode: base64_encode,
|
|
3803
|
+
base64_decode: base64_decode
|
|
3804
|
+
});
|
|
3805
|
+
|
|
3806
|
+
const filters = {
|
|
3807
|
+
...htmlFilters,
|
|
3808
|
+
...mathFilters,
|
|
3809
|
+
...urlFilters,
|
|
3810
|
+
...arrayFilters,
|
|
3811
|
+
...dateFilters,
|
|
3812
|
+
...stringFilters,
|
|
3813
|
+
...base64Filters,
|
|
3814
|
+
...misc
|
|
3815
|
+
};
|
|
3816
|
+
|
|
3817
|
+
class AssignTag extends Tag {
|
|
3818
|
+
constructor(token, remainTokens, liquid) {
|
|
3819
|
+
super(token, remainTokens, liquid);
|
|
3820
|
+
this.identifier = this.tokenizer.readIdentifier();
|
|
3821
|
+
this.key = this.identifier.content;
|
|
3822
|
+
this.tokenizer.assert(this.key, 'expected variable name');
|
|
3823
|
+
this.tokenizer.skipBlank();
|
|
3824
|
+
this.tokenizer.assert(this.tokenizer.peek() === '=', 'expected "="');
|
|
3825
|
+
this.tokenizer.advance();
|
|
3826
|
+
this.value = new Value(this.tokenizer.readFilteredValue(), this.liquid);
|
|
3827
|
+
}
|
|
3828
|
+
*render(ctx) {
|
|
3829
|
+
ctx.bottom()[this.key] = yield this.value.value(ctx, this.liquid.options.lenientIf);
|
|
3830
|
+
}
|
|
3831
|
+
*arguments() {
|
|
3832
|
+
yield this.value;
|
|
3833
|
+
}
|
|
3834
|
+
*localScope() {
|
|
3835
|
+
yield this.identifier;
|
|
3836
|
+
}
|
|
3837
|
+
}
|
|
3838
|
+
|
|
3839
|
+
const MODIFIERS = ['offset', 'limit', 'reversed'];
|
|
3840
|
+
class ForTag extends Tag {
|
|
3841
|
+
constructor(token, remainTokens, liquid, parser) {
|
|
3842
|
+
super(token, remainTokens, liquid);
|
|
3843
|
+
const variable = this.tokenizer.readIdentifier();
|
|
3844
|
+
const inStr = this.tokenizer.readIdentifier();
|
|
3845
|
+
const collection = this.tokenizer.readValue();
|
|
3846
|
+
if (!variable.size() || inStr.content !== 'in' || !collection) {
|
|
3847
|
+
throw new Error(`illegal tag: ${token.getText()}`);
|
|
3848
|
+
}
|
|
3849
|
+
this.variable = variable.content;
|
|
3850
|
+
this.collection = collection;
|
|
3851
|
+
this.hash = new Hash(this.tokenizer, liquid.options.keyValueSeparator);
|
|
3852
|
+
this.templates = [];
|
|
3853
|
+
this.elseTemplates = [];
|
|
3854
|
+
let p;
|
|
3855
|
+
const stream = parser.parseStream(remainTokens)
|
|
3856
|
+
.on('start', () => (p = this.templates))
|
|
3857
|
+
.on('tag:else', tag => { assertEmpty(tag.args); p = this.elseTemplates; })
|
|
3858
|
+
.on('tag:endfor', tag => { assertEmpty(tag.args); stream.stop(); })
|
|
3859
|
+
.on('template', (tpl) => p.push(tpl))
|
|
3860
|
+
.on('end', () => { throw new Error(`tag ${token.getText()} not closed`); });
|
|
3861
|
+
stream.start();
|
|
3862
|
+
}
|
|
3863
|
+
*render(ctx, emitter) {
|
|
3864
|
+
const r = this.liquid.renderer;
|
|
3865
|
+
let collection = toEnumerable(yield evalToken(this.collection, ctx));
|
|
3866
|
+
if (!collection.length) {
|
|
3867
|
+
yield r.renderTemplates(this.elseTemplates, ctx, emitter);
|
|
3868
|
+
return;
|
|
3869
|
+
}
|
|
3870
|
+
const continueKey = 'continue-' + this.variable + '-' + this.collection.getText();
|
|
3871
|
+
ctx.push({ continue: ctx.getRegister(continueKey) });
|
|
3872
|
+
const hash = yield this.hash.render(ctx);
|
|
3873
|
+
ctx.pop();
|
|
3874
|
+
const modifiers = this.liquid.options.orderedFilterParameters
|
|
3875
|
+
? Object.keys(hash).filter(x => MODIFIERS.includes(x))
|
|
3876
|
+
: MODIFIERS.filter(x => hash[x] !== undefined);
|
|
3877
|
+
collection = modifiers.reduce((collection, modifier) => {
|
|
3878
|
+
if (modifier === 'offset')
|
|
3879
|
+
return offset(collection, hash['offset']);
|
|
3880
|
+
if (modifier === 'limit')
|
|
3881
|
+
return limit(collection, hash['limit']);
|
|
3882
|
+
return reversed(collection);
|
|
3883
|
+
}, collection);
|
|
3884
|
+
ctx.setRegister(continueKey, (hash['offset'] || 0) + collection.length);
|
|
3885
|
+
const scope = { forloop: new ForloopDrop(collection.length, this.collection.getText(), this.variable) };
|
|
3886
|
+
ctx.push(scope);
|
|
3887
|
+
for (const item of collection) {
|
|
3888
|
+
scope[this.variable] = item;
|
|
3889
|
+
ctx.continueCalled = ctx.breakCalled = false;
|
|
3890
|
+
yield r.renderTemplates(this.templates, ctx, emitter);
|
|
3891
|
+
if (ctx.breakCalled)
|
|
3892
|
+
break;
|
|
3893
|
+
scope.forloop.next();
|
|
3894
|
+
}
|
|
3895
|
+
ctx.continueCalled = ctx.breakCalled = false;
|
|
3896
|
+
ctx.pop();
|
|
3897
|
+
}
|
|
3898
|
+
*children() {
|
|
3899
|
+
const templates = this.templates.slice();
|
|
3900
|
+
if (this.elseTemplates) {
|
|
3901
|
+
templates.push(...this.elseTemplates);
|
|
3902
|
+
}
|
|
3903
|
+
return templates;
|
|
3904
|
+
}
|
|
3905
|
+
*arguments() {
|
|
3906
|
+
yield this.collection;
|
|
3907
|
+
for (const v of Object.values(this.hash.hash)) {
|
|
3908
|
+
if (isValueToken(v)) {
|
|
3909
|
+
yield v;
|
|
3910
|
+
}
|
|
3911
|
+
}
|
|
3912
|
+
}
|
|
3913
|
+
blockScope() {
|
|
3914
|
+
return [this.variable, 'forloop'];
|
|
3915
|
+
}
|
|
3916
|
+
}
|
|
3917
|
+
function reversed(arr) {
|
|
3918
|
+
return [...arr].reverse();
|
|
3919
|
+
}
|
|
3920
|
+
function offset(arr, count) {
|
|
3921
|
+
return arr.slice(count);
|
|
3922
|
+
}
|
|
3923
|
+
function limit(arr, count) {
|
|
3924
|
+
return arr.slice(0, count);
|
|
3925
|
+
}
|
|
3926
|
+
|
|
3927
|
+
class CaptureTag extends Tag {
|
|
3928
|
+
constructor(tagToken, remainTokens, liquid, parser) {
|
|
3929
|
+
super(tagToken, remainTokens, liquid);
|
|
3930
|
+
this.templates = [];
|
|
3931
|
+
this.identifier = this.readVariable();
|
|
3932
|
+
this.variable = this.identifier.content;
|
|
3933
|
+
while (remainTokens.length) {
|
|
3934
|
+
const token = remainTokens.shift();
|
|
3935
|
+
if (isTagToken(token) && token.name === 'endcapture')
|
|
3936
|
+
return;
|
|
3937
|
+
this.templates.push(parser.parseToken(token, remainTokens));
|
|
3938
|
+
}
|
|
3939
|
+
throw new Error(`tag ${tagToken.getText()} not closed`);
|
|
3940
|
+
}
|
|
3941
|
+
readVariable() {
|
|
3942
|
+
let ident = this.tokenizer.readIdentifier();
|
|
3943
|
+
if (ident.content)
|
|
3944
|
+
return ident;
|
|
3945
|
+
ident = this.tokenizer.readQuoted();
|
|
3946
|
+
if (ident)
|
|
3947
|
+
return ident;
|
|
3948
|
+
throw this.tokenizer.error('invalid capture name');
|
|
3949
|
+
}
|
|
3950
|
+
*render(ctx) {
|
|
3951
|
+
const r = this.liquid.renderer;
|
|
3952
|
+
const html = yield r.renderTemplates(this.templates, ctx);
|
|
3953
|
+
ctx.bottom()[this.variable] = html;
|
|
3954
|
+
}
|
|
3955
|
+
*children() {
|
|
3956
|
+
return this.templates;
|
|
3957
|
+
}
|
|
3958
|
+
*localScope() {
|
|
3959
|
+
yield this.identifier;
|
|
3960
|
+
}
|
|
3961
|
+
}
|
|
3962
|
+
|
|
3963
|
+
class CaseTag extends Tag {
|
|
3964
|
+
constructor(tagToken, remainTokens, liquid, parser) {
|
|
3965
|
+
super(tagToken, remainTokens, liquid);
|
|
3966
|
+
this.branches = [];
|
|
3967
|
+
this.elseTemplates = [];
|
|
3968
|
+
this.value = new Value(this.tokenizer.readFilteredValue(), this.liquid);
|
|
3969
|
+
this.elseTemplates = [];
|
|
3970
|
+
let p = [];
|
|
3971
|
+
let elseCount = 0;
|
|
3972
|
+
const stream = parser.parseStream(remainTokens)
|
|
3973
|
+
.on('tag:when', (token) => {
|
|
3974
|
+
if (elseCount > 0) {
|
|
3975
|
+
return;
|
|
3976
|
+
}
|
|
3977
|
+
p = [];
|
|
3978
|
+
const values = [];
|
|
3979
|
+
while (!token.tokenizer.end()) {
|
|
3980
|
+
values.push(token.tokenizer.readValueOrThrow());
|
|
3981
|
+
token.tokenizer.skipBlank();
|
|
3982
|
+
if (token.tokenizer.peek() === ',') {
|
|
3983
|
+
token.tokenizer.readTo(',');
|
|
3984
|
+
}
|
|
3985
|
+
else {
|
|
3986
|
+
token.tokenizer.readTo('or');
|
|
3987
|
+
}
|
|
3988
|
+
}
|
|
3989
|
+
this.branches.push({
|
|
3990
|
+
values,
|
|
3991
|
+
templates: p
|
|
3992
|
+
});
|
|
3993
|
+
})
|
|
3994
|
+
.on('tag:else', () => {
|
|
3995
|
+
elseCount++;
|
|
3996
|
+
p = this.elseTemplates;
|
|
3997
|
+
})
|
|
3998
|
+
.on('tag:endcase', () => stream.stop())
|
|
3999
|
+
.on('template', (tpl) => {
|
|
4000
|
+
if (p !== this.elseTemplates || elseCount === 1) {
|
|
4001
|
+
p.push(tpl);
|
|
4002
|
+
}
|
|
4003
|
+
})
|
|
4004
|
+
.on('end', () => {
|
|
4005
|
+
throw new Error(`tag ${tagToken.getText()} not closed`);
|
|
4006
|
+
});
|
|
4007
|
+
stream.start();
|
|
4008
|
+
}
|
|
4009
|
+
*render(ctx, emitter) {
|
|
4010
|
+
const r = this.liquid.renderer;
|
|
4011
|
+
const target = toValue(yield this.value.value(ctx, ctx.opts.lenientIf));
|
|
4012
|
+
let branchHit = false;
|
|
4013
|
+
for (const branch of this.branches) {
|
|
4014
|
+
for (const valueToken of branch.values) {
|
|
4015
|
+
const value = yield evalToken(valueToken, ctx, ctx.opts.lenientIf);
|
|
4016
|
+
if (equals(target, value)) {
|
|
4017
|
+
yield r.renderTemplates(branch.templates, ctx, emitter);
|
|
4018
|
+
branchHit = true;
|
|
4019
|
+
break;
|
|
4020
|
+
}
|
|
4021
|
+
}
|
|
4022
|
+
}
|
|
4023
|
+
if (!branchHit) {
|
|
4024
|
+
yield r.renderTemplates(this.elseTemplates, ctx, emitter);
|
|
4025
|
+
}
|
|
4026
|
+
}
|
|
4027
|
+
*arguments() {
|
|
4028
|
+
yield this.value;
|
|
4029
|
+
yield* this.branches.flatMap(b => b.values);
|
|
4030
|
+
}
|
|
4031
|
+
*children() {
|
|
4032
|
+
const templates = this.branches.flatMap(b => b.templates);
|
|
4033
|
+
if (this.elseTemplates) {
|
|
4034
|
+
templates.push(...this.elseTemplates);
|
|
4035
|
+
}
|
|
4036
|
+
return templates;
|
|
4037
|
+
}
|
|
4038
|
+
}
|
|
4039
|
+
|
|
4040
|
+
class CommentTag extends Tag {
|
|
4041
|
+
constructor(tagToken, remainTokens, liquid) {
|
|
4042
|
+
super(tagToken, remainTokens, liquid);
|
|
4043
|
+
while (remainTokens.length) {
|
|
4044
|
+
const token = remainTokens.shift();
|
|
4045
|
+
if (isTagToken(token) && token.name === 'endcomment')
|
|
4046
|
+
return;
|
|
4047
|
+
}
|
|
4048
|
+
throw new Error(`tag ${tagToken.getText()} not closed`);
|
|
4049
|
+
}
|
|
4050
|
+
render() { }
|
|
4051
|
+
}
|
|
4052
|
+
|
|
4053
|
+
class RenderTag extends Tag {
|
|
4054
|
+
constructor(token, remainTokens, liquid, parser) {
|
|
4055
|
+
super(token, remainTokens, liquid);
|
|
4056
|
+
const tokenizer = this.tokenizer;
|
|
4057
|
+
this.file = parseFilePath(tokenizer, this.liquid, parser);
|
|
4058
|
+
this.currentFile = token.file;
|
|
4059
|
+
while (!tokenizer.end()) {
|
|
4060
|
+
tokenizer.skipBlank();
|
|
4061
|
+
const begin = tokenizer.p;
|
|
4062
|
+
const keyword = tokenizer.readIdentifier();
|
|
4063
|
+
if (keyword.content === 'with' || keyword.content === 'for') {
|
|
4064
|
+
tokenizer.skipBlank();
|
|
4065
|
+
// can be normal key/value pair, like "with: true"
|
|
4066
|
+
if (tokenizer.peek() !== ':') {
|
|
4067
|
+
const value = tokenizer.readValue();
|
|
4068
|
+
// can be normal key, like "with,"
|
|
4069
|
+
if (value) {
|
|
4070
|
+
const beforeAs = tokenizer.p;
|
|
4071
|
+
const asStr = tokenizer.readIdentifier();
|
|
4072
|
+
let alias;
|
|
4073
|
+
if (asStr.content === 'as')
|
|
4074
|
+
alias = tokenizer.readIdentifier();
|
|
4075
|
+
else
|
|
4076
|
+
tokenizer.p = beforeAs;
|
|
4077
|
+
this[keyword.content] = { value, alias: alias && alias.content };
|
|
4078
|
+
tokenizer.skipBlank();
|
|
4079
|
+
if (tokenizer.peek() === ',')
|
|
4080
|
+
tokenizer.advance();
|
|
4081
|
+
continue; // matched!
|
|
4082
|
+
}
|
|
4083
|
+
}
|
|
4084
|
+
}
|
|
4085
|
+
/**
|
|
4086
|
+
* restore cursor if with/for not matched
|
|
4087
|
+
*/
|
|
4088
|
+
tokenizer.p = begin;
|
|
4089
|
+
break;
|
|
4090
|
+
}
|
|
4091
|
+
this.hash = new Hash(tokenizer, liquid.options.keyValueSeparator);
|
|
4092
|
+
}
|
|
4093
|
+
*render(ctx, emitter) {
|
|
4094
|
+
const { liquid, hash } = this;
|
|
4095
|
+
const filepath = (yield renderFilePath(this['file'], ctx, liquid));
|
|
4096
|
+
assert(filepath, () => `illegal file path "${filepath}"`);
|
|
4097
|
+
const childCtx = ctx.spawn();
|
|
4098
|
+
const scope = childCtx.bottom();
|
|
4099
|
+
__assign(scope, yield hash.render(ctx));
|
|
4100
|
+
if (this['with']) {
|
|
4101
|
+
const { value, alias } = this['with'];
|
|
4102
|
+
scope[alias || filepath] = yield evalToken(value, ctx);
|
|
4103
|
+
}
|
|
4104
|
+
if (this['for']) {
|
|
4105
|
+
const { value, alias } = this['for'];
|
|
4106
|
+
const collection = toEnumerable(yield evalToken(value, ctx));
|
|
4107
|
+
scope['forloop'] = new ForloopDrop(collection.length, value.getText(), alias);
|
|
4108
|
+
for (const item of collection) {
|
|
4109
|
+
scope[alias] = item;
|
|
4110
|
+
const templates = (yield liquid._parsePartialFile(filepath, childCtx.sync, this['currentFile']));
|
|
4111
|
+
yield liquid.renderer.renderTemplates(templates, childCtx, emitter);
|
|
4112
|
+
scope['forloop'].next();
|
|
4113
|
+
}
|
|
4114
|
+
}
|
|
4115
|
+
else {
|
|
4116
|
+
const templates = (yield liquid._parsePartialFile(filepath, childCtx.sync, this['currentFile']));
|
|
4117
|
+
yield liquid.renderer.renderTemplates(templates, childCtx, emitter);
|
|
4118
|
+
}
|
|
4119
|
+
}
|
|
4120
|
+
*children(partials, sync) {
|
|
4121
|
+
if (partials && isString(this['file'])) {
|
|
4122
|
+
return (yield this.liquid._parsePartialFile(this['file'], sync, this['currentFile']));
|
|
4123
|
+
}
|
|
4124
|
+
return [];
|
|
4125
|
+
}
|
|
4126
|
+
partialScope() {
|
|
4127
|
+
if (isString(this['file'])) {
|
|
4128
|
+
const names = Object.keys(this.hash.hash);
|
|
4129
|
+
if (this['with']) {
|
|
4130
|
+
const { value, alias } = this['with'];
|
|
4131
|
+
if (isString(alias)) {
|
|
4132
|
+
names.push([alias, value]);
|
|
4133
|
+
}
|
|
4134
|
+
else if (isString(this.file)) {
|
|
4135
|
+
names.push([this.file, value]);
|
|
4136
|
+
}
|
|
4137
|
+
}
|
|
4138
|
+
if (this['for']) {
|
|
4139
|
+
const { value, alias } = this['for'];
|
|
4140
|
+
if (isString(alias)) {
|
|
4141
|
+
names.push([alias, value]);
|
|
4142
|
+
}
|
|
4143
|
+
else if (isString(this.file)) {
|
|
4144
|
+
names.push([this.file, value]);
|
|
4145
|
+
}
|
|
4146
|
+
}
|
|
4147
|
+
return { name: this['file'], isolated: true, scope: names };
|
|
4148
|
+
}
|
|
4149
|
+
}
|
|
4150
|
+
*arguments() {
|
|
4151
|
+
for (const v of Object.values(this.hash.hash)) {
|
|
4152
|
+
if (isValueToken(v)) {
|
|
4153
|
+
yield v;
|
|
4154
|
+
}
|
|
4155
|
+
}
|
|
4156
|
+
if (this['with']) {
|
|
4157
|
+
const { value } = this['with'];
|
|
4158
|
+
if (isValueToken(value)) {
|
|
4159
|
+
yield value;
|
|
4160
|
+
}
|
|
4161
|
+
}
|
|
4162
|
+
if (this['for']) {
|
|
4163
|
+
const { value } = this['for'];
|
|
4164
|
+
if (isValueToken(value)) {
|
|
4165
|
+
yield value;
|
|
4166
|
+
}
|
|
4167
|
+
}
|
|
4168
|
+
}
|
|
4169
|
+
}
|
|
4170
|
+
/**
|
|
4171
|
+
* @return null for "none",
|
|
4172
|
+
* @return Template[] for quoted with tags and/or filters
|
|
4173
|
+
* @return Token for expression (not quoted)
|
|
4174
|
+
* @throws TypeError if cannot read next token
|
|
4175
|
+
*/
|
|
4176
|
+
function parseFilePath(tokenizer, liquid, parser) {
|
|
4177
|
+
if (liquid.options.dynamicPartials) {
|
|
4178
|
+
const file = tokenizer.readValue();
|
|
4179
|
+
tokenizer.assert(file, 'illegal file path');
|
|
4180
|
+
if (file.getText() === 'none')
|
|
4181
|
+
return;
|
|
4182
|
+
if (isQuotedToken(file)) {
|
|
4183
|
+
// for filenames like "files/{{file}}", eval as liquid template
|
|
4184
|
+
const templates = parser.parse(evalQuotedToken(file));
|
|
4185
|
+
return optimize(templates);
|
|
4186
|
+
}
|
|
4187
|
+
return file;
|
|
4188
|
+
}
|
|
4189
|
+
const tokens = [...tokenizer.readFileNameTemplate(liquid.options)];
|
|
4190
|
+
const templates = optimize(parser.parseTokens(tokens));
|
|
4191
|
+
return templates === 'none' ? undefined : templates;
|
|
4192
|
+
}
|
|
4193
|
+
function optimize(templates) {
|
|
4194
|
+
// for filenames like "files/file.liquid", extract the string directly
|
|
4195
|
+
if (templates.length === 1 && isHTMLToken(templates[0].token))
|
|
4196
|
+
return templates[0].token.getContent();
|
|
4197
|
+
return templates;
|
|
4198
|
+
}
|
|
4199
|
+
function* renderFilePath(file, ctx, liquid) {
|
|
4200
|
+
if (typeof file === 'string')
|
|
4201
|
+
return file;
|
|
4202
|
+
if (Array.isArray(file))
|
|
4203
|
+
return liquid.renderer.renderTemplates(file, ctx);
|
|
4204
|
+
return yield evalToken(file, ctx);
|
|
4205
|
+
}
|
|
4206
|
+
|
|
4207
|
+
class IncludeTag extends Tag {
|
|
4208
|
+
constructor(token, remainTokens, liquid, parser) {
|
|
4209
|
+
super(token, remainTokens, liquid);
|
|
4210
|
+
const { tokenizer } = token;
|
|
4211
|
+
this['file'] = parseFilePath(tokenizer, this.liquid, parser);
|
|
4212
|
+
this['currentFile'] = token.file;
|
|
4213
|
+
const begin = tokenizer.p;
|
|
4214
|
+
const withStr = tokenizer.readIdentifier();
|
|
4215
|
+
if (withStr.content === 'with') {
|
|
4216
|
+
tokenizer.skipBlank();
|
|
4217
|
+
if (tokenizer.peek() !== ':') {
|
|
4218
|
+
this.withVar = tokenizer.readValue();
|
|
4219
|
+
}
|
|
4220
|
+
else
|
|
4221
|
+
tokenizer.p = begin;
|
|
4222
|
+
}
|
|
4223
|
+
else
|
|
4224
|
+
tokenizer.p = begin;
|
|
4225
|
+
this.hash = new Hash(tokenizer, liquid.options.jekyllInclude || liquid.options.keyValueSeparator);
|
|
4226
|
+
}
|
|
4227
|
+
*render(ctx, emitter) {
|
|
4228
|
+
const { liquid, hash, withVar } = this;
|
|
4229
|
+
const { renderer } = liquid;
|
|
4230
|
+
const filepath = (yield renderFilePath(this['file'], ctx, liquid));
|
|
4231
|
+
assert(filepath, () => `illegal file path "${filepath}"`);
|
|
4232
|
+
const saved = ctx.saveRegister('blocks', 'blockMode');
|
|
4233
|
+
ctx.setRegister('blocks', {});
|
|
4234
|
+
ctx.setRegister('blockMode', BlockMode.OUTPUT);
|
|
4235
|
+
const scope = (yield hash.render(ctx));
|
|
4236
|
+
if (withVar)
|
|
4237
|
+
scope[filepath] = yield evalToken(withVar, ctx);
|
|
4238
|
+
const templates = (yield liquid._parsePartialFile(filepath, ctx.sync, this['currentFile']));
|
|
4239
|
+
ctx.push(ctx.opts.jekyllInclude ? { include: scope } : scope);
|
|
4240
|
+
yield renderer.renderTemplates(templates, ctx, emitter);
|
|
4241
|
+
ctx.pop();
|
|
4242
|
+
ctx.restoreRegister(saved);
|
|
4243
|
+
}
|
|
4244
|
+
*children(partials, sync) {
|
|
4245
|
+
if (partials && isString(this['file'])) {
|
|
4246
|
+
return (yield this.liquid._parsePartialFile(this['file'], sync, this['currentFile']));
|
|
4247
|
+
}
|
|
4248
|
+
return [];
|
|
4249
|
+
}
|
|
4250
|
+
partialScope() {
|
|
4251
|
+
if (isString(this['file'])) {
|
|
4252
|
+
let names;
|
|
4253
|
+
if (this.liquid.options.jekyllInclude) {
|
|
4254
|
+
names = ['include'];
|
|
4255
|
+
}
|
|
4256
|
+
else {
|
|
4257
|
+
names = Object.keys(this.hash.hash);
|
|
4258
|
+
if (this.withVar) {
|
|
4259
|
+
names.push([this['file'], this.withVar]);
|
|
4260
|
+
}
|
|
4261
|
+
}
|
|
4262
|
+
return { name: this['file'], isolated: false, scope: names };
|
|
4263
|
+
}
|
|
4264
|
+
}
|
|
4265
|
+
*arguments() {
|
|
4266
|
+
yield* Object.values(this.hash.hash).filter(isValueToken);
|
|
4267
|
+
if (isValueToken(this['file'])) {
|
|
4268
|
+
yield this['file'];
|
|
4269
|
+
}
|
|
4270
|
+
if (isValueToken(this.withVar)) {
|
|
4271
|
+
yield this.withVar;
|
|
4272
|
+
}
|
|
4273
|
+
}
|
|
4274
|
+
}
|
|
4275
|
+
|
|
4276
|
+
class DecrementTag extends Tag {
|
|
4277
|
+
constructor(token, remainTokens, liquid) {
|
|
4278
|
+
super(token, remainTokens, liquid);
|
|
4279
|
+
this.identifier = this.tokenizer.readIdentifier();
|
|
4280
|
+
this.variable = this.identifier.content;
|
|
4281
|
+
}
|
|
4282
|
+
render(context, emitter) {
|
|
4283
|
+
const scope = context.environments;
|
|
4284
|
+
if (!isNumber(scope[this.variable])) {
|
|
4285
|
+
scope[this.variable] = 0;
|
|
4286
|
+
}
|
|
4287
|
+
emitter.write(stringify(--scope[this.variable]));
|
|
4288
|
+
}
|
|
4289
|
+
*localScope() {
|
|
4290
|
+
yield this.identifier;
|
|
4291
|
+
}
|
|
4292
|
+
}
|
|
4293
|
+
|
|
4294
|
+
class CycleTag extends Tag {
|
|
4295
|
+
constructor(token, remainTokens, liquid) {
|
|
4296
|
+
super(token, remainTokens, liquid);
|
|
4297
|
+
this.candidates = [];
|
|
4298
|
+
const group = this.tokenizer.readValue();
|
|
4299
|
+
this.tokenizer.skipBlank();
|
|
4300
|
+
if (group) {
|
|
4301
|
+
if (this.tokenizer.peek() === ':') {
|
|
4302
|
+
this.group = group;
|
|
4303
|
+
this.tokenizer.advance();
|
|
4304
|
+
}
|
|
4305
|
+
else
|
|
4306
|
+
this.candidates.push(group);
|
|
4307
|
+
}
|
|
4308
|
+
while (!this.tokenizer.end()) {
|
|
4309
|
+
const value = this.tokenizer.readValue();
|
|
4310
|
+
if (value)
|
|
4311
|
+
this.candidates.push(value);
|
|
4312
|
+
this.tokenizer.readTo(',');
|
|
4313
|
+
}
|
|
4314
|
+
this.tokenizer.assert(this.candidates.length, () => `empty candidates: "${token.getText()}"`);
|
|
4315
|
+
}
|
|
4316
|
+
*render(ctx, emitter) {
|
|
4317
|
+
const group = (yield evalToken(this.group, ctx));
|
|
4318
|
+
const fingerprint = `cycle:${group}:` + this.candidates.join(',');
|
|
4319
|
+
const groups = ctx.getRegister('cycle');
|
|
4320
|
+
let idx = groups[fingerprint];
|
|
4321
|
+
if (idx === undefined) {
|
|
4322
|
+
idx = groups[fingerprint] = 0;
|
|
4323
|
+
}
|
|
4324
|
+
const candidate = this.candidates[idx];
|
|
4325
|
+
idx = (idx + 1) % this.candidates.length;
|
|
4326
|
+
groups[fingerprint] = idx;
|
|
4327
|
+
return yield evalToken(candidate, ctx);
|
|
4328
|
+
}
|
|
4329
|
+
*arguments() {
|
|
4330
|
+
yield* this.candidates;
|
|
4331
|
+
if (this.group) {
|
|
4332
|
+
yield this.group;
|
|
4333
|
+
}
|
|
4334
|
+
}
|
|
4335
|
+
}
|
|
4336
|
+
|
|
4337
|
+
class IfTag extends Tag {
|
|
4338
|
+
constructor(tagToken, remainTokens, liquid, parser) {
|
|
4339
|
+
super(tagToken, remainTokens, liquid);
|
|
4340
|
+
this.branches = [];
|
|
4341
|
+
let p = [];
|
|
4342
|
+
parser.parseStream(remainTokens)
|
|
4343
|
+
.on('start', () => this.branches.push({
|
|
4344
|
+
value: new Value(tagToken.tokenizer.readFilteredValue(), this.liquid),
|
|
4345
|
+
templates: (p = [])
|
|
4346
|
+
}))
|
|
4347
|
+
.on('tag:elsif', (token) => {
|
|
4348
|
+
assert(!this.elseTemplates, 'unexpected elsif after else');
|
|
4349
|
+
this.branches.push({
|
|
4350
|
+
value: new Value(token.tokenizer.readFilteredValue(), this.liquid),
|
|
4351
|
+
templates: (p = [])
|
|
4352
|
+
});
|
|
4353
|
+
})
|
|
4354
|
+
.on('tag:else', tag => {
|
|
4355
|
+
assertEmpty(tag.args);
|
|
4356
|
+
assert(!this.elseTemplates, 'duplicated else');
|
|
4357
|
+
p = this.elseTemplates = [];
|
|
4358
|
+
})
|
|
4359
|
+
.on('tag:endif', function (tag) { assertEmpty(tag.args); this.stop(); })
|
|
4360
|
+
.on('template', (tpl) => p.push(tpl))
|
|
4361
|
+
.on('end', () => { throw new Error(`tag ${tagToken.getText()} not closed`); })
|
|
4362
|
+
.start();
|
|
4363
|
+
}
|
|
4364
|
+
*render(ctx, emitter) {
|
|
4365
|
+
const r = this.liquid.renderer;
|
|
4366
|
+
for (const { value, templates } of this.branches) {
|
|
4367
|
+
const v = yield value.value(ctx, ctx.opts.lenientIf);
|
|
4368
|
+
if (isTruthy(v, ctx)) {
|
|
4369
|
+
yield r.renderTemplates(templates, ctx, emitter);
|
|
4370
|
+
return;
|
|
4371
|
+
}
|
|
4372
|
+
}
|
|
4373
|
+
yield r.renderTemplates(this.elseTemplates || [], ctx, emitter);
|
|
4374
|
+
}
|
|
4375
|
+
*children() {
|
|
4376
|
+
const templates = this.branches.flatMap(b => b.templates);
|
|
4377
|
+
if (this.elseTemplates) {
|
|
4378
|
+
templates.push(...this.elseTemplates);
|
|
4379
|
+
}
|
|
4380
|
+
return templates;
|
|
4381
|
+
}
|
|
4382
|
+
arguments() {
|
|
4383
|
+
return this.branches.map(b => b.value);
|
|
4384
|
+
}
|
|
4385
|
+
}
|
|
4386
|
+
|
|
4387
|
+
class IncrementTag extends Tag {
|
|
4388
|
+
constructor(token, remainTokens, liquid) {
|
|
4389
|
+
super(token, remainTokens, liquid);
|
|
4390
|
+
this.identifier = this.tokenizer.readIdentifier();
|
|
4391
|
+
this.variable = this.identifier.content;
|
|
4392
|
+
}
|
|
4393
|
+
render(context, emitter) {
|
|
4394
|
+
const scope = context.environments;
|
|
4395
|
+
if (!isNumber(scope[this.variable])) {
|
|
4396
|
+
scope[this.variable] = 0;
|
|
4397
|
+
}
|
|
4398
|
+
const val = scope[this.variable];
|
|
4399
|
+
scope[this.variable]++;
|
|
4400
|
+
emitter.write(stringify(val));
|
|
4401
|
+
}
|
|
4402
|
+
*localScope() {
|
|
4403
|
+
yield this.identifier;
|
|
4404
|
+
}
|
|
4405
|
+
}
|
|
4406
|
+
|
|
4407
|
+
class LayoutTag extends Tag {
|
|
4408
|
+
constructor(token, remainTokens, liquid, parser) {
|
|
4409
|
+
super(token, remainTokens, liquid);
|
|
4410
|
+
this.file = parseFilePath(this.tokenizer, this.liquid, parser);
|
|
4411
|
+
this['currentFile'] = token.file;
|
|
4412
|
+
this.args = new Hash(this.tokenizer, liquid.options.keyValueSeparator);
|
|
4413
|
+
this.templates = parser.parseTokens(remainTokens);
|
|
4414
|
+
}
|
|
4415
|
+
*render(ctx, emitter) {
|
|
4416
|
+
const { liquid, args, file } = this;
|
|
4417
|
+
const { renderer } = liquid;
|
|
4418
|
+
if (file === undefined) {
|
|
4419
|
+
ctx.setRegister('blockMode', BlockMode.OUTPUT);
|
|
4420
|
+
yield renderer.renderTemplates(this.templates, ctx, emitter);
|
|
4421
|
+
return;
|
|
4422
|
+
}
|
|
4423
|
+
const filepath = (yield renderFilePath(this.file, ctx, liquid));
|
|
4424
|
+
assert(filepath, () => `illegal file path "${filepath}"`);
|
|
4425
|
+
const templates = (yield liquid._parseLayoutFile(filepath, ctx.sync, this['currentFile']));
|
|
4426
|
+
// render remaining contents and store rendered results
|
|
4427
|
+
ctx.setRegister('blockMode', BlockMode.STORE);
|
|
4428
|
+
const html = yield renderer.renderTemplates(this.templates, ctx);
|
|
4429
|
+
const blocks = ctx.getRegister('blocks');
|
|
4430
|
+
// set whole content to anonymous block if anonymous doesn't specified
|
|
4431
|
+
if (blocks[''] === undefined)
|
|
4432
|
+
blocks[''] = (parent, emitter) => emitter.write(html);
|
|
4433
|
+
ctx.setRegister('blockMode', BlockMode.OUTPUT);
|
|
4434
|
+
// render the layout file use stored blocks
|
|
4435
|
+
ctx.push((yield args.render(ctx)));
|
|
4436
|
+
yield renderer.renderTemplates(templates, ctx, emitter);
|
|
4437
|
+
ctx.pop();
|
|
4438
|
+
}
|
|
4439
|
+
*children(partials) {
|
|
4440
|
+
const templates = this.templates.slice();
|
|
4441
|
+
if (partials && isString(this.file)) {
|
|
4442
|
+
templates.push(...(yield this.liquid._parsePartialFile(this.file, true, this['currentFile'])));
|
|
4443
|
+
}
|
|
4444
|
+
return templates;
|
|
4445
|
+
}
|
|
4446
|
+
*arguments() {
|
|
4447
|
+
for (const v of Object.values(this.args.hash)) {
|
|
4448
|
+
if (isValueToken(v)) {
|
|
4449
|
+
yield v;
|
|
4450
|
+
}
|
|
4451
|
+
}
|
|
4452
|
+
if (isValueToken(this.file)) {
|
|
4453
|
+
yield this.file;
|
|
4454
|
+
}
|
|
4455
|
+
}
|
|
4456
|
+
partialScope() {
|
|
4457
|
+
if (isString(this.file)) {
|
|
4458
|
+
return { name: this.file, isolated: false, scope: Object.keys(this.args.hash) };
|
|
4459
|
+
}
|
|
4460
|
+
}
|
|
4461
|
+
}
|
|
4462
|
+
|
|
4463
|
+
class BlockTag extends Tag {
|
|
4464
|
+
constructor(token, remainTokens, liquid, parser) {
|
|
4465
|
+
super(token, remainTokens, liquid);
|
|
4466
|
+
this.templates = [];
|
|
4467
|
+
const match = /\w+/.exec(token.args);
|
|
4468
|
+
this.block = match ? match[0] : '';
|
|
4469
|
+
while (remainTokens.length) {
|
|
4470
|
+
const token = remainTokens.shift();
|
|
4471
|
+
if (isTagToken(token) && token.name === 'endblock')
|
|
4472
|
+
return;
|
|
4473
|
+
const template = parser.parseToken(token, remainTokens);
|
|
4474
|
+
this.templates.push(template);
|
|
4475
|
+
}
|
|
4476
|
+
throw new Error(`tag ${token.getText()} not closed`);
|
|
4477
|
+
}
|
|
4478
|
+
*render(ctx, emitter) {
|
|
4479
|
+
const blockRender = this.getBlockRender(ctx);
|
|
4480
|
+
if (ctx.getRegister('blockMode') === BlockMode.STORE) {
|
|
4481
|
+
ctx.getRegister('blocks')[this.block] = blockRender;
|
|
4482
|
+
}
|
|
4483
|
+
else {
|
|
4484
|
+
yield blockRender(new BlockDrop(), emitter);
|
|
4485
|
+
}
|
|
4486
|
+
}
|
|
4487
|
+
getBlockRender(ctx) {
|
|
4488
|
+
const { liquid, templates } = this;
|
|
4489
|
+
const renderChild = ctx.getRegister('blocks')[this.block];
|
|
4490
|
+
const renderCurrent = function* (superBlock, emitter) {
|
|
4491
|
+
// add {{ block.super }} support when rendering
|
|
4492
|
+
ctx.push({ block: superBlock });
|
|
4493
|
+
yield liquid.renderer.renderTemplates(templates, ctx, emitter);
|
|
4494
|
+
ctx.pop();
|
|
4495
|
+
};
|
|
4496
|
+
return renderChild
|
|
4497
|
+
? (superBlock, emitter) => renderChild(new BlockDrop((emitter) => renderCurrent(superBlock, emitter)), emitter)
|
|
4498
|
+
: renderCurrent;
|
|
4499
|
+
}
|
|
4500
|
+
*children() {
|
|
4501
|
+
return this.templates;
|
|
4502
|
+
}
|
|
4503
|
+
blockScope() {
|
|
4504
|
+
return ['block'];
|
|
4505
|
+
}
|
|
4506
|
+
}
|
|
4507
|
+
|
|
4508
|
+
class RawTag extends Tag {
|
|
4509
|
+
constructor(tagToken, remainTokens, liquid) {
|
|
4510
|
+
super(tagToken, remainTokens, liquid);
|
|
4511
|
+
this.tokens = [];
|
|
4512
|
+
while (remainTokens.length) {
|
|
4513
|
+
const token = remainTokens.shift();
|
|
4514
|
+
if (isTagToken(token) && token.name === 'endraw')
|
|
4515
|
+
return;
|
|
4516
|
+
this.tokens.push(token);
|
|
4517
|
+
}
|
|
4518
|
+
throw new Error(`tag ${tagToken.getText()} not closed`);
|
|
4519
|
+
}
|
|
4520
|
+
render() {
|
|
4521
|
+
return this.tokens.map((token) => token.getText()).join('');
|
|
4522
|
+
}
|
|
4523
|
+
}
|
|
4524
|
+
|
|
4525
|
+
class TablerowloopDrop extends ForloopDrop {
|
|
4526
|
+
constructor(length, cols, collection, variable) {
|
|
4527
|
+
super(length, collection, variable);
|
|
4528
|
+
this.length = length;
|
|
4529
|
+
this.cols = cols;
|
|
4530
|
+
}
|
|
4531
|
+
row() {
|
|
4532
|
+
return Math.floor(this.i / this.cols) + 1;
|
|
4533
|
+
}
|
|
4534
|
+
col0() {
|
|
4535
|
+
return (this.i % this.cols);
|
|
4536
|
+
}
|
|
4537
|
+
col() {
|
|
4538
|
+
return this.col0() + 1;
|
|
4539
|
+
}
|
|
4540
|
+
col_first() {
|
|
4541
|
+
return this.col0() === 0;
|
|
4542
|
+
}
|
|
4543
|
+
col_last() {
|
|
4544
|
+
return this.col() === this.cols;
|
|
4545
|
+
}
|
|
4546
|
+
}
|
|
4547
|
+
|
|
4548
|
+
class TablerowTag extends Tag {
|
|
4549
|
+
constructor(tagToken, remainTokens, liquid, parser) {
|
|
4550
|
+
super(tagToken, remainTokens, liquid);
|
|
4551
|
+
const variable = this.tokenizer.readIdentifier();
|
|
4552
|
+
this.tokenizer.skipBlank();
|
|
4553
|
+
const predicate = this.tokenizer.readIdentifier();
|
|
4554
|
+
const collectionToken = this.tokenizer.readValue();
|
|
4555
|
+
if (predicate.content !== 'in' || !collectionToken) {
|
|
4556
|
+
throw new Error(`illegal tag: ${tagToken.getText()}`);
|
|
4557
|
+
}
|
|
4558
|
+
this.variable = variable.content;
|
|
4559
|
+
this.collection = collectionToken;
|
|
4560
|
+
this.args = new Hash(this.tokenizer, liquid.options.keyValueSeparator);
|
|
4561
|
+
this.templates = [];
|
|
4562
|
+
let p;
|
|
4563
|
+
const stream = parser.parseStream(remainTokens)
|
|
4564
|
+
.on('start', () => (p = this.templates))
|
|
4565
|
+
.on('tag:endtablerow', () => stream.stop())
|
|
4566
|
+
.on('template', (tpl) => p.push(tpl))
|
|
4567
|
+
.on('end', () => {
|
|
4568
|
+
throw new Error(`tag ${tagToken.getText()} not closed`);
|
|
4569
|
+
});
|
|
4570
|
+
stream.start();
|
|
4571
|
+
}
|
|
4572
|
+
*render(ctx, emitter) {
|
|
4573
|
+
let collection = toEnumerable(yield evalToken(this.collection, ctx));
|
|
4574
|
+
const args = (yield this.args.render(ctx));
|
|
4575
|
+
const offset = args.offset || 0;
|
|
4576
|
+
const limit = (args.limit === undefined) ? collection.length : args.limit;
|
|
4577
|
+
collection = collection.slice(offset, offset + limit);
|
|
4578
|
+
const cols = args.cols || collection.length;
|
|
4579
|
+
const r = this.liquid.renderer;
|
|
4580
|
+
const tablerowloop = new TablerowloopDrop(collection.length, cols, this.collection.getText(), this.variable);
|
|
4581
|
+
const scope = { tablerowloop };
|
|
4582
|
+
ctx.push(scope);
|
|
4583
|
+
for (let idx = 0; idx < collection.length; idx++, tablerowloop.next()) {
|
|
4584
|
+
scope[this.variable] = collection[idx];
|
|
4585
|
+
if (tablerowloop.col0() === 0) {
|
|
4586
|
+
if (tablerowloop.row() !== 1)
|
|
4587
|
+
emitter.write('</tr>');
|
|
4588
|
+
emitter.write(`<tr class="row${tablerowloop.row()}">`);
|
|
4589
|
+
}
|
|
4590
|
+
emitter.write(`<td class="col${tablerowloop.col()}">`);
|
|
4591
|
+
yield r.renderTemplates(this.templates, ctx, emitter);
|
|
4592
|
+
emitter.write('</td>');
|
|
4593
|
+
}
|
|
4594
|
+
if (collection.length)
|
|
4595
|
+
emitter.write('</tr>');
|
|
4596
|
+
ctx.pop();
|
|
4597
|
+
}
|
|
4598
|
+
*children() {
|
|
4599
|
+
return this.templates;
|
|
4600
|
+
}
|
|
4601
|
+
*arguments() {
|
|
4602
|
+
yield this.collection;
|
|
4603
|
+
for (const v of Object.values(this.args.hash)) {
|
|
4604
|
+
if (isValueToken(v)) {
|
|
4605
|
+
yield v;
|
|
4606
|
+
}
|
|
4607
|
+
}
|
|
4608
|
+
}
|
|
4609
|
+
blockScope() {
|
|
4610
|
+
return [this.variable, 'tablerowloop'];
|
|
4611
|
+
}
|
|
4612
|
+
}
|
|
4613
|
+
|
|
4614
|
+
class UnlessTag extends Tag {
|
|
4615
|
+
constructor(tagToken, remainTokens, liquid, parser) {
|
|
4616
|
+
super(tagToken, remainTokens, liquid);
|
|
4617
|
+
this.branches = [];
|
|
4618
|
+
this.elseTemplates = [];
|
|
4619
|
+
let p = [];
|
|
4620
|
+
let elseCount = 0;
|
|
4621
|
+
parser.parseStream(remainTokens)
|
|
4622
|
+
.on('start', () => this.branches.push({
|
|
4623
|
+
value: new Value(tagToken.tokenizer.readFilteredValue(), this.liquid),
|
|
4624
|
+
test: isFalsy,
|
|
4625
|
+
templates: (p = [])
|
|
4626
|
+
}))
|
|
4627
|
+
.on('tag:elsif', (token) => {
|
|
4628
|
+
if (elseCount > 0) {
|
|
4629
|
+
p = [];
|
|
4630
|
+
return;
|
|
4631
|
+
}
|
|
4632
|
+
this.branches.push({
|
|
4633
|
+
value: new Value(token.tokenizer.readFilteredValue(), this.liquid),
|
|
4634
|
+
test: isTruthy,
|
|
4635
|
+
templates: (p = [])
|
|
4636
|
+
});
|
|
4637
|
+
})
|
|
4638
|
+
.on('tag:else', () => {
|
|
4639
|
+
elseCount++;
|
|
4640
|
+
p = this.elseTemplates;
|
|
4641
|
+
})
|
|
4642
|
+
.on('tag:endunless', function () { this.stop(); })
|
|
4643
|
+
.on('template', (tpl) => {
|
|
4644
|
+
if (p !== this.elseTemplates || elseCount === 1) {
|
|
4645
|
+
p.push(tpl);
|
|
4646
|
+
}
|
|
4647
|
+
})
|
|
4648
|
+
.on('end', () => { throw new Error(`tag ${tagToken.getText()} not closed`); })
|
|
4649
|
+
.start();
|
|
4650
|
+
}
|
|
4651
|
+
*render(ctx, emitter) {
|
|
4652
|
+
const r = this.liquid.renderer;
|
|
4653
|
+
for (const { value, test, templates } of this.branches) {
|
|
4654
|
+
const v = yield value.value(ctx, ctx.opts.lenientIf);
|
|
4655
|
+
if (test(v, ctx)) {
|
|
4656
|
+
yield r.renderTemplates(templates, ctx, emitter);
|
|
4657
|
+
return;
|
|
4658
|
+
}
|
|
4659
|
+
}
|
|
4660
|
+
yield r.renderTemplates(this.elseTemplates, ctx, emitter);
|
|
4661
|
+
}
|
|
4662
|
+
*children() {
|
|
4663
|
+
const children = this.branches.flatMap(b => b.templates);
|
|
4664
|
+
if (this.elseTemplates) {
|
|
4665
|
+
children.push(...this.elseTemplates);
|
|
4666
|
+
}
|
|
4667
|
+
return children;
|
|
4668
|
+
}
|
|
4669
|
+
arguments() {
|
|
4670
|
+
return this.branches.map(b => b.value);
|
|
4671
|
+
}
|
|
4672
|
+
}
|
|
4673
|
+
|
|
4674
|
+
class BreakTag extends Tag {
|
|
4675
|
+
render(ctx, _emitter) {
|
|
4676
|
+
ctx.breakCalled = true;
|
|
4677
|
+
}
|
|
4678
|
+
}
|
|
4679
|
+
|
|
4680
|
+
class ContinueTag extends Tag {
|
|
4681
|
+
render(ctx, _emitter) {
|
|
4682
|
+
ctx.continueCalled = true;
|
|
4683
|
+
}
|
|
4684
|
+
}
|
|
4685
|
+
|
|
4686
|
+
class EchoTag extends Tag {
|
|
4687
|
+
constructor(token, remainTokens, liquid) {
|
|
4688
|
+
super(token, remainTokens, liquid);
|
|
4689
|
+
this.tokenizer.skipBlank();
|
|
4690
|
+
if (!this.tokenizer.end()) {
|
|
4691
|
+
this.value = new Value(this.tokenizer.readFilteredValue(), this.liquid);
|
|
4692
|
+
}
|
|
4693
|
+
}
|
|
4694
|
+
*render(ctx, emitter) {
|
|
4695
|
+
if (!this.value)
|
|
4696
|
+
return;
|
|
4697
|
+
const val = yield this.value.value(ctx, false);
|
|
4698
|
+
emitter.write(val);
|
|
4699
|
+
}
|
|
4700
|
+
*arguments() {
|
|
4701
|
+
if (this.value) {
|
|
4702
|
+
yield this.value;
|
|
4703
|
+
}
|
|
4704
|
+
}
|
|
4705
|
+
}
|
|
4706
|
+
|
|
4707
|
+
class LiquidTag extends Tag {
|
|
4708
|
+
constructor(token, remainTokens, liquid, parser) {
|
|
4709
|
+
super(token, remainTokens, liquid);
|
|
4710
|
+
const tokens = this.tokenizer.readLiquidTagTokens(this.liquid.options);
|
|
4711
|
+
this.templates = parser.parseTokens(tokens);
|
|
4712
|
+
}
|
|
4713
|
+
*render(ctx, emitter) {
|
|
4714
|
+
yield this.liquid.renderer.renderTemplates(this.templates, ctx, emitter);
|
|
4715
|
+
}
|
|
4716
|
+
*children() {
|
|
4717
|
+
return this.templates;
|
|
4718
|
+
}
|
|
4719
|
+
}
|
|
4720
|
+
|
|
4721
|
+
class InlineCommentTag extends Tag {
|
|
4722
|
+
constructor(tagToken, remainTokens, liquid) {
|
|
4723
|
+
super(tagToken, remainTokens, liquid);
|
|
4724
|
+
if (tagToken.args.search(/\n\s*[^#\s]/g) !== -1) {
|
|
4725
|
+
throw new Error('every line of an inline comment must start with a \'#\' character');
|
|
4726
|
+
}
|
|
4727
|
+
}
|
|
4728
|
+
render() { }
|
|
4729
|
+
}
|
|
4730
|
+
|
|
4731
|
+
const tags = {
|
|
4732
|
+
assign: AssignTag,
|
|
4733
|
+
'for': ForTag,
|
|
4734
|
+
capture: CaptureTag,
|
|
4735
|
+
'case': CaseTag,
|
|
4736
|
+
comment: CommentTag,
|
|
4737
|
+
include: IncludeTag,
|
|
4738
|
+
render: RenderTag,
|
|
4739
|
+
decrement: DecrementTag,
|
|
4740
|
+
increment: IncrementTag,
|
|
4741
|
+
cycle: CycleTag,
|
|
4742
|
+
'if': IfTag,
|
|
4743
|
+
layout: LayoutTag,
|
|
4744
|
+
block: BlockTag,
|
|
4745
|
+
raw: RawTag,
|
|
4746
|
+
tablerow: TablerowTag,
|
|
4747
|
+
unless: UnlessTag,
|
|
4748
|
+
'break': BreakTag,
|
|
4749
|
+
'continue': ContinueTag,
|
|
4750
|
+
echo: EchoTag,
|
|
4751
|
+
liquid: LiquidTag,
|
|
4752
|
+
'#': InlineCommentTag
|
|
4753
|
+
};
|
|
4754
|
+
|
|
4755
|
+
class Liquid {
|
|
4756
|
+
constructor(opts = {}) {
|
|
4757
|
+
this.renderer = new Render();
|
|
4758
|
+
this.filters = {};
|
|
4759
|
+
this.tags = {};
|
|
4760
|
+
this.options = normalize(opts);
|
|
4761
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
4762
|
+
this.parser = new Parser(this);
|
|
4763
|
+
forOwn(tags, (conf, name) => this.registerTag(name, conf));
|
|
4764
|
+
forOwn(filters, (handler, name) => this.registerFilter(name, handler));
|
|
4765
|
+
}
|
|
4766
|
+
parse(html, filepath) {
|
|
4767
|
+
const parser = new Parser(this);
|
|
4768
|
+
return parser.parse(html, filepath);
|
|
4769
|
+
}
|
|
4770
|
+
_render(tpl, scope, renderOptions) {
|
|
4771
|
+
const ctx = scope instanceof Context ? scope : new Context(scope, this.options, renderOptions);
|
|
4772
|
+
return this.renderer.renderTemplates(tpl, ctx);
|
|
4773
|
+
}
|
|
4774
|
+
async render(tpl, scope, renderOptions) {
|
|
4775
|
+
return toPromise(this._render(tpl, scope, { ...renderOptions, sync: false }));
|
|
4776
|
+
}
|
|
4777
|
+
renderSync(tpl, scope, renderOptions) {
|
|
4778
|
+
return toValueSync(this._render(tpl, scope, { ...renderOptions, sync: true }));
|
|
4779
|
+
}
|
|
4780
|
+
renderToNodeStream(tpl, scope, renderOptions = {}) {
|
|
4781
|
+
const ctx = new Context(scope, this.options, renderOptions);
|
|
4782
|
+
return this.renderer.renderTemplatesToNodeStream(tpl, ctx);
|
|
4783
|
+
}
|
|
4784
|
+
_parseAndRender(html, scope, renderOptions) {
|
|
4785
|
+
const tpl = this.parse(html);
|
|
4786
|
+
return this._render(tpl, scope, renderOptions);
|
|
4787
|
+
}
|
|
4788
|
+
async parseAndRender(html, scope, renderOptions) {
|
|
4789
|
+
return toPromise(this._parseAndRender(html, scope, { ...renderOptions, sync: false }));
|
|
4790
|
+
}
|
|
4791
|
+
parseAndRenderSync(html, scope, renderOptions) {
|
|
4792
|
+
return toValueSync(this._parseAndRender(html, scope, { ...renderOptions, sync: true }));
|
|
4793
|
+
}
|
|
4794
|
+
_parsePartialFile(file, sync, currentFile) {
|
|
4795
|
+
return new Parser(this).parseFile(file, sync, exports.LookupType.Partials, currentFile);
|
|
4796
|
+
}
|
|
4797
|
+
_parseLayoutFile(file, sync, currentFile) {
|
|
4798
|
+
return new Parser(this).parseFile(file, sync, exports.LookupType.Layouts, currentFile);
|
|
4799
|
+
}
|
|
4800
|
+
_parseFile(file, sync, lookupType, currentFile) {
|
|
4801
|
+
return new Parser(this).parseFile(file, sync, lookupType, currentFile);
|
|
4802
|
+
}
|
|
4803
|
+
async parseFile(file, lookupType) {
|
|
4804
|
+
return toPromise(new Parser(this).parseFile(file, false, lookupType));
|
|
4805
|
+
}
|
|
4806
|
+
parseFileSync(file, lookupType) {
|
|
4807
|
+
return toValueSync(new Parser(this).parseFile(file, true, lookupType));
|
|
4808
|
+
}
|
|
4809
|
+
*_renderFile(file, ctx, renderFileOptions) {
|
|
4810
|
+
const templates = (yield this._parseFile(file, renderFileOptions.sync, renderFileOptions.lookupType));
|
|
4811
|
+
return yield this._render(templates, ctx, renderFileOptions);
|
|
4812
|
+
}
|
|
4813
|
+
async renderFile(file, ctx, renderFileOptions) {
|
|
4814
|
+
return toPromise(this._renderFile(file, ctx, { ...renderFileOptions, sync: false }));
|
|
4815
|
+
}
|
|
4816
|
+
renderFileSync(file, ctx, renderFileOptions) {
|
|
4817
|
+
return toValueSync(this._renderFile(file, ctx, { ...renderFileOptions, sync: true }));
|
|
4818
|
+
}
|
|
4819
|
+
async renderFileToNodeStream(file, scope, renderOptions) {
|
|
4820
|
+
const templates = await this.parseFile(file);
|
|
4821
|
+
return this.renderToNodeStream(templates, scope, renderOptions);
|
|
4822
|
+
}
|
|
4823
|
+
_evalValue(str, scope) {
|
|
4824
|
+
const value = new Value(str, this);
|
|
4825
|
+
const ctx = scope instanceof Context ? scope : new Context(scope, this.options);
|
|
4826
|
+
return value.value(ctx);
|
|
4827
|
+
}
|
|
4828
|
+
async evalValue(str, scope) {
|
|
4829
|
+
return toPromise(this._evalValue(str, scope));
|
|
4830
|
+
}
|
|
4831
|
+
evalValueSync(str, scope) {
|
|
4832
|
+
return toValueSync(this._evalValue(str, scope));
|
|
4833
|
+
}
|
|
4834
|
+
registerFilter(name, filter) {
|
|
4835
|
+
this.filters[name] = filter;
|
|
4836
|
+
}
|
|
4837
|
+
registerTag(name, tag) {
|
|
4838
|
+
this.tags[name] = isFunction(tag) ? tag : createTagClass(tag);
|
|
4839
|
+
}
|
|
4840
|
+
plugin(plugin) {
|
|
4841
|
+
return plugin.call(this, Liquid);
|
|
4842
|
+
}
|
|
4843
|
+
express() {
|
|
4844
|
+
const self = this; // eslint-disable-line
|
|
4845
|
+
let firstCall = true;
|
|
4846
|
+
return function (filePath, ctx, callback) {
|
|
4847
|
+
if (firstCall) {
|
|
4848
|
+
firstCall = false;
|
|
4849
|
+
const dirs = normalizeDirectoryList(this.root);
|
|
4850
|
+
self.options.root.unshift(...dirs);
|
|
4851
|
+
self.options.layouts.unshift(...dirs);
|
|
4852
|
+
self.options.partials.unshift(...dirs);
|
|
4853
|
+
}
|
|
4854
|
+
self.renderFile(filePath, ctx).then(html => callback(null, html), callback);
|
|
4855
|
+
};
|
|
4856
|
+
}
|
|
4857
|
+
async analyze(template, options = {}) {
|
|
4858
|
+
return analyze(template, options);
|
|
4859
|
+
}
|
|
4860
|
+
analyzeSync(template, options = {}) {
|
|
4861
|
+
return analyzeSync(template, options);
|
|
4862
|
+
}
|
|
4863
|
+
async parseAndAnalyze(html, filename, options = {}) {
|
|
4864
|
+
return analyze(this.parse(html, filename), options);
|
|
4865
|
+
}
|
|
4866
|
+
parseAndAnalyzeSync(html, filename, options = {}) {
|
|
4867
|
+
return analyzeSync(this.parse(html, filename), options);
|
|
4868
|
+
}
|
|
4869
|
+
/** Return an array of all variables without their properties. */
|
|
4870
|
+
async variables(template, options = {}) {
|
|
4871
|
+
const analysis = await analyze(isString(template) ? this.parse(template) : template, options);
|
|
4872
|
+
return Object.keys(analysis.variables);
|
|
4873
|
+
}
|
|
4874
|
+
/** Return an array of all variables without their properties. */
|
|
4875
|
+
variablesSync(template, options = {}) {
|
|
4876
|
+
const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options);
|
|
4877
|
+
return Object.keys(analysis.variables);
|
|
4878
|
+
}
|
|
4879
|
+
/** Return an array of all variables including their properties/paths. */
|
|
4880
|
+
async fullVariables(template, options = {}) {
|
|
4881
|
+
const analysis = await analyze(isString(template) ? this.parse(template) : template, options);
|
|
4882
|
+
return Array.from(new Set(Object.values(analysis.variables).flatMap((a) => a.map((v) => String(v)))));
|
|
4883
|
+
}
|
|
4884
|
+
/** Return an array of all variables including their properties/paths. */
|
|
4885
|
+
fullVariablesSync(template, options = {}) {
|
|
4886
|
+
const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options);
|
|
4887
|
+
return Array.from(new Set(Object.values(analysis.variables).flatMap((a) => a.map((v) => String(v)))));
|
|
4888
|
+
}
|
|
4889
|
+
/** Return an array of all variables, each as an array of properties/segments. */
|
|
4890
|
+
async variableSegments(template, options = {}) {
|
|
4891
|
+
const analysis = await analyze(isString(template) ? this.parse(template) : template, options);
|
|
4892
|
+
return Array.from(strictUniq(Object.values(analysis.variables).flatMap((a) => a.map((v) => v.toArray()))));
|
|
4893
|
+
}
|
|
4894
|
+
/** Return an array of all variables, each as an array of properties/segments. */
|
|
4895
|
+
variableSegmentsSync(template, options = {}) {
|
|
4896
|
+
const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options);
|
|
4897
|
+
return Array.from(strictUniq(Object.values(analysis.variables).flatMap((a) => a.map((v) => v.toArray()))));
|
|
4898
|
+
}
|
|
4899
|
+
/** Return an array of all expected context variables without their properties. */
|
|
4900
|
+
async globalVariables(template, options = {}) {
|
|
4901
|
+
const analysis = await analyze(isString(template) ? this.parse(template) : template, options);
|
|
4902
|
+
return Object.keys(analysis.globals);
|
|
4903
|
+
}
|
|
4904
|
+
/** Return an array of all expected context variables without their properties. */
|
|
4905
|
+
globalVariablesSync(template, options = {}) {
|
|
4906
|
+
const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options);
|
|
4907
|
+
return Object.keys(analysis.globals);
|
|
4908
|
+
}
|
|
4909
|
+
/** Return an array of all expected context variables including their properties/paths. */
|
|
4910
|
+
async globalFullVariables(template, options = {}) {
|
|
4911
|
+
const analysis = await analyze(isString(template) ? this.parse(template) : template, options);
|
|
4912
|
+
return Array.from(new Set(Object.values(analysis.globals).flatMap((a) => a.map((v) => String(v)))));
|
|
4913
|
+
}
|
|
4914
|
+
/** Return an array of all expected context variables including their properties/paths. */
|
|
4915
|
+
globalFullVariablesSync(template, options = {}) {
|
|
4916
|
+
const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options);
|
|
4917
|
+
return Array.from(new Set(Object.values(analysis.globals).flatMap((a) => a.map((v) => String(v)))));
|
|
4918
|
+
}
|
|
4919
|
+
/** Return an array of all expected context variables, each as an array of properties/segments. */
|
|
4920
|
+
async globalVariableSegments(template, options = {}) {
|
|
4921
|
+
const analysis = await analyze(isString(template) ? this.parse(template) : template, options);
|
|
4922
|
+
return Array.from(strictUniq(Object.values(analysis.globals).flatMap((a) => a.map((v) => v.toArray()))));
|
|
4923
|
+
}
|
|
4924
|
+
/** Return an array of all expected context variables, each as an array of properties/segments. */
|
|
4925
|
+
globalVariableSegmentsSync(template, options = {}) {
|
|
4926
|
+
const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options);
|
|
4927
|
+
return Array.from(strictUniq(Object.values(analysis.globals).flatMap((a) => a.map((v) => v.toArray()))));
|
|
4928
|
+
}
|
|
4929
|
+
}
|
|
4930
|
+
|
|
4931
|
+
/* istanbul ignore file */
|
|
4932
|
+
const version = '10.25.0';
|
|
4933
|
+
|
|
4934
|
+
exports.AssertionError = AssertionError;
|
|
4935
|
+
exports.AssignTag = AssignTag;
|
|
4936
|
+
exports.BlockTag = BlockTag;
|
|
4937
|
+
exports.BreakTag = BreakTag;
|
|
4938
|
+
exports.CaptureTag = CaptureTag;
|
|
4939
|
+
exports.CaseTag = CaseTag;
|
|
4940
|
+
exports.CommentTag = CommentTag;
|
|
4941
|
+
exports.Context = Context;
|
|
4942
|
+
exports.ContinueTag = ContinueTag;
|
|
4943
|
+
exports.CycleTag = CycleTag;
|
|
4944
|
+
exports.DecrementTag = DecrementTag;
|
|
4945
|
+
exports.Drop = Drop;
|
|
4946
|
+
exports.EchoTag = EchoTag;
|
|
4947
|
+
exports.Expression = Expression;
|
|
4948
|
+
exports.Filter = Filter;
|
|
4949
|
+
exports.ForTag = ForTag;
|
|
4950
|
+
exports.Hash = Hash;
|
|
4951
|
+
exports.IfTag = IfTag;
|
|
4952
|
+
exports.IncludeTag = IncludeTag;
|
|
4953
|
+
exports.IncrementTag = IncrementTag;
|
|
4954
|
+
exports.InlineCommentTag = InlineCommentTag;
|
|
4955
|
+
exports.LayoutTag = LayoutTag;
|
|
4956
|
+
exports.Liquid = Liquid;
|
|
4957
|
+
exports.LiquidError = LiquidError;
|
|
4958
|
+
exports.LiquidTag = LiquidTag;
|
|
4959
|
+
exports.Output = Output;
|
|
4960
|
+
exports.ParseError = ParseError;
|
|
4961
|
+
exports.ParseStream = ParseStream;
|
|
4962
|
+
exports.Parser = Parser;
|
|
4963
|
+
exports.RawTag = RawTag;
|
|
4964
|
+
exports.RenderError = RenderError;
|
|
4965
|
+
exports.RenderTag = RenderTag;
|
|
4966
|
+
exports.TablerowTag = TablerowTag;
|
|
4967
|
+
exports.Tag = Tag;
|
|
4968
|
+
exports.TagToken = TagToken;
|
|
4969
|
+
exports.Token = Token;
|
|
4970
|
+
exports.TokenizationError = TokenizationError;
|
|
4971
|
+
exports.Tokenizer = Tokenizer;
|
|
4972
|
+
exports.TypeGuards = typeGuards;
|
|
4973
|
+
exports.UndefinedVariableError = UndefinedVariableError;
|
|
4974
|
+
exports.UnlessTag = UnlessTag;
|
|
4975
|
+
exports.Value = Value;
|
|
4976
|
+
exports.Variable = Variable;
|
|
4977
|
+
exports.analyze = analyze;
|
|
4978
|
+
exports.analyzeSync = analyzeSync;
|
|
4979
|
+
exports.assert = assert;
|
|
4980
|
+
exports.createTrie = createTrie;
|
|
4981
|
+
exports.defaultOperators = defaultOperators;
|
|
4982
|
+
exports.defaultOptions = defaultOptions;
|
|
4983
|
+
exports.evalQuotedToken = evalQuotedToken;
|
|
4984
|
+
exports.evalToken = evalToken;
|
|
4985
|
+
exports.filters = filters;
|
|
4986
|
+
exports.isFalsy = isFalsy;
|
|
4987
|
+
exports.isTruthy = isTruthy;
|
|
4988
|
+
exports.tags = tags;
|
|
4989
|
+
exports.toPromise = toPromise;
|
|
4990
|
+
exports.toValue = toValue;
|
|
4991
|
+
exports.toValueSync = toValueSync;
|
|
4992
|
+
exports.version = version;
|