Skip to content

Conversation

@u1f992
Copy link
Member

@u1f992 u1f992 commented Nov 21, 2025

fix: #598

Issueで報告した通りnpmのバグでした。npm/cli#8534 で修正されたので、Arboristを更新することで対応できます。サンプルを添付します。 nested-local-theme.zip

installLinksを使用するため、ローカルディレクトリのテーマはシンボリックリンクではなくコピーになります。これはnpm CLIの--install-linksオプションの挙動と同一です。 https://docs.npmjs.com/cli/v8/commands/npm-install#install-links

修正前
$ tree .vivliostyle/themes/node_modules/
.vivliostyle/themes/node_modules/
└── chapter -> ../../../css/chapter

2 directories, 0 files
修正後
$ tree .vivliostyle/themes/node_modules/
.vivliostyle/themes/node_modules/
├── base
│   ├── package.json
│   └── style.css
└── chapter
    ├── package.json
    └── style.css

@u1f992
Copy link
Member Author

u1f992 commented Dec 3, 2025

このPR自体はよさそうなのでready for reviewにしました。お手すきの際にお願いします。

テーマのパス解決について少し気になっていることがあります。

現在@vivliostyle/theme-*で配布しているテーマは../theme-baseに依存テーマが存在するとしています。このPRは、ローカルに作成したテーマで同じ挙動を実現するためのものでした。
https://github.com/vivliostyle/themes/blob/f4d2d61e9885a770d595a7e4282ed6b2afcd1d71/packages/%40vivliostyle/theme-academic/theme.css#L1

ところが、もし1つの書籍に使用するテーマa,bがバージョンの互換性がない同名のテーマbaseに依存する場合、baseは.vivliostyle/themes/node_modules/a/node_modules/base.vivliostyle/themes/node_modules/b/node_modules/baseに追加されるはずです。
モジュール名解決の仕組みを持たず素朴なパス解決しか行わないCSSは、baseが自分から見て../baseにあるのか、node_modules/baseにあるのか理解しません。
依存関係を持つNode.jsモジュールとしてCSSを配布してArboristで解決させるのには、限界がありそうです。

@u1f992 u1f992 marked this pull request as ready for review December 3, 2025 01:21
@u1f992 u1f992 force-pushed the fix/#598-update-arborist-install-links branch from 6645017 to c2a94e8 Compare December 3, 2025 01:26
@spring-raining
Copy link
Member

spring-raining commented Dec 3, 2025

Arborist v9はNode.js 18をサポートしないため、Vivliostyle v10のリリースに合わせてマージします
https://github.com/npm/cli/blob/latest/workspaces/arborist/CHANGELOG.md#900-pre0-2024-11-26

Copy link
Member

@spring-raining spring-raining left a comment

Choose a reason for hiding this comment

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

PRありがとうございます! 問題なく動作することを確認しました

@spring-raining
Copy link
Member

@u1f992 Conflictを解消するためhead branchをvivliostyle orgに移してPRを作成し直しました。すでにvivliostyle/vivliostyle-cliのwrite権限を付与しているので、直接こちらのrepositoryにbranchを作ってもらって大丈夫です! #677

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nested local theme path resolution fails

2 participants