diff --git a/.changeset/slimy-ravens-visit.md b/.changeset/slimy-ravens-visit.md new file mode 100644 index 0000000..da16f96 --- /dev/null +++ b/.changeset/slimy-ravens-visit.md @@ -0,0 +1,5 @@ +--- +'@finsweet/ts-utils': minor +--- + +feat: added optional `page` argument to `getSiteId` and `getPublishDate`. diff --git a/package.json b/package.json index da61c4d..75d0431 100644 --- a/package.json +++ b/package.json @@ -42,13 +42,13 @@ "devDependencies": { "@changesets/changelog-git": "^0.1.14", "@changesets/cli": "^2.26.0", - "@finsweet/eslint-config": "^2.0.0", - "@typescript-eslint/eslint-plugin": "^5.48.1", - "@typescript-eslint/parser": "^5.48.1", - "eslint": "^8.31.0", + "@finsweet/eslint-config": "^2.0.2", + "@typescript-eslint/eslint-plugin": "^5.52.0", + "@typescript-eslint/parser": "^5.52.0", + "eslint": "^8.34.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-prettier": "^4.2.1", - "prettier": "^2.8.2", - "typescript": "^4.9.4" + "prettier": "^2.8.4", + "typescript": "^4.9.5" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 42ced9a..7e91793 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3,26 +3,26 @@ lockfileVersion: 5.4 specifiers: '@changesets/changelog-git': ^0.1.14 '@changesets/cli': ^2.26.0 - '@finsweet/eslint-config': ^2.0.0 - '@typescript-eslint/eslint-plugin': ^5.48.1 - '@typescript-eslint/parser': ^5.48.1 - eslint: ^8.31.0 + '@finsweet/eslint-config': ^2.0.2 + '@typescript-eslint/eslint-plugin': ^5.52.0 + '@typescript-eslint/parser': ^5.52.0 + eslint: ^8.34.0 eslint-config-prettier: ^8.6.0 eslint-plugin-prettier: ^4.2.1 - prettier: ^2.8.2 - typescript: ^4.9.4 + prettier: ^2.8.4 + typescript: ^4.9.5 devDependencies: '@changesets/changelog-git': 0.1.14 '@changesets/cli': 2.26.0 - '@finsweet/eslint-config': 2.0.0_puoiliissvzurc6i5kvdxsghbu - '@typescript-eslint/eslint-plugin': 5.48.1_3jon24igvnqaqexgwtxk6nkpse - '@typescript-eslint/parser': 5.48.1_iukboom6ndih5an6iafl45j2fe - eslint: 8.31.0 - eslint-config-prettier: 8.6.0_eslint@8.31.0 - eslint-plugin-prettier: 4.2.1_iu5s7nk6dw7o3tajefwfiqfmge - prettier: 2.8.2 - typescript: 4.9.4 + '@finsweet/eslint-config': 2.0.2_452f3vq3q5carmqkss343wngoa + '@typescript-eslint/eslint-plugin': 5.52.0_6cfvjsbua5ptj65675bqcn6oza + '@typescript-eslint/parser': 5.52.0_7kw3g6rralp5ps6mg3uyzz6azm + eslint: 8.34.0 + eslint-config-prettier: 8.6.0_eslint@8.34.0 + eslint-plugin-prettier: 4.2.1_u5wnrdwibbfomslmnramz52buy + prettier: 2.8.4 + typescript: 4.9.5 packages: @@ -67,7 +67,7 @@ packages: fs-extra: 7.0.1 lodash.startcase: 4.4.0 outdent: 0.5.0 - prettier: 2.8.2 + prettier: 2.8.4 resolve-from: 5.0.0 semver: 5.7.1 dev: true @@ -235,7 +235,7 @@ packages: '@changesets/types': 5.2.1 fs-extra: 7.0.1 human-id: 1.0.2 - prettier: 2.8.2 + prettier: 2.8.4 dev: true /@eslint/eslintrc/1.4.1: @@ -245,7 +245,7 @@ packages: ajv: 6.12.6 debug: 4.3.4 espree: 9.4.1 - globals: 13.19.0 + globals: 13.20.0 ignore: 5.2.4 import-fresh: 3.3.0 js-yaml: 4.1.0 @@ -255,26 +255,26 @@ packages: - supports-color dev: true - /@finsweet/eslint-config/2.0.0_puoiliissvzurc6i5kvdxsghbu: - resolution: {integrity: sha512-8zy0E+3nOvdy0v6PSum3uWscWrhQJHp+jlA13wm9S3xhT39TzDKENVmxBZdB3OiY+myg+HSdPTL/XkUUP8KI6A==} + /@finsweet/eslint-config/2.0.2_452f3vq3q5carmqkss343wngoa: + resolution: {integrity: sha512-SsVB8AF8nDbIeSjYxqTJM+yQJeCOzRv9E/ij1kyBo+/BypCHkwPuOC+gRPK0mNNFhdwDmCHLDdxjSaUO2LhluQ==} peerDependencies: - '@typescript-eslint/eslint-plugin': ^5.46.1 - '@typescript-eslint/parser': ^5.46.1 - eslint: ^8.29.0 - eslint-config-prettier: ^8.5.0 + '@typescript-eslint/eslint-plugin': ^5.51.0 + '@typescript-eslint/parser': ^5.51.0 + eslint: ^8.33.0 + eslint-config-prettier: ^8.6.0 eslint-plugin-prettier: ^4.2.1 - eslint-plugin-simple-import-sort: ^8.0.0 - prettier: ^2.8.1 - typescript: ^4.9.4 + eslint-plugin-simple-import-sort: ^10.0.0 + prettier: ^2.8.4 + typescript: ^4.9.5 dependencies: - '@typescript-eslint/eslint-plugin': 5.48.1_3jon24igvnqaqexgwtxk6nkpse - '@typescript-eslint/parser': 5.48.1_iukboom6ndih5an6iafl45j2fe - eslint: 8.31.0 - eslint-config-prettier: 8.6.0_eslint@8.31.0 - eslint-plugin-prettier: 4.2.1_iu5s7nk6dw7o3tajefwfiqfmge - eslint-plugin-simple-import-sort: 8.0.0_eslint@8.31.0 - prettier: 2.8.2 - typescript: 4.9.4 + '@typescript-eslint/eslint-plugin': 5.52.0_6cfvjsbua5ptj65675bqcn6oza + '@typescript-eslint/parser': 5.52.0_7kw3g6rralp5ps6mg3uyzz6azm + eslint: 8.34.0 + eslint-config-prettier: 8.6.0_eslint@8.34.0 + eslint-plugin-prettier: 4.2.1_u5wnrdwibbfomslmnramz52buy + eslint-plugin-simple-import-sort: 10.0.0_eslint@8.34.0 + prettier: 2.8.4 + typescript: 4.9.5 dev: true /@humanwhocodes/config-array/0.11.8: @@ -368,8 +368,8 @@ packages: resolution: {integrity: sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==} dev: true - /@typescript-eslint/eslint-plugin/5.48.1_3jon24igvnqaqexgwtxk6nkpse: - resolution: {integrity: sha512-9nY5K1Rp2ppmpb9s9S2aBiF3xo5uExCehMDmYmmFqqyxgenbHJ3qbarcLt4ITgaD6r/2ypdlcFRdcuVPnks+fQ==} + /@typescript-eslint/eslint-plugin/5.52.0_6cfvjsbua5ptj65675bqcn6oza: + resolution: {integrity: sha512-lHazYdvYVsBokwCdKOppvYJKaJ4S41CgKBcPvyd0xjZNbvQdhn/pnJlGtQksQ/NhInzdaeaSarlBjDXHuclEbg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: '@typescript-eslint/parser': ^5.0.0 @@ -379,24 +379,25 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/parser': 5.48.1_iukboom6ndih5an6iafl45j2fe - '@typescript-eslint/scope-manager': 5.48.1 - '@typescript-eslint/type-utils': 5.48.1_iukboom6ndih5an6iafl45j2fe - '@typescript-eslint/utils': 5.48.1_iukboom6ndih5an6iafl45j2fe + '@typescript-eslint/parser': 5.52.0_7kw3g6rralp5ps6mg3uyzz6azm + '@typescript-eslint/scope-manager': 5.52.0 + '@typescript-eslint/type-utils': 5.52.0_7kw3g6rralp5ps6mg3uyzz6azm + '@typescript-eslint/utils': 5.52.0_7kw3g6rralp5ps6mg3uyzz6azm debug: 4.3.4 - eslint: 8.31.0 + eslint: 8.34.0 + grapheme-splitter: 1.0.4 ignore: 5.2.4 natural-compare-lite: 1.4.0 regexpp: 3.2.0 semver: 7.3.8 - tsutils: 3.21.0_typescript@4.9.4 - typescript: 4.9.4 + tsutils: 3.21.0_typescript@4.9.5 + typescript: 4.9.5 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/parser/5.48.1_iukboom6ndih5an6iafl45j2fe: - resolution: {integrity: sha512-4yg+FJR/V1M9Xoq56SF9Iygqm+r5LMXvheo6DQ7/yUWynQ4YfCRnsKuRgqH4EQ5Ya76rVwlEpw4Xu+TgWQUcdA==} + /@typescript-eslint/parser/5.52.0_7kw3g6rralp5ps6mg3uyzz6azm: + resolution: {integrity: sha512-e2KiLQOZRo4Y0D/b+3y08i3jsekoSkOYStROYmPUnGMEoA0h+k2qOH5H6tcjIc68WDvGwH+PaOrP1XRzLJ6QlA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 @@ -405,26 +406,26 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 5.48.1 - '@typescript-eslint/types': 5.48.1 - '@typescript-eslint/typescript-estree': 5.48.1_typescript@4.9.4 + '@typescript-eslint/scope-manager': 5.52.0 + '@typescript-eslint/types': 5.52.0 + '@typescript-eslint/typescript-estree': 5.52.0_typescript@4.9.5 debug: 4.3.4 - eslint: 8.31.0 - typescript: 4.9.4 + eslint: 8.34.0 + typescript: 4.9.5 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/scope-manager/5.48.1: - resolution: {integrity: sha512-S035ueRrbxRMKvSTv9vJKIWgr86BD8s3RqoRZmsSh/s8HhIs90g6UlK8ZabUSjUZQkhVxt7nmZ63VJ9dcZhtDQ==} + /@typescript-eslint/scope-manager/5.52.0: + resolution: {integrity: sha512-AR7sxxfBKiNV0FWBSARxM8DmNxrwgnYMPwmpkC1Pl1n+eT8/I2NAUPuwDy/FmDcC6F8pBfmOcaxcxRHspgOBMw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.48.1 - '@typescript-eslint/visitor-keys': 5.48.1 + '@typescript-eslint/types': 5.52.0 + '@typescript-eslint/visitor-keys': 5.52.0 dev: true - /@typescript-eslint/type-utils/5.48.1_iukboom6ndih5an6iafl45j2fe: - resolution: {integrity: sha512-Hyr8HU8Alcuva1ppmqSYtM/Gp0q4JOp1F+/JH5D1IZm/bUBrV0edoewQZiEc1r6I8L4JL21broddxK8HAcZiqQ==} + /@typescript-eslint/type-utils/5.52.0_7kw3g6rralp5ps6mg3uyzz6azm: + resolution: {integrity: sha512-tEKuUHfDOv852QGlpPtB3lHOoig5pyFQN/cUiZtpw99D93nEBjexRLre5sQZlkMoHry/lZr8qDAt2oAHLKA6Jw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: '*' @@ -433,23 +434,23 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 5.48.1_typescript@4.9.4 - '@typescript-eslint/utils': 5.48.1_iukboom6ndih5an6iafl45j2fe + '@typescript-eslint/typescript-estree': 5.52.0_typescript@4.9.5 + '@typescript-eslint/utils': 5.52.0_7kw3g6rralp5ps6mg3uyzz6azm debug: 4.3.4 - eslint: 8.31.0 - tsutils: 3.21.0_typescript@4.9.4 - typescript: 4.9.4 + eslint: 8.34.0 + tsutils: 3.21.0_typescript@4.9.5 + typescript: 4.9.5 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/types/5.48.1: - resolution: {integrity: sha512-xHyDLU6MSuEEdIlzrrAerCGS3T7AA/L8Hggd0RCYBi0w3JMvGYxlLlXHeg50JI9Tfg5MrtsfuNxbS/3zF1/ATg==} + /@typescript-eslint/types/5.52.0: + resolution: {integrity: sha512-oV7XU4CHYfBhk78fS7tkum+/Dpgsfi91IIDy7fjCyq2k6KB63M6gMC0YIvy+iABzmXThCRI6xpCEyVObBdWSDQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@typescript-eslint/typescript-estree/5.48.1_typescript@4.9.4: - resolution: {integrity: sha512-Hut+Osk5FYr+sgFh8J/FHjqX6HFcDzTlWLrFqGoK5kVUN3VBHF/QzZmAsIXCQ8T/W9nQNBTqalxi1P3LSqWnRA==} + /@typescript-eslint/typescript-estree/5.52.0_typescript@4.9.5: + resolution: {integrity: sha512-WeWnjanyEwt6+fVrSR0MYgEpUAuROxuAH516WPjUblIrClzYJj0kBbjdnbQXLpgAN8qbEuGywiQsXUVDiAoEuQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: typescript: '*' @@ -457,56 +458,56 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 5.48.1 - '@typescript-eslint/visitor-keys': 5.48.1 + '@typescript-eslint/types': 5.52.0 + '@typescript-eslint/visitor-keys': 5.52.0 debug: 4.3.4 globby: 11.1.0 is-glob: 4.0.3 semver: 7.3.8 - tsutils: 3.21.0_typescript@4.9.4 - typescript: 4.9.4 + tsutils: 3.21.0_typescript@4.9.5 + typescript: 4.9.5 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/utils/5.48.1_iukboom6ndih5an6iafl45j2fe: - resolution: {integrity: sha512-SmQuSrCGUOdmGMwivW14Z0Lj8dxG1mOFZ7soeJ0TQZEJcs3n5Ndgkg0A4bcMFzBELqLJ6GTHnEU+iIoaD6hFGA==} + /@typescript-eslint/utils/5.52.0_7kw3g6rralp5ps6mg3uyzz6azm: + resolution: {integrity: sha512-As3lChhrbwWQLNk2HC8Ree96hldKIqk98EYvypd3It8Q1f8d5zWyIoaZEp2va5667M4ZyE7X8UUR+azXrFl+NA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: '@types/json-schema': 7.0.11 '@types/semver': 7.3.13 - '@typescript-eslint/scope-manager': 5.48.1 - '@typescript-eslint/types': 5.48.1 - '@typescript-eslint/typescript-estree': 5.48.1_typescript@4.9.4 - eslint: 8.31.0 + '@typescript-eslint/scope-manager': 5.52.0 + '@typescript-eslint/types': 5.52.0 + '@typescript-eslint/typescript-estree': 5.52.0_typescript@4.9.5 + eslint: 8.34.0 eslint-scope: 5.1.1 - eslint-utils: 3.0.0_eslint@8.31.0 + eslint-utils: 3.0.0_eslint@8.34.0 semver: 7.3.8 transitivePeerDependencies: - supports-color - typescript dev: true - /@typescript-eslint/visitor-keys/5.48.1: - resolution: {integrity: sha512-Ns0XBwmfuX7ZknznfXozgnydyR8F6ev/KEGePP4i74uL3ArsKbEhJ7raeKr1JSa997DBDwol/4a0Y+At82c9dA==} + /@typescript-eslint/visitor-keys/5.52.0: + resolution: {integrity: sha512-qMwpw6SU5VHCPr99y274xhbm+PRViK/NATY6qzt+Et7+mThGuFSl/ompj2/hrBlRP/kq+BFdgagnOSgw9TB0eA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.48.1 + '@typescript-eslint/types': 5.52.0 eslint-visitor-keys: 3.3.0 dev: true - /acorn-jsx/5.3.2_acorn@8.8.1: + /acorn-jsx/5.3.2_acorn@8.8.2: resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: - acorn: 8.8.1 + acorn: 8.8.2 dev: true - /acorn/8.8.1: - resolution: {integrity: sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==} + /acorn/8.8.2: + resolution: {integrity: sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==} engines: {node: '>=0.4.0'} hasBin: true dev: true @@ -905,16 +906,16 @@ packages: engines: {node: '>=10'} dev: true - /eslint-config-prettier/8.6.0_eslint@8.31.0: + /eslint-config-prettier/8.6.0_eslint@8.34.0: resolution: {integrity: sha512-bAF0eLpLVqP5oEVUFKpMA+NnRFICwn9X8B5jrR9FcqnYBuPbqWEjTEspPWMj5ye6czoSLDweCzSo3Ko7gGrZaA==} hasBin: true peerDependencies: eslint: '>=7.0.0' dependencies: - eslint: 8.31.0 + eslint: 8.34.0 dev: true - /eslint-plugin-prettier/4.2.1_iu5s7nk6dw7o3tajefwfiqfmge: + /eslint-plugin-prettier/4.2.1_u5wnrdwibbfomslmnramz52buy: resolution: {integrity: sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==} engines: {node: '>=12.0.0'} peerDependencies: @@ -925,18 +926,18 @@ packages: eslint-config-prettier: optional: true dependencies: - eslint: 8.31.0 - eslint-config-prettier: 8.6.0_eslint@8.31.0 - prettier: 2.8.2 + eslint: 8.34.0 + eslint-config-prettier: 8.6.0_eslint@8.34.0 + prettier: 2.8.4 prettier-linter-helpers: 1.0.0 dev: true - /eslint-plugin-simple-import-sort/8.0.0_eslint@8.31.0: - resolution: {integrity: sha512-bXgJQ+lqhtQBCuWY/FUWdB27j4+lqcvXv5rUARkzbeWLwea+S5eBZEQrhnO+WgX3ZoJHVj0cn943iyXwByHHQw==} + /eslint-plugin-simple-import-sort/10.0.0_eslint@8.34.0: + resolution: {integrity: sha512-AeTvO9UCMSNzIHRkg8S6c3RPy5YEwKWSQPx3DYghLedo2ZQxowPFLGDN1AZ2evfg6r6mjBSZSLxLFsWSu3acsw==} peerDependencies: eslint: '>=5.0.0' dependencies: - eslint: 8.31.0 + eslint: 8.34.0 dev: true /eslint-scope/5.1.1: @@ -955,13 +956,13 @@ packages: estraverse: 5.3.0 dev: true - /eslint-utils/3.0.0_eslint@8.31.0: + /eslint-utils/3.0.0_eslint@8.34.0: resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==} engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0} peerDependencies: eslint: '>=5' dependencies: - eslint: 8.31.0 + eslint: 8.34.0 eslint-visitor-keys: 2.1.0 dev: true @@ -975,8 +976,8 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /eslint/8.31.0: - resolution: {integrity: sha512-0tQQEVdmPZ1UtUKXjX7EMm9BlgJ08G90IhWh0PKDCb3ZLsgAOHI8fYSIzYVZej92zsgq+ft0FGsxhJ3xo2tbuA==} + /eslint/8.34.0: + resolution: {integrity: sha512-1Z8iFsucw+7kSqXNZVslXS8Ioa4u2KM7GPwuKtkTFAqZ/cHMcEaR+1+Br0wLlot49cNxIiZk5wp8EAbPcYZxTg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} hasBin: true dependencies: @@ -991,23 +992,23 @@ packages: doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.1.1 - eslint-utils: 3.0.0_eslint@8.31.0 + eslint-utils: 3.0.0_eslint@8.34.0 eslint-visitor-keys: 3.3.0 espree: 9.4.1 - esquery: 1.4.0 + esquery: 1.4.2 esutils: 2.0.3 fast-deep-equal: 3.1.3 file-entry-cache: 6.0.1 find-up: 5.0.0 glob-parent: 6.0.2 - globals: 13.19.0 + globals: 13.20.0 grapheme-splitter: 1.0.4 ignore: 5.2.4 import-fresh: 3.3.0 imurmurhash: 0.1.4 is-glob: 4.0.3 is-path-inside: 3.0.3 - js-sdsl: 4.2.0 + js-sdsl: 4.3.0 js-yaml: 4.1.0 json-stable-stringify-without-jsonify: 1.0.1 levn: 0.4.1 @@ -1027,8 +1028,8 @@ packages: resolution: {integrity: sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - acorn: 8.8.1 - acorn-jsx: 5.3.2_acorn@8.8.1 + acorn: 8.8.2 + acorn-jsx: 5.3.2_acorn@8.8.2 eslint-visitor-keys: 3.3.0 dev: true @@ -1038,8 +1039,8 @@ packages: hasBin: true dev: true - /esquery/1.4.0: - resolution: {integrity: sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==} + /esquery/1.4.2: + resolution: {integrity: sha512-JVSoLdTlTDkmjFmab7H/9SL9qGSyjElT3myyKp7krqjVFQCDLmj1QFaCLRFBszBKI0XVZaiiXvuPIX3ZwHe1Ng==} engines: {node: '>=0.10'} dependencies: estraverse: 5.3.0 @@ -1254,8 +1255,8 @@ packages: path-is-absolute: 1.0.1 dev: true - /globals/13.19.0: - resolution: {integrity: sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ==} + /globals/13.20.0: + resolution: {integrity: sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==} engines: {node: '>=8'} dependencies: type-fest: 0.20.2 @@ -1557,8 +1558,8 @@ packages: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} dev: true - /js-sdsl/4.2.0: - resolution: {integrity: sha512-dyBIzQBDkCqCu+0upx25Y2jGdbTGxE9fshMsCdK0ViOongpV+n5tXRcZY9v7CaVQ79AGS9KA1KHtojxiM7aXSQ==} + /js-sdsl/4.3.0: + resolution: {integrity: sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ==} dev: true /js-tokens/4.0.0: @@ -1923,8 +1924,8 @@ packages: fast-diff: 1.2.0 dev: true - /prettier/2.8.2: - resolution: {integrity: sha512-BtRV9BcncDyI2tsuS19zzhzoxD8Dh8LiCx7j7tHzrkz8GFXAexeWFdi22mjE1d16dftH2qNaytVxqiRTGlMfpw==} + /prettier/2.8.4: + resolution: {integrity: sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==} engines: {node: '>=10.13.0'} hasBin: true dev: true @@ -1933,8 +1934,8 @@ packages: resolution: {integrity: sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==} dev: true - /punycode/2.2.0: - resolution: {integrity: sha512-LN6QV1IJ9ZhxWTNdktaPClrNfp8xdSAYS0Zk2ddX7XsXZAxckMHPCBcHRo0cTcEIgYPRiGEkmji3Idkh2yFtYw==} + /punycode/2.3.0: + resolution: {integrity: sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==} engines: {node: '>=6'} dev: true @@ -2270,14 +2271,14 @@ packages: resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} dev: true - /tsutils/3.21.0_typescript@4.9.4: + /tsutils/3.21.0_typescript@4.9.5: resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} engines: {node: '>= 6'} peerDependencies: typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' dependencies: tslib: 1.14.1 - typescript: 4.9.4 + typescript: 4.9.5 dev: true /tty-table/4.1.6: @@ -2329,8 +2330,8 @@ packages: is-typed-array: 1.1.10 dev: true - /typescript/4.9.4: - resolution: {integrity: sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==} + /typescript/4.9.5: + resolution: {integrity: sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==} engines: {node: '>=4.2.0'} hasBin: true dev: true @@ -2352,7 +2353,7 @@ packages: /uri-js/4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} dependencies: - punycode: 2.2.0 + punycode: 2.3.0 dev: true /validate-npm-package-license/3.0.4: diff --git a/src/webflow/getPublishDate.ts b/src/webflow/getPublishDate.ts index 5ee3a61..8ff192f 100644 --- a/src/webflow/getPublishDate.ts +++ b/src/webflow/getPublishDate.ts @@ -1,11 +1,12 @@ /** * Extracts the publish date of a Webflow site - * @returns A Date object, if found + * @returns A Date object, if found. + * @param page The page to get the publish date from. Defaults to the current page. */ -export const getPublishDate = (): Date | undefined => { +export const getPublishDate = (page = document): Date | undefined => { const publishDatePrefix = 'Last Published:'; - for (const node of document.childNodes) { + for (const node of page.childNodes) { if (node.nodeType === Node.COMMENT_NODE && node.textContent?.includes(publishDatePrefix)) { const publishDateValue = node.textContent.trim().split(publishDatePrefix)[1]; if (publishDateValue) return new Date(publishDateValue); diff --git a/src/webflow/getSiteId.ts b/src/webflow/getSiteId.ts index 90444ce..f8a04a5 100644 --- a/src/webflow/getSiteId.ts +++ b/src/webflow/getSiteId.ts @@ -1,4 +1,5 @@ /** - * @returns The Webflow Site ID of the website + * @returns The Webflow Site ID of the website. + * @param page The page to get the site ID from. Defaults to the current page. */ -export const getSiteId = (): string | null => document.documentElement.getAttribute('data-wf-site'); +export const getSiteId = (page = document): string | null => page.documentElement.getAttribute('data-wf-site');