Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Maximum call stack size exceeded の修正の取り込み #2

Open
wants to merge 131 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
131 commits
Select commit Hold shift + click to select a range
dd0f090
chore: fix typo
azu Apr 29, 2024
5280979
add: 新規フィード追加
azu Apr 30, 2024
7fc51d0
build(deps): bump ejs from 3.1.9 to 3.1.10
dependabot[bot] May 2, 2024
d8d7732
add: 新規フィード追加
azu May 3, 2024
16bc150
Merge pull request #99 from azu/fix-typo
yamadashy May 3, 2024
f7d538b
Merge pull request #100 from azu/2024-04-30-add-feeds
yamadashy May 3, 2024
b7e7a20
Merge pull request #101 from yamadashy/dependabot/npm_and_yarn/ejs-3.…
yamadashy May 3, 2024
cf66eb3
update: フィード追加、社名変更
yamadashy May 3, 2024
0a03978
chore(deps): update minor and patch dependencies
renovate[bot] May 3, 2024
9cd3f08
chore(deps): update dependency renovate to v37.340.8
renovate[bot] May 4, 2024
78c9eeb
chore(deps): update dependency renovate to v37.340.9
renovate[bot] May 5, 2024
47382b3
chore(deps): update dependency renovate to v37.341.0
renovate[bot] May 5, 2024
e916019
chore(deps): update dependency renovate to v37.342.0
renovate[bot] May 5, 2024
901bd45
Merge pull request #106 from yamadashy/renovate/minor-and-patch-depen…
yamadashy May 5, 2024
d62e4f5
feat: ESLint, yarn のアプデ
yamadashy May 5, 2024
defbd38
update: いくつかのnodeパッケージのメジャーバージョンアップデート
yamadashy May 5, 2024
e5310a7
Merge pull request #108 from yamadashy/feature/package-upgrade-major
yamadashy May 5, 2024
38d25f9
update: renovate でmajorもPRを作成するように。automerge: false
yamadashy May 5, 2024
e330083
Merge pull request #109 from yamadashy/feature/renovate-major
yamadashy May 5, 2024
8ecc907
chore(deps): update peaceiris/actions-gh-pages action to v4
renovate[bot] May 5, 2024
24facd7
Merge pull request #110 from yamadashy/renovate/major-major-dependencies
yamadashy May 5, 2024
6c84566
Revert "Merge pull request #110 from yamadashy/renovate/major-major-d…
yamadashy May 5, 2024
ba101ac
Revert "Merge pull request #109 from yamadashy/feature/renovate-major"
yamadashy May 5, 2024
f909f5e
Revert "Merge pull request #108 from yamadashy/feature/package-upgrad…
yamadashy May 5, 2024
27b3c4a
chore(deps): update dependency renovate to v37.342.1
renovate[bot] May 5, 2024
c6fa6ae
feat: テストしやすいように改修 + テスト追加
yamadashy May 6, 2024
99d459a
Merge pull request #111 from yamadashy/feature/feed-image-test
yamadashy May 7, 2024
6d14f0a
chore(deps): update minor and patch dependencies
renovate[bot] May 11, 2024
fe8191f
chore(deps): update dependency renovate to v37.354.6
renovate[bot] May 11, 2024
c9203fc
Reapply "Merge pull request #108 from yamadashy/feature/package-upgra…
yamadashy May 6, 2024
9791f54
Reapply "Merge pull request #109 from yamadashy/feature/renovate-major"
yamadashy May 6, 2024
3b295f7
Reapply "Merge pull request #110 from yamadashy/renovate/major-major-…
yamadashy May 6, 2024
7824476
fix: lint-fix実行
yamadashy May 7, 2024
882faa8
update: google-apiアプデ
yamadashy May 11, 2024
81a9237
fix: open-graph-scraperのアプデに伴うデグレを修正
yamadashy May 11, 2024
6e0f264
Merge pull request #112 from yamadashy/feature/package-update
yamadashy May 11, 2024
1aad2a6
chore(deps): update minor and patch dependencies
renovate[bot] May 11, 2024
2d5ac55
feat: 画像の事前キャッシュ
yamadashy May 11, 2024
168df26
fix: lint-fix
yamadashy May 11, 2024
6c8dc06
Merge pull request #116 from yamadashy/feature/precache-image
yamadashy May 11, 2024
c94a0dd
chore(deps): update dependency renovate to v37.355.0
renovate[bot] May 11, 2024
8b9c910
update: renovateのアプデが多すぎるので自動アプデから除外
yamadashy May 11, 2024
2615b64
chore: renovateのPRにはdependenciesラベルをつける
yamadashy May 11, 2024
86e12b6
add: 新規フィード追加 (GO Inc.)
anda3 May 13, 2024
bda8d29
Merge pull request #120 from anda3/new-blog-feed-goinc
yamadashy May 13, 2024
dd1b4d1
add: 新規フィード追加 PLAY,inc.
yellowsman May 16, 2024
165e098
chore(deps): update minor and patch dependencies
renovate[bot] May 17, 2024
f6062c8
chore(deps): update minor and patch dependencies to v9.3.0
renovate[bot] May 17, 2024
f8e8249
Merge pull request #122 from yellowsman/new-blog-feed-play-developers…
yamadashy May 18, 2024
aaf5f65
chore(deps): update dependency fast-xml-parser to v4.4.0
renovate[bot] May 18, 2024
65ac563
Merge pull request #125 from yamadashy/renovate/minor-and-patch-depen…
yamadashy May 18, 2024
513ed75
chore(deps): update minor and patch dependencies
renovate[bot] May 24, 2024
9458e72
chore(deps): update minor and patch dependencies
renovate[bot] May 31, 2024
d3d36fe
build(deps): bump pug from 3.0.2 to 3.0.3
dependabot[bot] May 31, 2024
b85b203
chore(deps): update dependency node to v20.14.0
renovate[bot] May 31, 2024
115c135
Merge pull request #129 from yamadashy/dependabot/npm_and_yarn/pug-3.0.3
yamadashy Jun 1, 2024
5223c2d
chore(deps): update dependency prettier to v3.3.0
renovate[bot] Jun 1, 2024
a8a8045
chore: renovateのPRにはrenovateラベルをつける
yamadashy Jun 2, 2024
bad5240
chore(deps): update dependency googleapis to v140
renovate[bot] Jun 7, 2024
8a41df4
chore(deps): update minor and patch dependencies
renovate[bot] Jun 7, 2024
52814dd
add: 新規フィード追加 (Suntory Wellness Limited.)
MasatoAoki14 Jun 13, 2024
1c7b022
chore(deps): update minor and patch dependencies
renovate[bot] Jun 14, 2024
796af76
build(deps): bump braces from 3.0.2 to 3.0.3
dependabot[bot] Jun 14, 2024
1455876
chore(deps): update yarn to v4.3.0
renovate[bot] Jun 14, 2024
0458db0
Merge pull request #133 from MasatoAoki14/new-blog-feed-suntory-welln…
yamadashy Jun 16, 2024
43c983d
Merge pull request #132 from yamadashy/renovate/major-major-dependencies
yamadashy Jun 16, 2024
9bb1bd5
Merge pull request #136 from yamadashy/dependabot/npm_and_yarn/braces…
yamadashy Jun 16, 2024
1d00225
build(deps): bump ws from 8.15.1 to 8.17.1
dependabot[bot] Jun 18, 2024
a432066
Merge pull request #137 from yamadashy/dependabot/npm_and_yarn/ws-8.17.1
yamadashy Jun 20, 2024
a980a4e
chore(deps): update minor and patch dependencies
renovate[bot] Jun 22, 2024
de705c9
Merge pull request #138 from yamadashy/renovate/minor-and-patch-depen…
yamadashy Jun 24, 2024
4c7b08f
chore: repopack用のignoreと設定
yamadashy Jul 20, 2024
2f8c1eb
update: feed更新
yamadashy Jul 20, 2024
0a5af48
chore(deps): update minor and patch dependencies
renovate[bot] Jul 20, 2024
f75ff09
fix: ogs types
yamadashy Jul 20, 2024
7bc4d61
Merge pull request #139 from yamadashy/renovate/minor-and-patch-depen…
yamadashy Jul 20, 2024
18a9052
chore(deps): update dependency vitest to v2
renovate[bot] Jul 20, 2024
384cbbd
Merge pull request #141 from yamadashy/renovate/major-major-dependencies
yamadashy Jul 20, 2024
c0f1431
chore: lintにtypeチェックもまとめる
yamadashy Jul 20, 2024
5805d92
chroe: カバレッジ取れるように
yamadashy Jul 20, 2024
cca4b6d
Merge pull request #142 from yamadashy/feature/coverage
yamadashy Jul 20, 2024
a42cf40
feat: ファビコン表示
yamadashy May 11, 2024
5fe6ae8
feat: icoの変換に対応
yamadashy Jul 20, 2024
57e8de9
refactor: 使っていないimportの削除
yamadashy Jul 20, 2024
e7fd50a
Merge pull request #143 from yamadashy/feature/feed-favicon
yamadashy Jul 20, 2024
4483c7f
chore(feed): フィード追加
yamadashy Jul 20, 2024
40e5748
feat(feed): symbolによるフラグ管理をやめる
yamadashy Jul 20, 2024
ac5ab5b
feat(feed): フィードのURLをチェックする
yamadashy Jul 20, 2024
1ce1fcf
chore(feed): フィード調整
yamadashy Jul 20, 2024
0546f60
chore: Add funding
yamadashy Jul 22, 2024
6423609
chore(deps): update minor and patch dependencies
renovate[bot] Jul 26, 2024
4381a0e
chore(deps): update dependency @types/eslint to v9
renovate[bot] Jul 26, 2024
be1aea5
chore(deps): update minor and patch dependencies to v9.8.0
renovate[bot] Jul 26, 2024
5e18e04
chore(deps): update dependency fast-xml-parser to v4.4.1
renovate[bot] Jul 28, 2024
00ab585
Merge pull request #145 from yamadashy/renovate/major-major-dependencies
yamadashy Jul 28, 2024
2d8bc35
chore(deps): update dependency @types/node to v20.14.13
renovate[bot] Jul 28, 2024
e29f71b
chore(ci): renovateの対象からnodeをはずす
yamadashy Aug 4, 2024
7922909
update: フィード調整
yamadashy Aug 10, 2024
b369b13
chore(deps): update minor and patch dependencies
renovate[bot] Aug 10, 2024
4e84e10
Merge pull request #150 from yamadashy/renovate/minor-and-patch-depen…
yamadashy Aug 10, 2024
8d16f8c
chore(deps): update major dependencies to v8
renovate[bot] Aug 10, 2024
a18d35c
fix: eslint error
yamadashy Aug 10, 2024
75dd5f6
Merge pull request #151 from yamadashy/renovate/major-major-dependencies
yamadashy Aug 10, 2024
27989b1
build(deps): bump fast-xml-parser from 4.2.5 to 4.4.1
dependabot[bot] Jul 29, 2024
6594bf1
fix: lock
yamadashy Aug 10, 2024
05360c7
Merge pull request #149 from yamadashy/dependabot/npm_and_yarn/fast-x…
yamadashy Aug 10, 2024
3b2a3be
update: フィード追加
yamadashy Aug 11, 2024
21a9fd1
chore(11ty): configをtsにする
yamadashy Aug 11, 2024
1585aaa
Merge pull request #152 from yamadashy/chore/config-ts
yamadashy Aug 11, 2024
e13c151
chore(deps): update dependency axios to v1.7.4 [security]
renovate[bot] Aug 13, 2024
447d045
chore(deps): update dependency googleapis to v142
renovate[bot] Aug 17, 2024
2f4cc63
Merge pull request #155 from yamadashy/renovate/major-major-dependencies
yamadashy Aug 19, 2024
dbb3caa
chore(deps): update minor and patch dependencies
renovate[bot] Aug 19, 2024
ce81e8b
Merge pull request #154 from yamadashy/renovate/minor-and-patch-depen…
yamadashy Aug 19, 2024
c9b4a33
chore(deps): update minor and patch dependencies
renovate[bot] Aug 23, 2024
5412ba6
build(deps): bump micromatch from 4.0.5 to 4.0.8
dependabot[bot] Aug 23, 2024
f20dca8
chore(deps): update minor and patch dependencies to v9.9.1
renovate[bot] Aug 23, 2024
c7bb54f
Merge pull request #158 from yamadashy/dependabot/npm_and_yarn/microm…
yamadashy Aug 24, 2024
f24c561
fix(feed): 一部のフィードでMaximum call stack size exceededが発生する
yamadashy Aug 24, 2024
1d4399a
Merge pull request #161 from yamadashy/fix/empty-og-image
yamadashy Aug 24, 2024
9e01c80
Merge remote-tracking branch 'yamadashy/main' into feature/merge-yama…
yamadashy Aug 24, 2024
fa7c90c
feat(11ty): data画像ならそのまま表示
yamadashy Aug 24, 2024
b45ddac
Merge branch 'feature/11ty'
yamadashy Aug 24, 2024
afc95c1
Merge remote-tracking branch 'yamadashy/main' into feature/merge-yama…
yamadashy Aug 24, 2024
bee9831
feat(feed): フィード生成コマンドのエラーハンドリング
yamadashy Aug 24, 2024
e2371f2
Merge pull request #163 from yamadashy/feature/error-handling
yamadashy Aug 24, 2024
319dff6
chore(deps): update yarn to v4.4.1
renovate[bot] Aug 24, 2024
b24705c
Merge pull request #162 from yamadashy/renovate/minor-and-patch-depen…
yamadashy Aug 24, 2024
b2ed48a
Merge remote-tracking branch 'yamadashy/main' into feature/merge-yama…
yamadashy Aug 24, 2024
2d53e71
chore: repopackはいらない
yamadashy Aug 24, 2024
d6b8db8
Merge remote-tracking branch 'yamadashy/main' into feature/merge-yama…
yamadashy Aug 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 0 additions & 111 deletions .eleventy.js

This file was deleted.

38 changes: 0 additions & 38 deletions .eslintrc.js

This file was deleted.

1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: yamadashy
5 changes: 1 addition & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ jobs:
- name: Install dependencies
run: yarn install

- name: Run type check
run: yarn type-check

- name: Lint
run: yarn lint

Expand All @@ -51,7 +48,7 @@ jobs:
run: yarn install

- name: Test
run: yarn test
run: yarn test-coverage

generate:
runs-on: ubuntu-22.04
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/generate-feed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
run: yarn site-build

- name: Push to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.12.2
20.16.0
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nodejs 20.12.2
nodejs 20.16.0
875 changes: 0 additions & 875 deletions .yarn/releases/yarn-3.8.1.cjs

This file was deleted.

925 changes: 925 additions & 0 deletions .yarn/releases/yarn-4.4.1.cjs

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
compressionLevel: mixed

enableGlobalCache: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.8.1.cjs
yarnPath: .yarn/releases/yarn-4.4.1.cjs
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,9 @@ $ yarn site-serve

コードのチェック
```bash
$ # lint
$ # eslint, tsc --noEmit
$ yarn lint

$ # TypeScript のチェック
$ yarn type-check

$ # テスト
$ yarn test
```
Expand Down
184 changes: 184 additions & 0 deletions eleventy.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
import htmlmin from 'html-minifier-terser';
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tsに移行してます。

import EleventyImage from '@11ty/eleventy-img';
import EleventyFetch from "@11ty/eleventy-fetch";
import path from 'path';
import ts from 'typescript';
import { imageCacheOptions } from './src/common/eleventy-cache-option';
import CleanCSS from "clean-css";
import sharpIco, {ImageData} from "sharp-ico";
import url from 'url';
import Eleventy from '@11ty/eleventy';

const ELEVENTY_FETCH_CONCURRENCY = 50;

EleventyImage.concurrency = ELEVENTY_FETCH_CONCURRENCY;

const minifyHtmlTransform = (content: string, outputPath: string) => {
if(outputPath && outputPath.endsWith('.html')) {
return htmlmin.minify(content, {
// オプション参考: https://github.com/terser/html-minifier-terser#options-quick-reference
useShortDoctype: true,
removeComments: true,
collapseWhitespace: true,
minifyCSS: true,
minifyJS: true,
maxLineLength: 1000
});
}

return content;
}

const imageThumbnailShortcode = async (src: string, alt: string, pathPrefix: string = '') => {
// 取れなければ代替画像
const alternativeImageTag = `<img src='${pathPrefix}images/alternate-feed-image.png' alt='${alt}' loading='lazy' width='256' height='256'>`;

if (!src) {
return alternativeImageTag;
}

let metadata: EleventyImage.Metadata;

try {
metadata = await EleventyImage(src, {
widths: [150, 450],
formats: ["webp", "jpeg"],
outputDir: 'public/images/feed-thumbnails',
urlPath: `${pathPrefix}images/feed-thumbnails/`,
cacheOptions: imageCacheOptions,
sharpWebpOptions: {
quality: 50,
},
sharpJpegOptions: {
quality: 70,
}
});
} catch {
// エラーが起きたら代替画像にする
console.log('[image-thumbnail-short-code] error', src);
return alternativeImageTag;
}

return EleventyImage.generateHTML(metadata, {
alt,
sizes: '100vw',
loading: 'lazy',
decoding: 'async',
});
}

const imageIconShortcode = async (src: string, alt: string, pathPrefix: string = '') => {
// 取れなければ画像なし
const alternativeImageTag = ``;

if (!src) {
return alternativeImageTag;
}

if (src.startsWith('data:')) {
return `<img src='${src}' alt='${alt}' loading='lazy' width='16' height='16'>`;
}

const parsedUrl = url.parse(src);
const fileName = path.basename(parsedUrl.pathname || '');
const fileExtension = path.extname(fileName).toLowerCase();
let imageSrc: EleventyImage.ImageSource = src;
let metadata: EleventyImage.Metadata;

if (fileExtension === '.ico') {
try {
const icoBuffer = await EleventyFetch(src, {
type: 'buffer',
duration: imageCacheOptions.duration,
concurrency: ELEVENTY_FETCH_CONCURRENCY,
});
const sharpIcoImages = await sharpIco.sharpsFromIco(icoBuffer, {}, true) as ImageData[];
const sharpIcoImage = sharpIcoImages.sort((a, b) => b.width - a.width)[0];
if (sharpIcoImage.image) {
imageSrc = await sharpIcoImage.image.png().toBuffer();
}
} catch (error) {
console.error('[image-icon-short-code] Error processing ICO:', src, error);
return alternativeImageTag;
}
}

try {
metadata = await EleventyImage(imageSrc, {
widths: [16],
formats: ["png"],
outputDir: 'public/images/feed-icons',
urlPath: `${pathPrefix}images/feed-icons/`,
cacheOptions: imageCacheOptions,
sharpPngOptions: {
quality: 50,
}
});
} catch (error) {
// エラーが起きたら画像なし
console.log('[image-icon-short-code] Error processing image', src, error);
return ``
}

return EleventyImage.generateHTML(metadata, {
alt,
loading: 'lazy',
decoding: 'async',
});
}

const relativeUrlFilter = (url: string) => {
const relativeUrl = path.relative(url, '/');
return relativeUrl === '' ? './' : `${relativeUrl}/`;
}

const minifyCssFilter = (css: string) => {
return new CleanCSS({}).minify(css).styles;
}

const supportTypeScriptTemplate = (eleventyConfig: Eleventy.UserConfig) => {
eleventyConfig.addTemplateFormats('ts');
eleventyConfig.addExtension('ts', {
outputFileExtension: 'js',
compile: async (inputContent: string) => {
return async () => {
const result = ts.transpileModule(inputContent, { compilerOptions: { module: ts.ModuleKind.CommonJS }});
return result.outputText;
}
}
});
}

module.exports = function (eleventyConfig: Eleventy.UserConfig) {
// static assets
eleventyConfig.addPassthroughCopy('src/site/images');
eleventyConfig.addPassthroughCopy('src/site/feeds');

// images
eleventyConfig.addNunjucksAsyncShortcode('imageThumbnail', imageThumbnailShortcode);
eleventyConfig.addNunjucksAsyncShortcode('imageIcon', imageIconShortcode);

// minify html
eleventyConfig.addTransform('minify html', minifyHtmlTransform);

// relative path
eleventyConfig.addFilter("relativeUrl", relativeUrlFilter);

// minify css
eleventyConfig.addFilter("minifyCss", minifyCssFilter);

// TypeScript
supportTypeScriptTemplate(eleventyConfig);

// TODO: _data も TypeScript 対応したい
// @see https://github.com/11ty/eleventy/discussions/1835

return {
htmlTemplateEngine: 'njk',

dir: {
input: 'src/site',
output: 'public'
}
}
}
Loading