rolldown 1.3.0 → 1.3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/rolldown/version.rb +1 -1
- data/rust/src/modules.rs +31 -4
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 43287c36f20c0eea05d2581ab41eb7347df8f497310090adf6b5aa4633d915a0
|
|
4
|
+
data.tar.gz: 5ffc16fe573d48d188fbaee042dfe854655ffb7e11b73d60ce135c6cf2661510
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2e3454bf63f2c1af58f6ca106d7e603d6e4156d84785aaf924e57b4fde2c0444f64e188455f2b311e5ed3f264f89671c62c0c711ecf949f71923c4d9ed291b2b
|
|
7
|
+
data.tar.gz: 7bc4aabbcfe6935a6f13734902cd11ff3b93f5f4ccab13a5eab6b0fdcf28d5bfd559180da65f4156895b12e81f0aa7a2be29234c990cf366c00007235ea30ecb
|
data/README.md
CHANGED
|
@@ -95,7 +95,7 @@ Rolldown.build(
|
|
|
95
95
|
)
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
-
They mix freely with what is on disk. A module in memory can import an npm package or a relative file, and a file on disk can import a module in memory. A relative import out of a module in memory resolves against that module's own name, so give it a path-shaped one when it needs to reach real files next to it.
|
|
98
|
+
They mix freely with what is on disk. A module in memory can import an npm package or a relative file, and a file on disk can import a module in memory. A relative import out of a module in memory resolves against that module's own name, so give it a path-shaped one when it needs to reach real files next to it. From there it resolves the way an import from disk does, against `cwd`, so an import with no extension and a directory with an `index` file are both found.
|
|
99
99
|
|
|
100
100
|
This exists so a generator can transform sources in Ruby first and bundle the result without writing anything out. There are no plugins, and no Ruby runs while the bundle does.
|
|
101
101
|
|
data/lib/rolldown/version.rb
CHANGED
data/rust/src/modules.rs
CHANGED
|
@@ -5,7 +5,7 @@ use std::path::{Component, Path, PathBuf};
|
|
|
5
5
|
use arcstr::ArcStr;
|
|
6
6
|
use rolldown_plugin::{
|
|
7
7
|
HookLoadArgs, HookLoadOutput, HookLoadReturn, HookResolveIdArgs, HookResolveIdOutput, HookResolveIdReturn, HookUsage,
|
|
8
|
-
Plugin, PluginContext, SharedLoadPluginContext,
|
|
8
|
+
Plugin, PluginContext, PluginContextResolveOptions, SharedLoadPluginContext,
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
#[derive(Debug)]
|
|
@@ -30,7 +30,7 @@ impl Plugin for VirtualModules {
|
|
|
30
30
|
HookUsage::ResolveId | HookUsage::Load
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
async fn resolve_id(&self,
|
|
33
|
+
async fn resolve_id(&self, ctx: &PluginContext, args: &HookResolveIdArgs<'_>) -> HookResolveIdReturn {
|
|
34
34
|
if self.sources.contains_key(args.specifier) {
|
|
35
35
|
return Ok(Some(HookResolveIdOutput {
|
|
36
36
|
id: ArcStr::from(args.specifier),
|
|
@@ -50,12 +50,39 @@ impl Plugin for VirtualModules {
|
|
|
50
50
|
return Ok(None);
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
-
let
|
|
53
|
+
let joined = directory.join(args.specifier);
|
|
54
|
+
|
|
55
|
+
let Some(resolved) = normalize(&joined) else {
|
|
56
|
+
return Ok(None);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
if self.sources.contains_key(&resolved) {
|
|
60
|
+
return Ok(Some(HookResolveIdOutput::from_id(resolved)));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
let Some(absolute) = normalize(&ctx.cwd().join(joined)) else {
|
|
64
|
+
return Ok(None);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
let options = PluginContextResolveOptions {
|
|
68
|
+
import_kind: args.kind,
|
|
69
|
+
skip_self: true,
|
|
70
|
+
custom: args.custom.clone(),
|
|
71
|
+
..Default::default()
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
let Ok(on_disk) = ctx.resolve(&absolute, None, Some(options)).await? else {
|
|
54
75
|
return Ok(None);
|
|
55
76
|
};
|
|
56
77
|
|
|
57
78
|
Ok(Some(HookResolveIdOutput {
|
|
58
|
-
id:
|
|
79
|
+
id: on_disk.id.as_arc_str().clone(),
|
|
80
|
+
external: Some(on_disk.external),
|
|
81
|
+
normalize_external_id: on_disk.normalize_external_id,
|
|
82
|
+
side_effects: on_disk.side_effects,
|
|
83
|
+
package_json_path: on_disk
|
|
84
|
+
.package_json
|
|
85
|
+
.map(|package| package.realpath().to_string_lossy().into_owned()),
|
|
59
86
|
..Default::default()
|
|
60
87
|
}))
|
|
61
88
|
}
|