@nocobase/plugin-idp-oauth 2.1.0-alpha.10
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/LICENSE.txt +107 -0
- package/README.md +14 -0
- package/build.config.ts +46 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/ErrorPage.d.ts +11 -0
- package/dist/client/InteractionPage.d.ts +11 -0
- package/dist/client/index.d.ts +9 -0
- package/dist/client/index.js +10 -0
- package/dist/client/locale.d.ts +10 -0
- package/dist/client/models/index.d.ts +11 -0
- package/dist/client/plugin.d.ts +13 -0
- package/dist/externalVersion.js +18 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +48 -0
- package/dist/locale/en-US.json +1 -0
- package/dist/locale/zh-CN.json +1 -0
- package/dist/node_modules/eta/LICENSE +7 -0
- package/dist/node_modules/eta/README.md +185 -0
- package/dist/node_modules/eta/dist/core.d.ts +179 -0
- package/dist/node_modules/eta/dist/core.d.ts.map +1 -0
- package/dist/node_modules/eta/dist/core.js +42 -0
- package/dist/node_modules/eta/dist/core.js.map +1 -0
- package/dist/node_modules/eta/dist/index.cjs +542 -0
- package/dist/node_modules/eta/dist/index.cjs.map +1 -0
- package/dist/node_modules/eta/dist/index.d.cts +187 -0
- package/dist/node_modules/eta/dist/index.d.cts.map +1 -0
- package/dist/node_modules/eta/dist/index.d.mts +187 -0
- package/dist/node_modules/eta/dist/index.d.mts.map +1 -0
- package/dist/node_modules/eta/dist/index.mjs +512 -0
- package/dist/node_modules/eta/dist/index.mjs.map +1 -0
- package/dist/node_modules/eta/package.json +75 -0
- package/dist/node_modules/jose/LICENSE.md +21 -0
- package/dist/node_modules/jose/README.md +153 -0
- package/dist/node_modules/jose/dist/types/index.d.ts +55 -0
- package/dist/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +31 -0
- package/dist/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +65 -0
- package/dist/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +31 -0
- package/dist/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +83 -0
- package/dist/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +38 -0
- package/dist/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +74 -0
- package/dist/node_modules/jose/dist/types/jwk/embedded.d.ts +17 -0
- package/dist/node_modules/jose/dist/types/jwk/thumbprint.d.ts +32 -0
- package/dist/node_modules/jose/dist/types/jwks/local.d.ts +29 -0
- package/dist/node_modules/jose/dist/types/jwks/remote.d.ts +237 -0
- package/dist/node_modules/jose/dist/types/jws/compact/sign.d.ts +36 -0
- package/dist/node_modules/jose/dist/types/jws/compact/verify.d.ts +33 -0
- package/dist/node_modules/jose/dist/types/jws/flattened/sign.d.ts +42 -0
- package/dist/node_modules/jose/dist/types/jws/flattened/verify.d.ts +33 -0
- package/dist/node_modules/jose/dist/types/jws/general/sign.d.ts +53 -0
- package/dist/node_modules/jose/dist/types/jws/general/verify.d.ts +41 -0
- package/dist/node_modules/jose/dist/types/jwt/decrypt.d.ts +35 -0
- package/dist/node_modules/jose/dist/types/jwt/encrypt.d.ts +91 -0
- package/dist/node_modules/jose/dist/types/jwt/sign.d.ts +43 -0
- package/dist/node_modules/jose/dist/types/jwt/unsecured.d.ts +43 -0
- package/dist/node_modules/jose/dist/types/jwt/verify.d.ts +37 -0
- package/dist/node_modules/jose/dist/types/key/export.d.ts +33 -0
- package/dist/node_modules/jose/dist/types/key/generate_key_pair.d.ts +47 -0
- package/dist/node_modules/jose/dist/types/key/generate_secret.d.ts +35 -0
- package/dist/node_modules/jose/dist/types/key/import.d.ts +83 -0
- package/dist/node_modules/jose/dist/types/types.d.ts +852 -0
- package/dist/node_modules/jose/dist/types/util/base64url.d.ts +9 -0
- package/dist/node_modules/jose/dist/types/util/decode_jwt.d.ts +18 -0
- package/dist/node_modules/jose/dist/types/util/decode_protected_header.d.ts +17 -0
- package/dist/node_modules/jose/dist/types/util/errors.d.ts +213 -0
- package/dist/node_modules/jose/dist/webapi/index.js +32 -0
- package/dist/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +27 -0
- package/dist/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +27 -0
- package/dist/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +155 -0
- package/dist/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +165 -0
- package/dist/node_modules/jose/dist/webapi/jwe/general/decrypt.js +31 -0
- package/dist/node_modules/jose/dist/webapi/jwe/general/encrypt.js +182 -0
- package/dist/node_modules/jose/dist/webapi/jwk/embedded.js +17 -0
- package/dist/node_modules/jose/dist/webapi/jwk/thumbprint.js +68 -0
- package/dist/node_modules/jose/dist/webapi/jwks/local.js +119 -0
- package/dist/node_modules/jose/dist/webapi/jwks/remote.js +179 -0
- package/dist/node_modules/jose/dist/webapi/jws/compact/sign.js +18 -0
- package/dist/node_modules/jose/dist/webapi/jws/compact/verify.js +21 -0
- package/dist/node_modules/jose/dist/webapi/jws/flattened/sign.js +89 -0
- package/dist/node_modules/jose/dist/webapi/jws/flattened/verify.js +110 -0
- package/dist/node_modules/jose/dist/webapi/jws/general/sign.js +70 -0
- package/dist/node_modules/jose/dist/webapi/jws/general/verify.js +24 -0
- package/dist/node_modules/jose/dist/webapi/jwt/decrypt.js +23 -0
- package/dist/node_modules/jose/dist/webapi/jwt/encrypt.js +101 -0
- package/dist/node_modules/jose/dist/webapi/jwt/sign.js +52 -0
- package/dist/node_modules/jose/dist/webapi/jwt/unsecured.js +63 -0
- package/dist/node_modules/jose/dist/webapi/jwt/verify.js +15 -0
- package/dist/node_modules/jose/dist/webapi/key/export.js +11 -0
- package/dist/node_modules/jose/dist/webapi/key/generate_key_pair.js +97 -0
- package/dist/node_modules/jose/dist/webapi/key/generate_secret.js +40 -0
- package/dist/node_modules/jose/dist/webapi/key/import.js +57 -0
- package/dist/node_modules/jose/dist/webapi/lib/aesgcmkw.js +15 -0
- package/dist/node_modules/jose/dist/webapi/lib/aeskw.js +25 -0
- package/dist/node_modules/jose/dist/webapi/lib/asn1.js +243 -0
- package/dist/node_modules/jose/dist/webapi/lib/base64.js +22 -0
- package/dist/node_modules/jose/dist/webapi/lib/buffer_utils.js +43 -0
- package/dist/node_modules/jose/dist/webapi/lib/check_key_type.js +122 -0
- package/dist/node_modules/jose/dist/webapi/lib/content_encryption.js +217 -0
- package/dist/node_modules/jose/dist/webapi/lib/crypto_key.js +136 -0
- package/dist/node_modules/jose/dist/webapi/lib/deflate.js +44 -0
- package/dist/node_modules/jose/dist/webapi/lib/ecdhes.js +52 -0
- package/dist/node_modules/jose/dist/webapi/lib/helpers.js +19 -0
- package/dist/node_modules/jose/dist/webapi/lib/invalid_key_input.js +27 -0
- package/dist/node_modules/jose/dist/webapi/lib/is_key_like.js +17 -0
- package/dist/node_modules/jose/dist/webapi/lib/jwk_to_key.js +107 -0
- package/dist/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +238 -0
- package/dist/node_modules/jose/dist/webapi/lib/key_management.js +186 -0
- package/dist/node_modules/jose/dist/webapi/lib/key_to_jwk.js +31 -0
- package/dist/node_modules/jose/dist/webapi/lib/normalize_key.js +166 -0
- package/dist/node_modules/jose/dist/webapi/lib/pbes2kw.js +39 -0
- package/dist/node_modules/jose/dist/webapi/lib/rsaes.js +24 -0
- package/dist/node_modules/jose/dist/webapi/lib/signing.js +68 -0
- package/dist/node_modules/jose/dist/webapi/lib/type_checks.js +40 -0
- package/dist/node_modules/jose/dist/webapi/lib/validate_algorithms.js +10 -0
- package/dist/node_modules/jose/dist/webapi/lib/validate_crit.js +33 -0
- package/dist/node_modules/jose/dist/webapi/util/base64url.js +30 -0
- package/dist/node_modules/jose/dist/webapi/util/decode_jwt.js +32 -0
- package/dist/node_modules/jose/dist/webapi/util/decode_protected_header.js +34 -0
- package/dist/node_modules/jose/dist/webapi/util/errors.js +99 -0
- package/dist/node_modules/jose/package.json +200 -0
- package/dist/node_modules/light-my-request/.gitattributes +2 -0
- package/dist/node_modules/light-my-request/.github/dependabot.yml +13 -0
- package/dist/node_modules/light-my-request/.github/stale.yml +21 -0
- package/dist/node_modules/light-my-request/.github/workflows/benchmark.yml +30 -0
- package/dist/node_modules/light-my-request/.github/workflows/ci.yml +23 -0
- package/dist/node_modules/light-my-request/LICENSE +32 -0
- package/dist/node_modules/light-my-request/benchmark/benchmark.js +164 -0
- package/dist/node_modules/light-my-request/build/build-validation.js +100 -0
- package/dist/node_modules/light-my-request/eslint.config.js +9 -0
- package/dist/node_modules/light-my-request/index.js +2 -0
- package/dist/node_modules/light-my-request/lib/config-validator.js +919 -0
- package/dist/node_modules/light-my-request/lib/form-data.js +79 -0
- package/dist/node_modules/light-my-request/lib/parse-url.js +47 -0
- package/dist/node_modules/light-my-request/lib/request.js +290 -0
- package/dist/node_modules/light-my-request/lib/response.js +240 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/.gitattributes +2 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/.github/dependabot.yml +13 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/.github/workflows/ci.yml +24 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/.taprc +2 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/benchmarks/warn.js +25 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/eslint.config.js +6 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/examples/example.js +11 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/index.js +124 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/package.json +73 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/emit-interpolated-string.test.js +29 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/emit-once-only.test.js +28 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/emit-reset.test.js +36 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/emit-set.test.js +30 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/emit-unlimited.test.js +37 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/index.test.js +99 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/issue-88.test.js +33 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/jest.test.js +22 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/no-warnings.test.js +80 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/types/index.d.ts +37 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/types/index.test-d.ts +36 -0
- package/dist/node_modules/light-my-request/package.json +1 -0
- package/dist/node_modules/light-my-request/test/async-await.test.js +55 -0
- package/dist/node_modules/light-my-request/test/index.test.js +2316 -0
- package/dist/node_modules/light-my-request/test/request.test.js +16 -0
- package/dist/node_modules/light-my-request/test/response.test.js +19 -0
- package/dist/node_modules/light-my-request/test/stream.test.js +359 -0
- package/dist/node_modules/light-my-request/types/index.d.ts +128 -0
- package/dist/node_modules/light-my-request/types/index.test-d.ts +149 -0
- package/dist/node_modules/oidc-provider/LICENSE.md +21 -0
- package/dist/node_modules/oidc-provider/README.md +174 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/assign_claims.js +28 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/assign_defaults.js +17 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/authenticated_client_id.js +6 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/backchannel_request_remap_errors.js +17 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/backchannel_request_response.js +41 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_ciba_context.js +12 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_claims.js +68 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_client.js +21 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_client_grant_type.js +21 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_dpop_jkt.js +35 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_extra_params.js +18 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_id_token_hint.js +23 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_max_age.js +25 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_openid_scope.js +47 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_pkce.js +41 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_prompt.js +25 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_redirect_uri.js +41 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_requested_expiry.js +16 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_response_mode.js +54 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_response_type.js +26 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_scope.js +53 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/ciba_load_account.js +58 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/ciba_required.js +13 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/device_authorization_response.js +31 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/device_user_flow.js +31 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/device_user_flow_errors.js +37 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/device_user_flow_response.js +55 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/index.js +200 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/interaction_emit.js +9 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/interactions.js +149 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/load_account.js +15 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/load_grant.js +29 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/load_pushed_authorization_request.js +36 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/oauth_required.js +11 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/oidc_required.js +27 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/one_redirect_uri_clients.js +20 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/process_request_object.js +214 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/pushed_authorization_request_remap_errors.js +17 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/pushed_authorization_request_response.js +65 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/reject_registration.js +12 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/reject_request_and_uri.js +12 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/reject_unsupported.js +33 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/respond.js +46 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/resume.js +111 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/strip_outside_jar_params.js +19 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/unsupported_rar.js +9 -0
- package/dist/node_modules/oidc-provider/lib/actions/challenge.js +22 -0
- package/dist/node_modules/oidc-provider/lib/actions/code_verification.js +122 -0
- package/dist/node_modules/oidc-provider/lib/actions/discovery.js +151 -0
- package/dist/node_modules/oidc-provider/lib/actions/end_session.js +222 -0
- package/dist/node_modules/oidc-provider/lib/actions/grants/authorization_code.js +144 -0
- package/dist/node_modules/oidc-provider/lib/actions/grants/ciba.js +127 -0
- package/dist/node_modules/oidc-provider/lib/actions/grants/client_credentials.js +79 -0
- package/dist/node_modules/oidc-provider/lib/actions/grants/device_code.js +125 -0
- package/dist/node_modules/oidc-provider/lib/actions/grants/index.js +7 -0
- package/dist/node_modules/oidc-provider/lib/actions/grants/refresh_token.js +229 -0
- package/dist/node_modules/oidc-provider/lib/actions/index.js +25 -0
- package/dist/node_modules/oidc-provider/lib/actions/interaction.js +150 -0
- package/dist/node_modules/oidc-provider/lib/actions/introspection.js +164 -0
- package/dist/node_modules/oidc-provider/lib/actions/jwks.js +7 -0
- package/dist/node_modules/oidc-provider/lib/actions/registration.js +274 -0
- package/dist/node_modules/oidc-provider/lib/actions/revocation.js +81 -0
- package/dist/node_modules/oidc-provider/lib/actions/token.js +74 -0
- package/dist/node_modules/oidc-provider/lib/actions/userinfo.js +183 -0
- package/dist/node_modules/oidc-provider/lib/adapters/memory_adapter.js +95 -0
- package/dist/node_modules/oidc-provider/lib/consts/client_attributes.js +211 -0
- package/dist/node_modules/oidc-provider/lib/consts/dev_keystore.js +18 -0
- package/dist/node_modules/oidc-provider/lib/consts/index.js +13 -0
- package/dist/node_modules/oidc-provider/lib/consts/jwa.js +47 -0
- package/dist/node_modules/oidc-provider/lib/consts/non_rejectable_claims.js +1 -0
- package/dist/node_modules/oidc-provider/lib/consts/param_list.js +23 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/camel_case.js +1 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/defaults.js +28 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/difference.js +1 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/is_plain_object.js +1 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/map_keys.js +9 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/merge.js +25 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/omit_by.js +11 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/pick.js +10 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/pick_by.js +10 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/remove.js +9 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/set.js +18 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/snake_case.js +1 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/upper_first.js +1 -0
- package/dist/node_modules/oidc-provider/lib/helpers/account_claims.js +6 -0
- package/dist/node_modules/oidc-provider/lib/helpers/add_client.js +14 -0
- package/dist/node_modules/oidc-provider/lib/helpers/als.js +3 -0
- package/dist/node_modules/oidc-provider/lib/helpers/append_www_authenticate.js +9 -0
- package/dist/node_modules/oidc-provider/lib/helpers/attention.js +23 -0
- package/dist/node_modules/oidc-provider/lib/helpers/base64url.js +11 -0
- package/dist/node_modules/oidc-provider/lib/helpers/certificate_thumbprint.js +15 -0
- package/dist/node_modules/oidc-provider/lib/helpers/challenge.js +111 -0
- package/dist/node_modules/oidc-provider/lib/helpers/check_attest_binding.js +10 -0
- package/dist/node_modules/oidc-provider/lib/helpers/claims.js +79 -0
- package/dist/node_modules/oidc-provider/lib/helpers/client_id_metadata_document.js +198 -0
- package/dist/node_modules/oidc-provider/lib/helpers/client_schema.js +700 -0
- package/dist/node_modules/oidc-provider/lib/helpers/combined_scope.js +17 -0
- package/dist/node_modules/oidc-provider/lib/helpers/configuration.js +544 -0
- package/dist/node_modules/oidc-provider/lib/helpers/constant_equals.js +20 -0
- package/dist/node_modules/oidc-provider/lib/helpers/defaults.js +3510 -0
- package/dist/node_modules/oidc-provider/lib/helpers/epoch_time.js +1 -0
- package/dist/node_modules/oidc-provider/lib/helpers/err_out.js +17 -0
- package/dist/node_modules/oidc-provider/lib/helpers/errors.js +161 -0
- package/dist/node_modules/oidc-provider/lib/helpers/features.js +51 -0
- package/dist/node_modules/oidc-provider/lib/helpers/fetch_body_check.js +25 -0
- package/dist/node_modules/oidc-provider/lib/helpers/fetch_request.js +221 -0
- package/dist/node_modules/oidc-provider/lib/helpers/filter_claims.js +16 -0
- package/dist/node_modules/oidc-provider/lib/helpers/formatters.js +24 -0
- package/dist/node_modules/oidc-provider/lib/helpers/grant_common.js +214 -0
- package/dist/node_modules/oidc-provider/lib/helpers/html_safe.js +19 -0
- package/dist/node_modules/oidc-provider/lib/helpers/initialize_adapter.js +24 -0
- package/dist/node_modules/oidc-provider/lib/helpers/initialize_app.js +243 -0
- package/dist/node_modules/oidc-provider/lib/helpers/initialize_clients.js +24 -0
- package/dist/node_modules/oidc-provider/lib/helpers/initialize_keystore.js +310 -0
- package/dist/node_modules/oidc-provider/lib/helpers/interaction_policy/check.js +21 -0
- package/dist/node_modules/oidc-provider/lib/helpers/interaction_policy/index.js +43 -0
- package/dist/node_modules/oidc-provider/lib/helpers/interaction_policy/prompt.js +95 -0
- package/dist/node_modules/oidc-provider/lib/helpers/interaction_policy/prompts/consent.js +105 -0
- package/dist/node_modules/oidc-provider/lib/helpers/interaction_policy/prompts/login.js +162 -0
- package/dist/node_modules/oidc-provider/lib/helpers/jwt.js +211 -0
- package/dist/node_modules/oidc-provider/lib/helpers/keystore.js +301 -0
- package/dist/node_modules/oidc-provider/lib/helpers/nanoid.js +5 -0
- package/dist/node_modules/oidc-provider/lib/helpers/oidc_context.js +284 -0
- package/dist/node_modules/oidc-provider/lib/helpers/params.js +27 -0
- package/dist/node_modules/oidc-provider/lib/helpers/pkce.js +30 -0
- package/dist/node_modules/oidc-provider/lib/helpers/pkce_format.js +17 -0
- package/dist/node_modules/oidc-provider/lib/helpers/process_response_types.js +202 -0
- package/dist/node_modules/oidc-provider/lib/helpers/re_render_errors.js +39 -0
- package/dist/node_modules/oidc-provider/lib/helpers/redirect_uri.js +16 -0
- package/dist/node_modules/oidc-provider/lib/helpers/resolve_resource.js +33 -0
- package/dist/node_modules/oidc-provider/lib/helpers/resolve_response_mode.js +7 -0
- package/dist/node_modules/oidc-provider/lib/helpers/resource_server.js +20 -0
- package/dist/node_modules/oidc-provider/lib/helpers/revoke.js +27 -0
- package/dist/node_modules/oidc-provider/lib/helpers/script_src_sha.js +21 -0
- package/dist/node_modules/oidc-provider/lib/helpers/sector_identifier.js +19 -0
- package/dist/node_modules/oidc-provider/lib/helpers/sector_validate.js +55 -0
- package/dist/node_modules/oidc-provider/lib/helpers/set_rt_bindings.js +21 -0
- package/dist/node_modules/oidc-provider/lib/helpers/token_find.js +51 -0
- package/dist/node_modules/oidc-provider/lib/helpers/type_validators.js +8 -0
- package/dist/node_modules/oidc-provider/lib/helpers/user_code_form.js +19 -0
- package/dist/node_modules/oidc-provider/lib/helpers/user_codes.js +38 -0
- package/dist/node_modules/oidc-provider/lib/helpers/valid_url.js +8 -0
- package/dist/node_modules/oidc-provider/lib/helpers/validate_dpop.js +129 -0
- package/dist/node_modules/oidc-provider/lib/helpers/validate_presence.js +17 -0
- package/dist/node_modules/oidc-provider/lib/helpers/weak_cache.js +11 -0
- package/dist/node_modules/oidc-provider/lib/index.js +21 -0
- package/dist/node_modules/oidc-provider/lib/models/access_token.js +31 -0
- package/dist/node_modules/oidc-provider/lib/models/authorization_code.js +27 -0
- package/dist/node_modules/oidc-provider/lib/models/backchannel_authentication_request.js +26 -0
- package/dist/node_modules/oidc-provider/lib/models/base_model.js +141 -0
- package/dist/node_modules/oidc-provider/lib/models/base_token.js +86 -0
- package/dist/node_modules/oidc-provider/lib/models/client.js +593 -0
- package/dist/node_modules/oidc-provider/lib/models/client_credentials.js +19 -0
- package/dist/node_modules/oidc-provider/lib/models/device_code.js +44 -0
- package/dist/node_modules/oidc-provider/lib/models/formats/dynamic.js +21 -0
- package/dist/node_modules/oidc-provider/lib/models/formats/index.js +14 -0
- package/dist/node_modules/oidc-provider/lib/models/formats/jwt.js +198 -0
- package/dist/node_modules/oidc-provider/lib/models/formats/opaque.js +58 -0
- package/dist/node_modules/oidc-provider/lib/models/grant.js +243 -0
- package/dist/node_modules/oidc-provider/lib/models/id_token.js +271 -0
- package/dist/node_modules/oidc-provider/lib/models/index.js +37 -0
- package/dist/node_modules/oidc-provider/lib/models/initial_access_token.js +12 -0
- package/dist/node_modules/oidc-provider/lib/models/interaction.js +73 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/apply.js +4 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/consumable.js +17 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/has_format.js +46 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/has_grant_id.js +12 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/has_grant_type.js +8 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/has_policies.js +38 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/is_attestation_constrained.js +15 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/is_sender_constrained.js +50 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/is_session_bound.js +38 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/set_audience.js +21 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/stores_auth.js +16 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/stores_pkce.js +9 -0
- package/dist/node_modules/oidc-provider/lib/models/pushed_authorization_request.js +21 -0
- package/dist/node_modules/oidc-provider/lib/models/refresh_token.js +47 -0
- package/dist/node_modules/oidc-provider/lib/models/registration_access_token.js +8 -0
- package/dist/node_modules/oidc-provider/lib/models/replay_detection.js +31 -0
- package/dist/node_modules/oidc-provider/lib/models/session.js +192 -0
- package/dist/node_modules/oidc-provider/lib/provider.js +453 -0
- package/dist/node_modules/oidc-provider/lib/response_modes/form_post.js +36 -0
- package/dist/node_modules/oidc-provider/lib/response_modes/fragment.js +7 -0
- package/dist/node_modules/oidc-provider/lib/response_modes/index.js +15 -0
- package/dist/node_modules/oidc-provider/lib/response_modes/jwt.js +43 -0
- package/dist/node_modules/oidc-provider/lib/response_modes/query.js +7 -0
- package/dist/node_modules/oidc-provider/lib/response_modes/web_message.js +55 -0
- package/dist/node_modules/oidc-provider/lib/shared/assemble_params.js +7 -0
- package/dist/node_modules/oidc-provider/lib/shared/attest_client_auth.js +111 -0
- package/dist/node_modules/oidc-provider/lib/shared/authorization_error_handler.js +104 -0
- package/dist/node_modules/oidc-provider/lib/shared/check_rar.js +75 -0
- package/dist/node_modules/oidc-provider/lib/shared/check_resource.js +77 -0
- package/dist/node_modules/oidc-provider/lib/shared/client_auth.js +263 -0
- package/dist/node_modules/oidc-provider/lib/shared/conditional_body.js +9 -0
- package/dist/node_modules/oidc-provider/lib/shared/cors.js +49 -0
- package/dist/node_modules/oidc-provider/lib/shared/error_handler.js +59 -0
- package/dist/node_modules/oidc-provider/lib/shared/jwt_client_auth.js +79 -0
- package/dist/node_modules/oidc-provider/lib/shared/no_cache.js +4 -0
- package/dist/node_modules/oidc-provider/lib/shared/reject_dupes.js +45 -0
- package/dist/node_modules/oidc-provider/lib/shared/reject_structured_tokens.js +18 -0
- package/dist/node_modules/oidc-provider/lib/shared/selective_body.js +60 -0
- package/dist/node_modules/oidc-provider/lib/shared/session.js +68 -0
- package/dist/node_modules/oidc-provider/lib/shared/set_www_authenticate_header.js +52 -0
- package/dist/node_modules/oidc-provider/lib/views/index.js +22 -0
- package/dist/node_modules/oidc-provider/lib/views/interaction.js +171 -0
- package/dist/node_modules/oidc-provider/lib/views/layout.js +237 -0
- package/dist/node_modules/oidc-provider/lib/views/login.js +43 -0
- package/dist/node_modules/oidc-provider/node_modules/@koa/router/LICENSE +21 -0
- package/dist/node_modules/oidc-provider/node_modules/@koa/router/README.md +1370 -0
- package/dist/node_modules/oidc-provider/node_modules/@koa/router/dist/index.d.mts +1003 -0
- package/dist/node_modules/oidc-provider/node_modules/@koa/router/dist/index.d.ts +1003 -0
- package/dist/node_modules/oidc-provider/node_modules/@koa/router/dist/index.js +1616 -0
- package/dist/node_modules/oidc-provider/node_modules/@koa/router/dist/index.mjs +1573 -0
- package/dist/node_modules/oidc-provider/node_modules/@koa/router/package.json +122 -0
- package/dist/node_modules/oidc-provider/node_modules/debug/LICENSE +20 -0
- package/dist/node_modules/oidc-provider/node_modules/debug/README.md +481 -0
- package/dist/node_modules/oidc-provider/node_modules/debug/package.json +64 -0
- package/dist/node_modules/oidc-provider/node_modules/debug/src/browser.js +272 -0
- package/dist/node_modules/oidc-provider/node_modules/debug/src/common.js +292 -0
- package/dist/node_modules/oidc-provider/node_modules/debug/src/index.js +10 -0
- package/dist/node_modules/oidc-provider/node_modules/debug/src/node.js +263 -0
- package/dist/node_modules/oidc-provider/node_modules/http-errors/HISTORY.md +186 -0
- package/dist/node_modules/oidc-provider/node_modules/http-errors/LICENSE +23 -0
- package/dist/node_modules/oidc-provider/node_modules/http-errors/README.md +169 -0
- package/dist/node_modules/oidc-provider/node_modules/http-errors/index.js +290 -0
- package/dist/node_modules/oidc-provider/node_modules/http-errors/package.json +54 -0
- package/dist/node_modules/oidc-provider/node_modules/jsesc/LICENSE-MIT.txt +20 -0
- package/dist/node_modules/oidc-provider/node_modules/jsesc/README.md +422 -0
- package/dist/node_modules/oidc-provider/node_modules/jsesc/bin/jsesc +148 -0
- package/dist/node_modules/oidc-provider/node_modules/jsesc/jsesc.js +337 -0
- package/dist/node_modules/oidc-provider/node_modules/jsesc/man/jsesc.1 +94 -0
- package/dist/node_modules/oidc-provider/node_modules/jsesc/package.json +56 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/LICENSE +20 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/README.md +38 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/bin/nanoid.js +55 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/index.browser.js +29 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/index.d.ts +106 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/index.js +47 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/nanoid.js +1 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/non-secure/index.d.ts +48 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/non-secure/index.js +21 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/package.json +46 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/url-alphabet/index.js +2 -0
- package/dist/node_modules/oidc-provider/node_modules/path-to-regexp/LICENSE +21 -0
- package/dist/node_modules/oidc-provider/node_modules/path-to-regexp/Readme.md +224 -0
- package/dist/node_modules/oidc-provider/node_modules/path-to-regexp/dist/index.d.ts +144 -0
- package/dist/node_modules/oidc-provider/node_modules/path-to-regexp/dist/index.js +409 -0
- package/dist/node_modules/oidc-provider/node_modules/path-to-regexp/dist/index.js.map +1 -0
- package/dist/node_modules/oidc-provider/node_modules/path-to-regexp/package.json +64 -0
- package/dist/node_modules/oidc-provider/node_modules/statuses/HISTORY.md +87 -0
- package/dist/node_modules/oidc-provider/node_modules/statuses/LICENSE +23 -0
- package/dist/node_modules/oidc-provider/node_modules/statuses/README.md +139 -0
- package/dist/node_modules/oidc-provider/node_modules/statuses/codes.json +65 -0
- package/dist/node_modules/oidc-provider/node_modules/statuses/index.js +146 -0
- package/dist/node_modules/oidc-provider/node_modules/statuses/package.json +49 -0
- package/dist/node_modules/oidc-provider/package.json +95 -0
- package/dist/node_modules/quick-lru/index.d.ts +178 -0
- package/dist/node_modules/quick-lru/index.js +329 -0
- package/dist/node_modules/quick-lru/license +9 -0
- package/dist/node_modules/quick-lru/package.json +54 -0
- package/dist/node_modules/quick-lru/readme.md +236 -0
- package/dist/node_modules/statuses/HISTORY.md +65 -0
- package/dist/node_modules/statuses/LICENSE +23 -0
- package/dist/node_modules/statuses/README.md +127 -0
- package/dist/node_modules/statuses/codes.json +66 -0
- package/dist/node_modules/statuses/index.js +113 -0
- package/dist/node_modules/statuses/package.json +48 -0
- package/dist/server/cache-adapter.d.ts +33 -0
- package/dist/server/cache-adapter.js +159 -0
- package/dist/server/index.d.ts +10 -0
- package/dist/server/index.js +48 -0
- package/dist/server/interaction.d.ts +26 -0
- package/dist/server/interaction.js +172 -0
- package/dist/server/paths.d.ts +19 -0
- package/dist/server/paths.js +64 -0
- package/dist/server/plugin.d.ts +16 -0
- package/dist/server/plugin.js +108 -0
- package/dist/server/provider-dispatch.d.ts +32 -0
- package/dist/server/provider-dispatch.js +252 -0
- package/dist/server/service.d.ts +63 -0
- package/dist/server/service.js +540 -0
- package/dist/server/utils.d.ts +12 -0
- package/dist/server/utils.js +58 -0
- package/package.json +24 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
|
@@ -0,0 +1,512 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
|
|
4
|
+
//#region src/err.ts
|
|
5
|
+
var EtaError = class extends Error {
|
|
6
|
+
constructor(message) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.name = "Eta Error";
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
var EtaParseError = class extends EtaError {
|
|
12
|
+
constructor(message) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.name = "EtaParser Error";
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var EtaRuntimeError = class extends EtaError {
|
|
18
|
+
constructor(message) {
|
|
19
|
+
super(message);
|
|
20
|
+
this.name = "EtaRuntime Error";
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
var EtaFileResolutionError = class extends EtaError {
|
|
24
|
+
constructor(message) {
|
|
25
|
+
super(message);
|
|
26
|
+
this.name = "EtaFileResolution Error";
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var EtaNameResolutionError = class extends EtaError {
|
|
30
|
+
constructor(message) {
|
|
31
|
+
super(message);
|
|
32
|
+
this.name = "EtaNameResolution Error";
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Throws an EtaError with a nicely formatted error and message showing where in the template the error occurred.
|
|
37
|
+
*/
|
|
38
|
+
function ParseErr(message, str, indx) {
|
|
39
|
+
const whitespace = str.slice(0, indx).split(/\n/);
|
|
40
|
+
const lineNo = whitespace.length;
|
|
41
|
+
const colNo = whitespace[lineNo - 1].length + 1;
|
|
42
|
+
message += " at line " + lineNo + " col " + colNo + ":\n\n " + str.split(/\n/)[lineNo - 1] + "\n " + Array(colNo).join(" ") + "^";
|
|
43
|
+
throw new EtaParseError(message);
|
|
44
|
+
}
|
|
45
|
+
function RuntimeErr(originalError, str, lineNo, path$1) {
|
|
46
|
+
const lines = str.split("\n");
|
|
47
|
+
const start = Math.max(lineNo - 3, 0);
|
|
48
|
+
const end = Math.min(lines.length, lineNo + 3);
|
|
49
|
+
const filename = path$1;
|
|
50
|
+
const context = lines.slice(start, end).map((line, i) => {
|
|
51
|
+
const curr = i + start + 1;
|
|
52
|
+
return (curr === lineNo ? " >> " : " ") + curr + "| " + line;
|
|
53
|
+
}).join("\n");
|
|
54
|
+
const err = new EtaRuntimeError((filename ? filename + ":" + lineNo + "\n" : "line " + lineNo + "\n") + context + "\n\n" + originalError.message);
|
|
55
|
+
err.name = originalError.name;
|
|
56
|
+
err.cause = originalError;
|
|
57
|
+
throw err;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/file-handling.ts
|
|
62
|
+
function readFile(path$1) {
|
|
63
|
+
let res = "";
|
|
64
|
+
try {
|
|
65
|
+
res = fs.readFileSync(path$1, "utf8");
|
|
66
|
+
} catch (err) {
|
|
67
|
+
if (err?.code === "ENOENT") throw new EtaFileResolutionError(`Could not find template: ${path$1}`);
|
|
68
|
+
else throw err;
|
|
69
|
+
}
|
|
70
|
+
return res;
|
|
71
|
+
}
|
|
72
|
+
function resolvePath(templatePath, options) {
|
|
73
|
+
let resolvedFilePath = "";
|
|
74
|
+
const views = this.config.views;
|
|
75
|
+
if (!views) throw new EtaFileResolutionError("Views directory is not defined");
|
|
76
|
+
const baseFilePath = options?.filepath;
|
|
77
|
+
const defaultExtension = this.config.defaultExtension === void 0 ? ".eta" : this.config.defaultExtension;
|
|
78
|
+
const cacheIndex = JSON.stringify({
|
|
79
|
+
filename: baseFilePath,
|
|
80
|
+
path: templatePath,
|
|
81
|
+
views: this.config.views
|
|
82
|
+
});
|
|
83
|
+
templatePath += path.extname(templatePath) ? "" : defaultExtension;
|
|
84
|
+
if (baseFilePath) {
|
|
85
|
+
if (this.config.cacheFilepaths && this.filepathCache[cacheIndex]) return this.filepathCache[cacheIndex];
|
|
86
|
+
if (absolutePathRegExp.exec(templatePath)?.length) {
|
|
87
|
+
const formattedPath = templatePath.replace(/^\/*|^\\*/, "");
|
|
88
|
+
resolvedFilePath = path.join(views, formattedPath);
|
|
89
|
+
} else resolvedFilePath = path.join(path.dirname(baseFilePath), templatePath);
|
|
90
|
+
} else resolvedFilePath = path.join(views, templatePath);
|
|
91
|
+
if (dirIsChild(views, resolvedFilePath)) {
|
|
92
|
+
if (baseFilePath && this.config.cacheFilepaths) this.filepathCache[cacheIndex] = resolvedFilePath;
|
|
93
|
+
return resolvedFilePath;
|
|
94
|
+
} else throw new EtaFileResolutionError(`Template '${templatePath}' is not in the views directory`);
|
|
95
|
+
}
|
|
96
|
+
function dirIsChild(parent, dir) {
|
|
97
|
+
const relative = path.relative(parent, dir);
|
|
98
|
+
return relative && !relative.startsWith("..") && !path.isAbsolute(relative);
|
|
99
|
+
}
|
|
100
|
+
const absolutePathRegExp = /^\\|^\//;
|
|
101
|
+
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region src/compile.ts
|
|
104
|
+
/* istanbul ignore next */
|
|
105
|
+
const AsyncFunction = (async () => {}).constructor;
|
|
106
|
+
/**
|
|
107
|
+
* Takes a template string and returns a template function that can be called with (data, config)
|
|
108
|
+
*
|
|
109
|
+
* @param str - The template string
|
|
110
|
+
* @param config - A custom configuration object (optional)
|
|
111
|
+
*/
|
|
112
|
+
function compile(str, options) {
|
|
113
|
+
const config = this.config;
|
|
114
|
+
const ctor = options?.async ? AsyncFunction : Function;
|
|
115
|
+
try {
|
|
116
|
+
return new ctor(config.varName, "options", this.compileToString.call(this, str, options));
|
|
117
|
+
} catch (e) {
|
|
118
|
+
if (e instanceof SyntaxError) throw new EtaParseError("Bad template syntax\n\n" + e.message + "\n" + Array(e.message.length + 1).join("=") + "\n" + this.compileToString.call(this, str, options) + "\n");
|
|
119
|
+
else throw e;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
//#endregion
|
|
124
|
+
//#region src/compile-string.ts
|
|
125
|
+
/**
|
|
126
|
+
* Compiles a template string to a function string. Most often users just use `compile()`, which calls `compileToString` and creates a new function using the result
|
|
127
|
+
*/
|
|
128
|
+
function compileToString(str, options) {
|
|
129
|
+
const config = this.config;
|
|
130
|
+
const isAsync = options?.async;
|
|
131
|
+
const compileBody$1 = this.compileBody;
|
|
132
|
+
const buffer = this.parse.call(this, str);
|
|
133
|
+
let res = `${config.functionHeader}
|
|
134
|
+
let include = (__eta_t, __eta_d) => this.render(__eta_t, {...${config.varName}, ...(__eta_d ?? {})}, options);
|
|
135
|
+
let includeAsync = (__eta_t, __eta_d) => this.renderAsync(__eta_t, {...${config.varName}, ...(__eta_d ?? {})}, options);
|
|
136
|
+
|
|
137
|
+
let __eta = {res: "", e: this.config.escapeFunction, f: this.config.filterFunction${config.debug ? ", line: 1, templateStr: \"" + str.replace(/\\|"/g, "\\$&").replace(/\r\n|\n|\r/g, "\\n") + "\"" : ""}};
|
|
138
|
+
|
|
139
|
+
function layout(path, data) {
|
|
140
|
+
__eta.layout = path;
|
|
141
|
+
__eta.layoutData = data;
|
|
142
|
+
}${config.debug ? "try {" : ""}${config.useWith ? "with(" + config.varName + "||{}){" : ""}
|
|
143
|
+
|
|
144
|
+
function ${config.outputFunctionName}(s){__eta.res+=s;}
|
|
145
|
+
|
|
146
|
+
${compileBody$1.call(this, buffer)}
|
|
147
|
+
if (__eta.layout) {
|
|
148
|
+
__eta.res = ${isAsync ? "await includeAsync" : "include"} (__eta.layout, {...${config.varName}, body: __eta.res, ...__eta.layoutData});
|
|
149
|
+
}
|
|
150
|
+
${config.useWith ? "}" : ""}${config.debug ? "} catch (e) { this.RuntimeErr(e, __eta.templateStr, __eta.line, options.filepath) }" : ""}
|
|
151
|
+
return __eta.res;
|
|
152
|
+
`;
|
|
153
|
+
if (config.plugins) for (let i = 0; i < config.plugins.length; i++) {
|
|
154
|
+
const plugin = config.plugins[i];
|
|
155
|
+
if (plugin.processFnString) res = plugin.processFnString(res, config);
|
|
156
|
+
}
|
|
157
|
+
return res;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Loops through the AST generated by `parse` and transform each item into JS calls
|
|
161
|
+
*
|
|
162
|
+
* **Example**
|
|
163
|
+
*
|
|
164
|
+
* ```js
|
|
165
|
+
* let templateAST = ['Hi ', { val: 'it.name', t: 'i' }]
|
|
166
|
+
* compileBody.call(Eta, templateAST)
|
|
167
|
+
* // => "__eta.res+='Hi '\n__eta.res+=__eta.e(it.name)\n"
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
function compileBody(buff) {
|
|
171
|
+
const config = this.config;
|
|
172
|
+
let i = 0;
|
|
173
|
+
const buffLength = buff.length;
|
|
174
|
+
let returnStr = "";
|
|
175
|
+
for (; i < buffLength; i++) {
|
|
176
|
+
const currentBlock = buff[i];
|
|
177
|
+
if (typeof currentBlock === "string") returnStr += "__eta.res+='" + currentBlock + "';\n";
|
|
178
|
+
else {
|
|
179
|
+
const type = currentBlock.t;
|
|
180
|
+
let content = currentBlock.val || "";
|
|
181
|
+
if (config.debug) returnStr += "__eta.line=" + currentBlock.lineNo + "\n";
|
|
182
|
+
if (type === "r") {
|
|
183
|
+
if (config.autoFilter) content = "__eta.f(" + content + ")";
|
|
184
|
+
returnStr += "__eta.res+=" + content + ";\n";
|
|
185
|
+
} else if (type === "i") {
|
|
186
|
+
if (config.autoFilter) content = "__eta.f(" + content + ")";
|
|
187
|
+
if (config.autoEscape) content = "__eta.e(" + content + ")";
|
|
188
|
+
returnStr += "__eta.res+=" + content + ";\n";
|
|
189
|
+
} else if (type === "e") returnStr += content + "\n";
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return returnStr;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
//#endregion
|
|
196
|
+
//#region src/utils.ts
|
|
197
|
+
/**
|
|
198
|
+
* Takes a string within a template and trims it, based on the preceding tag's whitespace control and `config.autoTrim`
|
|
199
|
+
*/
|
|
200
|
+
function trimWS(str, config, wsLeft, wsRight) {
|
|
201
|
+
let leftTrim;
|
|
202
|
+
let rightTrim;
|
|
203
|
+
if (Array.isArray(config.autoTrim)) {
|
|
204
|
+
leftTrim = config.autoTrim[1];
|
|
205
|
+
rightTrim = config.autoTrim[0];
|
|
206
|
+
} else leftTrim = rightTrim = config.autoTrim;
|
|
207
|
+
if (wsLeft || wsLeft === false) leftTrim = wsLeft;
|
|
208
|
+
if (wsRight || wsRight === false) rightTrim = wsRight;
|
|
209
|
+
if (!rightTrim && !leftTrim) return str;
|
|
210
|
+
if (leftTrim === "slurp" && rightTrim === "slurp") return str.trim();
|
|
211
|
+
if (leftTrim === "_" || leftTrim === "slurp") str = str.trimStart();
|
|
212
|
+
else if (leftTrim === "-" || leftTrim === "nl") str = str.replace(/^(?:\r\n|\n|\r)/, "");
|
|
213
|
+
if (rightTrim === "_" || rightTrim === "slurp") str = str.trimEnd();
|
|
214
|
+
else if (rightTrim === "-" || rightTrim === "nl") str = str.replace(/(?:\r\n|\n|\r)$/, "");
|
|
215
|
+
return str;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* A map of special HTML characters to their XML-escaped equivalents
|
|
219
|
+
*/
|
|
220
|
+
const escMap = {
|
|
221
|
+
"&": "&",
|
|
222
|
+
"<": "<",
|
|
223
|
+
">": ">",
|
|
224
|
+
"\"": """,
|
|
225
|
+
"'": "'"
|
|
226
|
+
};
|
|
227
|
+
function replaceChar(s) {
|
|
228
|
+
return escMap[s];
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* XML-escapes an input value after converting it to a string
|
|
232
|
+
*
|
|
233
|
+
* @param str - Input value (usually a string)
|
|
234
|
+
* @returns XML-escaped string
|
|
235
|
+
*/
|
|
236
|
+
function XMLEscape(str) {
|
|
237
|
+
const newStr = String(str);
|
|
238
|
+
if (/[&<>"']/.test(newStr)) return newStr.replace(/[&<>"']/g, replaceChar);
|
|
239
|
+
else return newStr;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
//#endregion
|
|
243
|
+
//#region src/config.ts
|
|
244
|
+
/** Eta's base (global) configuration */
|
|
245
|
+
const defaultConfig = {
|
|
246
|
+
autoEscape: true,
|
|
247
|
+
autoFilter: false,
|
|
248
|
+
autoTrim: [false, "nl"],
|
|
249
|
+
cache: false,
|
|
250
|
+
cacheFilepaths: true,
|
|
251
|
+
debug: false,
|
|
252
|
+
escapeFunction: XMLEscape,
|
|
253
|
+
filterFunction: (val) => String(val),
|
|
254
|
+
outputFunctionName: "output",
|
|
255
|
+
functionHeader: "",
|
|
256
|
+
parse: {
|
|
257
|
+
exec: "",
|
|
258
|
+
interpolate: "=",
|
|
259
|
+
raw: "~"
|
|
260
|
+
},
|
|
261
|
+
plugins: [],
|
|
262
|
+
rmWhitespace: false,
|
|
263
|
+
tags: ["<%", "%>"],
|
|
264
|
+
useWith: false,
|
|
265
|
+
varName: "it",
|
|
266
|
+
defaultExtension: ".eta"
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
//#endregion
|
|
270
|
+
//#region src/parse.ts
|
|
271
|
+
const templateLitReg = /`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g;
|
|
272
|
+
const singleQuoteReg = /'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g;
|
|
273
|
+
const doubleQuoteReg = /"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g;
|
|
274
|
+
/** Escape special regular expression characters inside a string */
|
|
275
|
+
function escapeRegExp(string) {
|
|
276
|
+
return string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&");
|
|
277
|
+
}
|
|
278
|
+
function getLineNo(str, index) {
|
|
279
|
+
return str.slice(0, index).split("\n").length;
|
|
280
|
+
}
|
|
281
|
+
function parse(str) {
|
|
282
|
+
const config = this.config;
|
|
283
|
+
let buffer = [];
|
|
284
|
+
let trimLeftOfNextStr = false;
|
|
285
|
+
let lastIndex = 0;
|
|
286
|
+
const parseOptions = config.parse;
|
|
287
|
+
if (config.plugins) for (let i = 0; i < config.plugins.length; i++) {
|
|
288
|
+
const plugin = config.plugins[i];
|
|
289
|
+
if (plugin.processTemplate) str = plugin.processTemplate(str, config);
|
|
290
|
+
}
|
|
291
|
+
if (config.rmWhitespace) str = str.replace(/[\r\n]+/g, "\n").replace(/^\s+|\s+$/gm, "");
|
|
292
|
+
templateLitReg.lastIndex = 0;
|
|
293
|
+
singleQuoteReg.lastIndex = 0;
|
|
294
|
+
doubleQuoteReg.lastIndex = 0;
|
|
295
|
+
function pushString(strng, shouldTrimRightOfString) {
|
|
296
|
+
if (strng) {
|
|
297
|
+
strng = trimWS(strng, config, trimLeftOfNextStr, shouldTrimRightOfString);
|
|
298
|
+
if (strng) {
|
|
299
|
+
strng = strng.replace(/\\|'/g, "\\$&").replace(/\r\n|\n|\r/g, "\\n");
|
|
300
|
+
buffer.push(strng);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
const prefixes = [
|
|
305
|
+
parseOptions.exec,
|
|
306
|
+
parseOptions.interpolate,
|
|
307
|
+
parseOptions.raw
|
|
308
|
+
].reduce((accumulator, prefix) => {
|
|
309
|
+
if (accumulator && prefix) return accumulator + "|" + escapeRegExp(prefix);
|
|
310
|
+
else if (prefix) return escapeRegExp(prefix);
|
|
311
|
+
else return accumulator;
|
|
312
|
+
}, "");
|
|
313
|
+
const parseOpenReg = new RegExp(escapeRegExp(config.tags[0]) + "(-|_)?\\s*(" + prefixes + ")?\\s*", "g");
|
|
314
|
+
const parseCloseReg = new RegExp("'|\"|`|\\/\\*|(\\s*(-|_)?" + escapeRegExp(config.tags[1]) + ")", "g");
|
|
315
|
+
let m;
|
|
316
|
+
while (m = parseOpenReg.exec(str)) {
|
|
317
|
+
const precedingString = str.slice(lastIndex, m.index);
|
|
318
|
+
lastIndex = m[0].length + m.index;
|
|
319
|
+
const wsLeft = m[1];
|
|
320
|
+
const prefix = m[2] || "";
|
|
321
|
+
pushString(precedingString, wsLeft);
|
|
322
|
+
parseCloseReg.lastIndex = lastIndex;
|
|
323
|
+
let closeTag;
|
|
324
|
+
let currentObj = false;
|
|
325
|
+
while (closeTag = parseCloseReg.exec(str)) if (closeTag[1]) {
|
|
326
|
+
const content = str.slice(lastIndex, closeTag.index);
|
|
327
|
+
parseOpenReg.lastIndex = lastIndex = parseCloseReg.lastIndex;
|
|
328
|
+
trimLeftOfNextStr = closeTag[2];
|
|
329
|
+
currentObj = {
|
|
330
|
+
t: prefix === parseOptions.exec ? "e" : prefix === parseOptions.raw ? "r" : prefix === parseOptions.interpolate ? "i" : "",
|
|
331
|
+
val: content
|
|
332
|
+
};
|
|
333
|
+
break;
|
|
334
|
+
} else {
|
|
335
|
+
const char = closeTag[0];
|
|
336
|
+
if (char === "/*") {
|
|
337
|
+
const commentCloseInd = str.indexOf("*/", parseCloseReg.lastIndex);
|
|
338
|
+
if (commentCloseInd === -1) ParseErr("unclosed comment", str, closeTag.index);
|
|
339
|
+
parseCloseReg.lastIndex = commentCloseInd;
|
|
340
|
+
} else if (char === "'") {
|
|
341
|
+
singleQuoteReg.lastIndex = closeTag.index;
|
|
342
|
+
if (singleQuoteReg.exec(str)) parseCloseReg.lastIndex = singleQuoteReg.lastIndex;
|
|
343
|
+
else ParseErr("unclosed string", str, closeTag.index);
|
|
344
|
+
} else if (char === "\"") {
|
|
345
|
+
doubleQuoteReg.lastIndex = closeTag.index;
|
|
346
|
+
if (doubleQuoteReg.exec(str)) parseCloseReg.lastIndex = doubleQuoteReg.lastIndex;
|
|
347
|
+
else ParseErr("unclosed string", str, closeTag.index);
|
|
348
|
+
} else if (char === "`") {
|
|
349
|
+
templateLitReg.lastIndex = closeTag.index;
|
|
350
|
+
if (templateLitReg.exec(str)) parseCloseReg.lastIndex = templateLitReg.lastIndex;
|
|
351
|
+
else ParseErr("unclosed string", str, closeTag.index);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
if (currentObj) {
|
|
355
|
+
if (config.debug) currentObj.lineNo = getLineNo(str, m.index);
|
|
356
|
+
buffer.push(currentObj);
|
|
357
|
+
} else ParseErr("unclosed tag", str, m.index);
|
|
358
|
+
}
|
|
359
|
+
pushString(str.slice(lastIndex, str.length), false);
|
|
360
|
+
if (config.plugins) for (let i = 0; i < config.plugins.length; i++) {
|
|
361
|
+
const plugin = config.plugins[i];
|
|
362
|
+
if (plugin.processAST) buffer = plugin.processAST(buffer, config);
|
|
363
|
+
}
|
|
364
|
+
return buffer;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
//#endregion
|
|
368
|
+
//#region src/render.ts
|
|
369
|
+
function handleCache(template, options) {
|
|
370
|
+
const templateStore = options?.async ? this.templatesAsync : this.templatesSync;
|
|
371
|
+
if (this.resolvePath && this.readFile && !template.startsWith("@")) {
|
|
372
|
+
const templatePath = options.filepath;
|
|
373
|
+
const cachedTemplate = templateStore.get(templatePath);
|
|
374
|
+
if (this.config.cache && cachedTemplate) return cachedTemplate;
|
|
375
|
+
else {
|
|
376
|
+
const templateString = this.readFile(templatePath);
|
|
377
|
+
const templateFn = this.compile(templateString, options);
|
|
378
|
+
if (this.config.cache) templateStore.define(templatePath, templateFn);
|
|
379
|
+
return templateFn;
|
|
380
|
+
}
|
|
381
|
+
} else {
|
|
382
|
+
const cachedTemplate = templateStore.get(template);
|
|
383
|
+
if (cachedTemplate) return cachedTemplate;
|
|
384
|
+
else throw new EtaNameResolutionError(`Failed to get template '${template}'`);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
function render(template, data, meta) {
|
|
388
|
+
let templateFn;
|
|
389
|
+
const options = {
|
|
390
|
+
...meta,
|
|
391
|
+
async: false
|
|
392
|
+
};
|
|
393
|
+
if (typeof template === "string") {
|
|
394
|
+
if (this.resolvePath && this.readFile && !template.startsWith("@")) options.filepath = this.resolvePath(template, options);
|
|
395
|
+
templateFn = handleCache.call(this, template, options);
|
|
396
|
+
} else templateFn = template;
|
|
397
|
+
return templateFn.call(this, data, options);
|
|
398
|
+
}
|
|
399
|
+
function renderAsync(template, data, meta) {
|
|
400
|
+
let templateFn;
|
|
401
|
+
const options = {
|
|
402
|
+
...meta,
|
|
403
|
+
async: true
|
|
404
|
+
};
|
|
405
|
+
if (typeof template === "string") {
|
|
406
|
+
if (this.resolvePath && this.readFile && !template.startsWith("@")) options.filepath = this.resolvePath(template, options);
|
|
407
|
+
templateFn = handleCache.call(this, template, options);
|
|
408
|
+
} else templateFn = template;
|
|
409
|
+
const res = templateFn.call(this, data, options);
|
|
410
|
+
return Promise.resolve(res);
|
|
411
|
+
}
|
|
412
|
+
function renderString(template, data) {
|
|
413
|
+
const templateFn = this.compile(template, { async: false });
|
|
414
|
+
return render.call(this, templateFn, data);
|
|
415
|
+
}
|
|
416
|
+
function renderStringAsync(template, data) {
|
|
417
|
+
const templateFn = this.compile(template, { async: true });
|
|
418
|
+
return renderAsync.call(this, templateFn, data);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
//#endregion
|
|
422
|
+
//#region src/storage.ts
|
|
423
|
+
/**
|
|
424
|
+
* Handles storage and accessing of values
|
|
425
|
+
*
|
|
426
|
+
* In this case, we use it to store compiled template functions
|
|
427
|
+
* Indexed by their `name` or `filename`
|
|
428
|
+
*/
|
|
429
|
+
var Cacher = class {
|
|
430
|
+
constructor(cache) {
|
|
431
|
+
this.cache = cache;
|
|
432
|
+
}
|
|
433
|
+
define(key, val) {
|
|
434
|
+
this.cache[key] = val;
|
|
435
|
+
}
|
|
436
|
+
get(key) {
|
|
437
|
+
return this.cache[key];
|
|
438
|
+
}
|
|
439
|
+
remove(key) {
|
|
440
|
+
delete this.cache[key];
|
|
441
|
+
}
|
|
442
|
+
reset() {
|
|
443
|
+
this.cache = {};
|
|
444
|
+
}
|
|
445
|
+
load(cacheObj) {
|
|
446
|
+
this.cache = {
|
|
447
|
+
...this.cache,
|
|
448
|
+
...cacheObj
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
|
|
453
|
+
//#endregion
|
|
454
|
+
//#region src/internal.ts
|
|
455
|
+
var Eta$1 = class {
|
|
456
|
+
constructor(customConfig) {
|
|
457
|
+
if (customConfig) this.config = {
|
|
458
|
+
...defaultConfig,
|
|
459
|
+
...customConfig
|
|
460
|
+
};
|
|
461
|
+
else this.config = { ...defaultConfig };
|
|
462
|
+
}
|
|
463
|
+
config;
|
|
464
|
+
RuntimeErr = RuntimeErr;
|
|
465
|
+
compile = compile;
|
|
466
|
+
compileToString = compileToString;
|
|
467
|
+
compileBody = compileBody;
|
|
468
|
+
parse = parse;
|
|
469
|
+
render = render;
|
|
470
|
+
renderAsync = renderAsync;
|
|
471
|
+
renderString = renderString;
|
|
472
|
+
renderStringAsync = renderStringAsync;
|
|
473
|
+
filepathCache = {};
|
|
474
|
+
templatesSync = new Cacher({});
|
|
475
|
+
templatesAsync = new Cacher({});
|
|
476
|
+
resolvePath = null;
|
|
477
|
+
readFile = null;
|
|
478
|
+
configure(customConfig) {
|
|
479
|
+
this.config = {
|
|
480
|
+
...this.config,
|
|
481
|
+
...customConfig
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
withConfig(customConfig) {
|
|
485
|
+
return {
|
|
486
|
+
...this,
|
|
487
|
+
config: {
|
|
488
|
+
...this.config,
|
|
489
|
+
...customConfig
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
loadTemplate(name, template, options) {
|
|
494
|
+
if (typeof template === "string") (options?.async ? this.templatesAsync : this.templatesSync).define(name, this.compile(template, options));
|
|
495
|
+
else {
|
|
496
|
+
let templates = this.templatesSync;
|
|
497
|
+
if (template.constructor.name === "AsyncFunction" || options?.async) templates = this.templatesAsync;
|
|
498
|
+
templates.define(name, template);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
//#endregion
|
|
504
|
+
//#region src/index.ts
|
|
505
|
+
var Eta = class extends Eta$1 {
|
|
506
|
+
readFile = readFile;
|
|
507
|
+
resolvePath = resolvePath;
|
|
508
|
+
};
|
|
509
|
+
|
|
510
|
+
//#endregion
|
|
511
|
+
export { Eta, EtaError, EtaFileResolutionError, EtaNameResolutionError, EtaParseError, EtaRuntimeError };
|
|
512
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["path","path","err: any","config: EtaConfig","compileBody","buffer: Array<AstObject>","leftTrim: string | false","rightTrim: string | false","escMap: { [key: string]: string }","defaultConfig: EtaConfig","buffer: Array<AstObject>","trimLeftOfNextStr: string | false","m: RegExpExecArray | null","closeTag: RegExpExecArray | null","currentObj: AstObject | false","templateFn: TemplateFunction","cache: Record<string, T>","Eta","EtaCore"],"sources":["../src/err.ts","../src/file-handling.ts","../src/compile.ts","../src/compile-string.ts","../src/utils.ts","../src/config.ts","../src/parse.ts","../src/render.ts","../src/storage.ts","../src/internal.ts","../src/index.ts"],"sourcesContent":["export class EtaError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"Eta Error\";\n }\n}\n\nexport class EtaParseError extends EtaError {\n constructor(message: string) {\n super(message);\n this.name = \"EtaParser Error\";\n }\n}\n\nexport class EtaRuntimeError extends EtaError {\n constructor(message: string) {\n super(message);\n this.name = \"EtaRuntime Error\";\n }\n}\n\nexport class EtaFileResolutionError extends EtaError {\n constructor(message: string) {\n super(message);\n this.name = \"EtaFileResolution Error\";\n }\n}\n\nexport class EtaNameResolutionError extends EtaError {\n constructor(message: string) {\n super(message);\n this.name = \"EtaNameResolution Error\";\n }\n}\n\n/**\n * Throws an EtaError with a nicely formatted error and message showing where in the template the error occurred.\n */\n\nexport function ParseErr(message: string, str: string, indx: number): never {\n const whitespace = str.slice(0, indx).split(/\\n/);\n\n const lineNo = whitespace.length;\n const colNo = whitespace[lineNo - 1].length + 1;\n message +=\n \" at line \" +\n lineNo +\n \" col \" +\n colNo +\n \":\\n\\n\" +\n \" \" +\n str.split(/\\n/)[lineNo - 1] +\n \"\\n\" +\n \" \" +\n Array(colNo).join(\" \") +\n \"^\";\n throw new EtaParseError(message);\n}\n\nexport function RuntimeErr(\n originalError: Error,\n str: string,\n lineNo: number,\n path: string,\n): never {\n // code gratefully taken from https://github.com/mde/ejs and adapted\n\n const lines = str.split(\"\\n\");\n const start = Math.max(lineNo - 3, 0);\n const end = Math.min(lines.length, lineNo + 3);\n const filename = path;\n // Error context\n const context = lines\n .slice(start, end)\n .map((line, i) => {\n const curr = i + start + 1;\n return (curr === lineNo ? \" >> \" : \" \") + curr + \"| \" + line;\n })\n .join(\"\\n\");\n\n const header = filename\n ? filename + \":\" + lineNo + \"\\n\"\n : \"line \" + lineNo + \"\\n\";\n\n const err = new EtaRuntimeError(\n header + context + \"\\n\\n\" + originalError.message,\n );\n\n err.name = originalError.name; // the original name (e.g. ReferenceError) may be useful\n err.cause = originalError;\n\n throw err;\n}\n","import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n\nimport type { Options } from \"./config.ts\";\nimport { EtaFileResolutionError } from \"./err.ts\";\nimport type { Eta as EtaCore } from \"./internal.ts\";\n\nexport function readFile(this: EtaCore, path: string): string {\n let res = \"\";\n\n try {\n res = fs.readFileSync(path, \"utf8\");\n // biome-ignore lint/suspicious/noExplicitAny: it's an error\n } catch (err: any) {\n if (err?.code === \"ENOENT\") {\n throw new EtaFileResolutionError(`Could not find template: ${path}`);\n } else {\n throw err;\n }\n }\n\n return res;\n}\n\nexport function resolvePath(\n this: EtaCore,\n templatePath: string,\n options?: Partial<Options>,\n): string {\n let resolvedFilePath = \"\";\n\n const views = this.config.views;\n\n if (!views) {\n throw new EtaFileResolutionError(\"Views directory is not defined\");\n }\n\n const baseFilePath = options?.filepath;\n const defaultExtension =\n this.config.defaultExtension === undefined\n ? \".eta\"\n : this.config.defaultExtension;\n\n // how we index cached template paths\n const cacheIndex = JSON.stringify({\n filename: baseFilePath, // filename of the template which called includeFile()\n path: templatePath,\n views: this.config.views,\n });\n\n templatePath += path.extname(templatePath) ? \"\" : defaultExtension;\n\n // if the file was included from another template\n if (baseFilePath) {\n // check the cache\n\n if (this.config.cacheFilepaths && this.filepathCache[cacheIndex]) {\n return this.filepathCache[cacheIndex];\n }\n\n const absolutePathTest = absolutePathRegExp.exec(templatePath);\n\n if (absolutePathTest?.length) {\n const formattedPath = templatePath.replace(/^\\/*|^\\\\*/, \"\");\n resolvedFilePath = path.join(views, formattedPath);\n } else {\n resolvedFilePath = path.join(path.dirname(baseFilePath), templatePath);\n }\n } else {\n resolvedFilePath = path.join(views, templatePath);\n }\n\n if (dirIsChild(views, resolvedFilePath)) {\n // add resolved path to the cache\n if (baseFilePath && this.config.cacheFilepaths) {\n this.filepathCache[cacheIndex] = resolvedFilePath;\n }\n\n return resolvedFilePath;\n } else {\n throw new EtaFileResolutionError(\n `Template '${templatePath}' is not in the views directory`,\n );\n }\n}\n\nfunction dirIsChild(parent: string, dir: string) {\n const relative = path.relative(parent, dir);\n return relative && !relative.startsWith(\"..\") && !path.isAbsolute(relative);\n}\n\nconst absolutePathRegExp = /^\\\\|^\\//;\n","import type { EtaConfig, Options } from \"./config.ts\";\nimport { EtaParseError } from \"./err.ts\";\nimport type { Eta } from \"./internal.ts\";\n\nexport type TemplateFunction = (\n this: Eta,\n data?: object,\n options?: Partial<Options>,\n) => string;\n/* END TYPES */\n\n/* istanbul ignore next */\nconst AsyncFunction = (async () => {}).constructor;\n\n/**\n * Takes a template string and returns a template function that can be called with (data, config)\n *\n * @param str - The template string\n * @param config - A custom configuration object (optional)\n */\n\nexport function compile(\n this: Eta,\n str: string,\n options?: Partial<Options>,\n): TemplateFunction {\n const config: EtaConfig = this.config;\n\n /* ASYNC HANDLING */\n // code gratefully taken from https://github.com/mde/ejs and adapted\n const ctor = options?.async\n ? (AsyncFunction as FunctionConstructor)\n : Function;\n /* END ASYNC HANDLING */\n\n try {\n return new ctor(\n config.varName,\n \"options\",\n this.compileToString.call(this, str, options),\n ) as TemplateFunction; // eslint-disable-line no-new-func\n } catch (e) {\n if (e instanceof SyntaxError) {\n throw new EtaParseError(\n \"Bad template syntax\\n\\n\" +\n e.message +\n \"\\n\" +\n Array(e.message.length + 1).join(\"=\") +\n \"\\n\" +\n this.compileToString.call(this, str, options) +\n \"\\n\", // This will put an extra newline before the callstack for extra readability\n );\n } else {\n throw e;\n }\n }\n}\n","import type { Options } from \"./config.ts\";\nimport type { Eta } from \"./internal.ts\";\nimport type { AstObject } from \"./parse.ts\";\n\n/**\n * Compiles a template string to a function string. Most often users just use `compile()`, which calls `compileToString` and creates a new function using the result\n */\n\nexport function compileToString(\n this: Eta,\n str: string,\n options?: Partial<Options>,\n): string {\n const config = this.config;\n const isAsync = options?.async;\n\n const compileBody = this.compileBody;\n\n const buffer: Array<AstObject> = this.parse.call(this, str);\n\n // note: when the include function passes through options, the only parameter that matters is the filepath parameter\n let res = `${config.functionHeader}\nlet include = (__eta_t, __eta_d) => this.render(__eta_t, {...${config.varName}, ...(__eta_d ?? {})}, options);\nlet includeAsync = (__eta_t, __eta_d) => this.renderAsync(__eta_t, {...${config.varName}, ...(__eta_d ?? {})}, options);\n\nlet __eta = {res: \"\", e: this.config.escapeFunction, f: this.config.filterFunction${\n config.debug\n ? ', line: 1, templateStr: \"' +\n str.replace(/\\\\|\"/g, \"\\\\$&\").replace(/\\r\\n|\\n|\\r/g, \"\\\\n\") +\n '\"'\n : \"\"\n }};\n\nfunction layout(path, data) {\n __eta.layout = path;\n __eta.layoutData = data;\n}${config.debug ? \"try {\" : \"\"}${\n config.useWith ? \"with(\" + config.varName + \"||{}){\" : \"\"\n }\n\nfunction ${config.outputFunctionName}(s){__eta.res+=s;}\n\n${compileBody.call(this, buffer)}\nif (__eta.layout) {\n __eta.res = ${\n isAsync ? \"await includeAsync\" : \"include\"\n } (__eta.layout, {...${\n config.varName\n }, body: __eta.res, ...__eta.layoutData});\n}\n${config.useWith ? \"}\" : \"\"}${\n config.debug\n ? \"} catch (e) { this.RuntimeErr(e, __eta.templateStr, __eta.line, options.filepath) }\"\n : \"\"\n}\nreturn __eta.res;\n`;\n\n if (config.plugins) {\n for (let i = 0; i < config.plugins.length; i++) {\n const plugin = config.plugins[i];\n if (plugin.processFnString) {\n res = plugin.processFnString(res, config);\n }\n }\n }\n\n return res;\n}\n\n/**\n * Loops through the AST generated by `parse` and transform each item into JS calls\n *\n * **Example**\n *\n * ```js\n * let templateAST = ['Hi ', { val: 'it.name', t: 'i' }]\n * compileBody.call(Eta, templateAST)\n * // => \"__eta.res+='Hi '\\n__eta.res+=__eta.e(it.name)\\n\"\n * ```\n */\n\nexport function compileBody(this: Eta, buff: Array<AstObject>): string {\n const config = this.config;\n\n let i = 0;\n const buffLength = buff.length;\n let returnStr = \"\";\n\n for (i; i < buffLength; i++) {\n const currentBlock = buff[i];\n if (typeof currentBlock === \"string\") {\n const str = currentBlock;\n\n // we know string exists\n returnStr += \"__eta.res+='\" + str + \"';\\n\";\n } else {\n const type = currentBlock.t; // \"r\", \"e\", or \"i\"\n let content = currentBlock.val || \"\";\n\n if (config.debug) returnStr += \"__eta.line=\" + currentBlock.lineNo + \"\\n\";\n\n if (type === \"r\") {\n // raw\n\n if (config.autoFilter) {\n content = \"__eta.f(\" + content + \")\";\n }\n\n returnStr += \"__eta.res+=\" + content + \";\\n\";\n } else if (type === \"i\") {\n // interpolate\n\n if (config.autoFilter) {\n content = \"__eta.f(\" + content + \")\";\n }\n\n if (config.autoEscape) {\n content = \"__eta.e(\" + content + \")\";\n }\n\n returnStr += \"__eta.res+=\" + content + \";\\n\";\n } else if (type === \"e\") {\n // execute\n returnStr += content + \"\\n\";\n }\n }\n }\n\n return returnStr;\n}\n","import type { EtaConfig } from \"./config.ts\";\n\n/**\n * Takes a string within a template and trims it, based on the preceding tag's whitespace control and `config.autoTrim`\n */\n\nexport function trimWS(\n str: string,\n config: EtaConfig,\n wsLeft: string | false,\n wsRight?: string | false,\n): string {\n let leftTrim: string | false;\n let rightTrim: string | false;\n\n if (Array.isArray(config.autoTrim)) {\n // Slightly confusing,\n // but _}} will trim the left side of the following string\n leftTrim = config.autoTrim[1];\n rightTrim = config.autoTrim[0];\n } else {\n leftTrim = rightTrim = config.autoTrim;\n }\n\n if (wsLeft || wsLeft === false) {\n leftTrim = wsLeft;\n }\n\n if (wsRight || wsRight === false) {\n rightTrim = wsRight;\n }\n\n if (!rightTrim && !leftTrim) {\n return str;\n }\n\n if (leftTrim === \"slurp\" && rightTrim === \"slurp\") {\n return str.trim();\n }\n\n if (leftTrim === \"_\" || leftTrim === \"slurp\") {\n // full slurp\n str = str.trimStart();\n } else if (leftTrim === \"-\" || leftTrim === \"nl\") {\n // nl trim\n str = str.replace(/^(?:\\r\\n|\\n|\\r)/, \"\");\n }\n\n if (rightTrim === \"_\" || rightTrim === \"slurp\") {\n // full slurp\n str = str.trimEnd();\n } else if (rightTrim === \"-\" || rightTrim === \"nl\") {\n // nl trim\n str = str.replace(/(?:\\r\\n|\\n|\\r)$/, \"\");\n }\n\n return str;\n}\n\n/**\n * A map of special HTML characters to their XML-escaped equivalents\n */\n\nconst escMap: { [key: string]: string } = {\n \"&\": \"&\",\n \"<\": \"<\",\n \">\": \">\",\n '\"': \""\",\n \"'\": \"'\",\n};\n\nfunction replaceChar(s: string): string {\n return escMap[s];\n}\n\n/**\n * XML-escapes an input value after converting it to a string\n *\n * @param str - Input value (usually a string)\n * @returns XML-escaped string\n */\n\nexport function XMLEscape(str: unknown): string {\n // To deal with XSS. Based on Escape implementations of Mustache.JS and Marko, then customized.\n const newStr = String(str);\n if (/[&<>\"']/.test(newStr)) {\n return newStr.replace(/[&<>\"']/g, replaceChar);\n } else {\n return newStr;\n }\n}\n","import type { AstObject } from \"./parse.ts\";\nimport { XMLEscape } from \"./utils.ts\";\n\ntype trimConfig = \"nl\" | \"slurp\" | false;\n\nexport interface Options {\n /** Compile to async function */\n async?: boolean;\n\n /** Absolute path to template file */\n filepath?: string;\n}\n\nexport interface EtaConfig {\n /** Whether or not to automatically XML-escape interpolations. Default true */\n autoEscape: boolean;\n\n /** Apply a filter function defined on the class to every interpolation or raw interpolation */\n autoFilter: boolean;\n\n /** Configure automatic whitespace trimming. Default `[false, 'nl']` */\n autoTrim: trimConfig | [trimConfig, trimConfig];\n\n /** Whether or not to cache templates if `name` or `filename` is passed */\n cache: boolean;\n\n /** Holds cache of resolved filepaths. Set to `false` to disable. */\n cacheFilepaths: boolean;\n\n /** Whether to pretty-format error messages (introduces runtime penalties) */\n debug: boolean;\n\n /** Function to XML-sanitize interpolations */\n escapeFunction: (str: unknown) => string;\n\n /** Function applied to all interpolations when autoFilter is true */\n filterFunction: (val: unknown) => string;\n\n /** Name of the function that can be used in template code to output text to the result (like EJS's `outputFunctionName`). */\n outputFunctionName: string;\n\n /** Raw JS code inserted in the template function. Useful for declaring global variables for user templates */\n functionHeader: string;\n\n /** Parsing options */\n parse: {\n /** Which prefix to use for evaluation. Default `\"\"`, does not support `\"-\"` or `\"_\"` */\n exec: string;\n\n /** Which prefix to use for interpolation. Default `\"=\"`, does not support `\"-\"` or `\"_\"` */\n interpolate: string;\n\n /** Which prefix to use for raw interpolation. Default `\"~\"`, does not support `\"-\"` or `\"_\"` */\n raw: string;\n };\n\n /** Array of plugins */\n plugins: Array<{\n processFnString?: (fnString: string, env?: EtaConfig) => string;\n processAST?: (ast: AstObject[], env?: EtaConfig) => AstObject[];\n processTemplate?: (fnString: string, env?: EtaConfig) => string;\n }>;\n\n /** Remove empty lines and whitespace between lines */\n rmWhitespace: boolean;\n\n /** Delimiters: by default `['<%', '%>']` */\n tags: [string, string];\n\n /** Make data available on the global object instead of varName */\n useWith: boolean;\n\n /** Name of the data object. Default `it` */\n varName: string;\n\n /** Directory that contains templates */\n views?: string;\n\n /** Control template file extension defaults. Default `.eta` */\n defaultExtension?: string;\n}\n\n/* END TYPES */\n\n/** Eta's base (global) configuration */\nconst defaultConfig: EtaConfig = {\n autoEscape: true,\n autoFilter: false,\n autoTrim: [false, \"nl\"],\n cache: false,\n cacheFilepaths: true,\n debug: false,\n escapeFunction: XMLEscape,\n // default filter function (not used unless enables) just stringifies the input\n filterFunction: (val) => String(val),\n outputFunctionName: \"output\",\n functionHeader: \"\",\n parse: {\n exec: \"\",\n interpolate: \"=\",\n raw: \"~\",\n },\n plugins: [],\n rmWhitespace: false,\n tags: [\"<%\", \"%>\"],\n useWith: false,\n varName: \"it\",\n defaultExtension: \".eta\",\n};\n\nexport { defaultConfig };\n","import { ParseErr } from \"./err.ts\";\nimport type { Eta } from \"./internal.ts\";\nimport { trimWS } from \"./utils.ts\";\n\nexport type TagType = \"r\" | \"e\" | \"i\" | \"\";\n\nexport interface TemplateObject {\n t: TagType;\n val: string;\n lineNo?: number;\n}\n\nexport type AstObject = string | TemplateObject;\n\n/* END TYPES */\n\nconst templateLitReg =\n /`(?:\\\\[\\s\\S]|\\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\\${)[^\\\\`])*`/g;\n\nconst singleQuoteReg = /'(?:\\\\[\\s\\w\"'\\\\`]|[^\\n\\r'\\\\])*?'/g;\n\nconst doubleQuoteReg = /\"(?:\\\\[\\s\\w\"'\\\\`]|[^\\n\\r\"\\\\])*?\"/g;\n\n/** Escape special regular expression characters inside a string */\n\nfunction escapeRegExp(string: string) {\n // From MDN\n return string.replace(/[.*+\\-?^${}()|[\\]\\\\]/g, \"\\\\$&\"); // $& means the whole matched string\n}\n\nfunction getLineNo(str: string, index: number) {\n return str.slice(0, index).split(\"\\n\").length;\n}\n\nexport function parse(this: Eta, str: string): Array<AstObject> {\n const config = this.config;\n\n let buffer: Array<AstObject> = [];\n let trimLeftOfNextStr: string | false = false;\n let lastIndex = 0;\n const parseOptions = config.parse;\n\n if (config.plugins) {\n for (let i = 0; i < config.plugins.length; i++) {\n const plugin = config.plugins[i];\n if (plugin.processTemplate) {\n str = plugin.processTemplate(str, config);\n }\n }\n }\n\n /* Adding for EJS compatibility */\n if (config.rmWhitespace) {\n // Code taken directly from EJS\n // Have to use two separate replaces here as `^` and `$` operators don't\n // work well with `\\r` and empty lines don't work well with the `m` flag.\n // Essentially, this replaces the whitespace at the beginning and end of\n // each line and removes multiple newlines.\n str = str.replace(/[\\r\\n]+/g, \"\\n\").replace(/^\\s+|\\s+$/gm, \"\");\n }\n /* End rmWhitespace option */\n\n templateLitReg.lastIndex = 0;\n singleQuoteReg.lastIndex = 0;\n doubleQuoteReg.lastIndex = 0;\n\n function pushString(strng: string, shouldTrimRightOfString?: string | false) {\n if (strng) {\n // if string is truthy it must be of type 'string'\n\n strng = trimWS(\n strng,\n config,\n trimLeftOfNextStr, // this will only be false on the first str, the next ones will be null or undefined\n shouldTrimRightOfString,\n );\n\n if (strng) {\n // replace \\ with \\\\, ' with \\'\n // we're going to convert all CRLF to LF so it doesn't take more than one replace\n\n strng = strng.replace(/\\\\|'/g, \"\\\\$&\").replace(/\\r\\n|\\n|\\r/g, \"\\\\n\");\n\n buffer.push(strng);\n }\n }\n }\n\n const prefixes = [\n parseOptions.exec,\n parseOptions.interpolate,\n parseOptions.raw,\n ].reduce((accumulator, prefix) => {\n if (accumulator && prefix) {\n return accumulator + \"|\" + escapeRegExp(prefix);\n } else if (prefix) {\n // accumulator is falsy\n return escapeRegExp(prefix);\n } else {\n // prefix and accumulator are both falsy\n return accumulator;\n }\n }, \"\");\n\n const parseOpenReg = new RegExp(\n escapeRegExp(config.tags[0]) + \"(-|_)?\\\\s*(\" + prefixes + \")?\\\\s*\",\n \"g\",\n );\n\n const parseCloseReg = new RegExp(\n \"'|\\\"|`|\\\\/\\\\*|(\\\\s*(-|_)?\" + escapeRegExp(config.tags[1]) + \")\",\n \"g\",\n );\n\n let m: RegExpExecArray | null;\n\n // biome-ignore lint/suspicious/noAssignInExpressions: this is performant\n while ((m = parseOpenReg.exec(str))) {\n const precedingString = str.slice(lastIndex, m.index);\n\n lastIndex = m[0].length + m.index;\n\n const wsLeft = m[1];\n const prefix = m[2] || \"\"; // by default either ~, =, or empty\n\n pushString(precedingString, wsLeft);\n\n parseCloseReg.lastIndex = lastIndex;\n let closeTag: RegExpExecArray | null;\n let currentObj: AstObject | false = false;\n\n // biome-ignore lint/suspicious/noAssignInExpressions: this is performant\n while ((closeTag = parseCloseReg.exec(str))) {\n if (closeTag[1]) {\n const content = str.slice(lastIndex, closeTag.index);\n\n parseOpenReg.lastIndex = lastIndex = parseCloseReg.lastIndex;\n\n trimLeftOfNextStr = closeTag[2];\n\n const currentType: TagType =\n prefix === parseOptions.exec\n ? \"e\"\n : prefix === parseOptions.raw\n ? \"r\"\n : prefix === parseOptions.interpolate\n ? \"i\"\n : \"\";\n\n currentObj = { t: currentType, val: content };\n break;\n } else {\n const char = closeTag[0];\n if (char === \"/*\") {\n const commentCloseInd = str.indexOf(\"*/\", parseCloseReg.lastIndex);\n\n if (commentCloseInd === -1) {\n ParseErr(\"unclosed comment\", str, closeTag.index);\n }\n parseCloseReg.lastIndex = commentCloseInd;\n } else if (char === \"'\") {\n singleQuoteReg.lastIndex = closeTag.index;\n\n const singleQuoteMatch = singleQuoteReg.exec(str);\n if (singleQuoteMatch) {\n parseCloseReg.lastIndex = singleQuoteReg.lastIndex;\n } else {\n ParseErr(\"unclosed string\", str, closeTag.index);\n }\n } else if (char === '\"') {\n doubleQuoteReg.lastIndex = closeTag.index;\n const doubleQuoteMatch = doubleQuoteReg.exec(str);\n\n if (doubleQuoteMatch) {\n parseCloseReg.lastIndex = doubleQuoteReg.lastIndex;\n } else {\n ParseErr(\"unclosed string\", str, closeTag.index);\n }\n } else if (char === \"`\") {\n templateLitReg.lastIndex = closeTag.index;\n const templateLitMatch = templateLitReg.exec(str);\n if (templateLitMatch) {\n parseCloseReg.lastIndex = templateLitReg.lastIndex;\n } else {\n ParseErr(\"unclosed string\", str, closeTag.index);\n }\n }\n }\n }\n if (currentObj) {\n if (config.debug) {\n currentObj.lineNo = getLineNo(str, m.index);\n }\n buffer.push(currentObj);\n } else {\n ParseErr(\"unclosed tag\", str, m.index);\n }\n }\n\n pushString(str.slice(lastIndex, str.length), false);\n\n if (config.plugins) {\n for (let i = 0; i < config.plugins.length; i++) {\n const plugin = config.plugins[i];\n if (plugin.processAST) {\n buffer = plugin.processAST(buffer, config);\n }\n }\n }\n\n return buffer;\n}\n","import type { TemplateFunction } from \"./compile.ts\";\n\n/* TYPES */\nimport type { Options } from \"./config.ts\";\nimport { EtaNameResolutionError } from \"./err.ts\";\nimport type { Eta } from \"./internal.ts\";\n\n/* END TYPES */\n\nfunction handleCache(\n this: Eta,\n template: string,\n options: Partial<Options>,\n): TemplateFunction {\n const templateStore = options?.async\n ? this.templatesAsync\n : this.templatesSync;\n\n if (this.resolvePath && this.readFile && !template.startsWith(\"@\")) {\n const templatePath = options.filepath as string;\n\n const cachedTemplate = templateStore.get(templatePath);\n\n if (this.config.cache && cachedTemplate) {\n return cachedTemplate;\n } else {\n const templateString = this.readFile(templatePath);\n\n const templateFn = this.compile(templateString, options);\n\n if (this.config.cache) templateStore.define(templatePath, templateFn);\n\n return templateFn;\n }\n } else {\n const cachedTemplate = templateStore.get(template);\n\n if (cachedTemplate) {\n return cachedTemplate;\n } else {\n throw new EtaNameResolutionError(`Failed to get template '${template}'`);\n }\n }\n}\n\nexport function render<T extends object>(\n this: Eta,\n template: string | TemplateFunction, // template name or template function\n data: T,\n meta?: { filepath: string },\n): string {\n let templateFn: TemplateFunction;\n const options = { ...meta, async: false };\n\n if (typeof template === \"string\") {\n if (this.resolvePath && this.readFile && !template.startsWith(\"@\")) {\n options.filepath = this.resolvePath(template, options);\n }\n\n templateFn = handleCache.call(this, template, options);\n } else {\n templateFn = template;\n }\n\n const res = templateFn.call(this, data, options);\n\n return res;\n}\n\nexport function renderAsync<T extends object>(\n this: Eta,\n template: string | TemplateFunction, // template name or template function\n data: T,\n meta?: { filepath: string },\n): Promise<string> {\n let templateFn: TemplateFunction;\n const options = { ...meta, async: true };\n\n if (typeof template === \"string\") {\n if (this.resolvePath && this.readFile && !template.startsWith(\"@\")) {\n options.filepath = this.resolvePath(template, options);\n }\n\n templateFn = handleCache.call(this, template, options);\n } else {\n templateFn = template;\n }\n\n const res = templateFn.call(this, data, options);\n\n // Return a promise\n return Promise.resolve(res);\n}\n\nexport function renderString<T extends object>(\n this: Eta,\n template: string,\n data: T,\n): string {\n const templateFn = this.compile(template, { async: false });\n\n return render.call(this, templateFn, data);\n}\n\nexport function renderStringAsync<T extends object>(\n this: Eta,\n template: string,\n data: T,\n): Promise<string> {\n const templateFn = this.compile(template, { async: true });\n\n return renderAsync.call(this, templateFn, data);\n}\n","/**\n * Handles storage and accessing of values\n *\n * In this case, we use it to store compiled template functions\n * Indexed by their `name` or `filename`\n */\n\nexport class Cacher<T> {\n constructor(private cache: Record<string, T>) {}\n define(key: string, val: T): void {\n this.cache[key] = val;\n }\n get(key: string): T {\n return this.cache[key];\n }\n remove(key: string): void {\n delete this.cache[key];\n }\n reset(): void {\n this.cache = {};\n }\n load(cacheObj: Record<string, T>): void {\n this.cache = { ...this.cache, ...cacheObj };\n }\n}\n","import type { TemplateFunction } from \"./compile.ts\";\nimport { compile } from \"./compile.ts\";\nimport { compileBody, compileToString } from \"./compile-string.ts\";\nimport type { EtaConfig, Options } from \"./config.ts\";\nimport { defaultConfig } from \"./config.ts\";\nimport { EtaError, RuntimeErr } from \"./err.ts\";\nimport { parse } from \"./parse.ts\";\nimport {\n render,\n renderAsync,\n renderString,\n renderStringAsync,\n} from \"./render.ts\";\nimport { Cacher } from \"./storage.ts\";\n\nexport class Eta {\n constructor(customConfig?: Partial<EtaConfig>) {\n if (customConfig) {\n this.config = { ...defaultConfig, ...customConfig };\n } else {\n this.config = { ...defaultConfig };\n }\n }\n\n config: EtaConfig;\n\n RuntimeErr = RuntimeErr;\n\n compile = compile;\n compileToString = compileToString;\n compileBody = compileBody;\n parse = parse;\n render = render;\n renderAsync = renderAsync;\n renderString = renderString;\n renderStringAsync = renderStringAsync;\n\n filepathCache: Record<string, string> = {};\n templatesSync: Cacher<TemplateFunction> = new Cacher<TemplateFunction>({});\n templatesAsync: Cacher<TemplateFunction> = new Cacher<TemplateFunction>({});\n\n // resolvePath takes a relative path from the \"views\" directory\n resolvePath:\n | null\n | ((this: Eta, template: string, options?: Partial<Options>) => string) =\n null;\n readFile: null | ((this: Eta, path: string) => string) = null;\n\n // METHODS\n\n configure(customConfig: Partial<EtaConfig>) {\n this.config = { ...this.config, ...customConfig };\n }\n\n withConfig(customConfig: Partial<EtaConfig>): this & { config: EtaConfig } {\n return { ...this, config: { ...this.config, ...customConfig } };\n }\n\n loadTemplate(\n name: string,\n template: string | TemplateFunction, // template string or template function\n options?: { async: boolean },\n ): void {\n if (typeof template === \"string\") {\n const templates = options?.async\n ? this.templatesAsync\n : this.templatesSync;\n\n templates.define(name, this.compile(template, options));\n } else {\n let templates = this.templatesSync;\n\n if (template.constructor.name === \"AsyncFunction\" || options?.async) {\n templates = this.templatesAsync;\n }\n\n templates.define(name, template);\n }\n }\n}\n\n// for instance checking against thrown errors\nexport { EtaError };\n","import { readFile, resolvePath } from \"./file-handling.ts\";\nimport { Eta as EtaCore } from \"./internal.ts\";\n\nexport type { TemplateFunction } from \"./compile.ts\";\nexport type { EtaConfig, Options } from \"./config.ts\";\nexport {\n EtaError,\n EtaFileResolutionError,\n EtaNameResolutionError,\n EtaParseError,\n EtaRuntimeError,\n} from \"./err.ts\";\n\nexport class Eta extends EtaCore {\n readFile = readFile;\n\n resolvePath = resolvePath;\n}\n"],"mappings":";;;;AAAA,IAAa,WAAb,cAA8B,MAAM;CAClC,YAAY,SAAiB;AAC3B,QAAM,QAAQ;AACd,OAAK,OAAO;;;AAIhB,IAAa,gBAAb,cAAmC,SAAS;CAC1C,YAAY,SAAiB;AAC3B,QAAM,QAAQ;AACd,OAAK,OAAO;;;AAIhB,IAAa,kBAAb,cAAqC,SAAS;CAC5C,YAAY,SAAiB;AAC3B,QAAM,QAAQ;AACd,OAAK,OAAO;;;AAIhB,IAAa,yBAAb,cAA4C,SAAS;CACnD,YAAY,SAAiB;AAC3B,QAAM,QAAQ;AACd,OAAK,OAAO;;;AAIhB,IAAa,yBAAb,cAA4C,SAAS;CACnD,YAAY,SAAiB;AAC3B,QAAM,QAAQ;AACd,OAAK,OAAO;;;;;;AAQhB,SAAgB,SAAS,SAAiB,KAAa,MAAqB;CAC1E,MAAM,aAAa,IAAI,MAAM,GAAG,KAAK,CAAC,MAAM,KAAK;CAEjD,MAAM,SAAS,WAAW;CAC1B,MAAM,QAAQ,WAAW,SAAS,GAAG,SAAS;AAC9C,YACE,cACA,SACA,UACA,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B,gBAAwC,EAAE;CAC1C,gBAA0C,IAAI,OAAyB,EAAE,CAAC;CAC1E,iBAA2C,IAAI,OAAyB,EAAE,CAAC;CAG3E,cAGE;CACF,WAAyD;CAIzD,UAAU,cAAkC;AAC1C,OAAK,SAAS;GAAE,GAAG,KAAK;GAAQ,GAAG;GAAc;;CAGnD,WAAW,cAAgE;AACzE,SAAO;GAAE,GAAG;GAAM,QAAQ;IAAE,GAAG,KAAK;IAAQ,GAAG;IAAc;GAAE;;CAGjE,aACE,MACA,UACA,SACM;AACN,MAAI,OAAO,aAAa,SAKtB,EAJkB,SAAS,QACvB,KAAK,iBACL,KAAK,eAEC,OAAO,MAAM,KAAK,QAAQ,UAAU,QAAQ,CAAC;OAClD;GACL,IAAI,YAAY,KAAK;AAErB,OAAI,SAAS,YAAY,SAAS,mBAAmB,SAAS,MAC5D,aAAY,KAAK;AAGnB,aAAU,OAAO,MAAM,SAAS;;;;;;;AC/DtC,IAAa,MAAb,cAAyBC,MAAQ;CAC/B,WAAW;CAEX,cAAc"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "eta",
|
|
3
|
+
"version": "4.5.1",
|
|
4
|
+
"description": "Lightweight, fast, and powerful embedded JS template engine",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"handlebars",
|
|
7
|
+
"ejs",
|
|
8
|
+
"eta",
|
|
9
|
+
"template engine",
|
|
10
|
+
"embedded template engine",
|
|
11
|
+
"layouts",
|
|
12
|
+
"partials",
|
|
13
|
+
"typescript types"
|
|
14
|
+
],
|
|
15
|
+
"homepage": "https://eta.js.org",
|
|
16
|
+
"type": "module",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": {
|
|
20
|
+
"import": "./dist/index.d.mts",
|
|
21
|
+
"require": "./dist/index.d.cts"
|
|
22
|
+
},
|
|
23
|
+
"import": "./dist/index.mjs",
|
|
24
|
+
"require": "./dist/index.cjs"
|
|
25
|
+
},
|
|
26
|
+
"./core": {
|
|
27
|
+
"require": "./dist/core.js",
|
|
28
|
+
"import": "./dist/core.js",
|
|
29
|
+
"types": "./dist/core.d.ts"
|
|
30
|
+
},
|
|
31
|
+
"./package.json": "./package.json"
|
|
32
|
+
},
|
|
33
|
+
"main": "./dist/index.cjs",
|
|
34
|
+
"module": "./dist/index.mjs",
|
|
35
|
+
"types": "./dist/index.d.mts",
|
|
36
|
+
"sideEffects": false,
|
|
37
|
+
"files": [
|
|
38
|
+
"dist"
|
|
39
|
+
],
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "tsdown",
|
|
42
|
+
"prepare": "npm run build",
|
|
43
|
+
"dev": "tsdown --watch",
|
|
44
|
+
"lint": "biome check --error-on-warnings",
|
|
45
|
+
"format": "biome format --write",
|
|
46
|
+
"test": "vitest run --coverage",
|
|
47
|
+
"size": "size-limit"
|
|
48
|
+
},
|
|
49
|
+
"author": "Ben Gubler <nebrelbug@gmail.com>",
|
|
50
|
+
"funding": "https://github.com/bgub/eta?sponsor=1",
|
|
51
|
+
"repository": "github:bgub/eta",
|
|
52
|
+
"bugs": {
|
|
53
|
+
"url": "https://github.com/bgub/eta/issues"
|
|
54
|
+
},
|
|
55
|
+
"license": "MIT",
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": ">=20"
|
|
58
|
+
},
|
|
59
|
+
"size-limit": [
|
|
60
|
+
{
|
|
61
|
+
"path": "dist/core.js",
|
|
62
|
+
"limit": "3.5 KB"
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"@biomejs/biome": "2.3.5",
|
|
67
|
+
"@size-limit/preset-small-lib": "^11.2.0",
|
|
68
|
+
"@types/node": "^24.10.1",
|
|
69
|
+
"@vitest/coverage-istanbul": "4.0.8",
|
|
70
|
+
"size-limit": "^11.2.0",
|
|
71
|
+
"tsdown": "^0.16.4",
|
|
72
|
+
"typescript": "^5.9.3",
|
|
73
|
+
"vitest": "^4.0.8"
|
|
74
|
+
}
|
|
75
|
+
}
|