deno
Ref
deno2node が内部で使っている ts-morph というモジュールの作者さんが、deno2node の実装を見て、作り直しを決心して出来たものらしいです
ロゴ
code: zsh
deno run --unstable --allow-write --allow-read --allow-run ./tools/format.js
code: config.toml
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]
code: zsh
git submodule update --init --recursive
issue
http
code: zsh
serve_test 023.09 httpServerTcpCancellation_file => ./cli/tests/unit/serve_test.ts:2409:8 serve_test 023.09 - 1 async operation to op_fs_open_async was started in this test, but never completed. serve_test 023.09 To get more details where ops were leaked, run again with --trace-ops flag. serve_test 023.09 httpServerTcpCancellation_stream => ./cli/tests/unit/serve_test.ts:2409:8 serve_test 023.09 - 1 async operation to op_fs_open_async was started before this test, but was completed during the test. Async operations should not complete in a test if they were not started in that test. serve_test 023.09 To get more details where ops were leaked, run again with --trace-ops flag. serve_test 023.09 httpServerTcpCancellation_file => ./cli/tests/unit/serve_test.ts:2409:8 serve_test 023.09 httpServerTcpCancellation_stream => ./cli/tests/unit/serve_test.ts:2409:8 status-code
issue
fs.fchmod
code: std_fs.rs
fn fchmod(fd: i32, mode: u32) -> nix::Result<()> {
use nix::sys::stat::{fchmod, Mode};
use std::os::unix::io::RawFd;
let mode: Mode = Mode::from_bits_truncate(mode);
fchmod(fd as RawFd, mode)?;
Ok(())
}
code: zsh
const file = await Deno.open("/Users/wafuwafu13/desktop/denotest.txt");
undefined
file.rid
3
file.rid
3
const file = await Deno.open("/Users/wafuwafu13/desktop/denotest.txt");
undefined
file.rid
4
file.rid
4
const fs = require('fs');
undefined
fs.open('/Users/wafuwafu13/desktop/denotest.txt', 'r', (err, fd) => {
... console.log(fd)
... }
...
... )
undefined
24
fs.open('/Users/wafuwafu13/desktop/denotest.txt', 'r', (err, fd) => {
... console.log(fd)
... })
undefined
25
code: _fs_open.ts
(file) => callback!(null, file.rid),
code: main.rs
use nix::fcntl::{open, OFlag};
use nix::sys::stat::{fchmod, Mode, SFlag};
use nix::unistd::close;
use nix::NixPath;
use std::ffi::CString;
use std::path::PathBuf;
use std::os::unix::io::RawFd;
fn main() -> nix::Result<()> {
let c_string = CString::new("/Users/wafuwafu13/desktop/denotest.txt").expect("Failed to create CString");
let path = PathBuf::from(c_string.into_string().unwrap());
let fd = open(&path, OFlag::O_RDWR, Mode::empty())?;
let mode: Mode = Mode::from_bits_truncate(0o777);
println!("{}", fd);
println!("{:?}", mode);
Ok(())
}
code: zsh
3
S_IRWXU | S_IRUSR | S_IWUSR | S_IXUSR | S_IRWXG | S_IRGRP | S_IWGRP | S_IXGRP | S_IRWXO | S_IROTH | S_IWOTH | S_IXOTH
code: main.rs
fn fchmod_test(fd: i32, mode: u16) -> FsResult<()> {
let mode: Mode = Mode::from_bits_truncate(mode);
fchmod(fd, mode)?;
Ok(())
}
use nix::Error;
impl From<Error> for FsError {
fn from(error: Error) -> Self {
match error {
nix::errno::Errno::EAGAIN => FsError::FileBusy,
nix::errno::Errno::EINVAL => FsError::NotSupported,
_ => FsError::Io(io::Error::from_raw_os_error(error as i32)),
}
}
}
コケていってくれる
code: zsh
$ cargo build
Blocking waiting for file lock on build directory
Compiling deno_fs v0.19.0 (/Users/wafuwafu13/Desktop/deno/ext/fs)
Compiling deno_node v0.46.0 (/Users/wafuwafu13/Desktop/deno/ext/node)
Compiling deno_runtime v0.117.0 (/Users/wafuwafu13/Desktop/deno/runtime)
Compiling deno v1.34.3 (/Users/wafuwafu13/Desktop/deno/cli)
errorE0046: not all trait items implemented, missing: fchmod_sync, fchmod_async --> cli/standalone/file_system.rs:56:1
|
56 | impl FileSystem for DenoCompileFileSystem {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing fchmod_sync, fchmod_async in implementation
TODO: ops.rs
一気に持っていこう!!!
code: zsh
test result: FAILED. 1220 passed; 71 failed; 13 ignored; 0 measured; 0 filtered out; finished in 163.20s
stashしても変わらず
code: rs
fn fchmod_sync(&self, fd: i32, mode: u16) -> FsResult<()> {
TODO
code: js_unit_test.rs
util::unit_test_factory!(
js_unit_test,
"tests/unit",
"*.ts",
動かん
code: zsh
test integration::worker::workers ... ok
test integration::node_unit_tests::crypto_key_test has been running for over 60 seconds
test integration::js_unit_tests::kv_queue_undelivered_test ... ok
test integration::node_unit_tests::crypto_key_test ... ok
test integration::run::_091_use_define_for_class_fields has been running for over 60 seconds
test integration::run::permissions::dynamic_import_permissions_blob_local has been running for over 60 seconds
code: todo.md
run.mjs
? virtual_fs.rs
js_unit_tests.rs
node_unit_tests.rs
+ cli/tests/unit/fchmod_test.ts
+ _fs_chomod_test.ts
ext/node/lib.rs
node/polifills/fs.ts
+ poliyfils/_fs/_fs_fchmod.ts
promises.ts
lib.deno.ns.d.ts
issue
This file is automatically generated by "node/_tools/setup.ts". Do not modify this file manually
NOTE: This file should not be manually edited. Please edit \`cli/tests/node_compat/config.json\` and run \`deno task setup\` instead.
issue
code: tools/node_compat/README.md
## Run Node.js test cases
Node.js compat tests are run as part of cargo test command. If you want to run
only the Node.js compat test cases you can use the command
cargo test node_compat.
単体の場合
code: tools/node_compat/node/deno.json
"test": "deno test -A ../../../cli/tests/node_compat/test.ts -- $HOGE"
code: zsh
$ deno task test HOGE=test-fs-write-stream-fs.js
Task test deno test -A ../../../cli/tests/node_compat/test.ts -- $HOGE "HOGE=test-fs-write-stream-fs.js"
running 1 test from ../../../cli/tests/node_compat/test.ts
Node.js compatibility ... ok (12ms)
ok | 1 passed | 0 failed (39ms)
issue
構造変わった
code: zsh
~/Desktop/deno
$ git stash list
stash@{0}: WIP on fs-fileinfo: ad8d0c90d chore: forward v1.32.3 release commit to main (#18561)
~/Desktop/deno
$ git submodule update --init --recursive
DirEntry
code: zsh
~/desktop
$ deno upgrade
Looking up latest version
Found latest version 1.34.0
Deno is upgrading to version 1.34.0
Archive: /var/folders/tp/hrvkt91914q8d7ft6dzrkk8w0000gn/T/.tmpH2Ov2I/deno.zip
inflating: deno
Upgraded successfully
https://scrapbox.io/files/646fcd330e5a3a001b51350c.png
issue
code: zsh
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]
code: zsh
~/Desktop/deno
$ sudo cargo build
Blocking waiting for file lock on build directory
Compiling deno_runtime v0.78.0 (/Users/wafuwafu13/Desktop/deno/runtime)
Compiling deno_emit v0.9.0
Compiling deno_doc v0.46.0
Compiling eszip v0.28.0
Compiling deno v1.25.4 (/Users/wafuwafu13/Desktop/deno/cli)
$ ./tools/format.js
code: zsh
use std::os::unix::fs::FileTypeExt;
use std::os::unix::fs::MetadataExt;
code: zsh
console.log(
s,
"||||||||||||||||||||||||||||||||||||||||||||||||||||||||\n",
);
console.log(
s.isBlockDevice,
"==========================================================\n",
);
{
isFile: true,
isDirectory: false,
isSymlink: false,
size: 5,
mtime: 2022-09-28T14:15:07.768Z,
atime: 2022-09-28T14:15:07.768Z,
birthtime: 2022-09-28T14:15:07.768Z,
dev: null,
ino: null,
mode: null,
nlink: null,
uid: null,
gid: null,
rdev: null,
blksize: null,
blocks: null,
isBlockDevice: false
} ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
false ==========================================================
issue
build on mac
code: zsh
$ sudo cargo build --all-targets
Password:
Compiling deno v1.14.3 (/Users/tagawahirotaka/Desktop/deno/cli)
Compiling deno_runtime v0.28.0 (/Users/tagawahirotaka/Desktop/deno/runtime)
error: failed to run custom build command for deno_runtime v0.28.0 (/Users/tagawahirotaka/Desktop/deno/runtime)
Caused by:
process didn't exit successfully: /Users/tagawahirotaka/Desktop/deno/target/debug/build/deno_runtime-afddc52b26a5a764/build-script-build (signal: 6, SIGABRT: process abort signal)
--- stdout
cargo:rustc-env=TARGET=x86_64-apple-darwin
cargo:rustc-env=PROFILE=debug
--- stderr
dyld: lazy symbol binding failed: Symbol not found: _v8__Function__SetName
Referenced from: /Users/tagawahirotaka/Desktop/deno/target/debug/build/deno_runtime-afddc52b26a5a764/build-script-build
Expected in: flat namespace
dyld: Symbol not found: _v8__Function__SetName
Referenced from: /Users/tagawahirotaka/Desktop/deno/target/debug/build/deno_runtime-afddc52b26a5a764/build-script-build
Expected in: flat namespace
warning: build failed, waiting for other jobs to finish...
error: build failed
$ brew install v8 同じ
issue
build on linux
code: zsh
error: Cannot load module "file:///home/user/desktop/deno/test_util/std/testing/asserts.ts".
at file:///home/user/desktop/deno/cli/tests/testdata/workers/test.ts:9:8
OUTPUT
thread 'integration::worker::workers' panicked at 'bad exit code, expected: 0, actual: 1', test_util/src/lib.rs:1550:9
failures:
integration::compile::compile
integration::compiler_api
integration::js_unit_tests
integration::lsp::lsp_cache_location
integration::run::_034_onload
integration::run::_045_proxy
integration::run::tls_connecttls
integration::run::tls_starttls
integration::test::allow_all
integration::test::allow_none
integration::test::steps_invalid_usage
integration::test::steps_passing_steps
integration::websocketstream
integration::test::steps_passing_steps_concurrent
integration::websocket
integration::websocket_server_multi_field_connection_header
integration::worker::workers
test result: FAILED. 538 passed; 17 failed; 8 ignored; 0 measured; 0 filtered out; finished in 912.07s
error: test failed, to rerun pass '-p deno --test integration_tests'
issue
テストが落ちる
code: zsh
failures:
integration::compat::compat_dyn_import_rejects_with_node_compatible_error
integration::compat::compat_with_import_map_and_https_imports
integration::compat::fs_promises
integration::compat::globals
integration::compat::globals_in_repl
integration::compat::node_prefix_fs_promises
integration::compile::compile
integration::compiler_api
integration::js_unit_tests
integration::run::_034_onload
integration::run::_045_proxy
integration::run::tls_connecttls
integration::run::tls_starttls
integration::test::allow_all
integration::test::allow_none
integration::test::ops_sanitizer_nexttick
integration::test::steps_invalid_usage
integration::test::steps_passing_steps
integration::test::steps_passing_steps_concurrent
integration::watcher::lint_watch_without_args_test
integration::websocket
integration::websocket_server_multi_field_connection_header
integration::websocketstream
integration::worker::workers
test result: FAILED. 584 passed; 24 failed; 8 ignored; 0 measured; 0 filtered out; finished in 44.70s
issue
code: zsh
~/Desktop/deno
$ ./tools/format.js
error: Cannot load module "file:///Users/wafuwafu13/Desktop/deno/test_util/std/async/delay.ts".
at file:///Users/wafuwafu13/Desktop/deno/tools/util.js:12:23
~/Desktop/deno
$ git submodule update --init
$ ./tools/format.js
Check file:///Users/wafuwafu13/Desktop/deno/tools/format.js
dprint
Formatted 1 files.
rustfmt 220 file(s)
issue
lint通ってないぞー