aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/io
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-09 11:10:53 +0900
committernsfisis <nsfisis@gmail.com>2026-08-09 11:10:53 +0900
commit66c3eba15ba6302d43de057a9063f7feee8c6fb3 (patch)
treed44bf5cec4d9ddfffa1a732dba85418c2873de82 /crates/shirabe/src/io
parent0b737de495e9a8530a6a32ce2799dc49f3e5786f (diff)
downloadphp-shirabe-66c3eba15ba6302d43de057a9063f7feee8c6fb3.tar.gz
php-shirabe-66c3eba15ba6302d43de057a9063f7feee8c6fb3.tar.zst
php-shirabe-66c3eba15ba6302d43de057a9063f7feee8c6fb3.zip
refactor(pcre): extract composer/pcre into the shirabe-pcre crate
Move `Composer\Pcre` out of shirabe-external-packages and into its own crate, so the path is `shirabe_pcre::preg::Preg` instead of `shirabe_external_packages::composer::pcre::preg::Preg`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/io')
-rw-r--r--crates/shirabe/src/io/base_io.rs2
-rw-r--r--crates/shirabe/src/io/buffer_io.rs14
-rw-r--r--crates/shirabe/src/io/console_io.rs2
3 files changed, 7 insertions, 11 deletions
diff --git a/crates/shirabe/src/io/base_io.rs b/crates/shirabe/src/io/base_io.rs
index 4b416413..4d0d9309 100644
--- a/crates/shirabe/src/io/base_io.rs
+++ b/crates/shirabe/src/io/base_io.rs
@@ -6,7 +6,7 @@ use crate::io::io_interface;
use crate::util::ProcessExecutor;
use crate::util::Silencer;
use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::Preg;
+use shirabe_pcre::Preg;
use shirabe_php_shim::{
JSON_INVALID_UTF8_IGNORE, JSON_UNESCAPED_SLASHES, JSON_UNESCAPED_UNICODE, PhpMixed,
UnexpectedValueException, array_merge, in_array_strict, json_encode_ex, php_regex,
diff --git a/crates/shirabe/src/io/buffer_io.rs b/crates/shirabe/src/io/buffer_io.rs
index d1224fdc..4b095e1c 100644
--- a/crates/shirabe/src/io/buffer_io.rs
+++ b/crates/shirabe/src/io/buffer_io.rs
@@ -1,13 +1,13 @@
//! ref: composer/src/Composer/IO/BufferIO.php
use crate::io::ConsoleIO;
-use shirabe_external_packages::composer::pcre::Preg;
use shirabe_external_packages::symfony::console::formatter::OutputFormatterInterface;
use shirabe_external_packages::symfony::console::helper::QuestionHelper;
use shirabe_external_packages::symfony::console::input::InputInterface;
use shirabe_external_packages::symfony::console::input::StringInput;
use shirabe_external_packages::symfony::console::output::OutputInterface;
use shirabe_external_packages::symfony::console::output::StreamOutput;
+use shirabe_pcre::Preg;
use shirabe_php_shim::{
PHP_EOL, PhpMixed, PhpResource, RuntimeException, SEEK_SET, fopen, fseek, fwrite, php_regex,
rewind, stream_get_contents, strip_tags,
@@ -76,20 +76,16 @@ impl BufferIO {
loop {
let next = Preg::replace_callback(
php_regex!(r"{(^|\n|\x08)(.+?)(\x08+)}"),
- |matches: &indexmap::IndexMap<
- shirabe_external_packages::composer::pcre::CaptureKey,
- String,
- >|
- -> String {
+ |matches: &indexmap::IndexMap<shirabe_pcre::CaptureKey, String>| -> String {
let empty = String::new();
let g1 = matches
- .get(&shirabe_external_packages::composer::pcre::CaptureKey::ByIndex(1))
+ .get(&shirabe_pcre::CaptureKey::ByIndex(1))
.unwrap_or(&empty);
let g2 = matches
- .get(&shirabe_external_packages::composer::pcre::CaptureKey::ByIndex(2))
+ .get(&shirabe_pcre::CaptureKey::ByIndex(2))
.unwrap_or(&empty);
let g3 = matches
- .get(&shirabe_external_packages::composer::pcre::CaptureKey::ByIndex(3))
+ .get(&shirabe_pcre::CaptureKey::ByIndex(3))
.unwrap_or(&empty);
let pre = strip_tags(g2);
diff --git a/crates/shirabe/src/io/console_io.rs b/crates/shirabe/src/io/console_io.rs
index 443a3e51..8d21242d 100644
--- a/crates/shirabe/src/io/console_io.rs
+++ b/crates/shirabe/src/io/console_io.rs
@@ -9,7 +9,6 @@ use crate::io::io_interface;
use crate::question::StrictConfirmationQuestion;
use indexmap::IndexMap;
use indexmap::indexmap;
-use shirabe_external_packages::composer::pcre::Preg;
use shirabe_external_packages::symfony::console::helper::ProgressBar;
use shirabe_external_packages::symfony::console::helper::QuestionHelper;
use shirabe_external_packages::symfony::console::helper::QuestionHelperInterface;
@@ -23,6 +22,7 @@ use shirabe_external_packages::symfony::console::output::output_interface::{
use shirabe_external_packages::symfony::console::question::ChoiceQuestion;
use shirabe_external_packages::symfony::console::question::Question;
use shirabe_external_packages::symfony::console::question::QuestionInterface;
+use shirabe_pcre::Preg;
use shirabe_php_shim::{
PhpMixed, array_search, implode, in_array_strict, is_array, is_string, microtime, str_repeat,
strip_tags, strlen,